255 lines
282 KiB
JavaScript
255 lines
282 KiB
JavaScript
var k_=Object.defineProperty;var q_=(n,a,r)=>a in n?k_(n,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[a]=r;var Se=(n,a,r)=>q_(n,typeof a!="symbol"?a+"":a,r);import{u as Fc,a as Jt,b as en,c as Mn,d as Ne,j as i,P as $_,e as z_,f as he,g as B_,N as Wi,R as Pe,J as Nt,h as ke,i as Jn,D as er,l as Aa,M as Tt,V as V_,r as M,k as Mc,m as Dc,n as rr,o as Tc,B as G,C as U_,p as ir,q as sr,s as ar,S as no,t as or,v as Vi,w,x as ro,y as Yi,z as Qi,A as Xi,E as Lr,F as io,G as so,H as ao,I as oo,K as lo,L as G_,O as Or,Q as H_,T as K_,U as W_,W as Le,X as pt,Y as Ge,Z as Ze,_ as Oe,$ as hn,a0 as uo,a1 as Y_,a2 as co,a3 as pn,a4 as fo,a5 as go,a6 as qr,a7 as Dt,a8 as Lc,a9 as Q_,aa as Ui,ab as lr,ac as mo,ad as ho,ae as po,af as xo,ag as Oc,ah as vo,ai as _o,aj as bo,ak as Zi,al as X_,am as Z_,an as J_,ao as gc,ap as e0,aq as t0,ar as mc,as as hc,at as Ia,au as n0,av as r0,aw as In,ax as pc,ay as i0,az as s0,aA as a0,aB as wo,aC as zt,aD as _n,aE as Ji,aF as Pc,aG as Fn,aH as o0,aI as kc,aJ as l0,aK as le,aL as es,aM as xc,aN as qc,aO as $c,aP as zc,aQ as Dn,aR as Bc,aS as ts,aT as zr,aU as Br,aV as Vr,aW as $r,aX as u0,aY as Vc,aZ as He,a_ as Ke,a$ as Ua,b0 as We,b1 as tr,b2 as ur,b3 as nr,b4 as c0,b5 as d0,b6 as f0,b7 as Ga,b8 as g0,b9 as m0,ba as Xn,bb as Uc,bc as Ha,bd as Gc,be as qt,bf as h0,bg as vc,bh as ns,bi as cr,bj as Hc,bk as p0,bl as So,bm as x0,bn as Kc,bo as Wc,bp as Yc,bq as Qc,br as Xc,bs as Zc,bt as Jc,bu as ed,bv as td,bw as v0,bx as Pi,by as _0,bz as b0,bA as w0,bB as S0,bC as j0,bD as C0,bE as y0,bF as N0,bG as R0,bH as E0,bI as A0,bJ as _c,bK as nd,bL as rd,bM as id,bN as sd,bO as ad,bP as od,bQ as ld,bR as I0,bS as Fa,bT as F0,bU as M0,bV as D0,bW as ud,bX as cd,bY as Ka,bZ as Wa,b_ as T0,b$ as Ma,c0 as L0,c1 as O0,c2 as P0}from"./index-vq9AFyzk.js";const k0=n=>{const{onSuccess:a,...r}=n||{},o=Mn(),{login:l}=Fc(),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 dd=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 q0=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 bc=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 wc=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 $0=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 z0=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 fd=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 B0=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 V0=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 U0=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 jo=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 gd=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 G0=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 md=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 H0=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 K0=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 hd=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 W0=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 yo=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 Y0=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 Q0=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 X0=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 pd=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 xd=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"}]]),Z0=({className:n,...a})=>i.jsx(z_,{className:he("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...a}),Sc=$_,J0=({withHandle:n,className:a,...r})=>i.jsx(B_,{className:he("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(hd,{className:"h-2.5 w-2.5"})})});function ut({className:n,...a}){return i.jsx("div",{className:he("animate-pulse rounded-md bg-muted",n),...a})}const eb=n=>typeof n=="object"&&n!==null&&n.hasOwnProperty("total_items");let ki;const tb=new Uint8Array(16);function nb(){if(!ki&&(ki=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ki))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ki(tb)}const Ue=[];for(let n=0;n<256;++n)Ue.push((n+256).toString(16).slice(1));function rb(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 ib=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jc={randomUUID:ib};function sb(n,a,r){if(jc.randomUUID&&!n)return jc.randomUUID();n=n||{};const o=n.random||(n.rng||nb)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,rb(o)}class dn extends Wi{static validate(a,r){const o=Pe.RULE_ALLOW_EMPTY.default(""),l=Nt.string().guid({version:["uuidv4"]}).label(r.label?r.label:"id"),c=Nt.alternatives(o,l);return Pe.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 ke.fail(Jn(er.INVALID_INPUT_DATA,"ID is null or empty"));if(a){const l=dn.validate(a,o);return l.isFailure?ke.fail(Jn(er.INVALID_INPUT_DATA,l.error.message,o)):ke.ok(new dn(dn.sanitize(l.object)))}return o.generateOnEmpty?dn.generateNewID():ke.ok(new dn(null))}static generateNewID(){return ke.ok(new dn(sb()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const Da={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);Se(this,"toString",()=>this.code)}static validate(r,o){const l=Nt.alternatives(Pe.RULE_ALLOW_EMPTY.default(""),Nt.string().lowercase().valid(...Object.keys(Da)).label(String(o.label)));return Pe.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 ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l));const d=fn.sanitize(c.object),h=d?{...Da[c.object],code:d}:void 0;return ke.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()}};Se(fn,"DEFAULT_LANGUAGE_CODE","es"),Se(fn,"LANGUAGES",Da);let Pr=fn;class vd{constructor(a){Se(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 _d=2,Ta={amount:0,scale:_d},ve=class ve extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Nt.number().min(ve.MIN_SCALE).max(ve.MAX_SCALE).label(l.label?l.label:"scale"),v=new vd([Pe.validate(Nt.alternatives(c,d,h,p),r),Pe.validate(Nt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);if(v.hasSomeFaultyResult())return v.getFirstFaultyResult();let R=typeof r=="string"?parseInt(r,10):Number(r),y=Aa.isNull(o)?ve.DEFAULT_SCALE:Number(o);const b=R/Math.pow(10,y);return b<ve.MIN_VALUE||b>ve.MAX_VALUE?ke.fail(new Error(`Value with scale is out of range: ${b}`)):ke.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=ve.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=ve._sanitize(l);const x={amount:Aa.isNull(p)?0:p,scale:c};return ke.ok(new this(x,Aa.isNull(p),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)}static _isWithinRange(r,o){const l=Number(ve._toString(r,o));return l>=ve.MIN_VALUE&&l<=ve.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 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);if(!ve._isWithinRange(d,r))throw new Error(`Value out of range after conversion: ${d} ${r}`);return new ve({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}isWithinRange(){return ve._isWithinRange(this.amount,this.scale)}};Se(ve,"DEFAULT_SCALE",_d),Se(ve,"MIN_VALUE",0),Se(ve,"MAX_VALUE",100),Se(ve,"MIN_SCALE",0),Se(ve,"MAX_SCALE",2);let $t=ve;const bd=2,La={amount:0,scale:bd},_e=class _e extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l={}){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Nt.number().min(_e.MIN_SCALE).max(_e.MAX_SCALE).label(l.label?l.label:"scale"),v=new vd([Pe.validate(Nt.alternatives(c,d,h,p),r),Pe.validate(Nt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);return v.hasSomeFaultyResult()?v.getFirstFaultyResult():ke.ok()}static create(r=La,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=La.amount,scale:c=La.scale}=r,d={label:"quantity",...o},h=_e.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=_e._sanitize(l);const x={amount:p===null?0:p,scale:c};return ke.ok(new _e(x,p===null,o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return _e.create({amount:null,scale:_e.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)),_e.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 _e._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!==_e.DEFAULT_SCALE?this.convertScale(_e.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<_e.MIN_SCALE||r>_e.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new _e({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 _e({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}increment(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)+Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)-Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden restar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};Se(_e,"DEFAULT_SCALE",bd),Se(_e,"MIN_SCALE",0),Se(_e,"MAX_SCALE",2);let xn=_e;const Cc=2;class ab extends Tt{static create(a){const{amount:r,currencyCode:o,scale:l=Cc}=a,c=Tt.create({amount:r,currencyCode:o,scale:l});if(c.isFailure)return c;const d=c.object.convertScale(Cc);return ke.ok(d)}}class Zn extends V_{constructor(){super(...arguments);Se(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);Se(this,"isEmpty",()=>!this.isValid());Se(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");Se(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");Se(this,"toLocaleDateString",(r,o)=>this.isValid()?this.props.toLocaleDateString(r,o):"");Se(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(r,o){const l=Pe.RULE_ALLOW_EMPTY.default(0),c=Nt.date().label(String(o.label)),d=Nt.alternatives(l,c);return Pe.validate(d,r)}static createCurrentDate(){return ke.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?ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l)):ke.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 ob=({isPending:n,interval:a=1e3,onInterval:r})=>{const[o,l]=M.useState(void 0);return M.useEffect(()=>{let c;return n&&(c=setInterval(()=>{l(d=>d===void 0?a:d+a)},a)),()=>{clearInterval(c),l(void 0)}},[n,a]),M.useEffect(()=>{r&&o&&r(o)},[o]),{elapsedTime:o}},lb=2*60*1e3,ub=60*1e3,No=({queryKey:n,queryFn:a,enabled:r,select:o,queryOptions:l={},overtimeOptions:c})=>{const[d,h]=M.useState(!1),p=Mc({queryKey:n,queryFn:a,placeholderData:Dc,staleTime:ub,refetchInterval:lb,refetchOnWindowFocus:!0,enabled:r&&!!a,select:o,...l});M.useEffect(()=>{p.isSuccess&&eb(p.data)&&h(p.data.total_items===0)},[p]);const{elapsedTime:x}=ob({isPending:p.isFetching,interval:c==null?void 0:c.interval,onInterval:c==null?void 0:c.onInterval});return{...p,overtime:{elapsedTime:x},isEmpty:d}},wd=n=>Mc({placeholderData:Dc,...n});function cb(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 db(){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 xt(n,a){return r=>{a.setState(o=>({...o,[n]:gn(r,o[n])}))}}function rs(n){return n instanceof Function}function fb(n){return Array.isArray(n)&&n.every(a=>typeof a=="number")}function gb(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 Z(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((v,R)=>o[R]!==v)))return l;o=h;let x;if(r.key&&r.debug&&(x=Date.now()),l=a(...h),r==null||r.onChange==null||r.onChange(l),r.key&&r.debug&&r!=null&&r.debug()){const v=Math.round((Date.now()-d)*100)/100,R=Math.round((Date.now()-x)*100)/100,y=R/16,b=(E,j)=>{for(E=String(E);E.length<j;)E=" "+E;return E};console.info(`%c⏱ ${b(R,5)} /${b(v,5)} ms`,`
|
||
font-size: .6rem;
|
||
font-weight: bold;
|
||
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,r==null?void 0:r.key)}return l}}function J(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 mb(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:Z(()=>[n,r,a,c],(d,h,p,x)=>({table:d,column:h,row:p,cell:x,getValue:x.getValue,renderValue:x.renderValue}),J(n.options,"debugCells"))};return n._features.forEach(d=>{d.createCell==null||d.createCell(c,r,a,n)},{}),c}function hb(n,a,r,o){var l,c;const h={...n._getDefaultColumnDef(),...a},p=h.accessorKey;let x=(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,v;if(h.accessorFn?v=h.accessorFn:p&&(p.includes(".")?v=y=>{let b=y;for(const j of p.split(".")){var E;b=(E=b)==null?void 0:E[j]}return b}:v=y=>y[h.accessorKey]),!x)throw new Error;let R={id:`${String(x)}`,accessorFn:v,parent:o,depth:r,columnDef:h,columns:[],getFlatColumns:Z(()=>[!0],()=>{var y;return[R,...(y=R.columns)==null?void 0:y.flatMap(b=>b.getFlatColumns())]},J(n.options,"debugColumns")),getLeafColumns:Z(()=>[n._getOrderColumnsFn()],y=>{var b;if((b=R.columns)!=null&&b.length){let E=R.columns.flatMap(j=>j.getLeafColumns());return y(E)}return[R]},J(n.options,"debugColumns"))};for(const y of n._features)y.createColumn==null||y.createColumn(R,n);return R}const Xe="debugHeaders";function yc(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 pb={createTable:n=>{n.getHeaderGroups=Z(()=>[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(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?c:[],p=(d=l==null?void 0:l.map(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?d:[],x=r.filter(R=>!(o!=null&&o.includes(R.id))&&!(l!=null&&l.includes(R.id)));return qi(a,[...h,...x,...p],n)},J(n.options,Xe)),n.getCenterHeaderGroups=Z(()=>[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))),qi(a,r,n,"center")),J(n.options,Xe)),n.getLeftHeaderGroups=Z(()=>[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 qi(a,c,n,"left")},J(n.options,Xe)),n.getRightHeaderGroups=Z(()=>[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 qi(a,c,n,"right")},J(n.options,Xe)),n.getFooterGroups=Z(()=>[n.getHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getLeftFooterGroups=Z(()=>[n.getLeftHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getCenterFooterGroups=Z(()=>[n.getCenterHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getRightFooterGroups=Z(()=>[n.getRightHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getFlatHeaders=Z(()=>[n.getHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getLeftFlatHeaders=Z(()=>[n.getLeftHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getCenterFlatHeaders=Z(()=>[n.getCenterHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getRightFlatHeaders=Z(()=>[n.getRightHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getCenterLeafHeaders=Z(()=>[n.getCenterFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getLeftLeafHeaders=Z(()=>[n.getLeftFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getRightLeafHeaders=Z(()=>[n.getRightFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getLeafHeaders=Z(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(a,r,o)=>{var l,c,d,h,p,x;return[...(l=(c=a[0])==null?void 0:c.headers)!=null?l:[],...(d=(h=r[0])==null?void 0:h.headers)!=null?d:[],...(p=(x=o[0])==null?void 0:x.headers)!=null?p:[]].map(v=>v.getLeafHeaders()).flat()},J(n.options,Xe))}};function qi(n,a,r,o){var l,c;let d=0;const h=function(y,b){b===void 0&&(b=1),d=Math.max(d,b),y.filter(E=>E.getIsVisible()).forEach(E=>{var j;(j=E.columns)!=null&&j.length&&h(E.columns,b+1)},0)};h(n);let p=[];const x=(y,b)=>{const E={depth:b,id:[o,`${b}`].filter(Boolean).join("_"),headers:[]},j=[];y.forEach(D=>{const F=[...j].reverse()[0],q=D.column.depth===E.depth;let $,Q=!1;if(q&&D.column.parent?$=D.column.parent:($=D.column,Q=!0),F&&(F==null?void 0:F.column)===$)F.subHeaders.push(D);else{const O=yc(r,$,{id:[o,b,$.id,D==null?void 0:D.id].filter(Boolean).join("_"),isPlaceholder:Q,placeholderId:Q?`${j.filter(k=>k.column===$).length}`:void 0,depth:b,index:j.length});O.subHeaders.push(D),j.push(O)}E.headers.push(D),D.headerGroup=E}),p.push(E),b>0&&x(j,b-1)},v=a.map((y,b)=>yc(r,y,{depth:d,index:b}));x(v,d-1),p.reverse();const R=y=>y.filter(E=>E.column.getIsVisible()).map(E=>{let j=0,D=0,F=[0];E.subHeaders&&E.subHeaders.length?(F=[],R(E.subHeaders).forEach($=>{let{colSpan:Q,rowSpan:O}=$;j+=Q,F.push(O)})):j=1;const q=Math.min(...F);return D=D+q,E.colSpan=j,E.rowSpan=D,{colSpan:j,rowSpan:D}});return R((l=(c=p[0])==null?void 0:c.headers)!=null?l:[]),p}const Ro=(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 x=n.getColumn(p);if(x!=null&&x.accessorFn)return h._valuesCache[p]=x.accessorFn(h.original,o),h._valuesCache[p]},getUniqueValues:p=>{if(h._uniqueValuesCache.hasOwnProperty(p))return h._uniqueValuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return x.columnDef.getUniqueValues?(h._uniqueValuesCache[p]=x.columnDef.getUniqueValues(h.original,o),h._uniqueValuesCache[p]):(h._uniqueValuesCache[p]=[h.getValue(p)],h._uniqueValuesCache[p])},renderValue:p=>{var x;return(x=h.getValue(p))!=null?x:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>gb(h.subRows,p=>p.subRows),getParentRow:()=>h.parentId?n.getRow(h.parentId,!0):void 0,getParentRows:()=>{let p=[],x=h;for(;;){const v=x.getParentRow();if(!v)break;p.push(v),x=v}return p.reverse()},getAllCells:Z(()=>[n.getAllLeafColumns()],p=>p.map(x=>mb(n,h,x,x.id)),J(n.options,"debugRows")),_getAllCellsByColumnId:Z(()=>[h.getAllCells()],p=>p.reduce((x,v)=>(x[v.column.id]=v,x),{}),J(n.options,"debugRows"))};for(let p=0;p<n._features.length;p++){const x=n._features[p];x==null||x.createRow==null||x.createRow(h,n)}return h},xb={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()}}},Sd=(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))};Sd.autoRemove=n=>Lt(n);const jd=(n,a,r)=>{var o;return!!(!((o=n.getValue(a))==null||(o=o.toString())==null)&&o.includes(r))};jd.autoRemove=n=>Lt(n);const Cd=(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())};Cd.autoRemove=n=>Lt(n);const yd=(n,a,r)=>{var o;return(o=n.getValue(a))==null?void 0:o.includes(r)};yd.autoRemove=n=>Lt(n);const Nd=(n,a,r)=>!r.some(o=>{var l;return!((l=n.getValue(a))!=null&&l.includes(o))});Nd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Rd=(n,a,r)=>r.some(o=>{var l;return(l=n.getValue(a))==null?void 0:l.includes(o)});Rd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Ed=(n,a,r)=>n.getValue(a)===r;Ed.autoRemove=n=>Lt(n);const Ad=(n,a,r)=>n.getValue(a)==r;Ad.autoRemove=n=>Lt(n);const Eo=(n,a,r)=>{let[o,l]=r;const c=n.getValue(a);return c>=o&&c<=l};Eo.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]};Eo.autoRemove=n=>Lt(n)||Lt(n[0])&&Lt(n[1]);const Zt={includesString:Sd,includesStringSensitive:jd,equalsString:Cd,arrIncludes:yd,arrIncludesAll:Nd,arrIncludesSome:Rd,equals:Ed,weakEquals:Ad,inNumberRange:Eo};function Lt(n){return n==null||n===""}const vb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:xt("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 rs(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(v=>v.id===n.id),d=gn(r,c?c.value:void 0);if(Nc(l,d,n)){var h;return(h=o==null?void 0:o.filter(v=>v.id!==n.id))!=null?h:[]}const p={id:n.id,value:d};if(c){var x;return(x=o==null?void 0:o.map(v=>v.id===n.id?p:v))!=null?x:[]}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(Nc(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 Nc(n,a,r){return(n&&n.autoRemove?n.autoRemove(a,r):!1)||typeof a>"u"||typeof a=="string"&&!a}const _b=(n,a,r)=>r.reduce((o,l)=>{const c=l.getValue(n);return o+(typeof c=="number"?c:0)},0),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;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o<c||o===void 0&&c>=c)&&(o=c)}),o},Sb=(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]},jb=(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(!fb(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},yb=(n,a)=>Array.from(new Set(a.map(r=>r.getValue(n))).values()),Nb=(n,a)=>new Set(a.map(r=>r.getValue(n))).size,Rb=(n,a)=>a.length,Oa={sum:_b,min:bb,max:wb,extent:Sb,mean:jb,median:Cb,unique:yb,uniqueCount:Nb,count:Rb},Eb={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:xt("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 Oa.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Oa.extent},n.getAggregationFn=()=>{var r,o;if(!n)throw new Error;return rs(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:Oa[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 Ab(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 Ib={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:xt("columnOrder",n)}),createColumn:(n,a)=>{n.getIndex=Z(r=>[kr(a,r)],r=>r.findIndex(o=>o.id===n.id),J(a.options,"debugColumns")),n.getIsFirstColumn=r=>{var o;return((o=kr(a,r)[0])==null?void 0:o.id)===n.id},n.getIsLastColumn=r=>{var o;const l=kr(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=Z(()=>[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(),x=h.findIndex(v=>v.id===p);x>-1&&c.push(h.splice(x,1)[0])}c=[...c,...h]}return Ab(c,r,o)},J(n.options,"debugTable"))}},Pa=()=>({left:[],right:[]}),Fb={getInitialState:n=>({columnPinning:Pa(),...n}),getDefaultOptions:n=>({onColumnPinningChange:xt("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(R=>!(o!=null&&o.includes(R))),right:[...((p=l==null?void 0:l.right)!=null?p:[]).filter(R=>!(o!=null&&o.includes(R))),...o]}}if(r==="left"){var x,v;return{left:[...((x=l==null?void 0:l.left)!=null?x:[]).filter(R=>!(o!=null&&o.includes(R))),...o],right:((v=l==null?void 0:l.right)!=null?v:[]).filter(R=>!(o!=null&&o.includes(R)))}}return{left:((c=l==null?void 0:l.left)!=null?c:[]).filter(R=>!(o!=null&&o.includes(R))),right:((d=l==null?void 0:l.right)!=null?d:[]).filter(R=>!(o!=null&&o.includes(R)))}})},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=Z(()=>[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))},J(a.options,"debugRows")),n.getLeftVisibleCells=Z(()=>[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"})),J(a.options,"debugRows")),n.getRightVisibleCells=Z(()=>[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"})),J(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?Pa():(r=(o=n.initialState)==null?void 0:o.columnPinning)!=null?r:Pa())},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=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getRightLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getCenterLeafColumns=Z(()=>[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))},J(n.options,"debugColumns"))}},$i={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ka=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Mb={getDefaultColumnDef:()=>$i,getInitialState:n=>({columnSizing:{},columnSizingInfo:ka(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xt("columnSizing",n),onColumnSizingInfoChange:xt("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:$i.minSize,(o=c??n.columnDef.size)!=null?o:$i.size),(l=n.columnDef.maxSize)!=null?l:$i.maxSize)},n.getStart=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(0,n.getIndex(r)).reduce((l,c)=>l+c.getSize(),0),J(a.options,"debugColumns")),n.getAfter=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(n.getIndex(r)+1).reduce((l,c)=>l+c.getSize(),0),J(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(),qa(c)&&c.touches&&c.touches.length>1))return;const d=n.getSize(),h=n?n.getLeafHeaders().map(F=>[F.column.id,F.column.getSize()]):[[o.id,o.getSize()]],p=qa(c)?Math.round(c.touches[0].clientX):c.clientX,x={},v=(F,q)=>{typeof q=="number"&&(a.setColumnSizingInfo($=>{var Q,O;const k=a.options.columnResizeDirection==="rtl"?-1:1,H=(q-((Q=$==null?void 0:$.startOffset)!=null?Q:0))*k,W=Math.max(H/((O=$==null?void 0:$.startSize)!=null?O:0),-.999999);return $.columnSizingStart.forEach(B=>{let[se,ce]=B;x[se]=Math.round(Math.max(ce+ce*W,0)*100)/100}),{...$,deltaOffset:H,deltaPercentage:W}}),(a.options.columnResizeMode==="onChange"||F==="end")&&a.setColumnSizing($=>({...$,...x})))},R=F=>v("move",F),y=F=>{v("end",F),a.setColumnSizingInfo(q=>({...q,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=r||typeof document<"u"?document:null,E={moveHandler:F=>R(F.clientX),upHandler:F=>{b==null||b.removeEventListener("mousemove",E.moveHandler),b==null||b.removeEventListener("mouseup",E.upHandler),y(F.clientX)}},j={moveHandler:F=>(F.cancelable&&(F.preventDefault(),F.stopPropagation()),R(F.touches[0].clientX),!1),upHandler:F=>{var q;b==null||b.removeEventListener("touchmove",j.moveHandler),b==null||b.removeEventListener("touchend",j.upHandler),F.cancelable&&(F.preventDefault(),F.stopPropagation()),y((q=F.touches[0])==null?void 0:q.clientX)}},D=Db()?{passive:!1}:!1;qa(c)?(b==null||b.addEventListener("touchmove",j.moveHandler,D),b==null||b.addEventListener("touchend",j.upHandler,D)):(b==null||b.addEventListener("mousemove",E.moveHandler,D),b==null||b.addEventListener("mouseup",E.upHandler,D)),a.setColumnSizingInfo(F=>({...F,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?ka():(r=n.initialState.columnSizingInfo)!=null?r:ka())},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 zi=null;function Db(){if(typeof zi=="boolean")return zi;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 zi=n,zi}function qa(n){return n.type==="touchstart"}const Tb={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:xt("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=Z(()=>[n.getAllCells(),a.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),J(a.options,"debugRows")),n.getVisibleCells=Z(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(r,o,l)=>[...r,...o,...l],J(a.options,"debugRows"))},createTable:n=>{const a=(r,o)=>Z(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(c=>c.getIsVisible==null?void 0:c.getIsVisible()),J(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 kr(n,a){return a?a==="center"?n.getCenterVisibleLeafColumns():a==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const Lb={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()}}},Ob={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:xt("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 rs(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)}}},Pb={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:xt("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()}}}},Ya=0,Qa=10,$a=()=>({pageIndex:Ya,pageSize:Qa}),kb={getInitialState:n=>({...n,pagination:{...$a(),...n==null?void 0:n.pagination}}),getDefaultOptions:n=>({onPaginationChange:xt("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?$a():(l=n.initialState.pagination)!=null?l:$a())},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?Ya:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageIndex)!=null?l:Ya)},n.resetPageSize=o=>{var l,c;n.setPageSize(o?Qa:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageSize)!=null?l:Qa)},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=Z(()=>[n.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((c,d)=>d)),l},J(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}}},za=()=>({top:[],bottom:[]}),qb={getInitialState:n=>({rowPinning:za(),...n}),getDefaultOptions:n=>({onRowPinningChange:xt("rowPinning",n)}),createRow:(n,a)=>{n.pin=(r,o,l)=>{const c=o?n.getLeafRows().map(p=>{let{id:x}=p;return x}):[],d=l?n.getParentRows().map(p=>{let{id:x}=p;return x}):[],h=new Set([...d,n.id,...c]);a.setRowPinning(p=>{var x,v;if(r==="bottom"){var R,y;return{top:((R=p==null?void 0:p.top)!=null?R:[]).filter(j=>!(h!=null&&h.has(j))),bottom:[...((y=p==null?void 0:p.bottom)!=null?y:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)]}}if(r==="top"){var b,E;return{top:[...((b=p==null?void 0:p.top)!=null?b:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)],bottom:((E=p==null?void 0:p.bottom)!=null?E:[]).filter(j=>!(h!=null&&h.has(j)))}}return{top:((x=p==null?void 0:p.top)!=null?x:[]).filter(j=>!(h!=null&&h.has(j))),bottom:((v=p==null?void 0:p.bottom)!=null?v:[]).filter(j=>!(h!=null&&h.has(j)))}})},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?za():(r=(o=n.initialState)==null?void 0:o.rowPinning)!=null?r:za())},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=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(a,r)=>n._getPinnedRows(a,r,"top"),J(n.options,"debugRows")),n.getBottomRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(a,r)=>n._getPinnedRows(a,r,"bottom"),J(n.options,"debugRows")),n.getCenterRows=Z(()=>[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))},J(n.options,"debugRows"))}},$b={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:xt("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=>{Xa(l,c.id,o,!0,n)}),l}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getCoreRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getFilteredSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getGroupedSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getSortedRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(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 Xa(h,n.id,r,(d=o==null?void 0:o.selectChildren)!=null?d:!0,a),h})},n.getIsSelected=()=>{const{rowSelection:r}=a.getState();return Ao(n,r)},n.getIsSomeSelected=()=>{const{rowSelection:r}=a.getState();return Za(n,r)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=a.getState();return Za(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)}}}},Xa=(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=>Xa(n,h.id,r,o,l))};function Ba(n,a){const r=n.getState().rowSelection,o=[],l={},c=function(d,h){return d.map(p=>{var x;const v=Ao(p,r);if(v&&(o.push(p),l[p.id]=p),(x=p.subRows)!=null&&x.length&&(p={...p,subRows:c(p.subRows)}),v)return p}).filter(Boolean)};return{rows:c(a.rows),flatRows:o,rowsById:l}}function Ao(n,a){var r;return(r=a[n.id])!=null?r:!1}function Za(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()&&(Ao(d,a)?c=!0:l=!1),d.subRows&&d.subRows.length)){const h=Za(d,a);h==="all"?c=!0:(h==="some"&&(c=!0),l=!1)}}),l?"all":c?"some":!1}const Ja=/([0-9]+)/gm,zb=(n,a,r)=>Id(vn(n.getValue(r)).toLowerCase(),vn(a.getValue(r)).toLowerCase()),Bb=(n,a,r)=>Id(vn(n.getValue(r)),vn(a.getValue(r))),Vb=(n,a,r)=>Io(vn(n.getValue(r)).toLowerCase(),vn(a.getValue(r)).toLowerCase()),Ub=(n,a,r)=>Io(vn(n.getValue(r)),vn(a.getValue(r))),Gb=(n,a,r)=>{const o=n.getValue(r),l=a.getValue(r);return o>l?1:o<l?-1:0},Hb=(n,a,r)=>Io(n.getValue(r),a.getValue(r));function Io(n,a){return n===a?0:n>a?1:-1}function vn(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function Id(n,a){const r=n.split(Ja).filter(Boolean),o=a.split(Ja).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 Dr={alphanumeric:zb,alphanumericCaseSensitive:Bb,text:Vb,textCaseSensitive:Ub,datetime:Gb,basic:Hb},Kb={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:xt("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 Dr.datetime;if(typeof c=="string"&&(o=!0,c.split(Ja).length>1))return Dr.alphanumeric}return o?Dr.text:Dr.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 rs(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:Dr[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 x=[],v,R=c?r:l==="desc";if(d!=null&&d.length&&n.getCanMultiSort()&&o?h?v="toggle":v="add":d!=null&&d.length&&p!==d.length-1?v="replace":h?v="toggle":v="replace",v==="toggle"&&(c||l||(v="remove")),v==="add"){var y;x=[...d,{id:n.id,desc:R}],x.splice(0,x.length-((y=a.options.maxMultiSortColCount)!=null?y:Number.MAX_SAFE_INTEGER))}else v==="toggle"?x=d.map(b=>b.id===n.id?{...b,desc:R}:b):v==="remove"?x=d.filter(b=>b.id!==n.id):x=[{id:n.id,desc:R}];return x})},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())}},Wb=[pb,Tb,Ib,Fb,xb,vb,Lb,Ob,Kb,Eb,Pb,kb,qb,$b,Mb];function Yb(n){var a,r;const o=[...Wb,...(a=n._features)!=null?a:[]];let l={_features:o};const c=l._features.reduce((y,b)=>Object.assign(y,b.getDefaultOptions==null?void 0:b.getDefaultOptions(l)),{}),d=y=>l.options.mergeOptions?l.options.mergeOptions(c,y):{...c,...y};let p={...{},...(r=n.initialState)!=null?r:{}};l._features.forEach(y=>{var b;p=(b=y.getInitialState==null?void 0:y.getInitialState(p))!=null?b:p});const x=[];let v=!1;const R={_features:o,options:{...c,...n},initialState:p,_queue:y=>{x.push(y),v||(v=!0,Promise.resolve().then(()=>{for(;x.length;)x.shift()();v=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{l.setState(l.initialState)},setOptions:y=>{const b=gn(y,l.options);l.options=d(b)},getState:()=>l.options.state,setState:y=>{l.options.onStateChange==null||l.options.onStateChange(y)},_getRowId:(y,b,E)=>{var j;return(j=l.options.getRowId==null?void 0:l.options.getRowId(y,b,E))!=null?j:`${E?[E.id,b].join("."):b}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(y,b)=>{let E=(b?l.getPrePaginationRowModel():l.getRowModel()).rowsById[y];if(!E&&(E=l.getCoreRowModel().rowsById[y],!E))throw new Error;return E},_getDefaultColumnDef:Z(()=>[l.options.defaultColumn],y=>{var b;return y=(b=y)!=null?b:{},{header:E=>{const j=E.header.column.columnDef;return j.accessorKey?j.accessorKey:j.accessorFn?j.id:null},cell:E=>{var j,D;return(j=(D=E.renderValue())==null||D.toString==null?void 0:D.toString())!=null?j:null},...l._features.reduce((E,j)=>Object.assign(E,j.getDefaultColumnDef==null?void 0:j.getDefaultColumnDef()),{}),...y}},J(n,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:Z(()=>[l._getColumnDefs()],y=>{const b=function(E,j,D){return D===void 0&&(D=0),E.map(F=>{const q=hb(l,F,D,j),$=F;return q.columns=$.columns?b($.columns,q,D+1):[],q})};return b(y)},J(n,"debugColumns")),getAllFlatColumns:Z(()=>[l.getAllColumns()],y=>y.flatMap(b=>b.getFlatColumns()),J(n,"debugColumns")),_getAllFlatColumnsById:Z(()=>[l.getAllFlatColumns()],y=>y.reduce((b,E)=>(b[E.id]=E,b),{}),J(n,"debugColumns")),getAllLeafColumns:Z(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(y,b)=>{let E=y.flatMap(j=>j.getLeafColumns());return b(E)},J(n,"debugColumns")),getColumn:y=>l._getAllFlatColumnsById()[y]};Object.assign(l,R);for(let y=0;y<l._features.length;y++){const b=l._features[y];b==null||b.createTable==null||b.createTable(l)}return l}function Fd(){return n=>Z(()=>[n.options.data],a=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(l,c,d){c===void 0&&(c=0);const h=[];for(let x=0;x<l.length;x++){const v=Ro(n,n._getRowId(l[x],x,d),l[x],x,c,void 0,d==null?void 0:d.id);if(r.flatRows.push(v),r.rowsById[v.id]=v,h.push(v),n.options.getSubRows){var p;v.originalSubRows=n.options.getSubRows(l[x],x),(p=v.originalSubRows)!=null&&p.length&&(v.subRows=o(v.originalSubRows,c+1,v))}}return h};return r.rows=o(a),r},J(n.options,"debugTable","getRowModel",()=>n._autoResetPageIndex()))}function Md(n,a,r){return r.options.filterFromLeafRows?Qb(n,a,r):Xb(n,a,r)}function Qb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,x){x===void 0&&(x=0);const v=[];for(let y=0;y<p.length;y++){var R;let b=p[y];const E=Ro(r,b.id,b.original,b.index,b.depth,void 0,b.parentId);if(E.columnFilters=b.columnFilters,(R=b.subRows)!=null&&R.length&&x<d){if(E.subRows=h(b.subRows,x+1),b=E,a(b)&&!E.subRows.length){v.push(b),c[b.id]=b,l.push(b);continue}if(a(b)||E.subRows.length){v.push(b),c[b.id]=b,l.push(b);continue}}else b=E,a(b)&&(v.push(b),c[b.id]=b,l.push(b))}return v};return{rows:h(n),flatRows:l,rowsById:c}}function Xb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,x){x===void 0&&(x=0);const v=[];for(let y=0;y<p.length;y++){let b=p[y];if(a(b)){var R;if((R=b.subRows)!=null&&R.length&&x<d){const j=Ro(r,b.id,b.original,b.index,b.depth,void 0,b.parentId);j.subRows=h(b.subRows,x+1),b=j}v.push(b),l.push(b),c[b.id]=b}}return v};return{rows:h(n),flatRows:l,rowsById:c}}function Zb(){return(n,a)=>Z(()=>[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 Md(r.rows,d,n)},J(n.options,"debugTable"))}function Jb(){return(n,a)=>Z(()=>{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},J(n.options,"debugTable"))}function ew(){return n=>Z(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(a,r,o)=>{if(!a.rows.length||!(r!=null&&r.length)&&!o){for(let y=0;y<a.flatRows.length;y++)a.flatRows[y].columnFilters={},a.flatRows[y].columnFiltersMeta={};return a}const l=[],c=[];(r??[]).forEach(y=>{var b;const E=n.getColumn(y.id);if(!E)return;const j=E.getFilterFn();j&&l.push({id:y.id,filterFn:j,resolvedValue:(b=j.resolveFilterValue==null?void 0:j.resolveFilterValue(y.value))!=null?b:y.value})});const d=(r??[]).map(y=>y.id),h=n.getGlobalFilterFn(),p=n.getAllLeafColumns().filter(y=>y.getCanGlobalFilter());o&&h&&p.length&&(d.push("__global__"),p.forEach(y=>{var b;c.push({id:y.id,filterFn:h,resolvedValue:(b=h.resolveFilterValue==null?void 0:h.resolveFilterValue(o))!=null?b:o})}));let x,v;for(let y=0;y<a.flatRows.length;y++){const b=a.flatRows[y];if(b.columnFilters={},l.length)for(let E=0;E<l.length;E++){x=l[E];const j=x.id;b.columnFilters[j]=x.filterFn(b,j,x.resolvedValue,D=>{b.columnFiltersMeta[j]=D})}if(c.length){for(let E=0;E<c.length;E++){v=c[E];const j=v.id;if(v.filterFn(b,j,v.resolvedValue,D=>{b.columnFiltersMeta[j]=D})){b.columnFilters.__global__=!0;break}}b.columnFilters.__global__!==!0&&(b.columnFilters.__global__=!1)}}const R=y=>{for(let b=0;b<d.length;b++)if(y.columnFilters[d[b]]===!1)return!1;return!0};return Md(a.rows,R,n)},J(n.options,"debugTable","getFilteredRowModel",()=>n._autoResetPageIndex()))}function tw(){return n=>Z(()=>[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 x;return(x=n.getColumn(p.id))==null?void 0:x.getCanSort()}),d={};c.forEach(p=>{const x=n.getColumn(p.id);x&&(d[p.id]={sortUndefined:x.columnDef.sortUndefined,invertSorting:x.columnDef.invertSorting,sortingFn:x.getSortingFn()})});const h=p=>{const x=p.map(v=>({...v}));return x.sort((v,R)=>{for(let b=0;b<c.length;b+=1){var y;const E=c[b],j=d[E.id],D=j.sortUndefined,F=(y=E==null?void 0:E.desc)!=null?y:!1;let q=0;if(D){const $=v.getValue(E.id),Q=R.getValue(E.id),O=$===void 0,k=Q===void 0;if(O||k){if(D==="first")return O?-1:1;if(D==="last")return O?1:-1;q=O&&k?0:O?D:-D}}if(q===0&&(q=j.sortingFn(v,R,E.id)),q!==0)return F&&(q*=-1),j.invertSorting&&(q*=-1),q}return v.index-R.index}),x.forEach(v=>{var R;l.push(v),(R=v.subRows)!=null&&R.length&&(v.subRows=h(v.subRows))}),x};return{rows:h(r.rows),flatRows:l,rowsById:r.rowsById}},J(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?nw(n)?M.createElement(n,a):n:null}function nw(n){return rw(n)||typeof n=="function"||iw(n)}function rw(n){return typeof n=="function"&&(()=>{const a=Object.getPrototypeOf(n);return a.prototype&&a.prototype.isReactComponent})()}function iw(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function Dd(n){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[r]=M.useState(()=>({current:Yb(a)})),[o,l]=M.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 sw=({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(rr,{children:[i.jsx(Tc,{asChild:!0,children:i.jsxs(G,{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(U_,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),i.jsxs(ir,{className:"sm:max-w-[425px]",children:[i.jsx(sr,{children:i.jsx(ar,{children:a})}),i.jsxs(no,{className:"grid gap-4 py-2",children:[r,i.jsx(or,{children:i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",children:w("common.close")})})})]})]})]})});function aw(n){let o=0;for(let v=0;v<n.length;v++)o=n.charCodeAt(v)+((o<<5)-o);let l="#";for(let v=0;v<3;v++){const R=o>>v*8&255;l+=("00"+R.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")}`,x=`#${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,x]}const Td=({label:n,className:a})=>{const[r,o]=aw(n);return i.jsx(ro,{className:a,style:a?{}:{backgroundColor:o,color:r},children:n})};function Ld({table:n,header:a,className:r}){return a.column.getCanSort()?i.jsx("div",{className:he("flex items-center space-x-2",r),children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{"aria-label":a.column.getIsSorted()==="desc"?w("common.sort_desc_description"):a.column.getIsSorted()==="asc"?w("common.sort_asc_description"):w("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(bc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):a.column.getIsSorted()==="asc"?i.jsx(wc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):i.jsx(q0,{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(Lr,{onClick:()=>a.column.toggleSorting(!1),"aria-label":w("common.sort_asc"),children:[i.jsx(wc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_asc")]}),i.jsxs(Lr,{onClick:()=>a.column.toggleSorting(!0),"aria-label":w("common.sort_desc"),children:[i.jsx(bc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_desc")]})]}),a.column.getCanSort()&&a.column.getCanHide()&&i.jsx(io,{}),a.column.getCanHide()&&i.jsxs(Lr,{onClick:()=>a.column.toggleVisibility(!1),"aria-label":w("Hide"),children:[i.jsx(md,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("Hide")]})]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:he("data-[state=open]:bg-accent tracking-wide text-ellipsis",r),children:a.isPlaceholder?null:Gi(a.column.columnDef.header,a.getContext())}),!1]})}function ow({table:n,className:a,enablePageSizeSelector:r=!0,visible:o="auto"}){const l=M.useMemo(()=>o===!0,[o]),c=M.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:w("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:w("common.rows_per_page")}),i.jsxs(so,{value:`${n.getState().pagination.pageSize}`,onValueChange:d=>{n.setPageSize(Number(d))},children:[i.jsx(ao,{className:"h-8 w-[70px]",children:i.jsx(oo,{placeholder:n.getState().pagination.pageSize})}),i.jsx(lo,{side:"top",children:G_.map(d=>i.jsx(Or,{value:`${d}`,children:d},d))})]})]}),i.jsxs("div",{className:he("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:w("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(G,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(H_),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_first_page")}),i.jsx($0,{className:"w-4 h-4"})]}),i.jsxs(G,{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:w("common.go_to_prev_page")}),i.jsx(K_,{className:"w-4 h-4"})]}),i.jsxs(G,{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:w("common.go_to_next_page")}),i.jsx(W_,{className:"w-4 h-4"})]}),i.jsxs(G,{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:w("common.go_to_last_page")}),i.jsx(z0,{className:"w-4 h-4"})]})]})]})]})]})}function is({table:n,title:a,description:r,caption:o,paginationOptions:l,headerOptions:c={visible:!0},children:d,className:h,contentClassName:p,footerClassName:x,rowClassName:v,cellClassName:R,onRowClick:y,activeRowIndex:b}){var j;const E=c==null?void 0:c.visible;return i.jsxs(Le,{className:h,children:[(a||r)&&i.jsxs(pt,{className:"pb-0",children:[i.jsx(Ge,{children:a}),i.jsx(Ze,{children:r})]}),i.jsxs(Oe,{className:he("pt-6",p),children:[d&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex space-x-2",children:d}),i.jsx(hn,{className:"my-4"})]}),i.jsxs(uo,{children:[typeof o<"u"&&i.jsx(Y_,{children:o}),E&&n.getHeaderGroups().length&&i.jsx(co,{children:n.getHeaderGroups().map(D=>i.jsx(pn,{className:v,children:D.headers.map(F=>i.jsx(fo,{colSpan:F.colSpan,style:{width:F.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.getSize()},children:i.jsx(Ld,{table:n,header:F})},F.id))},D.id))}),i.jsx(go,{children:(j=n.getRowModel().rows)!=null&&j.length?n.getRowModel().rows.map(D=>i.jsx(pn,{onClick:()=>{y&&y(D)},tabIndex:0,"data-state":D.getIsSelected()&&"selected",className:he(D.getIsSelected()||b===D.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",v),children:D.getVisibleCells().map(F=>i.jsx(qr,{className:R,style:{width:F.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.column.getSize()},children:Gi(F.column.columnDef.cell,F.getContext())},F.id))},D.id)):i.jsx(pn,{className:v,children:i.jsx(qr,{className:he("h-24 text-center",R),colSpan:n.getAllColumns.length,children:"No hay datos para mostrar"})})})]})]}),i.jsx(Dt,{className:x,children:i.jsx(ow,{className:"flex-1",table:n,...l})})]})}function lw({actions:n,rowContext:a}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{size:"icon",variant:"outline",className:"w-8 h-8",children:[i.jsx(G0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:w("common.open_menu")})]})}),i.jsxs(Xi,{align:"end",children:[i.jsxs(Lc,{children:[w("common.actions")," "]}),n&&n(a).map((r,o)=>r.label==="-"?i.jsx(io,{},o):i.jsxs(Lr,{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 uw(){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 ss({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,...x}){return i.jsxs("div",{className:he("w-full space-y-2.5 overflow-auto",p),...x,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((v,R)=>i.jsx(ut,{className:"w-40 h-7 lg:w-60"},R)):null,o>0?Array.from({length:o}).map((v,R)=>i.jsx(ut,{className:"h-7 w-[4.5rem] border-dashed"},R)):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(uo,{children:[i.jsx(co,{children:Array.from({length:1}).map((v,R)=>i.jsx(pn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(fo,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))}),i.jsx(go,{children:Array.from({length:a}).map((v,R)=>i.jsx(pn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(qr,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))})]})}),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 as=({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(G,{className:"my-4",onClick:o,children:[i.jsx(yo,{}),r]})]})]}),cw=vo("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:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=$t.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=$t.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:{max:100,min:0,...x},render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Oc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(cw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},dw=vo("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"}}),fw=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=xn.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=xn.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:x,render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Oc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(dw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},gw=vo("",{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"}}),mn=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,rules:p,required:x,type:v,variant:R}=n,{control:y}=lr();return i.jsx(mo,{control:y,name:a,disabled:h,rules:{required:x,...p},render:({field:b,fieldState:E})=>{const j=!!((p==null?void 0:p.required)??x);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:j}),i.jsx(xo,{className:"block",children:i.jsx(Zi,{type:v,placeholder:c,className:he(E.error?"border-destructive focus-visible:ring-destructive":"",gw({variant:R,className:d})),...b})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},mw=(n,a)=>{const r=M.useRef();return M.useEffect(()=>{r.current=n},[n,a]),r.current},Od=(n,a,r,o)=>n.getFixedT(a,r,o),hw=(n,a,r,o)=>M.useCallback(Od(n,a,r,o),[n,a,r,o]),Fo=(n,a={})=>{var Q,O,k,H;const{i18n:r}=a,{i18n:o,defaultNS:l}=M.useContext(X_)||{},c=r||o||Z_();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new J_),!c){gc(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const W=(se,ce)=>Ia(ce)?ce:n0(ce)&&Ia(ce.defaultValue)?ce.defaultValue:Array.isArray(se)?se[se.length-1]:se,B=[W,{},!1];return B.t=W,B.i18n={},B.ready=!1,B}(Q=c.options.react)!=null&&Q.wait&&gc(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...t0(),...c.options.react,...a},{useSuspense:h,keyPrefix:p}=d;let x=l||((O=c.options)==null?void 0:O.defaultNS);x=Ia(x)?[x]:x||["translation"],(H=(k=c.reportNamespaces).addUsedNamespaces)==null||H.call(k,x);const v=(c.isInitialized||c.initializedStoreOnce)&&x.every(W=>e0(W,c,d)),R=hw(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),y=()=>R,b=()=>Od(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),[E,j]=M.useState(y);let D=x.join();a.lng&&(D=`${a.lng}${D}`);const F=mw(D),q=M.useRef(!0);M.useEffect(()=>{const{bindI18n:W,bindI18nStore:B}=d;q.current=!0,!v&&!h&&(a.lng?mc(c,a.lng,x,()=>{q.current&&j(b)}):hc(c,x,()=>{q.current&&j(b)})),v&&F&&F!==D&&q.current&&j(b);const se=()=>{q.current&&j(b)};return W&&(c==null||c.on(W,se)),B&&(c==null||c.store.on(B,se)),()=>{q.current=!1,c&&(W==null||W.split(" ").forEach(ce=>c.off(ce,se))),B&&c&&B.split(" ").forEach(ce=>c.store.off(ce,se))}},[c,D]),M.useEffect(()=>{q.current&&v&&j(y)},[c,p,v]);const $=[E,c,v];if($.t=E,$.i18n=c,$.ready=v,v||!v&&!h)return $;throw new Promise(W=>{a.lng?mc(c,a.lng,x,()=>W()):hc(c,x,()=>W())})};function pw(n=!1){const[a,r]=M.useState(n);return[a,()=>r(l=>!l)]}const Tn=()=>{const n=M.useContext(r0);if(n===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return n};function os({data:n,columns:a,pageCount:r,enableSorting:o=!1,enableHiding:l=!1,enableRowSelection:c=!1,initialState:d,onPaginationChange:h,meta:p}){const{pagination:x,setPagination:v,sorting:R}=Tn(),[y,b]=In.useState({}),[E,j]=In.useState((d==null?void 0:d.columnVisibility)||{}),D=Q=>{if(typeof Q=="function"){const O=Q(x);v(O)}h&&h(Q)},F=Q=>{},q=M.useCallback(()=>{const Q=a;return c&&Q.unshift(uw()),Q},[a,c]);return{table:Dd({data:n,columns:q(),pageCount:r??-1,meta:p,getCoreRowModel:Fd(),initialState:d,state:{pagination:x,sorting:R,columnVisibility:E,rowSelection:y},enableRowSelection:c,onRowSelectionChange:b,manualSorting:!0,enableSorting:o,getSortedRowModel:tw(),onSortingChange:F,enableHiding:l,onColumnVisibilityChange:j,manualPagination:!0,onPaginationChange:D,manualFiltering:!0,getFilteredRowModel:ew(),getFacetedRowModel:Zb(),getFacetedUniqueValues:Jb(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const xw=({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 x=0;const v=new ReadableStream({start(R){a(R);const y=c.getReader();async function b(){return y.read().then(({done:E,value:j})=>E?R.close():(x+=(j==null?void 0:j.byteLength)||0,j&&R.enqueue(j),r({loaded:x,total:p}),b())).catch(E=>(o(E),y.cancel("Cancelled"),R.error(E)))}return b()}});return new Response(v)},Rc=(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 Ec({customHandleDownload:n,...a}={}){var Q;let r=!1;try{r=process?!!((Q=process==null?void 0:process.env)!=null&&Q.REACT_APP_DEBUG_MODE):!1}catch{r=!1}const[o,l]=M.useState(0),[c,d]=M.useState(0),[h,p]=M.useState(0),[x,v]=M.useState(null),[R,y]=M.useState(!1),b=M.useRef(null),E=M.useCallback(({loaded:O,total:k})=>{const H=Math.round(O/k*100);d(()=>H)},[]),j=M.useCallback(O=>{const k={"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"};v(()=>({errorMessage:k[O.message]?k[O.message]:O.message}))},[]),D=M.useCallback(O=>{b.current=O},[]),F=M.useCallback(()=>{b.current&&b.current.error()},[]),q=M.useCallback(()=>{D(null),l(()=>0),d(()=>0),p(()=>0),y(()=>!1)},[D]),$=M.useCallback(async(O,k,H=0,W={})=>{if(R)return null;q(),v(()=>null),y(()=>!0);const B=setInterval(()=>l(rt=>rt+1),r?1:1e3),se=xw({setSize:p,setControllerCallback:D,setPercentageCallback:E,setErrorCallback:j}),ce=new AbortController,Y=setTimeout(()=>{H>0&&ce.abort()},H),Re=n||Rc;try{const rt=await fetch(O,{method:"GET",...a,...W,signal:ce.signal}),je=await se(rt).blob();Re(je,k),q()}catch(rt){q(),v(ee=>{const{message:je}=rt;return je!=="Failed to fetch"?{errorMessage:je}:ee}),clearTimeout(Y)}finally{clearInterval(B)}},[R,q,r,D,E,j,a,n]);return M.useMemo(()=>({elapsed:o,percentage:c,size:h,download:$,cancel:F,error:x,isInProgress:R,jsDownload:Rc}),[o,c,h,$,F,x,R])}const vw=()=>{const{i18n:n}=Fo();return Pd({locale:n.language})},Pd=n=>{const{locale:a}=n,r=M.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:pc({amount:d,scale:h}))},[a]),o=M.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:pc({amount:d,scale:h}))},[a]),l=M.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 kd(n){const[a,r]=M.useState(!1);return M.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 _w=()=>{const n=M.useContext(i0);if(n===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return n},Mo=({isDirty:n=!1,title:a=w("hooks.use_unsaved_changes_notifier.title"),subtitle:r=w("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:o=w("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=w("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:c,onCancel:d,type:h="warning"})=>{const p=s0(n),{show:x}=_w(),v=M.useCallback(()=>n?new Promise(R=>{x({title:a,subtitle:r,confirmText:o,cancelText:l,type:h,onConfirm:()=>{R(!0),c==null||c()},onCancel:()=>{R(!1),d==null||d()}})}):Promise.resolve(!0),[l,o,n,d,c,x,r,a,h]);return M.useEffect(()=>{p.state==="blocked"&&v().then(R=>{R?p.proceed():p.reset()})},[p,v]),M.useEffect(()=>(n&&(window.onbeforeunload=()=>r),()=>{window.onbeforeunload=null}),[n,r]),{confirm:v}},qd=n=>{const{isSubmitting:a,isLoading:r,isValidating:o}=a0();return i.jsx(wo,{disabled:a||r||o,...n})};qd.displayName="FormSubmitButton";const $d={"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}}"},Bi=[{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"})}],oS=()=>{var R,y,b,E;const{t:n,i18n:a}=Fo(),[r,o]=M.useState(a.language),l=zt(),{toast:c}=_n();M.useEffect(()=>{const j=navigator.language.split("-")[0],D=Bi.find(F=>F.code===j);D&&d(D.code)},[]);const d=j=>{a.changeLanguage(j),o(j)},{mutate:h,status:p}=k0({onSuccess:j=>{const{success:D,error:F}=j;!D&&F&&x.setError("root",F),D&&l("/quotes",{replace:!0})},onError:j=>{const{message:D}=j;c({description:D,title:"Error"}),console.log(j)}}),x=Ji({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Pc(Fn.object({email:Fn.string().email({tlds:{allow:!1}}).required(),password:Fn.string().min(4).alphanum().required()}),{messages:$d})}),v=async j=>{h({email:j.email,password:j.password},{})};return i.jsxs(o0,{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(G,{variant:"outline",className:"w-[140px] justify-start",children:[i.jsx("span",{className:"mr-2",children:(R=Bi.find(j=>j.code===r))==null?void 0:R.flag()}),(y=Bi.find(j=>j.code===r))==null?void 0:y.name,i.jsx(kc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),i.jsx(Xi,{className:"w-[140px]",children:Bi.map(j=>i.jsxs(Lr,{onSelect:()=>d(j.code),children:[i.jsx("span",{className:"mr-2",children:j.flag()}),j.name]},j.code))})]})}),i.jsxs(Le,{className:"px-12 py-6 bg-muted/50",children:[i.jsxs(pt,{children:[i.jsx(l0,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),i.jsx(Ge,{children:i.jsx(le,{i18nKey:"login_page.title"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"login_page.description"})})]}),i.jsx(Oe,{children:i.jsx(es,{...x,children:i.jsx("form",{onSubmit:x.handleSubmit(v),children:i.jsxs("div",{className:"grid items-start gap-6",children:[i.jsx("div",{className:"grid gap-6",children:i.jsx(mn,{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(mn,{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(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(le,{i18nKey:"login_page.contact_us"})})]})]}),((b=x.formState.errors.root)==null?void 0:b.message)&&i.jsxs(qc,{variant:"destructive",children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx($c,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx(zc,{children:(E=x.formState.errors.root)==null?void 0:E.message})]}),i.jsx(qd,{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(xc,{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.7"]})]})]})})})})]}),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"})})]})},bw=n=>{const{onSuccess:a,onError:r,...o}=n||{},l=Jt(),c=Mn(),{logout:d}=Fc(),h=zt(),{toast:p}=_n();return en({mutationKey:c().auth().action("logout").get(),mutationFn:d,onSuccess:async(x,v,R)=>{l.clear();const{success:y,redirectTo:b}=x;y&&b&&h(b||"/"),a&&a(x,v,R)},onError:(x,v,R)=>{const{message:y}=x;p({title:"Error",description:y,variant:"destructive"}),r&&r(x,v,R)},...o})},lS=()=>{const{mutate:n}=bw({});return M.useEffect(()=>n(),[n]),i.jsx(Dn,{})},ww=M.createContext(null),Sw=({children:n})=>{const[a,r]=Bc();return i.jsx(ww.Provider,{value:{pagination:a,setPagination:r},children:n})},uS=({children:n})=>i.jsx(ts,{children:i.jsx(Sw,{children:i.jsxs(zr,{className:"catalog-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),zd=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=[],enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("catalog").action("list").params(n).get(),queryFn:()=>a.getList({resource:"catalog",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})};function Bd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=In.useRef(null),[x,v]=In.useState(""),R=In.useCallback(E=>{E.key==="Enter"&&x.trim()&&(E.preventDefault(),d(j=>[...j,x.trim()]),v("")),E.key==="Backspace"&&!x&&l.length>0&&(E.preventDefault(),d(j=>j.slice(0,-1)))},[l,x]),y=In.useCallback(E=>{d(j=>j.filter(D=>D!==E))},[]),b=In.useCallback(()=>{var E;x.trim()&&(d(j=>[...j,x.trim()]),v(""),(E=p.current)==null||E.focus())},[x]);return i.jsx(u0,{children:i.jsxs("div",{className:"w-full space-y-2",...o,children:[i.jsxs("div",{className:he("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",c?"border-primary":"border-input"),children:[i.jsx(Vc,{className:he("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(ro,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[E,i.jsxs(G,{variant:"ghost",onClick:()=>y(E),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Ua,{className:"w-4 h-4"})}),i.jsx(We,{children:i.jsx("p",{children:w("catalog.filter.badget_remove_tooltip")})})]}),i.jsx("span",{className:"sr-only",children:w("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:x,onChange:E=>v(E.target.value),onKeyDown:R,placeholder:w("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(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})}),i.jsx(We,{children:i.jsx("p",{children:w("common.filter.reset_filter")})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"default",size:"icon",disabled:!x,onClick:b,className:"w-8 h-8 p-0 transition-all",children:[i.jsx(yo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.filter.button_add_term")})]})}),i.jsx(We,{children:i.jsx("p",{children:w("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:w("common.filter.help_text")})]})})}const jw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=zd({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.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:w("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:v})=>i.jsx("div",{className:"text-right",children:v()})},{id:"retail_price",accessorKey:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:v})=>{const R=Tt.create(v.original.retail_price).object;return i.jsx("div",{className:"text-right",children:R.toFormat()})}}],[]),{table:x}=os({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(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(Bd,{table:x})})},cS=()=>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(jw,{})]}),dS=()=>{const{data:n,status:a}=c0();return i.jsxs(zr,{children:[i.jsx(Br,{}),i.jsx(Vr,{children:a==="success"?i.jsx("div",{className:"flex items-center",children:i.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${w("dashboard.welcome")}, ${n==null?void 0:n.name}`})}):i.jsx(ut,{className:"w-[100px] h-[20px] rounded-full"})})]})},fS=({children:n})=>i.jsx(ts,{children:i.jsxs(zr,{className:"dealers-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})});function Cw({table:n}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[i.jsx(X0,{className:"w-4 h-4 mr-2"}),"Columnas"]})}),i.jsxs(Xi,{align:"end",className:"w-[150px]",children:[i.jsx(Lc,{children:"Columnas"}),i.jsx(io,{}),n.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>i.jsx(d0,{className:"capitalize",checked:a.getIsVisible(),onCheckedChange:r=>a.toggleVisibility(!!r),children:i.jsx(i.Fragment,{children:a.columnDef.header})},a.id))]})]})}function Vd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=x=>{const v=String(x.target.value);v===""?h():d([v])};return i.jsxs("div",{className:he("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(Vc,{className:"w-4 h-4 text-gray-500"}),i.jsx(Zi,{placeholder:w("common.filter.input_placeholder"),value:l,onChange:p,className:he("h-8 w-full transition-all")},"global-filter"),c&&i.jsxs(G,{variant:"outline",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r,n.options.enableHiding&&i.jsx(Cw,{table:n})]})]})}const yw=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=void 0,enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("dealer").action("list").params(n).get(),queryFn:()=>a.getList({resource:"dealers",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})},Nw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=yw({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.useMemo(()=>[{id:"id",accessorKey:"id",enableResizing:!1,size:10},{id:"name",accessorKey:"name",enableResizing:!1,size:10}],[]),{table:x}=os({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1});return d?i.jsx(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(i.Fragment,{children:i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(Vd,{table:x})})})},gS=()=>i.jsx(nr,{children:i.jsx(Nw,{})}),mS=()=>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(G,{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"})})]})}),Ud=M.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 Rw(n){return n.isSorting||n.wasDragging?g0(n):!0}function Ew({id:n,children:a,isActive:r=!1,onActivate:o}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:h,setActivatorNodeRef:p,transform:x,transition:v}=f0({animateLayoutChanges:Rw,id:n}),R={transform:Ga.Translate.toString(x),transition:v},y=M.useMemo(()=>({attributes:l,listeners:d,ref:p,isDragging:c}),[l,c,d,p]);return i.jsx(Ud.Provider,{value:y,children:i.jsx(pn,{id:String(n),className:he(c?"opacity-60":"opacity-100",r?"border border-destructive/30 border-b-0 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5 focus-within:bg-destructive/5":"hover:bg-muted hover:focus-within:bg-accent focus-within:bg-accent","m-0"),ref:h,style:R,onClick:o,onFocusCapture:o,children:a},n)})}const Aw=({className:n})=>{const{attributes:a,isDragging:r,listeners:o,ref:l}=M.useContext(Ud);return i.jsxs(G,{ref:l,onClick:c=>{c.preventDefault()},size:"icon",variant:"link",className:he(r?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground",n),...a,...o,children:[i.jsx(hd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.move_row")})]})};function Iw(n,a={}){const{enableDragHandleColumn:r=!1,enableSelectionColumn:o=!1,enableActionsColumn:l=!1,rowActionFn:c=void 0}=a;return M.useMemo(()=>(r&&n.unshift({id:"row_drag_handle",header:()=>null,cell:()=>i.jsx(Aw,{}),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(lw,{rowContext:d,actions:c}),enableSorting:!1,enableHiding:!1,size:48}),n),[l,r,o])}var Gd={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,x=d.trim===void 0?!0:d.trim,v=c.normalize().split("").reduce(function(R,y){var b=h[y];return b===void 0&&(b=r[y]),b===void 0&&(b=y),b===p&&(b=" "),R+b.replace(d.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return d.strict&&(v=v.replace(/[^A-Za-z0-9\s]/g,"")),x&&(v=v.trim()),v=v.replace(/\s+/g,p),d.lower&&(v=v.toLowerCase()),v}return l.extend=function(c){Object.assign(r,c)},l})})(Gd);var Fw=Gd.exports;const Mw=m0(Fw),Ur=()=>{const n=$r(),a=Mn(),r=M.useCallback(c=>`${n.getApiUrl()}/quotes/${c}/report`,[n]),o=M.useCallback(c=>`quote-${Mw(c.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),l={useList:c=>{const d=$r(),h=Mn(),{pagination:p,status:x="draft",quickSearchTerm:v=void 0,enabled:R=!0,queryOptions:y}=c;return No({queryKey:h().data().resource("quotes").action("list").params(c).get(),queryFn:()=>d.getList({resource:"quotes",quickSearchTerm:v,filters:x!=="all"?[{field:"status",operator:"eq",value:x}]:[{field:"status",operator:"ne",value:"archived"}],pagination:p}),enabled:R,queryOptions:y})},useCreate:()=>{const c=Jt();return cb({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)=>wd({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]=M.useState(void 0),{download:p,...x}=Ec({headers:{Authorization:c},customHandleDownload:M.useCallback(R=>{const y=[R],b=new Blob(y,{type:"application/octet-stream"});return h(b),!0},[h])}),v=M.useCallback(R=>p(l.getQuotePDFDownloadURL(R),""),[p]);return{...x,preview:v,report:d}},useDownloader:()=>{const c=n.getApiAuthorization(),d=Ec({headers:{Authorization:c}});return{...d,download:(p,x)=>{const v=l.getQuotePDFDownloadURL(p);return d.download(v,x)}}}};return l},hS=()=>{const n=zt(),{toast:a}=_n(),{useCreate:r}=Ur(),{mutate:o,isPending:l}=r(),c=M.useMemo(()=>({date:new Date(Date.now()).toUTCString(),customer_reference:"",customer_information:""}),[]),d=Ji({mode:"onBlur",defaultValues:c,resolver:Pc(Fn.object({customer_reference:Fn.string(),date:Fn.date().required(),customer_information:Fn.string().required()}),{messages:{es:$d}})}),{formState:h,reset:p,getValues:x,handleSubmit:v}=d,{isSubmitting:R,isDirty:y}=h;Mo({isDirty:y});const b=async E=>{try{o(E,{onError:j=>{console.debug(j),a({title:"Error",description:j.message,variant:"destructive"})},onSuccess:j=>{p(x()),a({title:"Cotización creada",variant:"default"}),n(`/quotes/edit/${j.id}`,{relative:"path"})}})}finally{}};return R?i.jsx(Dn,{title:"Guardando ajustes"}):l?i.jsx(Dn,{}):i.jsx(es,{...d,children:i.jsx("form",{onSubmit:v(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(Uc,{}),i.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:w("quotes.create.title")})]}),i.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:i.jsxs(Ha,{className:"md:col-span-4",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),footerActions:i.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[i.jsx(G,{size:"sm",variant:"outline",onClick:()=>n("/quotes"),children:w("common.discard")}),i.jsx(wo,{size:"sm",label:w("common.continue")})]}),children:[i.jsx(mn,{required:!0,name:"customer_reference",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),placeholder:w("quotes.form_fields.customer_reference.placeholder")}),i.jsx(Gc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(hn,{}),i.jsx(qt,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),placeholder:w("quotes.form_fields.customer_information.placeholder")})]})})]})})})},Va=(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,x=Tt.create(l||{amount:null,scale:2});if(x.isFailure)throw x.error;const v=a?Dw(n.items).convertScale(2):x.object,R=v.percentage(d.toNumber()).convertScale(2),y=v.subtract(R).convertScale(2),b=y.percentage(p.toNumber()).convertScale(2),E=y.add(b).convertScale(2);return{subtotal_price:v,discount:n.discount,discount_price:R,before_tax_price:y,tax:p,tax_price:b,total_price:E}},Dw=n=>{let a=Tt.create({amount:0,scale:2}).object;return n&&n.map(r=>{const o=eo(r);a=a.add(o.total_price)}),a},eo=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:xn.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=xn.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 x=p.object,v=h.multiply(c.toNumber()),R=v.subtract(v.percentage(x.toNumber()));return{quantity:c,unit_price:h,subtotal_price:v,discount:x,total_price:R}},Tw=()=>{const{id:n}=h0();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__",x=500,v="__lodash_placeholder__",R=1,y=2,b=4,E=1,j=2,D=1,F=2,q=4,$=8,Q=16,O=32,k=64,H=128,W=256,B=512,se=30,ce="...",Y=800,Re=16,rt=1,ee=2,je=3,Me=1/0,U=9007199254740991,be=17976931348623157e292,Je=NaN,it=4294967295,bn=it-1,Qd=it>>>1,Xd=[["ary",H],["bind",D],["bindKey",F],["curry",$],["curryRight",Q],["flip",B],["partial",O],["partialRight",k],["rearg",W]],Ln="[object Arguments]",Gr="[object Array]",Zd="[object AsyncFunction]",dr="[object Boolean]",fr="[object Date]",Jd="[object DOMException]",Hr="[object Error]",Kr="[object Function]",Oo="[object GeneratorFunction]",Rt="[object Map]",gr="[object Number]",ef="[object Null]",Bt="[object Object]",Po="[object Promise]",tf="[object Proxy]",mr="[object RegExp]",Et="[object Set]",hr="[object String]",Wr="[object Symbol]",nf="[object Undefined]",pr="[object WeakMap]",rf="[object WeakSet]",xr="[object ArrayBuffer]",On="[object DataView]",ls="[object Float32Array]",us="[object Float64Array]",cs="[object Int8Array]",ds="[object Int16Array]",fs="[object Int32Array]",gs="[object Uint8Array]",ms="[object Uint8ClampedArray]",hs="[object Uint16Array]",ps="[object Uint32Array]",sf=/\b__p \+= '';/g,af=/\b(__p \+=) '' \+/g,of=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ko=/&(?:amp|lt|gt|quot|#39);/g,qo=/[&<>"']/g,lf=RegExp(ko.source),uf=RegExp(qo.source),cf=/<%-([\s\S]+?)%>/g,df=/<%([\s\S]+?)%>/g,$o=/<%=([\s\S]+?)%>/g,ff=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gf=/^\w*$/,mf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xs=/[\\^$.*+?()[\]{}|]/g,hf=RegExp(xs.source),vs=/^\s+/,pf=/\s/,xf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,vf=/\{\n\/\* \[wrapped with (.+)\] \*/,_f=/,? & /,bf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,wf=/[()=,{}\[\]\/\s]/,Sf=/\\(\\)?/g,jf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zo=/\w*$/,Cf=/^[-+]0x[0-9a-f]+$/i,yf=/^0b[01]+$/i,Nf=/^\[object .+?Constructor\]$/,Rf=/^0o[0-7]+$/i,Ef=/^(?:0|[1-9]\d*)$/,Af=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yr=/($^)/,If=/['\n\r\u2028\u2029\\]/g,Qr="\\ud800-\\udfff",Ff="\\u0300-\\u036f",Mf="\\ufe20-\\ufe2f",Df="\\u20d0-\\u20ff",Bo=Ff+Mf+Df,Vo="\\u2700-\\u27bf",Uo="a-z\\xdf-\\xf6\\xf8-\\xff",Tf="\\xac\\xb1\\xd7\\xf7",Lf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Of="\\u2000-\\u206f",Pf=" \\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",Go="A-Z\\xc0-\\xd6\\xd8-\\xde",Ho="\\ufe0e\\ufe0f",Ko=Tf+Lf+Of+Pf,_s="['’]",kf="["+Qr+"]",Wo="["+Ko+"]",Xr="["+Bo+"]",Yo="\\d+",qf="["+Vo+"]",Qo="["+Uo+"]",Xo="[^"+Qr+Ko+Yo+Vo+Uo+Go+"]",bs="\\ud83c[\\udffb-\\udfff]",$f="(?:"+Xr+"|"+bs+")",Zo="[^"+Qr+"]",ws="(?:\\ud83c[\\udde6-\\uddff]){2}",Ss="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+Go+"]",Jo="\\u200d",el="(?:"+Qo+"|"+Xo+")",zf="(?:"+Pn+"|"+Xo+")",tl="(?:"+_s+"(?:d|ll|m|re|s|t|ve))?",nl="(?:"+_s+"(?:D|LL|M|RE|S|T|VE))?",rl=$f+"?",il="["+Ho+"]?",Bf="(?:"+Jo+"(?:"+[Zo,ws,Ss].join("|")+")"+il+rl+")*",Vf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Uf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",sl=il+rl+Bf,Gf="(?:"+[qf,ws,Ss].join("|")+")"+sl,Hf="(?:"+[Zo+Xr+"?",Xr,ws,Ss,kf].join("|")+")",Kf=RegExp(_s,"g"),Wf=RegExp(Xr,"g"),js=RegExp(bs+"(?="+bs+")|"+Hf+sl,"g"),Yf=RegExp([Pn+"?"+Qo+"+"+tl+"(?="+[Wo,Pn,"$"].join("|")+")",zf+"+"+nl+"(?="+[Wo,Pn+el,"$"].join("|")+")",Pn+"?"+el+"+"+tl,Pn+"+"+nl,Uf,Vf,Yo,Gf].join("|"),"g"),Qf=RegExp("["+Jo+Qr+Bo+Ho+"]"),Xf=/[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"],Jf=-1,ye={};ye[ls]=ye[us]=ye[cs]=ye[ds]=ye[fs]=ye[gs]=ye[ms]=ye[hs]=ye[ps]=!0,ye[Ln]=ye[Gr]=ye[xr]=ye[dr]=ye[On]=ye[fr]=ye[Hr]=ye[Kr]=ye[Rt]=ye[gr]=ye[Bt]=ye[mr]=ye[Et]=ye[hr]=ye[pr]=!1;var Ce={};Ce[Ln]=Ce[Gr]=Ce[xr]=Ce[On]=Ce[dr]=Ce[fr]=Ce[ls]=Ce[us]=Ce[cs]=Ce[ds]=Ce[fs]=Ce[Rt]=Ce[gr]=Ce[Bt]=Ce[mr]=Ce[Et]=Ce[hr]=Ce[Wr]=Ce[gs]=Ce[ms]=Ce[hs]=Ce[ps]=!0,Ce[Hr]=Ce[Kr]=Ce[pr]=!1;var eg={À:"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"},tg={"&":"&","<":"<",">":">",'"':""","'":"'"},ng={"&":"&","<":"<",">":">",""":'"',"'":"'"},rg={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ig=parseFloat,sg=parseInt,al=typeof Xn=="object"&&Xn&&Xn.Object===Object&&Xn,ag=typeof self=="object"&&self&&self.Object===Object&&self,Be=al||ag||Function("return this")(),Cs=a&&!a.nodeType&&a,wn=Cs&&!0&&n&&!n.nodeType&&n,ol=wn&&wn.exports===Cs,ys=ol&&al.process,vt=function(){try{var C=wn&&wn.require&&wn.require("util").types;return C||ys&&ys.binding&&ys.binding("util")}catch{}}(),ll=vt&&vt.isArrayBuffer,ul=vt&&vt.isDate,cl=vt&&vt.isMap,dl=vt&&vt.isRegExp,fl=vt&&vt.isSet,gl=vt&&vt.isTypedArray;function ct(C,I,A){switch(A.length){case 0:return C.call(I);case 1:return C.call(I,A[0]);case 2:return C.call(I,A[0],A[1]);case 3:return C.call(I,A[0],A[1],A[2])}return C.apply(I,A)}function og(C,I,A,V){for(var re=-1,me=C==null?0:C.length;++re<me;){var qe=C[re];I(V,qe,A(qe),C)}return V}function _t(C,I){for(var A=-1,V=C==null?0:C.length;++A<V&&I(C[A],A,C)!==!1;);return C}function lg(C,I){for(var A=C==null?0:C.length;A--&&I(C[A],A,C)!==!1;);return C}function ml(C,I){for(var A=-1,V=C==null?0:C.length;++A<V;)if(!I(C[A],A,C))return!1;return!0}function tn(C,I){for(var A=-1,V=C==null?0:C.length,re=0,me=[];++A<V;){var qe=C[A];I(qe,A,C)&&(me[re++]=qe)}return me}function Zr(C,I){var A=C==null?0:C.length;return!!A&&kn(C,I,0)>-1}function Ns(C,I,A){for(var V=-1,re=C==null?0:C.length;++V<re;)if(A(I,C[V]))return!0;return!1}function Ee(C,I){for(var A=-1,V=C==null?0:C.length,re=Array(V);++A<V;)re[A]=I(C[A],A,C);return re}function nn(C,I){for(var A=-1,V=I.length,re=C.length;++A<V;)C[re+A]=I[A];return C}function Rs(C,I,A,V){var re=-1,me=C==null?0:C.length;for(V&&me&&(A=C[++re]);++re<me;)A=I(A,C[re],re,C);return A}function ug(C,I,A,V){var re=C==null?0:C.length;for(V&&re&&(A=C[--re]);re--;)A=I(A,C[re],re,C);return A}function Es(C,I){for(var A=-1,V=C==null?0:C.length;++A<V;)if(I(C[A],A,C))return!0;return!1}var cg=As("length");function dg(C){return C.split("")}function fg(C){return C.match(bf)||[]}function hl(C,I,A){var V;return A(C,function(re,me,qe){if(I(re,me,qe))return V=me,!1}),V}function Jr(C,I,A,V){for(var re=C.length,me=A+(V?1:-1);V?me--:++me<re;)if(I(C[me],me,C))return me;return-1}function kn(C,I,A){return I===I?Cg(C,I,A):Jr(C,pl,A)}function gg(C,I,A,V){for(var re=A-1,me=C.length;++re<me;)if(V(C[re],I))return re;return-1}function pl(C){return C!==C}function xl(C,I){var A=C==null?0:C.length;return A?Fs(C,I)/A:Je}function As(C){return function(I){return I==null?r:I[C]}}function Is(C){return function(I){return C==null?r:C[I]}}function vl(C,I,A,V,re){return re(C,function(me,qe,we){A=V?(V=!1,me):I(A,me,qe,we)}),A}function mg(C,I){var A=C.length;for(C.sort(I);A--;)C[A]=C[A].value;return C}function Fs(C,I){for(var A,V=-1,re=C.length;++V<re;){var me=I(C[V]);me!==r&&(A=A===r?me:A+me)}return A}function Ms(C,I){for(var A=-1,V=Array(C);++A<C;)V[A]=I(A);return V}function hg(C,I){return Ee(I,function(A){return[A,C[A]]})}function _l(C){return C&&C.slice(0,jl(C)+1).replace(vs,"")}function dt(C){return function(I){return C(I)}}function Ds(C,I){return Ee(I,function(A){return C[A]})}function vr(C,I){return C.has(I)}function bl(C,I){for(var A=-1,V=C.length;++A<V&&kn(I,C[A],0)>-1;);return A}function wl(C,I){for(var A=C.length;A--&&kn(I,C[A],0)>-1;);return A}function pg(C,I){for(var A=C.length,V=0;A--;)C[A]===I&&++V;return V}var xg=Is(eg),vg=Is(tg);function _g(C){return"\\"+rg[C]}function bg(C,I){return C==null?r:C[I]}function qn(C){return Qf.test(C)}function wg(C){return Xf.test(C)}function Sg(C){for(var I,A=[];!(I=C.next()).done;)A.push(I.value);return A}function Ts(C){var I=-1,A=Array(C.size);return C.forEach(function(V,re){A[++I]=[re,V]}),A}function Sl(C,I){return function(A){return C(I(A))}}function rn(C,I){for(var A=-1,V=C.length,re=0,me=[];++A<V;){var qe=C[A];(qe===I||qe===v)&&(C[A]=v,me[re++]=A)}return me}function ei(C){var I=-1,A=Array(C.size);return C.forEach(function(V){A[++I]=V}),A}function jg(C){var I=-1,A=Array(C.size);return C.forEach(function(V){A[++I]=[V,V]}),A}function Cg(C,I,A){for(var V=A-1,re=C.length;++V<re;)if(C[V]===I)return V;return-1}function yg(C,I,A){for(var V=A+1;V--;)if(C[V]===I)return V;return V}function $n(C){return qn(C)?Rg(C):cg(C)}function At(C){return qn(C)?Eg(C):dg(C)}function jl(C){for(var I=C.length;I--&&pf.test(C.charAt(I)););return I}var Ng=Is(ng);function Rg(C){for(var I=js.lastIndex=0;js.test(C);)++I;return I}function Eg(C){return C.match(js)||[]}function Ag(C){return C.match(Yf)||[]}var Ig=function C(I){I=I==null?Be:zn.defaults(Be.Object(),I,zn.pick(Be,Zf));var A=I.Array,V=I.Date,re=I.Error,me=I.Function,qe=I.Math,we=I.Object,Ls=I.RegExp,Fg=I.String,bt=I.TypeError,ti=A.prototype,Mg=me.prototype,Bn=we.prototype,ni=I["__core-js_shared__"],ri=Mg.toString,xe=Bn.hasOwnProperty,Dg=0,Cl=function(){var e=/[^.]+$/.exec(ni&&ni.keys&&ni.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ii=Bn.toString,Tg=ri.call(we),Lg=Be._,Og=Ls("^"+ri.call(xe).replace(xs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),si=ol?I.Buffer:r,sn=I.Symbol,ai=I.Uint8Array,yl=si?si.allocUnsafe:r,oi=Sl(we.getPrototypeOf,we),Nl=we.create,Rl=Bn.propertyIsEnumerable,li=ti.splice,El=sn?sn.isConcatSpreadable:r,_r=sn?sn.iterator:r,Sn=sn?sn.toStringTag:r,ui=function(){try{var e=Rn(we,"defineProperty");return e({},"",{}),e}catch{}}(),Pg=I.clearTimeout!==Be.clearTimeout&&I.clearTimeout,kg=V&&V.now!==Be.Date.now&&V.now,qg=I.setTimeout!==Be.setTimeout&&I.setTimeout,ci=qe.ceil,di=qe.floor,Os=we.getOwnPropertySymbols,$g=si?si.isBuffer:r,Al=I.isFinite,zg=ti.join,Bg=Sl(we.keys,we),$e=qe.max,Ye=qe.min,Vg=V.now,Ug=I.parseInt,Il=qe.random,Gg=ti.reverse,Ps=Rn(I,"DataView"),br=Rn(I,"Map"),ks=Rn(I,"Promise"),Vn=Rn(I,"Set"),wr=Rn(I,"WeakMap"),Sr=Rn(we,"create"),fi=wr&&new wr,Un={},Hg=En(Ps),Kg=En(br),Wg=En(ks),Yg=En(Vn),Qg=En(wr),gi=sn?sn.prototype:r,jr=gi?gi.valueOf:r,Fl=gi?gi.toString:r;function g(e){if(Ie(e)&&!ie(e)&&!(e instanceof fe)){if(e instanceof wt)return e;if(xe.call(e,"__wrapped__"))return Mu(e)}return new wt(e)}var Gn=function(){function e(){}return function(t){if(!Ae(t))return{};if(Nl)return Nl(t);e.prototype=t;var s=new e;return e.prototype=r,s}}();function mi(){}function wt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}g.templateSettings={escape:cf,evaluate:df,interpolate:$o,variable:"",imports:{_:g}},g.prototype=mi.prototype,g.prototype.constructor=g,wt.prototype=Gn(mi.prototype),wt.prototype.constructor=wt;function fe(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=it,this.__views__=[]}function Xg(){var e=new fe(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 fe(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Jg(){var e=this.__wrapped__.value(),t=this.__dir__,s=ie(e),u=t<0,f=s?e.length:0,m=dh(0,f,this.__views__),_=m.start,S=m.end,N=S-_,T=u?S:_-1,L=this.__iteratees__,P=L.length,z=0,K=Ye(N,this.__takeCount__);if(!s||!u&&f==N&&K==N)return tu(e,this.__actions__);var te=[];e:for(;N--&&z<K;){T+=t;for(var oe=-1,ne=e[T];++oe<P;){var de=L[oe],ge=de.iteratee,mt=de.type,nt=ge(ne);if(mt==ee)ne=nt;else if(!nt){if(mt==rt)continue e;break e}}te[z++]=ne}return te}fe.prototype=Gn(mi.prototype),fe.prototype.constructor=fe;function jn(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 em(){this.__data__=Sr?Sr(null):{},this.size=0}function tm(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function nm(e){var t=this.__data__;if(Sr){var s=t[e];return s===p?r:s}return xe.call(t,e)?t[e]:r}function rm(e){var t=this.__data__;return Sr?t[e]!==r:xe.call(t,e)}function im(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Sr&&t===r?p:t,this}jn.prototype.clear=em,jn.prototype.delete=tm,jn.prototype.get=nm,jn.prototype.has=rm,jn.prototype.set=im;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 sm(){this.__data__=[],this.size=0}function am(e){var t=this.__data__,s=hi(t,e);if(s<0)return!1;var u=t.length-1;return s==u?t.pop():li.call(t,s,1),--this.size,!0}function om(e){var t=this.__data__,s=hi(t,e);return s<0?r:t[s][1]}function lm(e){return hi(this.__data__,e)>-1}function um(e,t){var s=this.__data__,u=hi(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this}Vt.prototype.clear=sm,Vt.prototype.delete=am,Vt.prototype.get=om,Vt.prototype.has=lm,Vt.prototype.set=um;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 cm(){this.size=0,this.__data__={hash:new jn,map:new(br||Vt),string:new jn}}function dm(e){var t=Ri(this,e).delete(e);return this.size-=t?1:0,t}function fm(e){return Ri(this,e).get(e)}function gm(e){return Ri(this,e).has(e)}function mm(e,t){var s=Ri(this,e),u=s.size;return s.set(e,t),this.size+=s.size==u?0:1,this}Ut.prototype.clear=cm,Ut.prototype.delete=dm,Ut.prototype.get=fm,Ut.prototype.has=gm,Ut.prototype.set=mm;function Cn(e){var t=-1,s=e==null?0:e.length;for(this.__data__=new Ut;++t<s;)this.add(e[t])}function hm(e){return this.__data__.set(e,p),this}function pm(e){return this.__data__.has(e)}Cn.prototype.add=Cn.prototype.push=hm,Cn.prototype.has=pm;function It(e){var t=this.__data__=new Vt(e);this.size=t.size}function xm(){this.__data__=new Vt,this.size=0}function vm(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s}function _m(e){return this.__data__.get(e)}function bm(e){return this.__data__.has(e)}function wm(e,t){var s=this.__data__;if(s instanceof Vt){var u=s.__data__;if(!br||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}It.prototype.clear=xm,It.prototype.delete=vm,It.prototype.get=_m,It.prototype.has=bm,It.prototype.set=wm;function Ml(e,t){var s=ie(e),u=!s&&An(e),f=!s&&!u&&cn(e),m=!s&&!u&&!f&&Yn(e),_=s||u||f||m,S=_?Ms(e.length,Fg):[],N=S.length;for(var T in e)(t||xe.call(e,T))&&!(_&&(T=="length"||f&&(T=="offset"||T=="parent")||m&&(T=="buffer"||T=="byteLength"||T=="byteOffset")||Wt(T,N)))&&S.push(T);return S}function Dl(e){var t=e.length;return t?e[Ys(0,t-1)]:r}function Sm(e,t){return Ei(st(e),yn(t,0,e.length))}function jm(e){return Ei(st(e))}function qs(e,t,s){(s!==r&&!Ft(e[t],s)||s===r&&!(t in e))&&Gt(e,t,s)}function Cr(e,t,s){var u=e[t];(!(xe.call(e,t)&&Ft(u,s))||s===r&&!(t in e))&&Gt(e,t,s)}function hi(e,t){for(var s=e.length;s--;)if(Ft(e[s][0],t))return s;return-1}function Cm(e,t,s,u){return an(e,function(f,m,_){t(u,f,s(f),_)}),u}function Tl(e,t){return e&&Pt(t,ze(t),e)}function ym(e,t){return e&&Pt(t,ot(t),e)}function Gt(e,t,s){t=="__proto__"&&ui?ui(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}function $s(e,t){for(var s=-1,u=t.length,f=A(u),m=e==null;++s<u;)f[s]=m?r:ba(e,t[s]);return f}function yn(e,t,s){return e===e&&(s!==r&&(e=e<=s?e:s),t!==r&&(e=e>=t?e:t)),e}function St(e,t,s,u,f,m){var _,S=t&R,N=t&y,T=t&b;if(s&&(_=f?s(e,u,f,m):s(e)),_!==r)return _;if(!Ae(e))return e;var L=ie(e);if(L){if(_=gh(e),!S)return st(e,_)}else{var P=Qe(e),z=P==Kr||P==Oo;if(cn(e))return iu(e,S);if(P==Bt||P==Ln||z&&!f){if(_=N||z?{}:ju(e),!S)return N?nh(e,ym(_,e)):th(e,Tl(_,e))}else{if(!Ce[P])return f?e:{};_=mh(e,P,S)}}m||(m=new It);var K=m.get(e);if(K)return K;m.set(e,_),Zu(e)?e.forEach(function(ne){_.add(St(ne,t,s,ne,e,m))}):Qu(e)&&e.forEach(function(ne,de){_.set(de,St(ne,t,s,de,e,m))});var te=T?N?aa:sa:N?ot:ze,oe=L?r:te(e);return _t(oe||e,function(ne,de){oe&&(de=ne,ne=e[de]),Cr(_,de,St(ne,t,s,de,e,m))}),_}function Nm(e){var t=ze(e);return function(s){return Ll(s,e,t)}}function Ll(e,t,s){var u=s.length;if(e==null)return!u;for(e=we(e);u--;){var f=s[u],m=t[f],_=e[f];if(_===r&&!(f in e)||!m(_))return!1}return!0}function Ol(e,t,s){if(typeof e!="function")throw new bt(d);return Fr(function(){e.apply(r,s)},t)}function yr(e,t,s,u){var f=-1,m=Zr,_=!0,S=e.length,N=[],T=t.length;if(!S)return N;s&&(t=Ee(t,dt(s))),u?(m=Ns,_=!1):t.length>=l&&(m=vr,_=!1,t=new Cn(t));e:for(;++f<S;){var L=e[f],P=s==null?L:s(L);if(L=u||L!==0?L:0,_&&P===P){for(var z=T;z--;)if(t[z]===P)continue e;N.push(L)}else m(t,P,u)||N.push(L)}return N}var an=uu(Ot),Pl=uu(Bs,!0);function Rm(e,t){var s=!0;return an(e,function(u,f,m){return s=!!t(u,f,m),s}),s}function pi(e,t,s){for(var u=-1,f=e.length;++u<f;){var m=e[u],_=t(m);if(_!=null&&(S===r?_===_&&!gt(_):s(_,S)))var S=_,N=m}return N}function Em(e,t,s,u){var f=e.length;for(s=ae(s),s<0&&(s=-s>f?0:f+s),u=u===r||u>f?f:ae(u),u<0&&(u+=f),u=s>u?0:ec(u);s<u;)e[s++]=t;return e}function kl(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=ph),f||(f=[]);++m<_;){var S=e[m];t>0&&s(S)?t>1?Ve(S,t-1,s,u,f):nn(f,S):u||(f[f.length]=S)}return f}var zs=cu(),ql=cu(!0);function Ot(e,t){return e&&zs(e,t,ze)}function Bs(e,t){return e&&ql(e,t,ze)}function xi(e,t){return tn(t,function(s){return Yt(e[s])})}function Nn(e,t){t=ln(t,e);for(var s=0,u=t.length;e!=null&&s<u;)e=e[kt(t[s++])];return s&&s==u?e:r}function $l(e,t,s){var u=t(e);return ie(e)?u:nn(u,s(e))}function et(e){return e==null?e===r?nf:ef:Sn&&Sn in we(e)?ch(e):jh(e)}function Vs(e,t){return e>t}function Am(e,t){return e!=null&&xe.call(e,t)}function Im(e,t){return e!=null&&t in we(e)}function Fm(e,t,s){return e>=Ye(t,s)&&e<$e(t,s)}function Us(e,t,s){for(var u=s?Ns:Zr,f=e[0].length,m=e.length,_=m,S=A(m),N=1/0,T=[];_--;){var L=e[_];_&&t&&(L=Ee(L,dt(t))),N=Ye(L.length,N),S[_]=!s&&(t||f>=120&&L.length>=120)?new Cn(_&&L):r}L=e[0];var P=-1,z=S[0];e:for(;++P<f&&T.length<N;){var K=L[P],te=t?t(K):K;if(K=s||K!==0?K:0,!(z?vr(z,te):u(T,te,s))){for(_=m;--_;){var oe=S[_];if(!(oe?vr(oe,te):u(e[_],te,s)))continue e}z&&z.push(te),T.push(K)}}return T}function Mm(e,t,s,u){return Ot(e,function(f,m,_){t(u,s(f),m,_)}),u}function Nr(e,t,s){t=ln(t,e),e=Ru(e,t);var u=e==null?e:e[kt(Ct(t))];return u==null?r:ct(u,e,s)}function zl(e){return Ie(e)&&et(e)==Ln}function Dm(e){return Ie(e)&&et(e)==xr}function Tm(e){return Ie(e)&&et(e)==fr}function Rr(e,t,s,u,f){return e===t?!0:e==null||t==null||!Ie(e)&&!Ie(t)?e!==e&&t!==t:Lm(e,t,s,u,Rr,f)}function Lm(e,t,s,u,f,m){var _=ie(e),S=ie(t),N=_?Gr:Qe(e),T=S?Gr:Qe(t);N=N==Ln?Bt:N,T=T==Ln?Bt:T;var L=N==Bt,P=T==Bt,z=N==T;if(z&&cn(e)){if(!cn(t))return!1;_=!0,L=!1}if(z&&!L)return m||(m=new It),_||Yn(e)?bu(e,t,s,u,f,m):lh(e,t,N,s,u,f,m);if(!(s&E)){var K=L&&xe.call(e,"__wrapped__"),te=P&&xe.call(t,"__wrapped__");if(K||te){var oe=K?e.value():e,ne=te?t.value():t;return m||(m=new It),f(oe,ne,s,u,m)}}return z?(m||(m=new It),uh(e,t,s,u,f,m)):!1}function Om(e){return Ie(e)&&Qe(e)==Rt}function Gs(e,t,s,u){var f=s.length,m=f,_=!u;if(e==null)return!m;for(e=we(e);f--;){var S=s[f];if(_&&S[2]?S[1]!==e[S[0]]:!(S[0]in e))return!1}for(;++f<m;){S=s[f];var N=S[0],T=e[N],L=S[1];if(_&&S[2]){if(T===r&&!(N in e))return!1}else{var P=new It;if(u)var z=u(T,L,N,e,t,P);if(!(z===r?Rr(L,T,E|j,u,P):z))return!1}}return!0}function Bl(e){if(!Ae(e)||vh(e))return!1;var t=Yt(e)?Og:Nf;return t.test(En(e))}function Pm(e){return Ie(e)&&et(e)==mr}function km(e){return Ie(e)&&Qe(e)==Et}function qm(e){return Ie(e)&&Ti(e.length)&&!!ye[et(e)]}function Vl(e){return typeof e=="function"?e:e==null?lt:typeof e=="object"?ie(e)?Hl(e[0],e[1]):Gl(e):dc(e)}function Hs(e){if(!Ir(e))return Bg(e);var t=[];for(var s in we(e))xe.call(e,s)&&s!="constructor"&&t.push(s);return t}function $m(e){if(!Ae(e))return Sh(e);var t=Ir(e),s=[];for(var u in e)u=="constructor"&&(t||!xe.call(e,u))||s.push(u);return s}function Ks(e,t){return e<t}function Ul(e,t){var s=-1,u=at(e)?A(e.length):[];return an(e,function(f,m,_){u[++s]=t(f,m,_)}),u}function Gl(e){var t=la(e);return t.length==1&&t[0][2]?yu(t[0][0],t[0][1]):function(s){return s===e||Gs(s,e,t)}}function Hl(e,t){return ca(e)&&Cu(t)?yu(kt(e),t):function(s){var u=ba(s,e);return u===r&&u===t?wa(s,e):Rr(t,u,E|j)}}function vi(e,t,s,u,f){e!==t&&zs(t,function(m,_){if(f||(f=new It),Ae(m))zm(e,t,_,s,vi,u,f);else{var S=u?u(fa(e,_),m,_+"",e,t,f):r;S===r&&(S=m),qs(e,_,S)}},ot)}function zm(e,t,s,u,f,m,_){var S=fa(e,s),N=fa(t,s),T=_.get(N);if(T){qs(e,s,T);return}var L=m?m(S,N,s+"",e,t,_):r,P=L===r;if(P){var z=ie(N),K=!z&&cn(N),te=!z&&!K&&Yn(N);L=N,z||K||te?ie(S)?L=S:De(S)?L=st(S):K?(P=!1,L=iu(N,!0)):te?(P=!1,L=su(N,!0)):L=[]:Mr(N)||An(N)?(L=S,An(S)?L=tc(S):(!Ae(S)||Yt(S))&&(L=ju(N))):P=!1}P&&(_.set(N,L),f(L,N,u,m,_),_.delete(N)),qs(e,s,L)}function Kl(e,t){var s=e.length;if(s)return t+=t<0?s:0,Wt(t,s)?e[t]:r}function Wl(e,t,s){t.length?t=Ee(t,function(m){return ie(m)?function(_){return Nn(_,m.length===1?m[0]:m)}:m}):t=[lt];var u=-1;t=Ee(t,dt(X()));var f=Ul(e,function(m,_,S){var N=Ee(t,function(T){return T(m)});return{criteria:N,index:++u,value:m}});return mg(f,function(m,_){return eh(m,_,s)})}function Bm(e,t){return Yl(e,t,function(s,u){return wa(e,u)})}function Yl(e,t,s){for(var u=-1,f=t.length,m={};++u<f;){var _=t[u],S=Nn(e,_);s(S,_)&&Er(m,ln(_,e),S)}return m}function Vm(e){return function(t){return Nn(t,e)}}function Ws(e,t,s,u){var f=u?gg:kn,m=-1,_=t.length,S=e;for(e===t&&(t=st(t)),s&&(S=Ee(e,dt(s)));++m<_;)for(var N=0,T=t[m],L=s?s(T):T;(N=f(S,L,N,u))>-1;)S!==e&&li.call(S,N,1),li.call(e,N,1);return e}function Ql(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)?li.call(e,f,1):Zs(e,f)}}return e}function Ys(e,t){return e+di(Il()*(t-e+1))}function Um(e,t,s,u){for(var f=-1,m=$e(ci((t-e)/(s||1)),0),_=A(m);m--;)_[u?m:++f]=e,e+=s;return _}function Qs(e,t){var s="";if(!e||t<1||t>U)return s;do t%2&&(s+=e),t=di(t/2),t&&(e+=e);while(t);return s}function ue(e,t){return ga(Nu(e,t,lt),e+"")}function Gm(e){return Dl(Qn(e))}function Hm(e,t){var s=Qn(e);return Ei(s,yn(t,0,s.length))}function Er(e,t,s,u){if(!Ae(e))return e;t=ln(t,e);for(var f=-1,m=t.length,_=m-1,S=e;S!=null&&++f<m;){var N=kt(t[f]),T=s;if(N==="__proto__"||N==="constructor"||N==="prototype")return e;if(f!=_){var L=S[N];T=u?u(L,N,S):r,T===r&&(T=Ae(L)?L:Wt(t[f+1])?[]:{})}Cr(S,N,T),S=S[N]}return e}var Xl=fi?function(e,t){return fi.set(e,t),e}:lt,Km=ui?function(e,t){return ui(e,"toString",{configurable:!0,enumerable:!1,value:ja(t),writable:!0})}:lt;function Wm(e){return Ei(Qn(e))}function jt(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 Ym(e,t){var s;return an(e,function(u,f,m){return s=t(u,f,m),!s}),!!s}function _i(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 Xs(e,t,lt,s)}function Xs(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,S=t===null,N=gt(t),T=t===r;f<m;){var L=di((f+m)/2),P=s(e[L]),z=P!==r,K=P===null,te=P===P,oe=gt(P);if(_)var ne=u||te;else T?ne=te&&(u||z):S?ne=te&&z&&(u||!K):N?ne=te&&z&&!K&&(u||!oe):K||oe?ne=!1:ne=u?P<=t:P<t;ne?f=L+1:m=L}return Ye(m,bn)}function Zl(e,t){for(var s=-1,u=e.length,f=0,m=[];++s<u;){var _=e[s],S=t?t(_):_;if(!s||!Ft(S,N)){var N=S;m[f++]=_===0?0:_}}return m}function Jl(e){return typeof e=="number"?e:gt(e)?Je:+e}function ft(e){if(typeof e=="string")return e;if(ie(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=Zr,m=e.length,_=!0,S=[],N=S;if(s)_=!1,f=Ns;else if(m>=l){var T=t?null:ah(e);if(T)return ei(T);_=!1,f=vr,N=new Cn}else N=t?[]:S;e:for(;++u<m;){var L=e[u],P=t?t(L):L;if(L=s||L!==0?L:0,_&&P===P){for(var z=N.length;z--;)if(N[z]===P)continue e;t&&N.push(P),S.push(L)}else f(N,P,s)||(N!==S&&N.push(P),S.push(L))}return S}function Zs(e,t){return t=ln(t,e),e=Ru(e,t),e==null||delete e[kt(Ct(t))]}function eu(e,t,s,u){return Er(e,t,s(Nn(e,t)),u)}function bi(e,t,s,u){for(var f=e.length,m=u?f:-1;(u?m--:++m<f)&&t(e[m],m,e););return s?jt(e,u?0:m,u?m+1:f):jt(e,u?m+1:0,u?f:m)}function tu(e,t){var s=e;return s instanceof fe&&(s=s.value()),Rs(t,function(u,f){return f.func.apply(f.thisArg,nn([u],f.args))},s)}function Js(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],S=-1;++S<u;)S!=f&&(m[f]=yr(m[f]||_,e[S],t,s));return on(Ve(m,1),t,s)}function nu(e,t,s){for(var u=-1,f=e.length,m=t.length,_={};++u<f;){var S=u<m?t[u]:r;s(_,e[u],S)}return _}function ea(e){return De(e)?e:[]}function ta(e){return typeof e=="function"?e:lt}function ln(e,t){return ie(e)?e:ca(e,t)?[e]:Fu(pe(e))}var Qm=ue;function un(e,t,s){var u=e.length;return s=s===r?u:s,!t&&s>=u?e:jt(e,t,s)}var ru=Pg||function(e){return Be.clearTimeout(e)};function iu(e,t){if(t)return e.slice();var s=e.length,u=yl?yl(s):new e.constructor(s);return e.copy(u),u}function na(e){var t=new e.constructor(e.byteLength);return new ai(t).set(new ai(e)),t}function Xm(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function Zm(e){var t=new e.constructor(e.source,zo.exec(e));return t.lastIndex=e.lastIndex,t}function Jm(e){return jr?we(jr.call(e)):{}}function su(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function au(e,t){if(e!==t){var s=e!==r,u=e===null,f=e===e,m=gt(e),_=t!==r,S=t===null,N=t===t,T=gt(t);if(!S&&!T&&!m&&e>t||m&&_&&N&&!S&&!T||u&&_&&N||!s&&N||!f)return 1;if(!u&&!m&&!T&&e<t||T&&s&&f&&!u&&!m||S&&s&&f||!_&&f||!N)return-1}return 0}function eh(e,t,s){for(var u=-1,f=e.criteria,m=t.criteria,_=f.length,S=s.length;++u<_;){var N=au(f[u],m[u]);if(N){if(u>=S)return N;var T=s[u];return N*(T=="desc"?-1:1)}}return e.index-t.index}function ou(e,t,s,u){for(var f=-1,m=e.length,_=s.length,S=-1,N=t.length,T=$e(m-_,0),L=A(N+T),P=!u;++S<N;)L[S]=t[S];for(;++f<_;)(P||f<m)&&(L[s[f]]=e[f]);for(;T--;)L[S++]=e[f++];return L}function lu(e,t,s,u){for(var f=-1,m=e.length,_=-1,S=s.length,N=-1,T=t.length,L=$e(m-S,0),P=A(L+T),z=!u;++f<L;)P[f]=e[f];for(var K=f;++N<T;)P[K+N]=t[N];for(;++_<S;)(z||f<m)&&(P[K+s[_]]=e[f++]);return P}function st(e,t){var s=-1,u=e.length;for(t||(t=A(u));++s<u;)t[s]=e[s];return t}function Pt(e,t,s,u){var f=!s;s||(s={});for(var m=-1,_=t.length;++m<_;){var S=t[m],N=u?u(s[S],e[S],S,s,e):r;N===r&&(N=e[S]),f?Gt(s,S,N):Cr(s,S,N)}return s}function th(e,t){return Pt(e,ua(e),t)}function nh(e,t){return Pt(e,wu(e),t)}function wi(e,t){return function(s,u){var f=ie(s)?og:Cm,m=t?t():{};return f(s,e,X(u,2),m)}}function Hn(e){return ue(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,_&&tt(s[0],s[1],_)&&(m=f<3?r:m,f=1),t=we(t);++u<f;){var S=s[u];S&&e(t,S,u,m)}return t})}function uu(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,_=we(s);(t?m--:++m<f)&&u(_[m],m,_)!==!1;);return s}}function cu(e){return function(t,s,u){for(var f=-1,m=we(t),_=u(t),S=_.length;S--;){var N=_[e?S:++f];if(s(m[N],N,m)===!1)break}return t}}function rh(e,t,s){var u=t&D,f=Ar(e);function m(){var _=this&&this!==Be&&this instanceof m?f:e;return _.apply(u?s:this,arguments)}return m}function du(e){return function(t){t=pe(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 Rs(uc(lc(t).replace(Kf,"")),e,"")}}function Ar(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 ih(e,t,s){var u=Ar(e);function f(){for(var m=arguments.length,_=A(m),S=m,N=Wn(f);S--;)_[S]=arguments[S];var T=m<3&&_[0]!==N&&_[m-1]!==N?[]:rn(_,N);if(m-=T.length,m<s)return pu(e,t,Si,f.placeholder,r,_,T,r,r,s-m);var L=this&&this!==Be&&this instanceof f?u:e;return ct(L,this,_)}return f}function fu(e){return function(t,s,u){var f=we(t);if(!at(t)){var m=X(s,3);t=ze(t),s=function(S){return m(f[S],S,f)}}var _=e(t,s,u);return _>-1?f[m?t[_]:_]:r}}function gu(e){return Kt(function(t){var s=t.length,u=s,f=wt.prototype.thru;for(e&&t.reverse();u--;){var m=t[u];if(typeof m!="function")throw new bt(d);if(f&&!_&&Ni(m)=="wrapper")var _=new wt([],!0)}for(u=_?u:s;++u<s;){m=t[u];var S=Ni(m),N=S=="wrapper"?oa(m):r;N&&da(N[0])&&N[1]==(H|$|O|W)&&!N[4].length&&N[9]==1?_=_[Ni(N[0])].apply(_,N[3]):_=m.length==1&&da(m)?_[S]():_.thru(m)}return function(){var T=arguments,L=T[0];if(_&&T.length==1&&ie(L))return _.plant(L).value();for(var P=0,z=s?t[P].apply(this,T):L;++P<s;)z=t[P].call(this,z);return z}})}function Si(e,t,s,u,f,m,_,S,N,T){var L=t&H,P=t&D,z=t&F,K=t&($|Q),te=t&B,oe=z?r:Ar(e);function ne(){for(var de=arguments.length,ge=A(de),mt=de;mt--;)ge[mt]=arguments[mt];if(K)var nt=Wn(ne),ht=pg(ge,nt);if(u&&(ge=ou(ge,u,f,K)),m&&(ge=lu(ge,m,_,K)),de-=ht,K&&de<T){var Te=rn(ge,nt);return pu(e,t,Si,ne.placeholder,s,ge,Te,S,N,T-de)}var Mt=P?s:this,Xt=z?Mt[e]:e;return de=ge.length,S?ge=Ch(ge,S):te&&de>1&&ge.reverse(),L&&N<de&&(ge.length=N),this&&this!==Be&&this instanceof ne&&(Xt=oe||Ar(Xt)),Xt.apply(Mt,ge)}return ne}function mu(e,t){return function(s,u){return Mm(s,e,t(u),{})}}function ji(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=Jl(s),u=Jl(u)),f=e(s,u)}return f}}function ra(e){return Kt(function(t){return t=Ee(t,dt(X())),ue(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?Qs(t,e):t;var u=Qs(t,ci(e/$n(t)));return qn(t)?un(At(u),0,e).join(""):u.slice(0,e)}function sh(e,t,s,u){var f=t&D,m=Ar(e);function _(){for(var S=-1,N=arguments.length,T=-1,L=u.length,P=A(L+N),z=this&&this!==Be&&this instanceof _?m:e;++T<L;)P[T]=u[T];for(;N--;)P[T++]=arguments[++S];return ct(z,f?s:this,P)}return _}function hu(e){return function(t,s,u){return u&&typeof u!="number"&&tt(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),Um(t,s,u,e)}}function yi(e){return function(t,s){return typeof t=="string"&&typeof s=="string"||(t=yt(t),s=yt(s)),e(t,s)}}function pu(e,t,s,u,f,m,_,S,N,T){var L=t&$,P=L?_:r,z=L?r:_,K=L?m:r,te=L?r:m;t|=L?O:k,t&=~(L?k:O),t&q||(t&=-4);var oe=[e,t,f,K,P,te,z,S,N,T],ne=s.apply(r,oe);return da(e)&&Eu(ne,oe),ne.placeholder=u,Au(ne,e,t)}function ia(e){var t=qe[e];return function(s,u){if(s=yt(s),u=u==null?0:Ye(ae(u),292),u&&Al(s)){var f=(pe(s)+"e").split("e"),m=t(f[0]+"e"+(+f[1]+u));return f=(pe(m)+"e").split("e"),+(f[0]+"e"+(+f[1]-u))}return t(s)}}var ah=Vn&&1/ei(new Vn([,-0]))[1]==Me?function(e){return new Vn(e)}:Na;function xu(e){return function(t){var s=Qe(t);return s==Rt?Ts(t):s==Et?jg(t):hg(t,e(t))}}function Ht(e,t,s,u,f,m,_,S){var N=t&F;if(!N&&typeof e!="function")throw new bt(d);var T=u?u.length:0;if(T||(t&=-97,u=f=r),_=_===r?_:$e(ae(_),0),S=S===r?S:ae(S),T-=f?f.length:0,t&k){var L=u,P=f;u=f=r}var z=N?r:oa(e),K=[e,t,s,u,f,L,P,m,_,S];if(z&&wh(K,z),e=K[0],t=K[1],s=K[2],u=K[3],f=K[4],S=K[9]=K[9]===r?N?0:e.length:$e(K[9]-T,0),!S&&t&($|Q)&&(t&=-25),!t||t==D)var te=rh(e,t,s);else t==$||t==Q?te=ih(e,t,S):(t==O||t==(D|O))&&!f.length?te=sh(e,t,s,u):te=Si.apply(r,K);var oe=z?Xl:Eu;return Au(oe(te,K),e,t)}function vu(e,t,s,u){return e===r||Ft(e,Bn[s])&&!xe.call(u,s)?t:e}function _u(e,t,s,u,f,m){return Ae(e)&&Ae(t)&&(m.set(t,e),vi(e,t,r,_u,m),m.delete(t)),e}function oh(e){return Mr(e)?r:e}function bu(e,t,s,u,f,m){var _=s&E,S=e.length,N=t.length;if(S!=N&&!(_&&N>S))return!1;var T=m.get(e),L=m.get(t);if(T&&L)return T==t&&L==e;var P=-1,z=!0,K=s&j?new Cn:r;for(m.set(e,t),m.set(t,e);++P<S;){var te=e[P],oe=t[P];if(u)var ne=_?u(oe,te,P,t,e,m):u(te,oe,P,e,t,m);if(ne!==r){if(ne)continue;z=!1;break}if(K){if(!Es(t,function(de,ge){if(!vr(K,ge)&&(te===de||f(te,de,s,u,m)))return K.push(ge)})){z=!1;break}}else if(!(te===oe||f(te,oe,s,u,m))){z=!1;break}}return m.delete(e),m.delete(t),z}function lh(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 xr:return!(e.byteLength!=t.byteLength||!m(new ai(e),new ai(t)));case dr:case fr:case gr:return Ft(+e,+t);case Hr:return e.name==t.name&&e.message==t.message;case mr:case hr:return e==t+"";case Rt:var S=Ts;case Et:var N=u&E;if(S||(S=ei),e.size!=t.size&&!N)return!1;var T=_.get(e);if(T)return T==t;u|=j,_.set(e,t);var L=bu(S(e),S(t),u,f,m,_);return _.delete(e),L;case Wr:if(jr)return jr.call(e)==jr.call(t)}return!1}function uh(e,t,s,u,f,m){var _=s&E,S=sa(e),N=S.length,T=sa(t),L=T.length;if(N!=L&&!_)return!1;for(var P=N;P--;){var z=S[P];if(!(_?z in t:xe.call(t,z)))return!1}var K=m.get(e),te=m.get(t);if(K&&te)return K==t&&te==e;var oe=!0;m.set(e,t),m.set(t,e);for(var ne=_;++P<N;){z=S[P];var de=e[z],ge=t[z];if(u)var mt=_?u(ge,de,z,t,e,m):u(de,ge,z,e,t,m);if(!(mt===r?de===ge||f(de,ge,s,u,m):mt)){oe=!1;break}ne||(ne=z=="constructor")}if(oe&&!ne){var nt=e.constructor,ht=t.constructor;nt!=ht&&"constructor"in e&&"constructor"in t&&!(typeof nt=="function"&&nt instanceof nt&&typeof ht=="function"&&ht instanceof ht)&&(oe=!1)}return m.delete(e),m.delete(t),oe}function Kt(e){return ga(Nu(e,r,Lu),e+"")}function sa(e){return $l(e,ze,ua)}function aa(e){return $l(e,ot,wu)}var oa=fi?function(e){return fi.get(e)}:Na;function Ni(e){for(var t=e.name+"",s=Un[t],u=xe.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=xe.call(g,"placeholder")?g:e;return t.placeholder}function X(){var e=g.iteratee||Ca;return e=e===Ca?Vl:e,arguments.length?e(arguments[0],arguments[1]):e}function Ri(e,t){var s=e.__data__;return xh(t)?s[typeof t=="string"?"string":"hash"]:s.map}function la(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 Rn(e,t){var s=bg(e,t);return Bl(s)?s:r}function ch(e){var t=xe.call(e,Sn),s=e[Sn];try{e[Sn]=r;var u=!0}catch{}var f=ii.call(e);return u&&(t?e[Sn]=s:delete e[Sn]),f}var ua=Os?function(e){return e==null?[]:(e=we(e),tn(Os(e),function(t){return Rl.call(e,t)}))}:Ra,wu=Os?function(e){for(var t=[];e;)nn(t,ua(e)),e=oi(e);return t}:Ra,Qe=et;(Ps&&Qe(new Ps(new ArrayBuffer(1)))!=On||br&&Qe(new br)!=Rt||ks&&Qe(ks.resolve())!=Po||Vn&&Qe(new Vn)!=Et||wr&&Qe(new wr)!=pr)&&(Qe=function(e){var t=et(e),s=t==Bt?e.constructor:r,u=s?En(s):"";if(u)switch(u){case Hg:return On;case Kg:return Rt;case Wg:return Po;case Yg:return Et;case Qg:return pr}return t});function dh(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=Ye(t,e+_);break;case"takeRight":e=$e(e,t-_);break}}return{start:e,end:t}}function fh(e){var t=e.match(vf);return t?t[1].split(_f):[]}function Su(e,t,s){t=ln(t,e);for(var u=-1,f=t.length,m=!1;++u<f;){var _=kt(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)&&(ie(e)||An(e)))}function gh(e){var t=e.length,s=new e.constructor(t);return t&&typeof e[0]=="string"&&xe.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function ju(e){return typeof e.constructor=="function"&&!Ir(e)?Gn(oi(e)):{}}function mh(e,t,s){var u=e.constructor;switch(t){case xr:return na(e);case dr:case fr:return new u(+e);case On:return Xm(e,s);case ls:case us:case cs:case ds:case fs:case gs:case ms:case hs:case ps:return su(e,s);case Rt:return new u;case gr:case hr:return new u(e);case mr:return Zm(e);case Et:return new u;case Wr:return Jm(e)}}function hh(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(xf,`{
|
||
/* [wrapped with `+t+`] */
|
||
`)}function ph(e){return ie(e)||An(e)||!!(El&&e&&e[El])}function Wt(e,t){var s=typeof e;return t=t??U,!!t&&(s=="number"||s!="symbol"&&Ef.test(e))&&e>-1&&e%1==0&&e<t}function tt(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)?Ft(s[t],e):!1}function ca(e,t){if(ie(e))return!1;var s=typeof e;return s=="number"||s=="symbol"||s=="boolean"||e==null||gt(e)?!0:gf.test(e)||!ff.test(e)||t!=null&&e in we(t)}function xh(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function da(e){var t=Ni(e),s=g[t];if(typeof s!="function"||!(t in fe.prototype))return!1;if(e===s)return!0;var u=oa(s);return!!u&&e===u[0]}function vh(e){return!!Cl&&Cl in e}var _h=ni?Yt:Ea;function Ir(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 yu(e,t){return function(s){return s==null?!1:s[e]===t&&(t!==r||e in we(s))}}function bh(e){var t=Mi(e,function(u){return s.size===x&&s.clear(),u}),s=t.cache;return t}function wh(e,t){var s=e[1],u=t[1],f=s|u,m=f<(D|F|H),_=u==H&&s==$||u==H&&s==W&&e[7].length<=t[8]||u==(H|W)&&t[7].length<=t[8]&&s==$;if(!(m||_))return e;u&D&&(e[2]=t[2],f|=s&D?0:q);var S=t[3];if(S){var N=e[3];e[3]=N?ou(N,S,t[4]):S,e[4]=N?rn(e[3],v):t[4]}return S=t[5],S&&(N=e[5],e[5]=N?lu(N,S,t[6]):S,e[6]=N?rn(e[5],v):t[6]),S=t[7],S&&(e[7]=S),u&H&&(e[8]=e[8]==null?t[8]:Ye(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=f,e}function Sh(e){var t=[];if(e!=null)for(var s in we(e))t.push(s);return t}function jh(e){return ii.call(e)}function Nu(e,t,s){return t=$e(t===r?e.length-1:t,0),function(){for(var u=arguments,f=-1,m=$e(u.length-t,0),_=A(m);++f<m;)_[f]=u[t+f];f=-1;for(var S=A(t+1);++f<t;)S[f]=u[f];return S[t]=s(_),ct(e,this,S)}}function Ru(e,t){return t.length<2?e:Nn(e,jt(t,0,-1))}function Ch(e,t){for(var s=e.length,u=Ye(t.length,s),f=st(e);u--;){var m=t[u];e[u]=Wt(m,s)?f[m]:r}return e}function fa(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Eu=Iu(Xl),Fr=qg||function(e,t){return Be.setTimeout(e,t)},ga=Iu(Km);function Au(e,t,s){var u=t+"";return ga(e,hh(u,yh(fh(u),s)))}function Iu(e){var t=0,s=0;return function(){var u=Vg(),f=Re-(u-s);if(s=u,f>0){if(++t>=Y)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ei(e,t){var s=-1,u=e.length,f=u-1;for(t=t===r?u:t;++s<t;){var m=Ys(s,f),_=e[m];e[m]=e[s],e[s]=_}return e.length=t,e}var Fu=bh(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(mf,function(s,u,f,m){t.push(f?m.replace(Sf,"$1"):u||s)}),t});function kt(e){if(typeof e=="string"||gt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function En(e){if(e!=null){try{return ri.call(e)}catch{}try{return e+""}catch{}}return""}function yh(e,t){return _t(Xd,function(s){var u="_."+s[0];t&s[1]&&!Zr(e,u)&&e.push(u)}),e.sort()}function Mu(e){if(e instanceof fe)return e.clone();var t=new wt(e.__wrapped__,e.__chain__);return t.__actions__=st(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Nh(e,t,s){(s?tt(e,t,s):t===r)?t=1:t=$e(ae(t),0);var u=e==null?0:e.length;if(!u||t<1)return[];for(var f=0,m=0,_=A(ci(u/t));f<u;)_[m++]=jt(e,f,f+=t);return _}function Rh(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 Eh(){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(ie(s)?st(s):[s],Ve(t,1))}var Ah=ue(function(e,t){return De(e)?yr(e,Ve(t,1,De,!0)):[]}),Ih=ue(function(e,t){var s=Ct(t);return De(s)&&(s=r),De(e)?yr(e,Ve(t,1,De,!0),X(s,2)):[]}),Fh=ue(function(e,t){var s=Ct(t);return De(s)&&(s=r),De(e)?yr(e,Ve(t,1,De,!0),r,s):[]});function Mh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ae(t),jt(e,t<0?0:t,u)):[]}function Dh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ae(t),t=u-t,jt(e,0,t<0?0:t)):[]}function Th(e,t){return e&&e.length?bi(e,X(t,3),!0,!0):[]}function Lh(e,t){return e&&e.length?bi(e,X(t,3),!0):[]}function Oh(e,t,s,u){var f=e==null?0:e.length;return f?(s&&typeof s!="number"&&tt(e,t,s)&&(s=0,u=f),Em(e,t,s,u)):[]}function Du(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:ae(s);return f<0&&(f=$e(u+f,0)),Jr(e,X(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=ae(s),f=s<0?$e(u+f,0):Ye(f,u-1)),Jr(e,X(t,3),f,!0)}function Lu(e){var t=e==null?0:e.length;return t?Ve(e,1):[]}function Ph(e){var t=e==null?0:e.length;return t?Ve(e,Me):[]}function kh(e,t){var s=e==null?0:e.length;return s?(t=t===r?1:ae(t),Ve(e,t)):[]}function qh(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 Ou(e){return e&&e.length?e[0]:r}function $h(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:ae(s);return f<0&&(f=$e(u+f,0)),kn(e,t,f)}function zh(e){var t=e==null?0:e.length;return t?jt(e,0,-1):[]}var Bh=ue(function(e){var t=Ee(e,ea);return t.length&&t[0]===e[0]?Us(t):[]}),Vh=ue(function(e){var t=Ct(e),s=Ee(e,ea);return t===Ct(s)?t=r:s.pop(),s.length&&s[0]===e[0]?Us(s,X(t,2)):[]}),Uh=ue(function(e){var t=Ct(e),s=Ee(e,ea);return t=typeof t=="function"?t:r,t&&s.pop(),s.length&&s[0]===e[0]?Us(s,r,t):[]});function Gh(e,t){return e==null?"":zg.call(e,t)}function Ct(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Hh(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=u;return s!==r&&(f=ae(s),f=f<0?$e(u+f,0):Ye(f,u-1)),t===t?yg(e,t,f):Jr(e,pl,f,!0)}function Kh(e,t){return e&&e.length?Kl(e,ae(t)):r}var Wh=ue(Pu);function Pu(e,t){return e&&e.length&&t&&t.length?Ws(e,t):e}function Yh(e,t,s){return e&&e.length&&t&&t.length?Ws(e,t,X(s,2)):e}function Qh(e,t,s){return e&&e.length&&t&&t.length?Ws(e,t,r,s):e}var Xh=Kt(function(e,t){var s=e==null?0:e.length,u=$s(e,t);return Ql(e,Ee(t,function(f){return Wt(f,s)?+f:f}).sort(au)),u});function Zh(e,t){var s=[];if(!(e&&e.length))return s;var u=-1,f=[],m=e.length;for(t=X(t,3);++u<m;){var _=e[u];t(_,u,e)&&(s.push(_),f.push(u))}return Ql(e,f),s}function ma(e){return e==null?e:Gg.call(e)}function Jh(e,t,s){var u=e==null?0:e.length;return u?(s&&typeof s!="number"&&tt(e,t,s)?(t=0,s=u):(t=t==null?0:ae(t),s=s===r?u:ae(s)),jt(e,t,s)):[]}function ep(e,t){return _i(e,t)}function tp(e,t,s){return Xs(e,t,X(s,2))}function np(e,t){var s=e==null?0:e.length;if(s){var u=_i(e,t);if(u<s&&Ft(e[u],t))return u}return-1}function rp(e,t){return _i(e,t,!0)}function ip(e,t,s){return Xs(e,t,X(s,2),!0)}function sp(e,t){var s=e==null?0:e.length;if(s){var u=_i(e,t,!0)-1;if(Ft(e[u],t))return u}return-1}function ap(e){return e&&e.length?Zl(e):[]}function op(e,t){return e&&e.length?Zl(e,X(t,2)):[]}function lp(e){var t=e==null?0:e.length;return t?jt(e,1,t):[]}function up(e,t,s){return e&&e.length?(t=s||t===r?1:ae(t),jt(e,0,t<0?0:t)):[]}function cp(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ae(t),t=u-t,jt(e,t<0?0:t,u)):[]}function dp(e,t){return e&&e.length?bi(e,X(t,3),!1,!0):[]}function fp(e,t){return e&&e.length?bi(e,X(t,3)):[]}var gp=ue(function(e){return on(Ve(e,1,De,!0))}),mp=ue(function(e){var t=Ct(e);return De(t)&&(t=r),on(Ve(e,1,De,!0),X(t,2))}),hp=ue(function(e){var t=Ct(e);return t=typeof t=="function"?t:r,on(Ve(e,1,De,!0),r,t)});function pp(e){return e&&e.length?on(e):[]}function xp(e,t){return e&&e.length?on(e,X(t,2)):[]}function vp(e,t){return t=typeof t=="function"?t:r,e&&e.length?on(e,r,t):[]}function ha(e){if(!(e&&e.length))return[];var t=0;return e=tn(e,function(s){if(De(s))return t=$e(s.length,t),!0}),Ms(t,function(s){return Ee(e,As(s))})}function ku(e,t){if(!(e&&e.length))return[];var s=ha(e);return t==null?s:Ee(s,function(u){return ct(t,r,u)})}var _p=ue(function(e,t){return De(e)?yr(e,t):[]}),bp=ue(function(e){return Js(tn(e,De))}),wp=ue(function(e){var t=Ct(e);return De(t)&&(t=r),Js(tn(e,De),X(t,2))}),Sp=ue(function(e){var t=Ct(e);return t=typeof t=="function"?t:r,Js(tn(e,De),r,t)}),jp=ue(ha);function Cp(e,t){return nu(e||[],t||[],Cr)}function yp(e,t){return nu(e||[],t||[],Er)}var Np=ue(function(e){var t=e.length,s=t>1?e[t-1]:r;return s=typeof s=="function"?(e.pop(),s):r,ku(e,s)});function qu(e){var t=g(e);return t.__chain__=!0,t}function Rp(e,t){return t(e),e}function Ai(e,t){return t(e)}var Ep=Kt(function(e){var t=e.length,s=t?e[0]:0,u=this.__wrapped__,f=function(m){return $s(m,e)};return t>1||this.__actions__.length||!(u instanceof fe)||!Wt(s)?this.thru(f):(u=u.slice(s,+s+(t?1:0)),u.__actions__.push({func:Ai,args:[f],thisArg:r}),new wt(u,this.__chain__).thru(function(m){return t&&!m.length&&m.push(r),m}))});function Ap(){return qu(this)}function Ip(){return new wt(this.value(),this.__chain__)}function Fp(){this.__values__===r&&(this.__values__=Ju(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function Mp(){return this}function Dp(e){for(var t,s=this;s instanceof mi;){var u=Mu(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 Tp(){var e=this.__wrapped__;if(e instanceof fe){var t=e;return this.__actions__.length&&(t=new fe(this)),t=t.reverse(),t.__actions__.push({func:Ai,args:[ma],thisArg:r}),new wt(t,this.__chain__)}return this.thru(ma)}function Lp(){return tu(this.__wrapped__,this.__actions__)}var Op=wi(function(e,t,s){xe.call(e,s)?++e[s]:Gt(e,s,1)});function Pp(e,t,s){var u=ie(e)?ml:Rm;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}function kp(e,t){var s=ie(e)?tn:kl;return s(e,X(t,3))}var qp=fu(Du),$p=fu(Tu);function zp(e,t){return Ve(Ii(e,t),1)}function Bp(e,t){return Ve(Ii(e,t),Me)}function Vp(e,t,s){return s=s===r?1:ae(s),Ve(Ii(e,t),s)}function $u(e,t){var s=ie(e)?_t:an;return s(e,X(t,3))}function zu(e,t){var s=ie(e)?lg:Pl;return s(e,X(t,3))}var Up=wi(function(e,t,s){xe.call(e,s)?e[s].push(t):Gt(e,s,[t])});function Gp(e,t,s,u){e=at(e)?e:Qn(e),s=s&&!u?ae(s):0;var f=e.length;return s<0&&(s=$e(f+s,0)),Li(e)?s<=f&&e.indexOf(t,s)>-1:!!f&&kn(e,t,s)>-1}var Hp=ue(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):Nr(_,t,s)}),m}),Kp=wi(function(e,t,s){Gt(e,s,t)});function Ii(e,t){var s=ie(e)?Ee:Ul;return s(e,X(t,3))}function Wp(e,t,s,u){return e==null?[]:(ie(t)||(t=t==null?[]:[t]),s=u?r:s,ie(s)||(s=s==null?[]:[s]),Wl(e,t,s))}var Yp=wi(function(e,t,s){e[s?0:1].push(t)},function(){return[[],[]]});function Qp(e,t,s){var u=ie(e)?Rs:vl,f=arguments.length<3;return u(e,X(t,4),s,f,an)}function Xp(e,t,s){var u=ie(e)?ug:vl,f=arguments.length<3;return u(e,X(t,4),s,f,Pl)}function Zp(e,t){var s=ie(e)?tn:kl;return s(e,Di(X(t,3)))}function Jp(e){var t=ie(e)?Dl:Gm;return t(e)}function ex(e,t,s){(s?tt(e,t,s):t===r)?t=1:t=ae(t);var u=ie(e)?Sm:Hm;return u(e,t)}function tx(e){var t=ie(e)?jm:Wm;return t(e)}function nx(e){if(e==null)return 0;if(at(e))return Li(e)?$n(e):e.length;var t=Qe(e);return t==Rt||t==Et?e.size:Hs(e).length}function rx(e,t,s){var u=ie(e)?Es:Ym;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}var ix=ue(function(e,t){if(e==null)return[];var s=t.length;return s>1&&tt(e,t[0],t[1])?t=[]:s>2&&tt(t[0],t[1],t[2])&&(t=[t[0]]),Wl(e,Ve(t,1),[])}),Fi=kg||function(){return Be.Date.now()};function sx(e,t){if(typeof t!="function")throw new bt(d);return e=ae(e),function(){if(--e<1)return t.apply(this,arguments)}}function Bu(e,t,s){return t=s?r:t,t=e&&t==null?e.length:t,Ht(e,H,r,r,r,r,t)}function Vu(e,t){var s;if(typeof t!="function")throw new bt(d);return e=ae(e),function(){return--e>0&&(s=t.apply(this,arguments)),e<=1&&(t=r),s}}var pa=ue(function(e,t,s){var u=D;if(s.length){var f=rn(s,Wn(pa));u|=O}return Ht(e,u,t,s,f)}),Uu=ue(function(e,t,s){var u=D|F;if(s.length){var f=rn(s,Wn(Uu));u|=O}return Ht(t,u,e,s,f)});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){t=s?r:t;var u=Ht(e,Q,r,r,r,r,r,t);return u.placeholder=Hu.placeholder,u}function Ku(e,t,s){var u,f,m,_,S,N,T=0,L=!1,P=!1,z=!0;if(typeof e!="function")throw new bt(d);t=yt(t)||0,Ae(s)&&(L=!!s.leading,P="maxWait"in s,m=P?$e(yt(s.maxWait)||0,t):m,z="trailing"in s?!!s.trailing:z);function K(Te){var Mt=u,Xt=f;return u=f=r,T=Te,_=e.apply(Xt,Mt),_}function te(Te){return T=Te,S=Fr(de,t),L?K(Te):_}function oe(Te){var Mt=Te-N,Xt=Te-T,fc=t-Mt;return P?Ye(fc,m-Xt):fc}function ne(Te){var Mt=Te-N,Xt=Te-T;return N===r||Mt>=t||Mt<0||P&&Xt>=m}function de(){var Te=Fi();if(ne(Te))return ge(Te);S=Fr(de,oe(Te))}function ge(Te){return S=r,z&&u?K(Te):(u=f=r,_)}function mt(){S!==r&&ru(S),T=0,u=N=f=S=r}function nt(){return S===r?_:ge(Fi())}function ht(){var Te=Fi(),Mt=ne(Te);if(u=arguments,f=this,N=Te,Mt){if(S===r)return te(N);if(P)return ru(S),S=Fr(de,t),K(N)}return S===r&&(S=Fr(de,t)),_}return ht.cancel=mt,ht.flush=nt,ht}var ax=ue(function(e,t){return Ol(e,1,t)}),ox=ue(function(e,t,s){return Ol(e,yt(t)||0,s)});function lx(e){return Ht(e,B)}function Mi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new bt(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(Mi.Cache||Ut),s}Mi.Cache=Ut;function Di(e){if(typeof e!="function")throw new bt(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 ux(e){return Vu(2,e)}var cx=Qm(function(e,t){t=t.length==1&&ie(t[0])?Ee(t[0],dt(X())):Ee(Ve(t,1),dt(X()));var s=t.length;return ue(function(u){for(var f=-1,m=Ye(u.length,s);++f<m;)u[f]=t[f].call(this,u[f]);return ct(e,this,u)})}),xa=ue(function(e,t){var s=rn(t,Wn(xa));return Ht(e,O,r,t,s)}),Wu=ue(function(e,t){var s=rn(t,Wn(Wu));return Ht(e,k,r,t,s)}),dx=Kt(function(e,t){return Ht(e,W,r,r,r,t)});function fx(e,t){if(typeof e!="function")throw new bt(d);return t=t===r?t:ae(t),ue(e,t)}function gx(e,t){if(typeof e!="function")throw new bt(d);return t=t==null?0:$e(ae(t),0),ue(function(s){var u=s[t],f=un(s,0,t);return u&&nn(f,u),ct(e,this,f)})}function mx(e,t,s){var u=!0,f=!0;if(typeof e!="function")throw new bt(d);return Ae(s)&&(u="leading"in s?!!s.leading:u,f="trailing"in s?!!s.trailing:f),Ku(e,t,{leading:u,maxWait:t,trailing:f})}function hx(e){return Bu(e,1)}function px(e,t){return xa(ta(t),e)}function xx(){if(!arguments.length)return[];var e=arguments[0];return ie(e)?e:[e]}function vx(e){return St(e,b)}function _x(e,t){return t=typeof t=="function"?t:r,St(e,b,t)}function bx(e){return St(e,R|b)}function wx(e,t){return t=typeof t=="function"?t:r,St(e,R|b,t)}function Sx(e,t){return t==null||Ll(e,t,ze(t))}function Ft(e,t){return e===t||e!==e&&t!==t}var jx=yi(Vs),Cx=yi(function(e,t){return e>=t}),An=zl(function(){return arguments}())?zl:function(e){return Ie(e)&&xe.call(e,"callee")&&!Rl.call(e,"callee")},ie=A.isArray,yx=ll?dt(ll):Dm;function at(e){return e!=null&&Ti(e.length)&&!Yt(e)}function De(e){return Ie(e)&&at(e)}function Nx(e){return e===!0||e===!1||Ie(e)&&et(e)==dr}var cn=$g||Ea,Rx=ul?dt(ul):Tm;function Ex(e){return Ie(e)&&e.nodeType===1&&!Mr(e)}function Ax(e){if(e==null)return!0;if(at(e)&&(ie(e)||typeof e=="string"||typeof e.splice=="function"||cn(e)||Yn(e)||An(e)))return!e.length;var t=Qe(e);if(t==Rt||t==Et)return!e.size;if(Ir(e))return!Hs(e).length;for(var s in e)if(xe.call(e,s))return!1;return!0}function Ix(e,t){return Rr(e,t)}function Fx(e,t,s){s=typeof s=="function"?s:r;var u=s?s(e,t):r;return u===r?Rr(e,t,r,s):!!u}function va(e){if(!Ie(e))return!1;var t=et(e);return t==Hr||t==Jd||typeof e.message=="string"&&typeof e.name=="string"&&!Mr(e)}function Mx(e){return typeof e=="number"&&Al(e)}function Yt(e){if(!Ae(e))return!1;var t=et(e);return t==Kr||t==Oo||t==Zd||t==tf}function Yu(e){return typeof e=="number"&&e==ae(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 Ie(e){return e!=null&&typeof e=="object"}var Qu=cl?dt(cl):Om;function Dx(e,t){return e===t||Gs(e,t,la(t))}function Tx(e,t,s){return s=typeof s=="function"?s:r,Gs(e,t,la(t),s)}function Lx(e){return Xu(e)&&e!=+e}function Ox(e){if(_h(e))throw new re(c);return Bl(e)}function Px(e){return e===null}function kx(e){return e==null}function Xu(e){return typeof e=="number"||Ie(e)&&et(e)==gr}function Mr(e){if(!Ie(e)||et(e)!=Bt)return!1;var t=oi(e);if(t===null)return!0;var s=xe.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&ri.call(s)==Tg}var _a=dl?dt(dl):Pm;function qx(e){return Yu(e)&&e>=-9007199254740991&&e<=U}var Zu=fl?dt(fl):km;function Li(e){return typeof e=="string"||!ie(e)&&Ie(e)&&et(e)==hr}function gt(e){return typeof e=="symbol"||Ie(e)&&et(e)==Wr}var Yn=gl?dt(gl):qm;function $x(e){return e===r}function zx(e){return Ie(e)&&Qe(e)==pr}function Bx(e){return Ie(e)&&et(e)==rf}var Vx=yi(Ks),Ux=yi(function(e,t){return e<=t});function Ju(e){if(!e)return[];if(at(e))return Li(e)?At(e):st(e);if(_r&&e[_r])return Sg(e[_r]());var t=Qe(e),s=t==Rt?Ts:t==Et?ei:Qn;return s(e)}function Qt(e){if(!e)return e===0?e:0;if(e=yt(e),e===Me||e===-1/0){var t=e<0?-1:1;return t*be}return e===e?e:0}function ae(e){var t=Qt(e),s=t%1;return t===t?s?t-s:t:0}function ec(e){return e?yn(ae(e),0,it):0}function yt(e){if(typeof e=="number")return e;if(gt(e))return Je;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=_l(e);var s=yf.test(e);return s||Rf.test(e)?sg(e.slice(2),s?2:8):Cf.test(e)?Je:+e}function tc(e){return Pt(e,ot(e))}function Gx(e){return e?yn(ae(e),-9007199254740991,U):e===0?e:0}function pe(e){return e==null?"":ft(e)}var Hx=Hn(function(e,t){if(Ir(t)||at(t)){Pt(t,ze(t),e);return}for(var s in t)xe.call(t,s)&&Cr(e,s,t[s])}),nc=Hn(function(e,t){Pt(t,ot(t),e)}),Oi=Hn(function(e,t,s,u){Pt(t,ot(t),e,u)}),Kx=Hn(function(e,t,s,u){Pt(t,ze(t),e,u)}),Wx=Kt($s);function Yx(e,t){var s=Gn(e);return t==null?s:Tl(s,t)}var Qx=ue(function(e,t){e=we(e);var s=-1,u=t.length,f=u>2?t[2]:r;for(f&&tt(t[0],t[1],f)&&(u=1);++s<u;)for(var m=t[s],_=ot(m),S=-1,N=_.length;++S<N;){var T=_[S],L=e[T];(L===r||Ft(L,Bn[T])&&!xe.call(e,T))&&(e[T]=m[T])}return e}),Xx=ue(function(e){return e.push(r,_u),ct(rc,r,e)});function Zx(e,t){return hl(e,X(t,3),Ot)}function Jx(e,t){return hl(e,X(t,3),Bs)}function ev(e,t){return e==null?e:zs(e,X(t,3),ot)}function tv(e,t){return e==null?e:ql(e,X(t,3),ot)}function nv(e,t){return e&&Ot(e,X(t,3))}function rv(e,t){return e&&Bs(e,X(t,3))}function iv(e){return e==null?[]:xi(e,ze(e))}function sv(e){return e==null?[]:xi(e,ot(e))}function ba(e,t,s){var u=e==null?r:Nn(e,t);return u===r?s:u}function av(e,t){return e!=null&&Su(e,t,Am)}function wa(e,t){return e!=null&&Su(e,t,Im)}var ov=mu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=ii.call(t)),e[t]=s},ja(lt)),lv=mu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=ii.call(t)),xe.call(e,t)?e[t].push(s):e[t]=[s]},X),uv=ue(Nr);function ze(e){return at(e)?Ml(e):Hs(e)}function ot(e){return at(e)?Ml(e,!0):$m(e)}function cv(e,t){var s={};return t=X(t,3),Ot(e,function(u,f,m){Gt(s,t(u,f,m),u)}),s}function dv(e,t){var s={};return t=X(t,3),Ot(e,function(u,f,m){Gt(s,f,t(u,f,m))}),s}var fv=Hn(function(e,t,s){vi(e,t,s)}),rc=Hn(function(e,t,s,u){vi(e,t,s,u)}),gv=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}),Pt(e,aa(e),s),u&&(s=St(s,R|y|b,oh));for(var f=t.length;f--;)Zs(s,t[f]);return s});function mv(e,t){return ic(e,Di(X(t)))}var hv=Kt(function(e,t){return e==null?{}:Bm(e,t)});function ic(e,t){if(e==null)return{};var s=Ee(aa(e),function(u){return[u]});return t=X(t),Yl(e,s,function(u,f){return t(u,f[0])})}function pv(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[kt(t[u])];m===r&&(u=f,m=s),e=Yt(m)?m.call(e):m}return e}function xv(e,t,s){return e==null?e:Er(e,t,s)}function vv(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:Er(e,t,s,u)}var sc=xu(ze),ac=xu(ot);function _v(e,t,s){var u=ie(e),f=u||cn(e)||Yn(e);if(t=X(t,4),s==null){var m=e&&e.constructor;f?s=u?new m:[]:Ae(e)?s=Yt(m)?Gn(oi(e)):{}:s={}}return(f?_t:Ot)(e,function(_,S,N){return t(s,_,S,N)}),s}function bv(e,t){return e==null?!0:Zs(e,t)}function wv(e,t,s){return e==null?e:eu(e,t,ta(s))}function Sv(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:eu(e,t,ta(s),u)}function Qn(e){return e==null?[]:Ds(e,ze(e))}function jv(e){return e==null?[]:Ds(e,ot(e))}function Cv(e,t,s){return s===r&&(s=t,t=r),s!==r&&(s=yt(s),s=s===s?s:0),t!==r&&(t=yt(t),t=t===t?t:0),yn(yt(e),t,s)}function yv(e,t,s){return t=Qt(t),s===r?(s=t,t=0):s=Qt(s),e=yt(e),Fm(e,t,s)}function Nv(e,t,s){if(s&&typeof s!="boolean"&&tt(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=Il();return Ye(e+f*(t-e+ig("1e-"+((f+"").length-1))),t)}return Ys(e,t)}var Rv=Kn(function(e,t,s){return t=t.toLowerCase(),e+(s?oc(t):t)});function oc(e){return Sa(pe(e).toLowerCase())}function lc(e){return e=pe(e),e&&e.replace(Af,xg).replace(Wf,"")}function Ev(e,t,s){e=pe(e),t=ft(t);var u=e.length;s=s===r?u:yn(ae(s),0,u);var f=s;return s-=t.length,s>=0&&e.slice(s,f)==t}function Av(e){return e=pe(e),e&&uf.test(e)?e.replace(qo,vg):e}function Iv(e){return e=pe(e),e&&hf.test(e)?e.replace(xs,"\\$&"):e}var Fv=Kn(function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}),Mv=Kn(function(e,t,s){return e+(s?" ":"")+t.toLowerCase()}),Dv=du("toLowerCase");function Tv(e,t,s){e=pe(e),t=ae(t);var u=t?$n(e):0;if(!t||u>=t)return e;var f=(t-u)/2;return Ci(di(f),s)+e+Ci(ci(f),s)}function Lv(e,t,s){e=pe(e),t=ae(t);var u=t?$n(e):0;return t&&u<t?e+Ci(t-u,s):e}function Ov(e,t,s){e=pe(e),t=ae(t);var u=t?$n(e):0;return t&&u<t?Ci(t-u,s)+e:e}function Pv(e,t,s){return s||t==null?t=0:t&&(t=+t),Ug(pe(e).replace(vs,""),t||0)}function kv(e,t,s){return(s?tt(e,t,s):t===r)?t=1:t=ae(t),Qs(pe(e),t)}function qv(){var e=arguments,t=pe(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var $v=Kn(function(e,t,s){return e+(s?"_":"")+t.toLowerCase()});function zv(e,t,s){return s&&typeof s!="number"&&tt(e,t,s)&&(t=s=r),s=s===r?it:s>>>0,s?(e=pe(e),e&&(typeof t=="string"||t!=null&&!_a(t))&&(t=ft(t),!t&&qn(e))?un(At(e),0,s):e.split(t,s)):[]}var Bv=Kn(function(e,t,s){return e+(s?" ":"")+Sa(t)});function Vv(e,t,s){return e=pe(e),s=s==null?0:yn(ae(s),0,e.length),t=ft(t),e.slice(s,s+t.length)==t}function Uv(e,t,s){var u=g.templateSettings;s&&tt(e,t,s)&&(t=r),e=pe(e),t=Oi({},t,u,vu);var f=Oi({},t.imports,u.imports,vu),m=ze(f),_=Ds(f,m),S,N,T=0,L=t.interpolate||Yr,P="__p += '",z=Ls((t.escape||Yr).source+"|"+L.source+"|"+(L===$o?jf:Yr).source+"|"+(t.evaluate||Yr).source+"|$","g"),K="//# sourceURL="+(xe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Jf+"]")+`
|
||
`;e.replace(z,function(ne,de,ge,mt,nt,ht){return ge||(ge=mt),P+=e.slice(T,ht).replace(If,_g),de&&(S=!0,P+=`' +
|
||
__e(`+de+`) +
|
||
'`),nt&&(N=!0,P+=`';
|
||
`+nt+`;
|
||
__p += '`),ge&&(P+=`' +
|
||
((__t = (`+ge+`)) == null ? '' : __t) +
|
||
'`),T=ht+ne.length,ne}),P+=`';
|
||
`;var te=xe.call(t,"variable")&&t.variable;if(!te)P=`with (obj) {
|
||
`+P+`
|
||
}
|
||
`;else if(wf.test(te))throw new re(h);P=(N?P.replace(sf,""):P).replace(af,"$1").replace(of,"$1;"),P="function("+(te||"obj")+`) {
|
||
`+(te?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(S?", __e = _.escape":"")+(N?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+P+`return __p
|
||
}`;var oe=cc(function(){return me(m,K+"return "+P).apply(r,_)});if(oe.source=P,va(oe))throw oe;return oe}function Gv(e){return pe(e).toLowerCase()}function Hv(e){return pe(e).toUpperCase()}function Kv(e,t,s){if(e=pe(e),e&&(s||t===r))return _l(e);if(!e||!(t=ft(t)))return e;var u=At(e),f=At(t),m=bl(u,f),_=wl(u,f)+1;return un(u,m,_).join("")}function Wv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.slice(0,jl(e)+1);if(!e||!(t=ft(t)))return e;var u=At(e),f=wl(u,At(t))+1;return un(u,0,f).join("")}function Yv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.replace(vs,"");if(!e||!(t=ft(t)))return e;var u=At(e),f=bl(u,At(t));return un(u,f).join("")}function Qv(e,t){var s=se,u=ce;if(Ae(t)){var f="separator"in t?t.separator:f;s="length"in t?ae(t.length):s,u="omission"in t?ft(t.omission):u}e=pe(e);var m=e.length;if(qn(e)){var _=At(e);m=_.length}if(s>=m)return e;var S=s-$n(u);if(S<1)return u;var N=_?un(_,0,S).join(""):e.slice(0,S);if(f===r)return N+u;if(_&&(S+=N.length-S),_a(f)){if(e.slice(S).search(f)){var T,L=N;for(f.global||(f=Ls(f.source,pe(zo.exec(f))+"g")),f.lastIndex=0;T=f.exec(L);)var P=T.index;N=N.slice(0,P===r?S:P)}}else if(e.indexOf(ft(f),S)!=S){var z=N.lastIndexOf(f);z>-1&&(N=N.slice(0,z))}return N+u}function Xv(e){return e=pe(e),e&&lf.test(e)?e.replace(ko,Ng):e}var Zv=Kn(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),Sa=du("toUpperCase");function uc(e,t,s){return e=pe(e),t=s?r:t,t===r?wg(e)?Ag(e):fg(e):e.match(t)||[]}var cc=ue(function(e,t){try{return ct(e,r,t)}catch(s){return va(s)?s:new re(s)}}),Jv=Kt(function(e,t){return _t(t,function(s){s=kt(s),Gt(e,s,pa(e[s],e))}),e});function e_(e){var t=e==null?0:e.length,s=X();return e=t?Ee(e,function(u){if(typeof u[1]!="function")throw new bt(d);return[s(u[0]),u[1]]}):[],ue(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 t_(e){return Nm(St(e,R))}function ja(e){return function(){return e}}function n_(e,t){return e==null||e!==e?t:e}var r_=gu(),i_=gu(!0);function lt(e){return e}function Ca(e){return Vl(typeof e=="function"?e:St(e,R))}function s_(e){return Gl(St(e,R))}function a_(e,t){return Hl(e,St(t,R))}var o_=ue(function(e,t){return function(s){return Nr(s,e,t)}}),l_=ue(function(e,t){return function(s){return Nr(e,s,t)}});function ya(e,t,s){var u=ze(t),f=xi(t,u);s==null&&!(Ae(t)&&(f.length||!u.length))&&(s=t,t=e,e=this,f=xi(t,ze(t)));var m=!(Ae(s)&&"chain"in s)||!!s.chain,_=Yt(e);return _t(f,function(S){var N=t[S];e[S]=N,_&&(e.prototype[S]=function(){var T=this.__chain__;if(m||T){var L=e(this.__wrapped__),P=L.__actions__=st(this.__actions__);return P.push({func:N,args:arguments,thisArg:e}),L.__chain__=T,L}return N.apply(e,nn([this.value()],arguments))})}),e}function u_(){return Be._===this&&(Be._=Lg),this}function Na(){}function c_(e){return e=ae(e),ue(function(t){return Kl(t,e)})}var d_=ra(Ee),f_=ra(ml),g_=ra(Es);function dc(e){return ca(e)?As(kt(e)):Vm(e)}function m_(e){return function(t){return e==null?r:Nn(e,t)}}var h_=hu(),p_=hu(!0);function Ra(){return[]}function Ea(){return!1}function x_(){return{}}function v_(){return""}function __(){return!0}function b_(e,t){if(e=ae(e),e<1||e>U)return[];var s=it,u=Ye(e,it);t=X(t),e-=it;for(var f=Ms(u,t);++s<e;)t(s);return f}function w_(e){return ie(e)?Ee(e,kt):gt(e)?[e]:st(Fu(pe(e)))}function S_(e){var t=++Dg;return pe(e)+t}var j_=ji(function(e,t){return e+t},0),C_=ia("ceil"),y_=ji(function(e,t){return e/t},1),N_=ia("floor");function R_(e){return e&&e.length?pi(e,lt,Vs):r}function E_(e,t){return e&&e.length?pi(e,X(t,2),Vs):r}function A_(e){return xl(e,lt)}function I_(e,t){return xl(e,X(t,2))}function F_(e){return e&&e.length?pi(e,lt,Ks):r}function M_(e,t){return e&&e.length?pi(e,X(t,2),Ks):r}var D_=ji(function(e,t){return e*t},1),T_=ia("round"),L_=ji(function(e,t){return e-t},0);function O_(e){return e&&e.length?Fs(e,lt):0}function P_(e,t){return e&&e.length?Fs(e,X(t,2)):0}return g.after=sx,g.ary=Bu,g.assign=Hx,g.assignIn=nc,g.assignInWith=Oi,g.assignWith=Kx,g.at=Wx,g.before=Vu,g.bind=pa,g.bindAll=Jv,g.bindKey=Uu,g.castArray=xx,g.chain=qu,g.chunk=Nh,g.compact=Rh,g.concat=Eh,g.cond=e_,g.conforms=t_,g.constant=ja,g.countBy=Op,g.create=Yx,g.curry=Gu,g.curryRight=Hu,g.debounce=Ku,g.defaults=Qx,g.defaultsDeep=Xx,g.defer=ax,g.delay=ox,g.difference=Ah,g.differenceBy=Ih,g.differenceWith=Fh,g.drop=Mh,g.dropRight=Dh,g.dropRightWhile=Th,g.dropWhile=Lh,g.fill=Oh,g.filter=kp,g.flatMap=zp,g.flatMapDeep=Bp,g.flatMapDepth=Vp,g.flatten=Lu,g.flattenDeep=Ph,g.flattenDepth=kh,g.flip=lx,g.flow=r_,g.flowRight=i_,g.fromPairs=qh,g.functions=iv,g.functionsIn=sv,g.groupBy=Up,g.initial=zh,g.intersection=Bh,g.intersectionBy=Vh,g.intersectionWith=Uh,g.invert=ov,g.invertBy=lv,g.invokeMap=Hp,g.iteratee=Ca,g.keyBy=Kp,g.keys=ze,g.keysIn=ot,g.map=Ii,g.mapKeys=cv,g.mapValues=dv,g.matches=s_,g.matchesProperty=a_,g.memoize=Mi,g.merge=fv,g.mergeWith=rc,g.method=o_,g.methodOf=l_,g.mixin=ya,g.negate=Di,g.nthArg=c_,g.omit=gv,g.omitBy=mv,g.once=ux,g.orderBy=Wp,g.over=d_,g.overArgs=cx,g.overEvery=f_,g.overSome=g_,g.partial=xa,g.partialRight=Wu,g.partition=Yp,g.pick=hv,g.pickBy=ic,g.property=dc,g.propertyOf=m_,g.pull=Wh,g.pullAll=Pu,g.pullAllBy=Yh,g.pullAllWith=Qh,g.pullAt=Xh,g.range=h_,g.rangeRight=p_,g.rearg=dx,g.reject=Zp,g.remove=Zh,g.rest=fx,g.reverse=ma,g.sampleSize=ex,g.set=xv,g.setWith=vv,g.shuffle=tx,g.slice=Jh,g.sortBy=ix,g.sortedUniq=ap,g.sortedUniqBy=op,g.split=zv,g.spread=gx,g.tail=lp,g.take=up,g.takeRight=cp,g.takeRightWhile=dp,g.takeWhile=fp,g.tap=Rp,g.throttle=mx,g.thru=Ai,g.toArray=Ju,g.toPairs=sc,g.toPairsIn=ac,g.toPath=w_,g.toPlainObject=tc,g.transform=_v,g.unary=hx,g.union=gp,g.unionBy=mp,g.unionWith=hp,g.uniq=pp,g.uniqBy=xp,g.uniqWith=vp,g.unset=bv,g.unzip=ha,g.unzipWith=ku,g.update=wv,g.updateWith=Sv,g.values=Qn,g.valuesIn=jv,g.without=_p,g.words=uc,g.wrap=px,g.xor=bp,g.xorBy=wp,g.xorWith=Sp,g.zip=jp,g.zipObject=Cp,g.zipObjectDeep=yp,g.zipWith=Np,g.entries=sc,g.entriesIn=ac,g.extend=nc,g.extendWith=Oi,ya(g,g),g.add=j_,g.attempt=cc,g.camelCase=Rv,g.capitalize=oc,g.ceil=C_,g.clamp=Cv,g.clone=vx,g.cloneDeep=bx,g.cloneDeepWith=wx,g.cloneWith=_x,g.conformsTo=Sx,g.deburr=lc,g.defaultTo=n_,g.divide=y_,g.endsWith=Ev,g.eq=Ft,g.escape=Av,g.escapeRegExp=Iv,g.every=Pp,g.find=qp,g.findIndex=Du,g.findKey=Zx,g.findLast=$p,g.findLastIndex=Tu,g.findLastKey=Jx,g.floor=N_,g.forEach=$u,g.forEachRight=zu,g.forIn=ev,g.forInRight=tv,g.forOwn=nv,g.forOwnRight=rv,g.get=ba,g.gt=jx,g.gte=Cx,g.has=av,g.hasIn=wa,g.head=Ou,g.identity=lt,g.includes=Gp,g.indexOf=$h,g.inRange=yv,g.invoke=uv,g.isArguments=An,g.isArray=ie,g.isArrayBuffer=yx,g.isArrayLike=at,g.isArrayLikeObject=De,g.isBoolean=Nx,g.isBuffer=cn,g.isDate=Rx,g.isElement=Ex,g.isEmpty=Ax,g.isEqual=Ix,g.isEqualWith=Fx,g.isError=va,g.isFinite=Mx,g.isFunction=Yt,g.isInteger=Yu,g.isLength=Ti,g.isMap=Qu,g.isMatch=Dx,g.isMatchWith=Tx,g.isNaN=Lx,g.isNative=Ox,g.isNil=kx,g.isNull=Px,g.isNumber=Xu,g.isObject=Ae,g.isObjectLike=Ie,g.isPlainObject=Mr,g.isRegExp=_a,g.isSafeInteger=qx,g.isSet=Zu,g.isString=Li,g.isSymbol=gt,g.isTypedArray=Yn,g.isUndefined=$x,g.isWeakMap=zx,g.isWeakSet=Bx,g.join=Gh,g.kebabCase=Fv,g.last=Ct,g.lastIndexOf=Hh,g.lowerCase=Mv,g.lowerFirst=Dv,g.lt=Vx,g.lte=Ux,g.max=R_,g.maxBy=E_,g.mean=A_,g.meanBy=I_,g.min=F_,g.minBy=M_,g.stubArray=Ra,g.stubFalse=Ea,g.stubObject=x_,g.stubString=v_,g.stubTrue=__,g.multiply=D_,g.nth=Kh,g.noConflict=u_,g.noop=Na,g.now=Fi,g.pad=Tv,g.padEnd=Lv,g.padStart=Ov,g.parseInt=Pv,g.random=Nv,g.reduce=Qp,g.reduceRight=Xp,g.repeat=kv,g.replace=qv,g.result=pv,g.round=T_,g.runInContext=C,g.sample=Jp,g.size=nx,g.snakeCase=$v,g.some=rx,g.sortedIndex=ep,g.sortedIndexBy=tp,g.sortedIndexOf=np,g.sortedLastIndex=rp,g.sortedLastIndexBy=ip,g.sortedLastIndexOf=sp,g.startCase=Bv,g.startsWith=Vv,g.subtract=L_,g.sum=O_,g.sumBy=P_,g.template=Uv,g.times=b_,g.toFinite=Qt,g.toInteger=ae,g.toLength=ec,g.toLower=Gv,g.toNumber=yt,g.toSafeInteger=Gx,g.toString=pe,g.toUpper=Hv,g.trim=Kv,g.trimEnd=Wv,g.trimStart=Yv,g.truncate=Qv,g.unescape=Xv,g.uniqueId=S_,g.upperCase=Zv,g.upperFirst=Sa,g.each=$u,g.eachRight=zu,g.first=Ou,ya(g,function(){var e={};return Ot(g,function(t,s){xe.call(g.prototype,s)||(e[s]=t)}),e}(),{chain:!1}),g.VERSION=o,_t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){g[e].placeholder=g}),_t(["drop","take"],function(e,t){fe.prototype[e]=function(s){s=s===r?1:$e(ae(s),0);var u=this.__filtered__&&!t?new fe(this):this.clone();return u.__filtered__?u.__takeCount__=Ye(s,u.__takeCount__):u.__views__.push({size:Ye(s,it),type:e+(u.__dir__<0?"Right":"")}),u},fe.prototype[e+"Right"]=function(s){return this.reverse()[e](s).reverse()}}),_t(["filter","map","takeWhile"],function(e,t){var s=t+1,u=s==rt||s==je;fe.prototype[e]=function(f){var m=this.clone();return m.__iteratees__.push({iteratee:X(f,3),type:s}),m.__filtered__=m.__filtered__||u,m}}),_t(["head","last"],function(e,t){var s="take"+(t?"Right":"");fe.prototype[e]=function(){return this[s](1).value()[0]}}),_t(["initial","tail"],function(e,t){var s="drop"+(t?"":"Right");fe.prototype[e]=function(){return this.__filtered__?new fe(this):this[s](1)}}),fe.prototype.compact=function(){return this.filter(lt)},fe.prototype.find=function(e){return this.filter(e).head()},fe.prototype.findLast=function(e){return this.reverse().find(e)},fe.prototype.invokeMap=ue(function(e,t){return typeof e=="function"?new fe(this):this.map(function(s){return Nr(s,e,t)})}),fe.prototype.reject=function(e){return this.filter(Di(X(e)))},fe.prototype.slice=function(e,t){e=ae(e);var s=this;return s.__filtered__&&(e>0||t<0)?new fe(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=ae(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},fe.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},fe.prototype.toArray=function(){return this.take(it)},Ot(fe.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__,S=u?[1]:arguments,N=_ instanceof fe,T=S[0],L=N||ie(_),P=function(de){var ge=f.apply(g,nn([de],S));return u&&z?ge[0]:ge};L&&s&&typeof T=="function"&&T.length!=1&&(N=L=!1);var z=this.__chain__,K=!!this.__actions__.length,te=m&&!z,oe=N&&!K;if(!m&&L){_=oe?_:new fe(this);var ne=e.apply(_,S);return ne.__actions__.push({func:Ai,args:[P],thisArg:r}),new wt(ne,z)}return te&&oe?e.apply(this,S):(ne=this.thru(P),te?u?ne.value()[0]:ne.value():ne)})}),_t(["pop","push","shift","sort","splice","unshift"],function(e){var t=ti[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(ie(m)?m:[],f)}return this[s](function(_){return t.apply(ie(_)?_:[],f)})}}),Ot(fe.prototype,function(e,t){var s=g[t];if(s){var u=s.name+"";xe.call(Un,u)||(Un[u]=[]),Un[u].push({name:t,func:s})}}),Un[Si(r,F).name]=[{name:"wrapper",func:r}],fe.prototype.clone=Xg,fe.prototype.reverse=Zg,fe.prototype.value=Jg,g.prototype.at=Ep,g.prototype.chain=Ap,g.prototype.commit=Ip,g.prototype.next=Fp,g.prototype.plant=Dp,g.prototype.reverse=Tp,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=Lp,g.prototype.first=g.prototype.head,_r&&(g.prototype[_r]=Mp),g},zn=Ig();wn?((wn.exports=zn)._=zn,Cs._=zn):Be._=zn}).call(Xn)})(Ki,Ki.exports);var Fe=Ki.exports;const Lw=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),x=p.percentage(l.toNumber()).convertScale(2),v=p.add(x).convertScale(2);return{subtotalPrice:d.toObject(),discount:r.toObject(),discountPrice:h.toObject(),priceBeforeTaxes:p.toObject(),tax:l.toObject(),taxesPrice:x.toObject(),totalPrice:v.toObject()}},Ow=({currency:n})=>{const{formState:a,control:r}=lr(),{formatNumber:o}=vw(),l=vc({control:r,name:["subtotal_price","discount","tax"]}),c=vc({control:r,name:"tax_label"})||w("quotes.form_fields.tax.label"),d=Lw(l),h=o(d.subtotalPrice),p=o(d.discountPrice),x=o(d.taxesPrice),v=o(d.totalPrice),R=M.useMemo(()=>n.symbol||"",[n]);return i.jsx(Le,{className:"w-full bg-muted",children:i.jsxs(Oe,{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(Ze,{className:"text-sm",children:w("quotes.form_fields.subtotal_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[h,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:R})]})]})}),i.jsx(hn,{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(Ze,{className:"text-sm",children:w("quotes.form_fields.discount.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("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(Ze,{className:"text-sm text-right",children:w("quotes.form_fields.discount_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[p,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:R})]})]})]}),i.jsx(hn,{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(Ze,{className:"text-sm",children:c}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("quotes.form_fields.tax.placeholder"),name:"tax"})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm text-right",children:w("quotes.form_fields.tax_price.label",{label:c})}),i.jsxs(Ge,{className:"flex items-baseline justify-end gap-1 text-2xl tabular-nums",children:[x,i.jsx("span",{className:"text-base font-medium tracking-normal",children:R})]})]})]})," ",i.jsx(hn,{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(Ze,{className:"text-sm font-semibold text-right text-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsxs(Ge,{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:R})]})]})})]})})},Hd=n=>{const{percentage:a,cancel:r,error:o,isInProgress:l,onFinishDownload:c}=n,d=M.useId();return M.useEffect(()=>{l&&!o&&a===100&&c&&c()},[a,l,o,c]),i.jsx(rr,{open:l,children:i.jsxs(ir,{className:"sm:max-w-md",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.downloading_dialog.title")}),i.jsx(ns,{children:w("quotes.downloading_dialog.description")})]}),i.jsxs("div",{className:"mb-4 space-y-2",id:d,children:[i.jsx(cr,{children:w("quotes.downloading_dialog.progress.label",{status:w(l?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),i.jsx(Hc,{value:a,max:100,getValueLabel:()=>w("quotes.downloading_dialog.progress.label",{})}),o&&i.jsxs("p",{children:["Error: ",JSON.stringify(o)]})]}),i.jsx(or,{className:"sm:justify-end",children:i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",variant:"secondary",onClick:()=>r(),children:w("quotes.downloading_dialog.cancel_button")})})})]})})},Pw=({isInProgress:n,percentage:a,elapsed:r,cancel:o,error:l,className:c})=>{const[d,h]=M.useState(10);return M.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(Le,{className:he("overflow-hidden",c),children:[i.jsx(pt,{children:i.jsxs(Ge,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?"Error en la generación del PDF":"Generando PDF",n&&i.jsx(W0,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&i.jsx(V0,{className:"w-4 h-4 text-destructive"})]})}),i.jsx(Oe,{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(K0,{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(Hc,{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(G,{variant:"destructive",onClick:o,className:"hidden",children:"Cancelar generación"})]})})]})},Kd=({quote:n,className:a})=>{const{useReport:r,getQuotePDFFilename:o,useDownloader:l}=Ur(),{download:c}=l(),{report:d,preview:h,isInProgress:p,...x}=r(),[v,R]=M.useState(void 0),y=M.useCallback(()=>{n&&c(n.id,o(n))},[n]);return M.useEffect(()=>{const b=setTimeout(()=>{n&&n.id&&h(n.id)},200);return()=>clearTimeout(b)},[n]),M.useEffect(()=>{if(!p&&d){const b=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(d):window.webkitURL.createObjectURL(d);return R(b),()=>{R(void 0),window.URL.revokeObjectURL(b)}}},[d,p]),n?p?i.jsx(Pw,{isInProgress:p,...x}):i.jsx(p0,{file:v,className:"object-contain",onThumbnailClick:y}):i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})})};Kd.whyDidYouRender=!0;const Tr=db();function kw({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 qw({row:n,table:a}){var o;const r=(o=a.options.meta)==null?void 0:o.catalogPicker;return i.jsxs(G,{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:w("common.add")})]})}const to=({onSelect:n})=>{const a=zt(),{pagination:r,globalFilter:o,isFiltered:l}=Tn(),[c,d]=M.useState([]),h=M.useCallback((D,F)=>{d(q=>{const $=[...q];return $[D]=F,$})},[]),p=()=>{d([])},{data:x,isPending:v,isError:R,error:y}=zd({pagination:{pageIndex:r.pageIndex,pageSize:r.pageSize},searchTerm:o});M.useEffect(()=>{p()},[r,o,l]);const b=M.useMemo(()=>({catalogPicker:{quantities:c,setQuantity:h,selectArticle:(D,F)=>n(D,c[F]===""?1:c[F]??1)}}),[h,n,c]),E=M.useMemo(()=>[Tr.accessor("description",{id:"description",header:()=>i.jsx(i.Fragment,{children:w("catalog.list.columns.description")})}),Tr.accessor("points",{id:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:D})=>i.jsx("div",{className:"text-right",children:D()})}),Tr.accessor("retail_price",{id:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:D})=>{const F=Tt.create(D.original.retail_price).object;return i.jsx("div",{className:"text-right",children:F.toFormat()})}}),Tr.display({id:"quantity",header:()=>i.jsx("div",{className:"font-medium text-right text-foreground",children:w("catalog.list.columns.quantity")}),cell:kw}),Tr.display({id:"row-actions",header:()=>null,cell:qw})],[]),{table:j}=os({data:[...(x==null?void 0:x.items)||[]],columns:E,pageCount:(x==null?void 0:x.total_pages)??-1,meta:b});return R?i.jsx(ur,{subtitle:y.message}):v?i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(x==null?void 0:x.total_items)===0&&!l?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>a("/catalog/add")}):i.jsx(is,{className:"bg-transparent border-0 shadow-none",table:j,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:i.jsx(Bd,{table:j})})},Do=M.forwardRef(({label:n=w("common.append_block"),className:a,...r},o)=>i.jsxs(G,{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})]}));Do.displayName="AppendBlockRowButton";const To=M.forwardRef(({label:n=w("common.append_article"),className:a,...r},o)=>i.jsxs(G,{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 Lo=M.forwardRef(({label:n=w("common.append_empty_row"),className:a,...r},o)=>i.jsxs(G,{type:"button",variant:"outline",ref:o,...r,children:[i.jsx(B0,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Lo.displayName="AppendEmptyRowButton";const $w=({table:n,showLineDiscountColumn:a,hasLineDiscounts:r,onShowLineDiscountColumnChange:o})=>{const l=n.getSelectedRowModel().rows.length,[c,d]=M.useState(!1),h=x=>{if(!x&&a&&r){d(!0);return}o(x)},p=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.jsxs("div",{className:"grid gap-0.5",children:[i.jsx(cr,{htmlFor:"show-line-discount-column",className:"text-sm font-medium",children:w("quotes.discount_column.label")}),i.jsx("p",{className:"text-xs font-normal text-muted-foreground",children:w("quotes.discount_column.description")})]}),i.jsx(So,{id:"show-line-discount-column",checked:a,onCheckedChange:h})]}),i.jsx(rr,{open:c,onOpenChange:d,children:i.jsxs(ir,{children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.discount_column.confirmation.title")}),i.jsx(ns,{children:w("quotes.discount_column.confirmation.description")})]}),i.jsxs(or,{children:[i.jsx(G,{type:"button",variant:"secondary",onClick:()=>d(!1),children:w("common.cancel")}),i.jsx(G,{type:"button",onClick:()=>{o(!1),d(!1)},children:w("quotes.discount_column.confirmation.confirm")})]})]})})]});return l?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(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.duplicateItems()},children:[i.jsx(U0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.duplicate_selected_rows")})]})}),i.jsx(We,{children:w("common.duplicate_selected_rows_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.deleteItems()},children:[i.jsx(xd,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.remove_selected_rows")})]})}),i.jsx(We,{children:w("common.remove_selected_rows_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>n.resetRowSelection(),children:[i.jsx(Y0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.reset_selected_rows")})]})}),i.jsx(We,{children:w("common.reset_selected_rows_tooltip")})]}),i.jsx(hn,{orientation:"vertical",className:"h-6 ml-1 mr-4"}),i.jsx("p",{className:"text-sm font-normal",children:w("common.rows_selected",{count:l})}),p]})}):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(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Lo,{variant:"link",onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.appendItem()}})}),i.jsx(We,{children:w("common.append_empty_row_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(To,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickCatalogArticle&&((x=n.options.meta)==null||x.pickCatalogArticle())}})}),i.jsx(We,{children:w("common.append_article_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Do,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickBlock&&((x=n.options.meta)==null||x.pickBlock())}})}),i.jsx(We,{children:w("common.append_block_tooltip")})]})]}),p]})},zw=({row:n,table:a,onDelete:r})=>{const o=()=>{var l;(l=a.options.meta)==null||l.deleteItems(n.index),r()};return i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index)},children:[i.jsx(x0,{className:"w-4 h-4 mr-2"}),w("common.insert_row_above")]}),i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index+1)},children:[i.jsx(kc,{className:"w-4 h-4 mr-2"}),w("common.insert_row_below")]}),i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.duplicateItems(n.index)},children:[i.jsx(jo,{className:"w-4 h-4 mr-2"}),w("common.duplicate_row")]}),i.jsxs(Kc,{children:[i.jsx(Wc,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"destructive",size:"sm",children:[i.jsx(xd,{className:"w-4 h-4 mr-2"}),w("common.remove_row")]})}),i.jsxs(Yc,{children:[i.jsxs(Qc,{children:[i.jsx(Xc,{children:w("quotes.inline_row_actions.delete_confirmation.title")}),i.jsx(Zc,{children:w("quotes.inline_row_actions.delete_confirmation.description")})]}),i.jsxs(Jc,{children:[i.jsx(ed,{children:w("common.cancel")}),i.jsx(td,{asChild:!0,children:i.jsx(G,{type:"button",variant:"destructive",onClick:o,children:w("quotes.inline_row_actions.delete_confirmation.confirm")})})]})]})]})]})},Bw={droppable:{strategy:w0.Always}},Vw={keyframes({transform:n}){return[{opacity:1,transform:Ga.Transform.toString(n.initial)},{opacity:0,transform:Ga.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:_c.duration,easing:_c.easing})}};function Ac({columns:n,data:a,defaultValues:r,initialState:o,actions:l,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h}){const[p,x]=M.useState({}),[v,R]=M.useState(),[y,b]=M.useState(null),E=M.useMemo(()=>a.map(O=>O.id),[a]),j=Dd({data:a,columns:n,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:o,state:{rowSelection:p,columnVisibility:{...o==null?void 0:o.columnVisibility,discount:c}},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:x,getCoreRowModel:Fd(),getRowId:O=>O==null?void 0:O.id,debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER},meta:{insertItem:(O,k)=>{l.insert(O,k||(r==null?void 0:r.items[0]),{shouldFocus:!0})},appendItem:O=>{l.append(O||(r==null?void 0:r.items[0]),{shouldFocus:!0})},pickCatalogArticle:()=>{l.pickCatalogArticle&&(l==null||l.pickCatalogArticle())},pickBlock:()=>{l.pickBlock&&(l==null||l.pickBlock())},duplicateItems:O=>{var k;if(O!=null){const H=((k=l.getItem)==null?void 0:k.call(l,O))??j.getRowModel().rows[O].original;l.insert(O+1,{...H,id:void 0},{shouldFocus:!0})}else if(j.getSelectedRowModel().rows.length){const H=j.getSelectedRowModel().rows[j.getSelectedRowModel().rows.length-1].index,W=j.getSelectedRowModel().rows.map(B=>({...B.original,id:void 0}));j.getRowModel().rows.length<H+1?l.append(W):l.insert(H+1,W,{shouldFocus:!0}),j.resetRowSelection()}},deleteItems:O=>{if(O!=null)l.remove(O);else if(j.getSelectedRowModel().rows.length>0){let k=j.getSelectedRowModel().rows.length-1;for(;k>=0;k--){const H=E.indexOf(String(j.getSelectedRowModel().rows[k].id));l.remove(H),E.splice(H,1)}j.resetRowSelection()}else l.remove()},updateItem:(O,k,H,W)=>{l.update(O,{...k,[`${H}`]:W})}}}),D=v0(Pi(A0,{}),Pi(E0,{}),Pi(R0,{}),Pi(N0,{}));function F(O){var W;let k=O.active.id,H=(W=O.over)==null?void 0:W.id;if(H!==void 0&&k!==H){let B=E.indexOf(String(H));if(j.getSelectedRowModel().rows.length>1)j.getSelectedRowModel().rows.forEach((se,ce)=>{const Y=E.indexOf(String(se.id));ce>0&&(k=se.id,B=E.indexOf(String(H)),B<Y&&(B=B+1)),l.move(Y,B),E.splice(B,0,E.splice(Y,1)[0]),H=se.id});else{const se=E.indexOf(String(k));l.move(se,B)}}R(null)}function q({active:O}){j.getSelectedRowModel().rowsById[O.id]||j.resetRowSelection(),R(O.id)}function $(){R(null)}function Q(O){return v?O.filter(k=>{const H=typeof k=="string"?k:k.id;return H===v||!j.getSelectedRowModel().rowsById[H]}):O}return i.jsx(_0,{measuring:Bw,sensors:D,onDragEnd:F,onDragStart:q,onDragCancel:$,collisionDetection:b0,children:i.jsxs(Le,{children:[i.jsx(pt,{className:"sticky z-10 top-16 bg-card/90",children:i.jsx(Ge,{children:i.jsx($w,{table:j,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h})})}),i.jsxs(Oe,{children:[i.jsxs(uo,{className:"table-fixed",children:[i.jsx(co,{className:"sticky top-0 z-10 bg-background",children:j.getHeaderGroups().map(O=>i.jsx(pn,{className:"hover:bg-transparent",children:O.headers.map(k=>i.jsx(fo,{className:"px-2 py-1",style:{width:k.getSize()===Number.MAX_SAFE_INTEGER?"auto":k.getSize()},children:k.isPlaceholder?null:i.jsx(Ld,{table:j,header:k})},k.id))},O.id))}),i.jsx(go,{children:i.jsx(j0,{items:Q(E),strategy:C0,children:Q(j.getRowModel().rows).map(O=>{const k=O,H=k.id===y;return i.jsxs(M.Fragment,{children:[i.jsx(Ew,{id:k.id,isActive:H,onActivate:()=>b(k.id),children:k.getVisibleCells().map(W=>i.jsx(qr,{className:"px-2 py-2 align-top",style:{width:W.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":W.column.getSize()},children:Gi(W.column.columnDef.cell,W.getContext())},W.id))}),H&&i.jsx(pn,{className:"border border-t-0 border-destructive/30 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5",children:i.jsx(qr,{colSpan:k.getVisibleCells().length,className:"px-2 py-2",children:i.jsx(zw,{row:k,table:j,onDelete:()=>b(null)})})})]},k.id)})})})]}),S0.createPortal(i.jsx(y0,{dropAnimation:Vw,className:"z-40 opacity-100",children:v&&i.jsx("div",{className:"relative flex flex-wrap",children:j.getSelectedRowModel().rows.length?i.jsx(ro,{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:j.getSelectedRowModel().rows.length}):null})}),document.body),!1]}),i.jsx(Dt,{children:i.jsxs(tr,{children:[i.jsx(Lo,{onClick:()=>{var O;return(O=j.options.meta)==null?void 0:O.appendItem()}}),i.jsx(To,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickCatalogArticle&&((O=j.options.meta)==null||O.pickCatalogArticle())}}),i.jsx(Do,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickBlock&&((O=j.options.meta)==null||O.pickBlock())}})]})})]})})}const Uw={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`}]},Ic=({onSelect:n})=>{const{i18n:a}=Fo(),[r]=M.useState(a.resolvedLanguage||"es"),[o]=M.useState(Uw[r.toLowerCase()]);return console.log(r),i.jsx(no,{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))})})},Gw=({isOpen:n,onOpenChange:a,onSelect:r})=>kd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ic,{onSelect:r}),i.jsx(or,{children:i.jsx(G,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(nd,{open:n,onOpenChange:a,children:i.jsxs(rd,{children:[i.jsxs(id,{className:"text-left",children:[i.jsx(sd,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(ad,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ic,{onSelect:r}),i.jsx(od,{className:"pt-2",children:i.jsx(ld,{asChild:!0,children:i.jsx(G,{variant:"outline",children:w("common.close")})})})]})}),Hw=({isOpen:n,onOpenChange:a,onSelect:r})=>kd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(or,{children:i.jsx(G,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(nd,{open:n,onOpenChange:a,children:i.jsxs(rd,{children:[i.jsxs(id,{className:"text-left",children:[i.jsx(sd,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(ad,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(od,{className:"pt-2",children:i.jsx(ld,{asChild:!0,children:i.jsx(G,{variant:"outline",children:w("common.close")})})})]})}),Kw=({currency:n,language:a,defaultValues:r})=>{var W;const{toast:o}=_n(),{control:l,getValues:c,setValue:d,watch:h}=lr(),p=h("show_line_discount_column")??!0,x=!!((W=c("items"))!=null&&W.some(B=>{var se;return Number((se=B.discount)==null?void 0:se.amount)>0})),[v]=M.useState("dialog"),[R,y]=M.useState(!1),[b,E]=M.useState(!1),{fields:j,...D}=I0({control:l,name:"items"}),F=Iw([{id:"description",accessorKey:"description",header:w("quotes.form_fields.items.description.label"),cell:({row:{index:B,original:se}})=>i.jsx(qt,{readOnly:se==null?void 0:se.id_article,autoSize:!0,name:`items.${B}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.quantity.label")}),cell:({row:{index:B}})=>i.jsx(fw,{scale:0,className:"text-right",name:`items.${B}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{currency:n,language:a,scale:2,className:"text-right",name:`items.${B}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"text-right",name:`items.${B}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.discount.label")}),cell:({row:{index:B}})=>i.jsx(Hi,{scale:2,className:"text-right",name:`items.${B}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.total_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${B}.total_price`}),size:150}],{enableDragHandleColumn:!0,enableSelectionColumn:!0}),q=M.useCallback((B,se=1)=>{D.append({...B,quantity:{amount:100*se,scale:xn.DEFAULT_SCALE},unit_price:B.retail_price,discount:{amount:null,scale:2}}),o({title:w("quotes.catalog_picker_dialog.toast_article_added"),description:B.description})},[D]),$=M.useCallback(B=>{D.append({description:`${B.title}
|
||
${B.body}`,quantity:{amount:null,scale:xn.DEFAULT_SCALE},unit_price:{amount:null,scale:ab.DEFAULT_SCALE},discount:{amount:null,scale:2}}),o({title:w("quotes.blocks_picker_dialog.toast_article_added"),description:B.title})},[D]),[Q,O]=M.useState(!1),k=[265,440,655],H=4;return v==="dialog"?i.jsxs("div",{className:"relative",children:[i.jsx(Ac,{actions:{...D,getItem:B=>c(`items.${B}`),pickCatalogArticle:()=>y(!0),pickBlock:()=>E(!0)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})}),i.jsx(Hw,{onSelect:q,isOpen:R,onOpenChange:y}),i.jsx(Gw,{onSelect:$,isOpen:b,onOpenChange:E})]}):i.jsxs(Z0,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[i.jsx(Sc,{defaultSize:k[0],collapsedSize:H,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{O(!0)},onExpand:()=>{O(!1)},className:he(Q&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:i.jsx(Ac,{actions:{...D,getItem:B=>c(`items.${B}`)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})})}),i.jsx(J0,{withHandle:!0,className:"mx-3"}),i.jsx(Sc,{defaultSize:k[1],minSize:10,children:i.jsx(nr,{syncWithLocation:!1,children:i.jsx(to,{onSelect:q})})})]})},Ww=()=>{const{formState:n}=lr();return i.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[i.jsxs(Ha,{className:"md:col-span-6",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),children:[i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(mn,{required:!0,className:"col-span-2",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),i.jsx(Gc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(mn,{label:w("quotes.form_fields.validity.label"),description:w("quotes.form_fields.validity.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.validity.placeholder"),name:"validity"}),i.jsx(qt,{className:"col-span-2",label:w("quotes.form_fields.payment_method.label"),description:w("quotes.form_fields.payment_method.desc"),disabled:n.disabled,placeholder:w("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:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:n.errors}),i.jsx(qt,{className:"col-span-3",label:w("quotes.form_fields.notes.label"),description:w("quotes.form_fields.notes.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),i.jsx(Ha,{className:"hidden md:col-span-2",title:w("quotes.create.form_groups.status.title"),description:w("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(cr,{htmlFor:"status",children:"Status"}),i.jsxs(so,{children:[i.jsx(ao,{id:"status","aria-label":"Select status",children:i.jsx(oo,{placeholder:"Select status"})}),i.jsxs(lo,{children:[i.jsx(Or,{value:"draft",children:"Draft"}),i.jsx(Or,{value:"published",children:"Active"}),i.jsx(Or,{value:"archived",children:"Archived"})]})]})]}),i.jsx(mn,{required:!0,label:w("quotes.form_fields.lang_code.label"),description:w("quotes.form_fields.lang_code.desc"),placeholder:w("quotes.form_fields.lang_code.placeholder"),name:"lang_code"}),i.jsx(mn,{required:!0,label:w("quotes.form_fields.currency_code.label"),description:w("quotes.form_fields.currency_code.desc"),placeholder:w("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Wd=({id:n,onSentTo:a,disabled:r})=>{const o=()=>{a(n)};return i.jsxs(Kc,{children:[i.jsx(Wc,{asChild:!0,disabled:r,children:i.jsxs(G,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[i.jsx(Q0,{className:"w-4 h-4"}),w("quotes.quote_sent_to_editor.trigger_button")]})}),i.jsxs(Yc,{children:[i.jsxs(Qc,{children:[i.jsx(Xc,{children:w("quotes.quote_sent_to_editor.title")}),i.jsx(Zc,{children:w("quotes.quote_sent_to_editor.description")})]}),i.jsxs(Jc,{children:[i.jsx(ed,{children:w("common.cancel")}),i.jsx(td,{asChild:!0,children:i.jsx(G,{onClick:o,children:w("common.continue")})})]})]})]})},Yw=["draft","ready","delivered","accepted","rejected","archived"],Qw={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"]},Yd=({type:n="button",status:a,onChangeStatus:r})=>{const[o,l]=M.useState(a),c=h=>l(h);M.useEffect(()=>{a&&l(a)},[a]);const d=()=>{o!==a&&r(o,a)};return i.jsxs(rr,{children:[i.jsx(Tc,{asChild:!0,children:n==="button"?i.jsxs(G,{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:w("quotes.quote_status_editor.trigger_button")})]}):i.jsx(M0,{status:a,isEditable:!0})}),i.jsxs(ir,{children:[i.jsx(sr,{children:i.jsx(ar,{children:w("quotes.quote_status_editor.title")})}),i.jsx(D0,{}),i.jsx("div",{className:"grid gap-4 py-4",children:Yw.map(h=>{const p=!Qw[a].includes(h);return i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx(So,{id:h,checked:o===h,onCheckedChange:()=>c(h),disabled:p}),i.jsxs("div",{className:"grid gap-1.5 leading-none",children:[i.jsx(cr,{htmlFor:h,className:he("font-medium",p?"text-input":"text-foreground"),children:w(`quotes.quote_status_editor.status.${h}.title`)}),i.jsx("p",{className:he("text-sm",p?"text-input":"text-muted-foreground"),children:w(`quotes.quote_status_editor.status.${h}.description`)})]})]},h)})}),i.jsxs(or,{className:"pt-6 border-t",children:[i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",variant:"secondary",children:w("common.cancel")})}),i.jsx(Vi,{asChild:!0,children:i.jsx(G,{onClick:d,disabled:o===a,children:w("quotes.quote_status_editor.submit_button")})})]})]})]})},Xw=({quoteId:n,className:a})=>{const r=zt(),{toast:o}=_n(),{useOne:l,useSetStatus:c,useSentTo:d,useDownloader:h,useDuplicate:p,getQuotePDFFilename:x}=Ur(),{data:v,status:R}=l(n),{mutate:y}=c(),{mutate:b}=d(n),{mutate:E}=p(),{download:j,...D}=h(),{formatCurrency:F,formatNumber:q}=Pd({locale:(v==null?void 0:v.lang_code)||"ES"}),$=M.useMemo(()=>v?{subtotal_price:F(v.subtotal_price),discount:q(v.discount),discount_price:F(v.discount_price),tax:q(v.tax),tax_price:F(v.tax_price),total_price:F(v.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[v]),Q=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!(v!=null&&v.date_sent),[v]),O=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!!(v!=null&&v.date_sent),[v]),k=Y=>{y({id:v.id,newStatus:Y},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},H=Y=>{b({sent_date:T0(new Date)},{onSuccess:()=>{o({description:w("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},W=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success"),variant:"success"})},[o]),B=M.useCallback(()=>{v&&j(v.id,x(v))},[v]);if(R==="error"||R!=="success")return null;if(!v)return i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})});const se=Y=>{E({id:Y},{onSuccess(Re){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Re.id}`,{relative:"path"})}})},ce=Y=>{y({id:Y,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})};return i.jsxs(i.Fragment,{children:[i.jsx(Hd,{...D,onFinishDownload:W}),i.jsx(ud,{defaultValue:"resume",children:i.jsxs(Le,{className:"w-[390px] overflow-hidden",children:[i.jsxs(pt,{className:"gap-3 border-b bg-accent",children:[i.jsxs(Ge,{className:"flex items-center justify-between text-lg",children:[i.jsx("span",{children:w("quotes.list.resume.title")}),i.jsx(Yd,{status:v.status,onChangeStatus:k,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(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),r(`/quotes/edit/${v.id}`,{relative:"path"})},children:[i.jsx(pd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",onClick:Y=>{Y.preventDefault(),se(v.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",onClick:B,children:[i.jsx(gd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),ce(v.id)},children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Wd,{disabled:O||!Q,id:v.id,onSentTo:H})})]})})]}),i.jsxs(Oe,{className:"p-6 text-sm",children:[i.jsxs(cd,{className:"grid w-full grid-cols-2",children:[i.jsx(Ka,{value:"resume",children:w("quotes.list.resume.tabs.resume")}),i.jsx(Ka,{value:"preview",children:w("quotes.list.resume.tabs.preview")})]}),i.jsx(Wa,{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:w("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:w("quotes.form_fields.reference.label")}),i.jsx("dd",{className:"font-medium",children:v.reference})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:w("quotes.form_fields.date.label")}),i.jsx("dd",{className:"font-medium",children:new Date(v.date).toLocaleDateString()})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:w("quotes.form_fields.customer_reference.label")}),i.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:v.customer_reference})]})]})]}),i.jsx(hn,{className:"my-4"}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.customer_information")}),i.jsx("div",{children:v.customer_information})]}),i.jsx(hn,{className:"my-4"}),i.jsx("div",{className:"font-semibold",children:w("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:w("quotes.form_fields.subtotal_price.label")}),i.jsx("span",{children:$.subtotal_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.discount_value.label",{value:$.discount})}),i.jsx("span",{children:$.discount_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.tax_value.label",{label:v.tax_label,value:$.tax})}),i.jsx("span",{children:$.tax_price})]}),i.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsx("span",{children:$.total_price})]})]})]})}),i.jsx(Wa,{value:"preview",children:i.jsx(Kd,{quote:v})})]}),i.jsx(Dt,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:i.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Zw=({status:n="all",preview:a=!1})=>{const r=zt(),{toast:o}=_n(),l=M.useId(),c=M.useId(),{pagination:d,globalFilter:h,isFiltered:p}=Tn(),[x,v]=M.useState(void 0),{useList:R,useDownloader:y,useSetStatus:b,useDuplicate:E,getQuotePDFFilename:j}=Ur(),{mutate:D}=b(),{mutate:F}=E(),{data:q,isPending:$,isError:Q,error:O}=R({pagination:{pageIndex:d.pageIndex,pageSize:d.pageSize},status:n,quickSearchTerm:h}),{download:k,...H}=y(),W=je=>{v(je)},B=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success")})},[o]),se=M.useCallback(je=>{r(`/quotes/edit/${je.id}`,{relative:"path"})},[r,o]),ce=je=>{F({id:je},{onSuccess(Me){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Me.id}`,{relative:"path"})}})},Y=je=>{D({id:je,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})},Re=(je,Me)=>{D({id:je,newStatus:Me},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w(`quotes.status.${Me}`)}),variant:"success"})}})},rt=M.useMemo(()=>{const je=[{id:"reference",accessorKey:"reference",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.reference")}),cell:({row:{original:U},renderValue:be})=>{const Je=!!((U==null?void 0:U.status)==="accepted"&&(U!=null&&U.date_sent));return i.jsx(G,{size:"sm",variant:"link",disabled:Je,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:it=>{it.preventDefault(),se(U)},children:i.jsx("div",{className:"",children:be()})})}},{id:"status",accessorKey:"status",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.status")}),cell:({row:{original:U}})=>i.jsx(Yd,{type:"badge",status:U.status,onChangeStatus:be=>Re(U.id,be)})},{id:"date_sent",accessor:"date_sent",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:w("quotes.list.columns.date_sent")}),cell:({row:{original:U}})=>{const be=Zn.create(U.date_sent),Je=be.isSuccess&&!be.object.isEmpty();return i.jsx("div",{className:"text-left text-ellipsis",children:Je?i.jsx(Td,{label:be.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:w("quotes.list.columns.date")}),cell:({row:{original:U}})=>{const be=Zn.create(U.date);return i.jsx("div",{className:"text-left text-ellipsis",children:be.isSuccess?be.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>i.jsx(i.Fragment,{children:w("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:w("quotes.list.columns.customer_information")}),cell:({row:{original:U}})=>i.jsx("div",{className:"text-left text-ellipsis",children:U.customer_information.split(`
|
||
`).map((be,Je)=>i.jsxs("span",{className:Je===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[be,i.jsx("br",{})]},Je))}),size:500}],Me=[{id:"row-actions",header:()=>null,cell:({row:{original:U}})=>{const be=(U==null?void 0:U.status)==="accepted"&&!(U!=null&&U.date_sent),Je=(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(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",disabled:Je,onClick:bn=>{bn.preventDefault(),se(U)},children:[i.jsx(pd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",onClick:bn=>{bn.preventDefault(),ce(U.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",onClick:()=>{k(U.id,j(U))},children:[i.jsx(gd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",disabled:it||Je,onClick:bn=>{bn.preventDefault(),Y(U.id)},children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Wd,{id:U.id,onSentTo:()=>null,disabled:Je||!be})})]})}}];return a?je:[...je,...Me]},[a]),{table:ee}=os({data:(q==null?void 0:q.items)??[],columns:rt,pageCount:(q==null?void 0:q.total_pages)??-1});return M.useEffect(()=>{ee&&q&&(q==null?void 0:q.total_pages)>0&&v(ee.getRowModel().rows[0])},[q,ee]),Q?i.jsx(ur,{subtitle:O.message}):$?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(Le,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),i.jsx("div",{})]}):(q==null?void 0:q.total_items)===0&&!p?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(as,{subtitle:"Empieza creando alguna cotización",buttonText:w("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(is,{table:ee,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:W,activeRowIndex:x==null?void 0:x.index,children:i.jsx(Vd,{table:ee})})}),a&&i.jsx("div",{id:c,className:"flex items-stretch ",children:i.jsx(Xw,{quoteId:x==null?void 0:x.original.id})})]}),i.jsx(Hd,{...H,onFinishDownload:B})]})},pS=()=>{const n=zt(),a=Tw(),{toast:r}=_n(),[o,l]=M.useState(Ma.createDefaultCode().object),[c,d]=M.useState(Pr.createDefaultCode().object),h=M.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",show_line_discount_column:!0,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_label:"% IVA",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:x}=Ur(),{data:v,status:R,error:y}=p(a),{mutate:b,isPending:E}=x(String(a)),j=Ji({mode:"onBlur",defaultValues:h}),{getValues:D,reset:F,handleSubmit:q,formState:$,control:Q,watch:O,setValue:k}=j,{isSubmitting:H,isDirty:W}=$;Mo({isDirty:W}),M.useEffect(()=>{if(!W)return;const{unsubscribe:ce}=O((Y,{name:Re,type:rt})=>{if(Re==="items"){Y.items&&Y.items.map((je,Me)=>{if(je){const U=eo(je);Fe.isEqual(U.subtotal_price.toObject(),je.subtotal_price)||k(`items.${Me}.subtotal_price`,U.subtotal_price.toObject()),Fe.isEqual(U.total_price.toObject(),je.total_price)||k(`items.${Me}.total_price`,U.total_price.toObject())}});const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}else if(Re&&rt==="change"){if(Re==="currency_code"){const ee=Ma.createFromCode(Y.currency_code??Ma.DEFAULT_CURRENCY_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;l(ee.object)}if(Re==="lang_code"){const ee=Pr.createFromCode(Y.lang_code??Pr.DEFAULT_LANGUAGE_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;d(ee.object)}if(["discount","tax"].includes(Re)){const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}if(Re!=null&&Re.startsWith("items")){const ee=Number(Re.split(".")[1]),je=Re.split(".")[2];if(["quantity","unit_price","discount"].includes(je)&&Y.items&&Y.items[ee]){const Me=Y.items[ee],U=eo(Me);Fe.isEqual(U.quantity.toObject(),Me.quantity)||k(`items.${ee}.quantity`,U.quantity.toObject()),Fe.isEqual(U.unit_price.toObject(),Me.unit_price)||k(`items.${ee}.unit_price`,U.unit_price.toObject()),Fe.isEqual(U.discount.toObject(),Me.discount)||k(`items.${ee}.discount`,U.discount.toObject()),Fe.isEqual(U.subtotal_price.toObject(),Me.subtotal_price)||k(`items.${ee}.subtotal_price`,U.subtotal_price.toObject()),Fe.isEqual(U.total_price.toObject(),Me.total_price)||k(`items.${ee}.total_price`,U.total_price.toObject());const be=Va(Y,!0);Fe.isEqual(be.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",be.subtotal_price.toObject()),Fe.isEqual(be.discount_price.toObject(),Y.total_price)||k("discount_price",be.discount_price.toObject()),Fe.isEqual(be.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",be.before_tax_price.toObject()),Fe.isEqual(be.tax_price.toObject(),Y.tax_price)||k("tax_price",be.tax_price.toObject()),Fe.isEqual(be.total_price.toObject(),Y.total_price)||k("total_price",be.total_price.toObject())}}}});return()=>ce()},[O,W,k]);const B=async(ce,Y)=>{b(ce,{onError:Re=>{console.error(Re),r({title:"Error",description:Re.message,variant:"destructive"})},onSuccess:()=>{F(D()),r({title:"Cotización guardada",variant:"success"}),Y&&n("/quotes")}})},se=M.useCallback(()=>{n("/quotes",{state:{id:a}})},[n,a]);return M.useEffect(()=>{R==="success"&&v&&F(v)},[R,v,F]),R==="error"?i.jsx(ur,{errorMessage:y.message}):R!=="success"?i.jsx(Dn,{}):i.jsxs(i.Fragment,{children:[(H||E)&&i.jsx(Dn,{title:"Guardando cotización"}),i.jsx(es,{...j,children:i.jsx("form",{onSubmit:q(ce=>B(ce,!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(Uc,{}),i.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[w("quotes.edit.title")," ",v.reference]}),i.jsx(Td,{label:w(`quotes.status.${v.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:w("common.close"),variant:"secondary",size:"sm",onClick:se}),i.jsx(wo,{label:w("common.save"),size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating}),i.jsx(G,{size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating,onClick:q(ce=>B(ce,!0)),children:w("common.save_close")})]})]}),i.jsx(Ww,{}),i.jsx(Ow,{currency:o}),i.jsx(Kw,{currency:o,language:c,defaultValues:h}),i.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[i.jsx(G,{variant:"outline",size:"sm",children:w("common.discard")}),i.jsx(G,{onClick:q(ce=>B(ce,!1)),size:"sm",children:w("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Jw=M.createContext(null),eS=({children:n})=>{const[a,r]=Bc();return i.jsx(Jw.Provider,{value:{pagination:a,setPagination:r},children:n})},xS=({children:n})=>i.jsx(ts,{children:i.jsx(eS,{children:i.jsxs(zr,{className:"quotes-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),vS=()=>{const n=zt(),[a,r]=M.useState("all"),[o,l]=pw(!0),c=[{value:"all",label:w("quotes.list.tabs.all")},{value:"draft",label:w("quotes.list.tabs.draft")},{value:"ready",label:w("quotes.list.tabs.ready")},{value:"delivered",label:w("quotes.list.tabs.delivered")},{value:"accepted",label:w("quotes.list.tabs.accepted")},{value:"rejected",label:w("quotes.list.tabs.rejected")},{value:"archived",label:w("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(G,{onClick:()=>n("/quotes/add"),children:[i.jsx(yo,{className:"w-4 h-4 mr-2"}),w("quotes.create.title")]})})]}),i.jsxs(ud,{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(cd,{className:"hidden sm:flex",children:c.map(d=>i.jsx(Ka,{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(cr,{children:w("quotes.list.tabs_title")}),i.jsxs(so,{value:a,onValueChange:r,children:[i.jsx(ao,{children:i.jsx(oo,{placeholder:"Seleccionar estado"})}),i.jsx(lo,{children:c.map(d=>i.jsx(Or,{value:d.value,children:d.label},d.value))})]})]})]}),i.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:i.jsx(sw,{buttonText:"Ayuda",title:"Ayuda sobre el Estado de Cotizaciones",content:tS})}),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(md,{className:"w-4 h-4 mr-2"}),w("common.disable_preview")]}):i.jsxs(i.Fragment,{children:[i.jsx(H0,{className:"w-4 h-4 mr-2"}),w("common.enable_preview")]})})})]}),c.map(d=>i.jsx(Wa,{value:d.value,children:i.jsx(Zw,{status:d.value,preview:o})},d.value))]})]})},tS=i.jsxs(no,{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."]})]}),nS=n=>{const a=$r(),r=Mn();return{useOne:()=>wd({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}}}},_S=()=>{var O,k;const[n,a]=M.useState("profile"),{useOne:r,useUpdate:o,useUploadLogo:l}=nS(),{toast:c}=_n(),{data:d,status:h,error:p}=r(),x=M.useMemo(()=>({contact_information:"",default_payment_method:"",default_notes:"",default_legal_terms:"",default_quote_validity:"",default_show_line_discount_column:!0,default_tax:{amount:void 0,scale:2},default_tax_label:"% IVA"}),[]),{mutate:v}=o(),{upload:R}=l(),y=Ji({mode:"onBlur",values:d==null?void 0:d.dealer,defaultValues:x}),{formState:b,reset:E,getValues:j,handleSubmit:D}=y,{isSubmitting:F,isDirty:q}=b,$=H=>{var B;const W=(B=H.target.files)==null?void 0:B[0];if(W){if(W.type!=="image/png"&&W.type!=="image/jpeg"){alert(w("settings.form_fields.logo.invalid_format"));return}const se=new FileReader;se.onloadend=()=>{const ce=new Image;ce.onload=()=>{const Y=ce.width,Re=ce.height,rt=Y/Re===2;Y<200||Re<100||!rt?alert(w("settings.form_fields.logo.invalid_dimensions")):R(W)},ce.src=se.result},se.readAsDataURL(W)}};Mo({isDirty:q});const Q=async H=>{v(H,{onError:W=>{console.debug(W),c({title:"Error",description:W.message,variant:"destructive"})},onSuccess:()=>{E(j()),c({description:"Ajustes guardados",variant:"success"})}})};return F?i.jsx(Dn,{title:"Guardando ajustes"}):h==="error"?i.jsx(ur,{errorMessage:p.message}):h!=="success"?i.jsx(Dn,{}):i.jsx(es,{...y,children:i.jsx("form",{onSubmit:D(Q),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:[((O=y.formState.errors.root)==null?void 0:O.message)&&i.jsxs(qc,{variant:"destructive",children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx($c,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx(zc,{children:(k=y.formState.errors.root)==null?void 0:k.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:he("grid gap-6",n==="profile"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:8,placeholder:w("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.desc"})})]}),i.jsx(Oe,{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(Dt,{className:"px-6 py-4 border-t",children:[i.jsx(cr,{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:$,className:"hidden"})]})]})]}),i.jsxs("div",{className:he("grid gap-6",n==="quotes"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_show_line_discount_column.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_show_line_discount_column.desc"})})]}),i.jsx(Oe,{children:i.jsx(P0,{control:y.control,name:"default_show_line_discount_column",render:({field:H})=>i.jsx(So,{checked:H.value??!0,onCheckedChange:H.onChange})})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),i.jsxs(Oe,{children:[i.jsx(mn,{maxLength:32,placeholder:w("settings.form_fields.default_tax_label.placeholder"),name:"default_tax_label",required:!0,description:w("settings.form_fields.default_tax_label.desc")}),i.jsx("br",{}),i.jsx(Hi,{scale:2,disabled:b.disabled,placeholder:w("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0,description:w("settings.form_fields.default_tax.desc")})]}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:y.formState.errors})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]})]}),i.jsx("div",{className:he("grid gap-6",n==="legal"?"visible":"hidden"),children:i.jsxs(Le,{className:"h-",children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:25,placeholder:w("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]})})]})})})},rS=M.createContext(null),iS=({children:n})=>i.jsx(rS.Provider,{value:{},children:n}),bS=({children:n})=>i.jsx(ts,{children:i.jsx(iS,{children:i.jsxs(zr,{className:"settings-layout",children:[i.jsx(Br,{}),i.jsxs(Vr,{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{uS as CatalogLayout,cS as CatalogList,dS as DashboardPage,fS as DealerLayout,gS as DealersList,mS as ErrorPage,oS as LoginPageWithLanguageSelector,lS as LogoutPage,hS as QuoteCreate,pS as QuoteEdit,xS as QuotesLayout,vS as QuotesList,_S as SettingsEditor,bS as SettingsLayout};
|