292 lines
290 KiB
JavaScript
292 lines
290 KiB
JavaScript
var Pv=Object.defineProperty;var qv=(n,o,r)=>o in n?Pv(n,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[o]=r;var je=(n,o,r)=>qv(n,typeof o!="symbol"?o+"":o,r);import{u as Fc,a as rn,b as Bt,c as qn,d as Re,j as i,P as kv,e as $v,f as pe,g as Bv,N as as,R as Pe,J as Et,h as qe,i as dr,D as fr,l as Ua,M as Ot,V as Uv,r as T,k as Dc,m as Mc,n as hr,o as Tc,B as H,C as Vv,p as pr,q as xr,s as _r,S as go,t as vr,v as es,w as b,x as mo,y as os,z as ls,A as us,E as Kr,F as ho,G as kn,H as $n,I as Bn,K as Un,L as zv,O as Vt,Q as Hv,T as Gv,U as Kv,W as Te,X as ct,Y as ze,Z as We,_ as Oe,$ as bn,a0 as po,a1 as Wv,a2 as xo,a3 as wn,a4 as _o,a5 as vo,a6 as Zr,a7 as Rt,a8 as Oc,a9 as Qv,aa as ts,ab as Hn,ac as bo,ad as wo,ae as Ln,af as So,ag as Lc,ah as jo,ai as Co,aj as yo,ak as cs,al as Yv,am as On,an as Pt,ao as pc,ap as Zv,aq as Xv,ar as Jv,as as No,at as Ht,au as Cn,av as ds,aw as Pc,ax as _n,ay as e0,az as qc,aA as t0,aB as oe,aC as fs,aD as xc,aE as kc,aF as $c,aG as Bc,aH as Vn,aI as Uc,aJ as gs,aK as ei,aL as ti,aM as ni,aN as Xr,aO as n0,aP as Vc,aQ as Qe,aR as Ye,aS as to,aT as Ze,aU as gr,aV as br,aW as mr,aX as r0,aY as i0,aZ as s0,a_ as no,a$ as a0,b0 as o0,b1 as ur,b2 as zc,b3 as ns,b4 as Hc,b5 as zn,b6 as Jr,b7 as Ut,b8 as l0,b9 as hn,ba as ms,bb as Gc,bc as u0,bd as hs,be as c0,bf as Kc,bg as Wc,bh as Qc,bi as Yc,bj as Zc,bk as Xc,bl as Jc,bm as ed,bn as td,bo as d0,bp as Qi,bq as f0,br as g0,bs as m0,bt as h0,bu as p0,bv as x0,bw as _0,bx as v0,by as b0,bz as w0,bA as S0,bB as _c,bC as nd,bD as rd,bE as id,bF as sd,bG as ad,bH as od,bI as ld,bJ as j0,bK as Va,bL as Wr,bM as C0,bN as ud,bO as y0,bP as N0,bQ as cd,bR as dd,bS as ro,bT as io,bU as R0,bV as E0,bW as A0}from"./index-BdgZcBCl.js";const I0=n=>{const{onSuccess:o,...r}=n||{},a=qn(),{login:l}=Fc(),c=rn();return Bt({mutationKey:a().auth().action("login").get(),mutationFn:l,onSuccess:async(d,m,p)=>{d.success&&c.removeQueries({queryKey:a().auth().get()}),await(o==null?void 0:o(d,m,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 fd=Re("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 F0=Re("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
|
||
* @license lucide-react v0.427.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vc=Re("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 bc=Re("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 D0=Re("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 M0=Re("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 gd=Re("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 T0=Re("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 O0=Re("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 L0=Re("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 Ro=Re("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 md=Re("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 P0=Re("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 hd=Re("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 q0=Re("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=Re("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 pd=Re("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 $0=Re("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 Eo=Re("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 Ao=Re("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 B0=Re("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 U0=Re("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 V0=Re("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 xd=Re("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 _d=Re("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,...o})=>i.jsx($v,{className:pe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...o}),wc=kv,H0=({withHandle:n,className:o,...r})=>i.jsx(Bv,{className:pe("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",o),...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(pd,{className:"h-2.5 w-2.5"})})});function ut({className:n,...o}){return i.jsx("div",{className:pe("animate-pulse rounded-md bg-muted",n),...o})}const G0=n=>typeof n=="object"&&n!==null&&n.hasOwnProperty("total_items");let Yi;const K0=new Uint8Array(16);function W0(){if(!Yi&&(Yi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yi(K0)}const Ke=[];for(let n=0;n<256;++n)Ke.push((n+256).toString(16).slice(1));function Q0(n,o=0){return Ke[n[o+0]]+Ke[n[o+1]]+Ke[n[o+2]]+Ke[n[o+3]]+"-"+Ke[n[o+4]]+Ke[n[o+5]]+"-"+Ke[n[o+6]]+Ke[n[o+7]]+"-"+Ke[n[o+8]]+Ke[n[o+9]]+"-"+Ke[n[o+10]]+Ke[n[o+11]]+Ke[n[o+12]]+Ke[n[o+13]]+Ke[n[o+14]]+Ke[n[o+15]]}const Y0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sc={randomUUID:Y0};function Z0(n,o,r){if(Sc.randomUUID&&!n)return Sc.randomUUID();n=n||{};const a=n.random||(n.rng||W0)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,Q0(a)}class pn extends as{static validate(o,r){const a=Pe.RULE_ALLOW_EMPTY.default(""),l=Et.string().guid({version:["uuidv4"]}).label(r.label?r.label:"id"),c=Et.alternatives(a,l);return Pe.validate(c,o)}static sanitize(o){return o.trim()}static create(o,r={}){const a={label:"id",generateOnEmpty:!1,...r};if(!o&&!a.generateOnEmpty)return qe.fail(dr(fr.INVALID_INPUT_DATA,"ID is null or empty"));if(o){const l=pn.validate(o,a);return l.isFailure?qe.fail(dr(fr.INVALID_INPUT_DATA,l.error.message,a)):qe.ok(new pn(pn.sanitize(l.object)))}return a.generateOnEmpty?pn.generateNewID():qe.ok(new pn(null))}static generateNewID(){return qe.ok(new pn(Z0()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const za={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"}},xn=class xn extends as{constructor(){super(...arguments);je(this,"toString",()=>this.code)}static validate(r,a){const l=Et.alternatives(Pe.RULE_ALLOW_EMPTY.default(""),Et.string().lowercase().valid(...Object.keys(za)).label(String(a.label)));return Pe.validate(l,r)}static sanitize(r){return r?String(r).toLowerCase():void 0}static createFromCode(r,a={}){const l={...a,label:a.label?a.label:"lang_code"},c=xn.validate(r,l);if(c.isFailure)return qe.fail(dr(fr.INVALID_INPUT_DATA,c.error.message,l));const d=xn.sanitize(c.object),m=d?{...za[c.object],code:d}:void 0;return qe.ok(new xn(m))}static createDefaultCode(){return xn.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()}};je(xn,"DEFAULT_LANGUAGE_CODE","es"),je(xn,"LANGUAGES",za);let Qr=xn;class vd{constructor(o){je(this,"_collection",[]);this._collection=o??[]}add(o){this._collection.push(o)}reset(){this._collection=[]}hasSomeFaultyResult(){return this._collection.some(o=>o.isFailure)}getFirstFaultyResult(){return this._collection.find(o=>o.isFailure)}getAllFaultyResults(){return this._collection.filter(o=>o.isFailure)}get objects(){return this._collection.filter(o=>o.isSuccess).map(o=>o.object)}get errors(){return this._collection.filter(o=>o.isFailure).map(o=>o.error)}}const bd=2,Ha={amount:0,scale:bd},ve=class ve extends as{constructor(r,a,l){super(r);je(this,"_isNull");je(this,"_options");je(this,"isEmpty",()=>this.isNull());je(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(a),this._options=Object.freeze(l)}static validate(r,a,l){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,m=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=Et.number().min(ve.MIN_SCALE).max(ve.MAX_SCALE).label(l.label?l.label:"scale"),_=new vd([Pe.validate(Et.alternatives(c,d,m,p),r),Pe.validate(Et.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),a)]);if(_.hasSomeFaultyResult())return _.getFirstFaultyResult();let j=typeof r=="string"?parseInt(r,10):Number(r),y=Ua.isNull(a)?ve.DEFAULT_SCALE:Number(a);const v=j/Math.pow(10,y);return v<ve.MIN_VALUE||v>ve.MAX_VALUE?qe.fail(new Error(`Value with scale is out of range: ${v}`)):qe.ok()}static create(r=Ha,a={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Ha.amount,scale:c=Ha.scale}=r,d={label:"percentage",...a},m=ve.validate(l,c,d);if(m.isFailure)return qe.fail(dr(fr.INVALID_INPUT_DATA,m.error.message,d));let p=ve._sanitize(l);const x={amount:Ua.isNull(p)?0:p,scale:c};return qe.ok(new this(x,Ua.isNull(p),a))}static createFromFormattedValue(r,a={}){if(r===null||r==="")return ve.create({amount:null,scale:ve.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let m=c,p=2;return d===void 0?p=0:(d===""&&(m=c+d.padEnd(1,"0"),p=1),d.length===1?(m=c+d.padEnd(1,"0"),p=1):d.length===2&&(m=c+d.padEnd(2,"0"),p=2)),ve.create({amount:m,scale:p},a)}static _sanitize(r){let a=null;return typeof r=="string"?a=parseInt(r,10):a=r,a}static _toString(r,a){if(r===null)return"";const l=Math.pow(10,a);return(Number(r)/l).toFixed(a)}static _isWithinRange(r,a){const l=Number(ve._toString(r,a));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 a=Math.pow(10,this.scale),l=Number(this.amount)/a,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)}};je(ve,"DEFAULT_SCALE",bd),je(ve,"MIN_VALUE",0),je(ve,"MAX_VALUE",100),je(ve,"MIN_SCALE",0),je(ve,"MAX_SCALE",2);let zt=ve;const wd=2,Ga={amount:0,scale:wd},be=class be extends as{constructor(r,a,l){super(r);je(this,"_isNull");je(this,"_options");je(this,"isEmpty",()=>this.isNull());je(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(a),this._options=Object.freeze(l)}static validate(r,a,l={}){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,m=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=Et.number().min(be.MIN_SCALE).max(be.MAX_SCALE).label(l.label?l.label:"scale"),_=new vd([Pe.validate(Et.alternatives(c,d,m,p),r),Pe.validate(Et.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),a)]);return _.hasSomeFaultyResult()?_.getFirstFaultyResult():qe.ok()}static create(r=Ga,a={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Ga.amount,scale:c=Ga.scale}=r,d={label:"quantity",...a},m=be.validate(l,c,d);if(m.isFailure)return qe.fail(dr(fr.INVALID_INPUT_DATA,m.error.message,d));let p=be._sanitize(l);const x={amount:p===null?0:p,scale:c};return qe.ok(new be(x,p===null,a))}static createFromFormattedValue(r,a={}){if(r===null||r==="")return be.create({amount:null,scale:be.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let m=c,p=2;return d===void 0?p=0:(d===""&&(m=c+d.padEnd(1,"0"),p=1),d.length===1?(m=c+d.padEnd(1,"0"),p=1):d.length===2&&(m=c+d.padEnd(2,"0"),p=2)),be.create({amount:m,scale:p},a)}static _sanitize(r){let a=null;return typeof r=="string"?a=parseInt(r,10):a=r,a}static _toString(r,a){if(r===null)return"";const l=Math.pow(10,a);return(Number(r)/l).toFixed(a)}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 be._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!==be.DEFAULT_SCALE?this.convertScale(be.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<be.MIN_SCALE||r>be.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new be({amount:null,scale:r},!0,this._options);const a=Math.pow(10,this.scale),l=Number(this.amount)/a,c=Math.pow(10,r),d=Math.round(l*c);return new be({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}increment(r){return this.isNull()?r?be.create(r.toObject()):be.create():r?this.hasSameScale(r)?be.create({amount:Number(this.amount)+Number(r.amount),scale:this.scale},this._options):qe.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):be.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(r){return this.isNull()?r?be.create(r.toObject()):be.create():r?this.hasSameScale(r)?be.create({amount:Number(this.amount)-Number(r.amount),scale:this.scale},this._options):qe.fail(Error("No se pueden restar cantidades con diferentes escalas.")):be.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};je(be,"DEFAULT_SCALE",wd),je(be,"MIN_SCALE",0),je(be,"MAX_SCALE",2);let Sn=be;const jc=2;class X0 extends Ot{static create(o){const{amount:r,currencyCode:a,scale:l=jc}=o,c=Ot.create({amount:r,currencyCode:a,scale:l});if(c.isFailure)return c;const d=c.object.convertScale(jc);return qe.ok(d)}}class cr extends Uv{constructor(){super(...arguments);je(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);je(this,"isEmpty",()=>!this.isValid());je(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");je(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");je(this,"toLocaleDateString",(r,a)=>this.isValid()?this.props.toLocaleDateString(r,a):"");je(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(r,a){const l=Pe.RULE_ALLOW_EMPTY.default(0),c=Et.date().label(String(a.label)),d=Et.alternatives(l,c);return Pe.validate(d,r)}static createCurrentDate(){return qe.ok(new cr(new Date))}static create(r,a={}){const l={...a,dateFormat:a.dateFormat?a.dateFormat:"YYYY-MM-DD",label:a.label?a.label:"date"},c=cr.validate(r,l);return c.isFailure?qe.fail(dr(fr.INVALID_INPUT_DATA,c.error.message,l)):qe.ok(new cr(new Date(c.object)))}toString(){if(!this.isEmpty()){const r=this.props.getFullYear(),a=String(this.props.getMonth()+1).padStart(2,"0"),l=String(this.props.getDate()).padStart(2,"0");return`${r}-${a}-${l}`}return""}toPrimitive(){return this.toISO8601()}}const J0=({isPending:n,interval:o=1e3,onInterval:r})=>{const[a,l]=T.useState(void 0);return T.useEffect(()=>{let c;return n&&(c=setInterval(()=>{l(d=>d===void 0?o:d+o)},o)),()=>{clearInterval(c),l(void 0)}},[n,o]),T.useEffect(()=>{r&&a&&r(a)},[a]),{elapsedTime:a}},eb=2*60*1e3,tb=60*1e3,Io=({queryKey:n,queryFn:o,enabled:r,select:a,queryOptions:l={},overtimeOptions:c})=>{const[d,m]=T.useState(!1),p=Dc({queryKey:n,queryFn:o,placeholderData:Mc,staleTime:tb,refetchInterval:eb,refetchOnWindowFocus:!0,enabled:r&&!!o,select:a,...l});T.useEffect(()=>{p.isSuccess&&G0(p.data)&&m(p.data.total_items===0)},[p]);const{elapsedTime:x}=J0({isPending:p.isFetching,interval:c==null?void 0:c.interval,onInterval:c==null?void 0:c.onInterval});return{...p,overtime:{elapsedTime:x},isEmpty:d}},Sd=n=>Dc({placeholderData:Mc,...n});function nb(n){return Bt({...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 rb(){return{accessor:(n,o)=>typeof n=="function"?{...o,accessorFn:n}:{...o,accessorKey:n},display:n=>n,group:n=>n}}function vn(n,o){return typeof n=="function"?n(o):n}function xt(n,o){return r=>{o.setState(a=>({...a,[n]:vn(r,a[n])}))}}function ps(n){return n instanceof Function}function ib(n){return Array.isArray(n)&&n.every(o=>typeof o=="number")}function sb(n,o){const r=[],a=l=>{l.forEach(c=>{r.push(c);const d=o(c);d!=null&&d.length&&a(d)})};return a(n),r}function Z(n,o,r){let a=[],l;return c=>{let d;r.key&&r.debug&&(d=Date.now());const m=n(c);if(!(m.length!==a.length||m.some((_,j)=>a[j]!==_)))return l;a=m;let x;if(r.key&&r.debug&&(x=Date.now()),l=o(...m),r==null||r.onChange==null||r.onChange(l),r.key&&r.debug&&r!=null&&r.debug()){const _=Math.round((Date.now()-d)*100)/100,j=Math.round((Date.now()-x)*100)/100,y=j/16,v=(E,N)=>{for(E=String(E);E.length<N;)E=" "+E;return E};console.info(`%c⏱ ${v(j,5)} /${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 X(n,o,r,a){return{debug:()=>{var l;return(l=n==null?void 0:n.debugAll)!=null?l:n[o]},key:!1,onChange:a}}function ab(n,o,r,a){const l=()=>{var d;return(d=c.getValue())!=null?d:n.options.renderFallbackValue},c={id:`${o.id}_${r.id}`,row:o,column:r,getValue:()=>o.getValue(a),renderValue:l,getContext:Z(()=>[n,r,o,c],(d,m,p,x)=>({table:d,column:m,row:p,cell:x,getValue:x.getValue,renderValue:x.renderValue}),X(n.options,"debugCells"))};return n._features.forEach(d=>{d.createCell==null||d.createCell(c,r,o,n)},{}),c}function ob(n,o,r,a){var l,c;const m={...n._getDefaultColumnDef(),...o},p=m.accessorKey;let x=(l=(c=m.id)!=null?c:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?l:typeof m.header=="string"?m.header:void 0,_;if(m.accessorFn?_=m.accessorFn:p&&(p.includes(".")?_=y=>{let v=y;for(const N of p.split(".")){var E;v=(E=v)==null?void 0:E[N]}return v}:_=y=>y[m.accessorKey]),!x)throw new Error;let j={id:`${String(x)}`,accessorFn:_,parent:a,depth:r,columnDef:m,columns:[],getFlatColumns:Z(()=>[!0],()=>{var y;return[j,...(y=j.columns)==null?void 0:y.flatMap(v=>v.getFlatColumns())]},X(n.options,"debugColumns")),getLeafColumns:Z(()=>[n._getOrderColumnsFn()],y=>{var v;if((v=j.columns)!=null&&v.length){let E=j.columns.flatMap(N=>N.getLeafColumns());return y(E)}return[j]},X(n.options,"debugColumns"))};for(const y of n._features)y.createColumn==null||y.createColumn(j,n);return j}const et="debugHeaders";function Cc(n,o,r){var a;let c={id:(a=r.id)!=null?a:o.id,column:o,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const d=[],m=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(m),d.push(p)};return m(c),d},getContext:()=>({table:n,header:c,column:o})};return n._features.forEach(d=>{d.createHeader==null||d.createHeader(c,n)}),c}const lb={createTable:n=>{n.getHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(o,r,a,l)=>{var c,d;const m=(c=a==null?void 0:a.map(j=>r.find(y=>y.id===j)).filter(Boolean))!=null?c:[],p=(d=l==null?void 0:l.map(j=>r.find(y=>y.id===j)).filter(Boolean))!=null?d:[],x=r.filter(j=>!(a!=null&&a.includes(j.id))&&!(l!=null&&l.includes(j.id)));return Zi(o,[...m,...x,...p],n)},X(n.options,et)),n.getCenterHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(o,r,a,l)=>(r=r.filter(c=>!(a!=null&&a.includes(c.id))&&!(l!=null&&l.includes(c.id))),Zi(o,r,n,"center")),X(n.options,et)),n.getLeftHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(o,r,a)=>{var l;const c=(l=a==null?void 0:a.map(d=>r.find(m=>m.id===d)).filter(Boolean))!=null?l:[];return Zi(o,c,n,"left")},X(n.options,et)),n.getRightHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(o,r,a)=>{var l;const c=(l=a==null?void 0:a.map(d=>r.find(m=>m.id===d)).filter(Boolean))!=null?l:[];return Zi(o,c,n,"right")},X(n.options,et)),n.getFooterGroups=Z(()=>[n.getHeaderGroups()],o=>[...o].reverse(),X(n.options,et)),n.getLeftFooterGroups=Z(()=>[n.getLeftHeaderGroups()],o=>[...o].reverse(),X(n.options,et)),n.getCenterFooterGroups=Z(()=>[n.getCenterHeaderGroups()],o=>[...o].reverse(),X(n.options,et)),n.getRightFooterGroups=Z(()=>[n.getRightHeaderGroups()],o=>[...o].reverse(),X(n.options,et)),n.getFlatHeaders=Z(()=>[n.getHeaderGroups()],o=>o.map(r=>r.headers).flat(),X(n.options,et)),n.getLeftFlatHeaders=Z(()=>[n.getLeftHeaderGroups()],o=>o.map(r=>r.headers).flat(),X(n.options,et)),n.getCenterFlatHeaders=Z(()=>[n.getCenterHeaderGroups()],o=>o.map(r=>r.headers).flat(),X(n.options,et)),n.getRightFlatHeaders=Z(()=>[n.getRightHeaderGroups()],o=>o.map(r=>r.headers).flat(),X(n.options,et)),n.getCenterLeafHeaders=Z(()=>[n.getCenterFlatHeaders()],o=>o.filter(r=>{var a;return!((a=r.subHeaders)!=null&&a.length)}),X(n.options,et)),n.getLeftLeafHeaders=Z(()=>[n.getLeftFlatHeaders()],o=>o.filter(r=>{var a;return!((a=r.subHeaders)!=null&&a.length)}),X(n.options,et)),n.getRightLeafHeaders=Z(()=>[n.getRightFlatHeaders()],o=>o.filter(r=>{var a;return!((a=r.subHeaders)!=null&&a.length)}),X(n.options,et)),n.getLeafHeaders=Z(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(o,r,a)=>{var l,c,d,m,p,x;return[...(l=(c=o[0])==null?void 0:c.headers)!=null?l:[],...(d=(m=r[0])==null?void 0:m.headers)!=null?d:[],...(p=(x=a[0])==null?void 0:x.headers)!=null?p:[]].map(_=>_.getLeafHeaders()).flat()},X(n.options,et))}};function Zi(n,o,r,a){var l,c;let d=0;const m=function(y,v){v===void 0&&(v=1),d=Math.max(d,v),y.filter(E=>E.getIsVisible()).forEach(E=>{var N;(N=E.columns)!=null&&N.length&&m(E.columns,v+1)},0)};m(n);let p=[];const x=(y,v)=>{const E={depth:v,id:[a,`${v}`].filter(Boolean).join("_"),headers:[]},N=[];y.forEach(L=>{const F=[...N].reverse()[0],$=L.column.depth===E.depth;let q,V=!1;if($&&L.column.parent?q=L.column.parent:(q=L.column,V=!0),F&&(F==null?void 0:F.column)===q)F.subHeaders.push(L);else{const O=Cc(r,q,{id:[a,v,q.id,L==null?void 0:L.id].filter(Boolean).join("_"),isPlaceholder:V,placeholderId:V?`${N.filter(k=>k.column===q).length}`:void 0,depth:v,index:N.length});O.subHeaders.push(L),N.push(O)}E.headers.push(L),L.headerGroup=E}),p.push(E),v>0&&x(N,v-1)},_=o.map((y,v)=>Cc(r,y,{depth:d,index:v}));x(_,d-1),p.reverse();const j=y=>y.filter(E=>E.column.getIsVisible()).map(E=>{let N=0,L=0,F=[0];E.subHeaders&&E.subHeaders.length?(F=[],j(E.subHeaders).forEach(q=>{let{colSpan:V,rowSpan:O}=q;N+=V,F.push(O)})):N=1;const $=Math.min(...F);return L=L+$,E.colSpan=N,E.rowSpan=L,{colSpan:N,rowSpan:L}});return j((l=(c=p[0])==null?void 0:c.headers)!=null?l:[]),p}const Fo=(n,o,r,a,l,c,d)=>{let m={id:o,index:a,original:r,depth:l,parentId:d,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(m._valuesCache.hasOwnProperty(p))return m._valuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return m._valuesCache[p]=x.accessorFn(m.original,a),m._valuesCache[p]},getUniqueValues:p=>{if(m._uniqueValuesCache.hasOwnProperty(p))return m._uniqueValuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return x.columnDef.getUniqueValues?(m._uniqueValuesCache[p]=x.columnDef.getUniqueValues(m.original,a),m._uniqueValuesCache[p]):(m._uniqueValuesCache[p]=[m.getValue(p)],m._uniqueValuesCache[p])},renderValue:p=>{var x;return(x=m.getValue(p))!=null?x:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>sb(m.subRows,p=>p.subRows),getParentRow:()=>m.parentId?n.getRow(m.parentId,!0):void 0,getParentRows:()=>{let p=[],x=m;for(;;){const _=x.getParentRow();if(!_)break;p.push(_),x=_}return p.reverse()},getAllCells:Z(()=>[n.getAllLeafColumns()],p=>p.map(x=>ab(n,m,x,x.id)),X(n.options,"debugRows")),_getAllCellsByColumnId:Z(()=>[m.getAllCells()],p=>p.reduce((x,_)=>(x[_.column.id]=_,x),{}),X(n.options,"debugRows"))};for(let p=0;p<n._features.length;p++){const x=n._features[p];x==null||x.createRow==null||x.createRow(m,n)}return m},ub={createColumn:(n,o)=>{n._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():o.getPreFilteredRowModel(),n._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},jd=(n,o,r)=>{var a,l;const c=r==null||(a=r.toString())==null?void 0:a.toLowerCase();return!!(!((l=n.getValue(o))==null||(l=l.toString())==null||(l=l.toLowerCase())==null)&&l.includes(c))};jd.autoRemove=n=>Lt(n);const Cd=(n,o,r)=>{var a;return!!(!((a=n.getValue(o))==null||(a=a.toString())==null)&&a.includes(r))};Cd.autoRemove=n=>Lt(n);const yd=(n,o,r)=>{var a;return((a=n.getValue(o))==null||(a=a.toString())==null?void 0:a.toLowerCase())===(r==null?void 0:r.toLowerCase())};yd.autoRemove=n=>Lt(n);const Nd=(n,o,r)=>{var a;return(a=n.getValue(o))==null?void 0:a.includes(r)};Nd.autoRemove=n=>Lt(n);const Rd=(n,o,r)=>!r.some(a=>{var l;return!((l=n.getValue(o))!=null&&l.includes(a))});Rd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Ed=(n,o,r)=>r.some(a=>{var l;return(l=n.getValue(o))==null?void 0:l.includes(a)});Ed.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Ad=(n,o,r)=>n.getValue(o)===r;Ad.autoRemove=n=>Lt(n);const Id=(n,o,r)=>n.getValue(o)==r;Id.autoRemove=n=>Lt(n);const Do=(n,o,r)=>{let[a,l]=r;const c=n.getValue(o);return c>=a&&c<=l};Do.resolveFilterValue=n=>{let[o,r]=n,a=typeof o!="number"?parseFloat(o):o,l=typeof r!="number"?parseFloat(r):r,c=o===null||Number.isNaN(a)?-1/0:a,d=r===null||Number.isNaN(l)?1/0:l;if(c>d){const m=c;c=d,d=m}return[c,d]};Do.autoRemove=n=>Lt(n)||Lt(n[0])&&Lt(n[1]);const nn={includesString:jd,includesStringSensitive:Cd,equalsString:yd,arrIncludes:Nd,arrIncludesAll:Rd,arrIncludesSome:Ed,equals:Ad,weakEquals:Id,inNumberRange:Do};function Lt(n){return n==null||n===""}const cb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:xt("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,o)=>{n.getAutoFilterFn=()=>{const r=o.getCoreRowModel().flatRows[0],a=r==null?void 0:r.getValue(n.id);return typeof a=="string"?nn.includesString:typeof a=="number"?nn.inNumberRange:typeof a=="boolean"||a!==null&&typeof a=="object"?nn.equals:Array.isArray(a)?nn.arrIncludes:nn.weakEquals},n.getFilterFn=()=>{var r,a;return ps(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(r=(a=o.options.filterFns)==null?void 0:a[n.columnDef.filterFn])!=null?r:nn[n.columnDef.filterFn]},n.getCanFilter=()=>{var r,a,l;return((r=n.columnDef.enableColumnFilter)!=null?r:!0)&&((a=o.options.enableColumnFilters)!=null?a:!0)&&((l=o.options.enableFilters)!=null?l:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var r;return(r=o.getState().columnFilters)==null||(r=r.find(a=>a.id===n.id))==null?void 0:r.value},n.getFilterIndex=()=>{var r,a;return(r=(a=o.getState().columnFilters)==null?void 0:a.findIndex(l=>l.id===n.id))!=null?r:-1},n.setFilterValue=r=>{o.setColumnFilters(a=>{const l=n.getFilterFn(),c=a==null?void 0:a.find(_=>_.id===n.id),d=vn(r,c?c.value:void 0);if(yc(l,d,n)){var m;return(m=a==null?void 0:a.filter(_=>_.id!==n.id))!=null?m:[]}const p={id:n.id,value:d};if(c){var x;return(x=a==null?void 0:a.map(_=>_.id===n.id?p:_))!=null?x:[]}return a!=null&&a.length?[...a,p]:[p]})}},createRow:(n,o)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=o=>{const r=n.getAllLeafColumns(),a=l=>{var c;return(c=vn(o,l))==null?void 0:c.filter(d=>{const m=r.find(p=>p.id===d.id);if(m){const p=m.getFilterFn();if(yc(p,d.value,m))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(a)},n.resetColumnFilters=o=>{var r,a;n.setColumnFilters(o?[]:(r=(a=n.initialState)==null?void 0:a.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 yc(n,o,r){return(n&&n.autoRemove?n.autoRemove(o,r):!1)||typeof o>"u"||typeof o=="string"&&!o}const db=(n,o,r)=>r.reduce((a,l)=>{const c=l.getValue(n);return a+(typeof c=="number"?c:0)},0),fb=(n,o,r)=>{let a;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(a>c||a===void 0&&c>=c)&&(a=c)}),a},gb=(n,o,r)=>{let a;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(a<c||a===void 0&&c>=c)&&(a=c)}),a},mb=(n,o,r)=>{let a,l;return r.forEach(c=>{const d=c.getValue(n);d!=null&&(a===void 0?d>=d&&(a=l=d):(a>d&&(a=d),l<d&&(l=d)))}),[a,l]},hb=(n,o)=>{let r=0,a=0;if(o.forEach(l=>{let c=l.getValue(n);c!=null&&(c=+c)>=c&&(++r,a+=c)}),r)return a/r},pb=(n,o)=>{if(!o.length)return;const r=o.map(c=>c.getValue(n));if(!ib(r))return;if(r.length===1)return r[0];const a=Math.floor(r.length/2),l=r.sort((c,d)=>c-d);return r.length%2!==0?l[a]:(l[a-1]+l[a])/2},xb=(n,o)=>Array.from(new Set(o.map(r=>r.getValue(n))).values()),_b=(n,o)=>new Set(o.map(r=>r.getValue(n))).size,vb=(n,o)=>o.length,Ka={sum:db,min:fb,max:gb,extent:mb,mean:hb,median:pb,unique:xb,uniqueCount:_b,count:vb},bb={getDefaultColumnDef:()=>({aggregatedCell:n=>{var o,r;return(o=(r=n.getValue())==null||r.toString==null?void 0:r.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:xt("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,o)=>{n.toggleGrouping=()=>{o.setGrouping(r=>r!=null&&r.includes(n.id)?r.filter(a=>a!==n.id):[...r??[],n.id])},n.getCanGroup=()=>{var r,a;return((r=n.columnDef.enableGrouping)!=null?r:!0)&&((a=o.options.enableGrouping)!=null?a:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var r;return(r=o.getState().grouping)==null?void 0:r.includes(n.id)},n.getGroupedIndex=()=>{var r;return(r=o.getState().grouping)==null?void 0:r.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const r=n.getCanGroup();return()=>{r&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const r=o.getCoreRowModel().flatRows[0],a=r==null?void 0:r.getValue(n.id);if(typeof a=="number")return Ka.sum;if(Object.prototype.toString.call(a)==="[object Date]")return Ka.extent},n.getAggregationFn=()=>{var r,a;if(!n)throw new Error;return ps(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(r=(a=o.options.aggregationFns)==null?void 0:a[n.columnDef.aggregationFn])!=null?r:Ka[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=o=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(o),n.resetGrouping=o=>{var r,a;n.setGrouping(o?[]:(r=(a=n.initialState)==null?void 0:a.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,o)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=r=>{if(n._groupingValuesCache.hasOwnProperty(r))return n._groupingValuesCache[r];const a=o.getColumn(r);return a!=null&&a.columnDef.getGroupingValue?(n._groupingValuesCache[r]=a.columnDef.getGroupingValue(n.original),n._groupingValuesCache[r]):n.getValue(r)},n._groupingValuesCache={}},createCell:(n,o,r,a)=>{n.getIsGrouped=()=>o.getIsGrouped()&&o.id===r.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&o.getIsGrouped(),n.getIsAggregated=()=>{var l;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((l=r.subRows)!=null&&l.length)}}};function wb(n,o,r){if(!(o!=null&&o.length)||!r)return n;const a=n.filter(c=>!o.includes(c.id));return r==="remove"?a:[...o.map(c=>n.find(d=>d.id===c)).filter(Boolean),...a]}const Sb={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:xt("columnOrder",n)}),createColumn:(n,o)=>{n.getIndex=Z(r=>[Yr(o,r)],r=>r.findIndex(a=>a.id===n.id),X(o.options,"debugColumns")),n.getIsFirstColumn=r=>{var a;return((a=Yr(o,r)[0])==null?void 0:a.id)===n.id},n.getIsLastColumn=r=>{var a;const l=Yr(o,r);return((a=l[l.length-1])==null?void 0:a.id)===n.id}},createTable:n=>{n.setColumnOrder=o=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(o),n.resetColumnOrder=o=>{var r;n.setColumnOrder(o?[]:(r=n.initialState.columnOrder)!=null?r:[])},n._getOrderColumnsFn=Z(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(o,r,a)=>l=>{let c=[];if(!(o!=null&&o.length))c=l;else{const d=[...o],m=[...l];for(;m.length&&d.length;){const p=d.shift(),x=m.findIndex(_=>_.id===p);x>-1&&c.push(m.splice(x,1)[0])}c=[...c,...m]}return wb(c,r,a)},X(n.options,"debugTable"))}},Wa=()=>({left:[],right:[]}),jb={getInitialState:n=>({columnPinning:Wa(),...n}),getDefaultOptions:n=>({onColumnPinningChange:xt("columnPinning",n)}),createColumn:(n,o)=>{n.pin=r=>{const a=n.getLeafColumns().map(l=>l.id).filter(Boolean);o.setColumnPinning(l=>{var c,d;if(r==="right"){var m,p;return{left:((m=l==null?void 0:l.left)!=null?m:[]).filter(j=>!(a!=null&&a.includes(j))),right:[...((p=l==null?void 0:l.right)!=null?p:[]).filter(j=>!(a!=null&&a.includes(j))),...a]}}if(r==="left"){var x,_;return{left:[...((x=l==null?void 0:l.left)!=null?x:[]).filter(j=>!(a!=null&&a.includes(j))),...a],right:((_=l==null?void 0:l.right)!=null?_:[]).filter(j=>!(a!=null&&a.includes(j)))}}return{left:((c=l==null?void 0:l.left)!=null?c:[]).filter(j=>!(a!=null&&a.includes(j))),right:((d=l==null?void 0:l.right)!=null?d:[]).filter(j=>!(a!=null&&a.includes(j)))}})},n.getCanPin=()=>n.getLeafColumns().some(a=>{var l,c,d;return((l=a.columnDef.enablePinning)!=null?l:!0)&&((c=(d=o.options.enableColumnPinning)!=null?d:o.options.enablePinning)!=null?c:!0)}),n.getIsPinned=()=>{const r=n.getLeafColumns().map(m=>m.id),{left:a,right:l}=o.getState().columnPinning,c=r.some(m=>a==null?void 0:a.includes(m)),d=r.some(m=>l==null?void 0:l.includes(m));return c?"left":d?"right":!1},n.getPinnedIndex=()=>{var r,a;const l=n.getIsPinned();return l?(r=(a=o.getState().columnPinning)==null||(a=a[l])==null?void 0:a.indexOf(n.id))!=null?r:-1:0}},createRow:(n,o)=>{n.getCenterVisibleCells=Z(()=>[n._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(r,a,l)=>{const c=[...a??[],...l??[]];return r.filter(d=>!c.includes(d.column.id))},X(o.options,"debugRows")),n.getLeftVisibleCells=Z(()=>[n._getAllVisibleCells(),o.getState().columnPinning.left],(r,a)=>(a??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"left"})),X(o.options,"debugRows")),n.getRightVisibleCells=Z(()=>[n._getAllVisibleCells(),o.getState().columnPinning.right],(r,a)=>(a??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"right"})),X(o.options,"debugRows"))},createTable:n=>{n.setColumnPinning=o=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(o),n.resetColumnPinning=o=>{var r,a;return n.setColumnPinning(o?Wa():(r=(a=n.initialState)==null?void 0:a.columnPinning)!=null?r:Wa())},n.getIsSomeColumnsPinned=o=>{var r;const a=n.getState().columnPinning;if(!o){var l,c;return!!((l=a.left)!=null&&l.length||(c=a.right)!=null&&c.length)}return!!((r=a[o])!=null&&r.length)},n.getLeftLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(o,r)=>(r??[]).map(a=>o.find(l=>l.id===a)).filter(Boolean),X(n.options,"debugColumns")),n.getRightLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(o,r)=>(r??[]).map(a=>o.find(l=>l.id===a)).filter(Boolean),X(n.options,"debugColumns")),n.getCenterLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(o,r,a)=>{const l=[...r??[],...a??[]];return o.filter(c=>!l.includes(c.id))},X(n.options,"debugColumns"))}},Xi={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Qa=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Cb={getDefaultColumnDef:()=>Xi,getInitialState:n=>({columnSizing:{},columnSizingInfo:Qa(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xt("columnSizing",n),onColumnSizingInfoChange:xt("columnSizingInfo",n)}),createColumn:(n,o)=>{n.getSize=()=>{var r,a,l;const c=o.getState().columnSizing[n.id];return Math.min(Math.max((r=n.columnDef.minSize)!=null?r:Xi.minSize,(a=c??n.columnDef.size)!=null?a:Xi.size),(l=n.columnDef.maxSize)!=null?l:Xi.maxSize)},n.getStart=Z(r=>[r,Yr(o,r),o.getState().columnSizing],(r,a)=>a.slice(0,n.getIndex(r)).reduce((l,c)=>l+c.getSize(),0),X(o.options,"debugColumns")),n.getAfter=Z(r=>[r,Yr(o,r),o.getState().columnSizing],(r,a)=>a.slice(n.getIndex(r)+1).reduce((l,c)=>l+c.getSize(),0),X(o.options,"debugColumns")),n.resetSize=()=>{o.setColumnSizing(r=>{let{[n.id]:a,...l}=r;return l})},n.getCanResize=()=>{var r,a;return((r=n.columnDef.enableResizing)!=null?r:!0)&&((a=o.options.enableColumnResizing)!=null?a:!0)},n.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,o)=>{n.getSize=()=>{let r=0;const a=l=>{if(l.subHeaders.length)l.subHeaders.forEach(a);else{var c;r+=(c=l.column.getSize())!=null?c:0}};return a(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 a=o.getColumn(n.column.id),l=a==null?void 0:a.getCanResize();return c=>{if(!a||!l||(c.persist==null||c.persist(),Ya(c)&&c.touches&&c.touches.length>1))return;const d=n.getSize(),m=n?n.getLeafHeaders().map(F=>[F.column.id,F.column.getSize()]):[[a.id,a.getSize()]],p=Ya(c)?Math.round(c.touches[0].clientX):c.clientX,x={},_=(F,$)=>{typeof $=="number"&&(o.setColumnSizingInfo(q=>{var V,O;const k=o.options.columnResizeDirection==="rtl"?-1:1,G=($-((V=q==null?void 0:q.startOffset)!=null?V:0))*k,ne=Math.max(G/((O=q==null?void 0:q.startSize)!=null?O:0),-.999999);return q.columnSizingStart.forEach(U=>{let[re,Q]=U;x[re]=Math.round(Math.max(Q+Q*ne,0)*100)/100}),{...q,deltaOffset:G,deltaPercentage:ne}}),(o.options.columnResizeMode==="onChange"||F==="end")&&o.setColumnSizing(q=>({...q,...x})))},j=F=>_("move",F),y=F=>{_("end",F),o.setColumnSizingInfo($=>({...$,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},v=r||typeof document<"u"?document:null,E={moveHandler:F=>j(F.clientX),upHandler:F=>{v==null||v.removeEventListener("mousemove",E.moveHandler),v==null||v.removeEventListener("mouseup",E.upHandler),y(F.clientX)}},N={moveHandler:F=>(F.cancelable&&(F.preventDefault(),F.stopPropagation()),j(F.touches[0].clientX),!1),upHandler:F=>{var $;v==null||v.removeEventListener("touchmove",N.moveHandler),v==null||v.removeEventListener("touchend",N.upHandler),F.cancelable&&(F.preventDefault(),F.stopPropagation()),y(($=F.touches[0])==null?void 0:$.clientX)}},L=yb()?{passive:!1}:!1;Ya(c)?(v==null||v.addEventListener("touchmove",N.moveHandler,L),v==null||v.addEventListener("touchend",N.upHandler,L)):(v==null||v.addEventListener("mousemove",E.moveHandler,L),v==null||v.addEventListener("mouseup",E.upHandler,L)),o.setColumnSizingInfo(F=>({...F,startOffset:p,startSize:d,deltaOffset:0,deltaPercentage:0,columnSizingStart:m,isResizingColumn:a.id}))}}},createTable:n=>{n.setColumnSizing=o=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(o),n.setColumnSizingInfo=o=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(o),n.resetColumnSizing=o=>{var r;n.setColumnSizing(o?{}:(r=n.initialState.columnSizing)!=null?r:{})},n.resetHeaderSizeInfo=o=>{var r;n.setColumnSizingInfo(o?Qa():(r=n.initialState.columnSizingInfo)!=null?r:Qa())},n.getTotalSize=()=>{var o,r;return(o=(r=n.getHeaderGroups()[0])==null?void 0:r.headers.reduce((a,l)=>a+l.getSize(),0))!=null?o:0},n.getLeftTotalSize=()=>{var o,r;return(o=(r=n.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((a,l)=>a+l.getSize(),0))!=null?o:0},n.getCenterTotalSize=()=>{var o,r;return(o=(r=n.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((a,l)=>a+l.getSize(),0))!=null?o:0},n.getRightTotalSize=()=>{var o,r;return(o=(r=n.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((a,l)=>a+l.getSize(),0))!=null?o:0}}};let Ji=null;function yb(){if(typeof Ji=="boolean")return Ji;let n=!1;try{const o={get passive(){return n=!0,!1}},r=()=>{};window.addEventListener("test",r,o),window.removeEventListener("test",r)}catch{n=!1}return Ji=n,Ji}function Ya(n){return n.type==="touchstart"}const Nb={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:xt("columnVisibility",n)}),createColumn:(n,o)=>{n.toggleVisibility=r=>{n.getCanHide()&&o.setColumnVisibility(a=>({...a,[n.id]:r??!n.getIsVisible()}))},n.getIsVisible=()=>{var r,a;const l=n.columns;return(r=l.length?l.some(c=>c.getIsVisible()):(a=o.getState().columnVisibility)==null?void 0:a[n.id])!=null?r:!0},n.getCanHide=()=>{var r,a;return((r=n.columnDef.enableHiding)!=null?r:!0)&&((a=o.options.enableHiding)!=null?a:!0)},n.getToggleVisibilityHandler=()=>r=>{n.toggleVisibility==null||n.toggleVisibility(r.target.checked)}},createRow:(n,o)=>{n._getAllVisibleCells=Z(()=>[n.getAllCells(),o.getState().columnVisibility],r=>r.filter(a=>a.column.getIsVisible()),X(o.options,"debugRows")),n.getVisibleCells=Z(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(r,a,l)=>[...r,...a,...l],X(o.options,"debugRows"))},createTable:n=>{const o=(r,a)=>Z(()=>[a(),a().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(c=>c.getIsVisible==null?void 0:c.getIsVisible()),X(n.options,"debugColumns"));n.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=r=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(r),n.resetColumnVisibility=r=>{var a;n.setColumnVisibility(r?{}:(a=n.initialState.columnVisibility)!=null?a:{})},n.toggleAllColumnsVisible=r=>{var a;r=(a=r)!=null?a:!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 a;n.toggleAllColumnsVisible((a=r.target)==null?void 0:a.checked)}}};function Yr(n,o){return o?o==="center"?n.getCenterVisibleLeafColumns():o==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const Rb={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()}}},Eb={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:xt("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var r;const a=(r=n.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[o.id])==null?void 0:r.getValue();return typeof a=="string"||typeof a=="number"}}),createColumn:(n,o)=>{n.getCanGlobalFilter=()=>{var r,a,l,c;return((r=n.columnDef.enableGlobalFilter)!=null?r:!0)&&((a=o.options.enableGlobalFilter)!=null?a:!0)&&((l=o.options.enableFilters)!=null?l:!0)&&((c=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(n))!=null?c:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>nn.includesString,n.getGlobalFilterFn=()=>{var o,r;const{globalFilterFn:a}=n.options;return ps(a)?a:a==="auto"?n.getGlobalAutoFilterFn():(o=(r=n.options.filterFns)==null?void 0:r[a])!=null?o:nn[a]},n.setGlobalFilter=o=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(o)},n.resetGlobalFilter=o=>{n.setGlobalFilter(o?void 0:n.initialState.globalFilter)}}},Ab={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:xt("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let o=!1,r=!1;n._autoResetExpanded=()=>{var a,l;if(!o){n._queue(()=>{o=!0});return}if((a=(l=n.options.autoResetAll)!=null?l:n.options.autoResetExpanded)!=null?a:!n.options.manualExpanding){if(r)return;r=!0,n._queue(()=>{n.resetExpanded(),r=!1})}},n.setExpanded=a=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(a),n.toggleAllRowsExpanded=a=>{a??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=a=>{var l,c;n.setExpanded(a?{}:(l=(c=n.initialState)==null?void 0:c.expanded)!=null?l:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(a=>a.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>a=>{a.persist==null||a.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const a=n.getState().expanded;return a===!0||Object.values(a).some(Boolean)},n.getIsAllRowsExpanded=()=>{const a=n.getState().expanded;return typeof a=="boolean"?a===!0:!(!Object.keys(a).length||n.getRowModel().flatRows.some(l=>!l.getIsExpanded()))},n.getExpandedDepth=()=>{let a=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(c=>{const d=c.split(".");a=Math.max(a,d.length)}),a},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,o)=>{n.toggleExpanded=r=>{o.setExpanded(a=>{var l;const c=a===!0?!0:!!(a!=null&&a[n.id]);let d={};if(a===!0?Object.keys(o.getRowModel().rowsById).forEach(m=>{d[m]=!0}):d=a,r=(l=r)!=null?l:!c,!c&&r)return{...d,[n.id]:!0};if(c&&!r){const{[n.id]:m,...p}=d;return p}return a})},n.getIsExpanded=()=>{var r;const a=o.getState().expanded;return!!((r=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(n))!=null?r:a===!0||a!=null&&a[n.id])},n.getCanExpand=()=>{var r,a,l;return(r=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(n))!=null?r:((a=o.options.enableExpanding)!=null?a:!0)&&!!((l=n.subRows)!=null&&l.length)},n.getIsAllParentsExpanded=()=>{let r=!0,a=n;for(;r&&a.parentId;)a=o.getRow(a.parentId,!0),r=a.getIsExpanded();return r},n.getToggleExpandedHandler=()=>{const r=n.getCanExpand();return()=>{r&&n.toggleExpanded()}}}},so=0,ao=10,Za=()=>({pageIndex:so,pageSize:ao}),Ib={getInitialState:n=>({...n,pagination:{...Za(),...n==null?void 0:n.pagination}}),getDefaultOptions:n=>({onPaginationChange:xt("pagination",n)}),createTable:n=>{let o=!1,r=!1;n._autoResetPageIndex=()=>{var a,l;if(!o){n._queue(()=>{o=!0});return}if((a=(l=n.options.autoResetAll)!=null?l:n.options.autoResetPageIndex)!=null?a:!n.options.manualPagination){if(r)return;r=!0,n._queue(()=>{n.resetPageIndex(),r=!1})}},n.setPagination=a=>{const l=c=>vn(a,c);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(l)},n.resetPagination=a=>{var l;n.setPagination(a?Za():(l=n.initialState.pagination)!=null?l:Za())},n.setPageIndex=a=>{n.setPagination(l=>{let c=vn(a,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=a=>{var l,c;n.setPageIndex(a?so:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageIndex)!=null?l:so)},n.resetPageSize=a=>{var l,c;n.setPageSize(a?ao:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageSize)!=null?l:ao)},n.setPageSize=a=>{n.setPagination(l=>{const c=Math.max(1,vn(a,l.pageSize)),d=l.pageSize*l.pageIndex,m=Math.floor(d/c);return{...l,pageIndex:m,pageSize:c}})},n.setPageCount=a=>n.setPagination(l=>{var c;let d=vn(a,(c=n.options.pageCount)!=null?c:-1);return typeof d=="number"&&(d=Math.max(-1,d)),{...l,pageCount:d}}),n.getPageOptions=Z(()=>[n.getPageCount()],a=>{let l=[];return a&&a>0&&(l=[...new Array(a)].fill(null).map((c,d)=>d)),l},X(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:a}=n.getState().pagination,l=n.getPageCount();return l===-1?!0:l===0?!1:a<l-1},n.previousPage=()=>n.setPageIndex(a=>a-1),n.nextPage=()=>n.setPageIndex(a=>a+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 a;return(a=n.options.pageCount)!=null?a:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var a;return(a=n.options.rowCount)!=null?a:n.getPrePaginationRowModel().rows.length}}},Xa=()=>({top:[],bottom:[]}),Fb={getInitialState:n=>({rowPinning:Xa(),...n}),getDefaultOptions:n=>({onRowPinningChange:xt("rowPinning",n)}),createRow:(n,o)=>{n.pin=(r,a,l)=>{const c=a?n.getLeafRows().map(p=>{let{id:x}=p;return x}):[],d=l?n.getParentRows().map(p=>{let{id:x}=p;return x}):[],m=new Set([...d,n.id,...c]);o.setRowPinning(p=>{var x,_;if(r==="bottom"){var j,y;return{top:((j=p==null?void 0:p.top)!=null?j:[]).filter(N=>!(m!=null&&m.has(N))),bottom:[...((y=p==null?void 0:p.bottom)!=null?y:[]).filter(N=>!(m!=null&&m.has(N))),...Array.from(m)]}}if(r==="top"){var v,E;return{top:[...((v=p==null?void 0:p.top)!=null?v:[]).filter(N=>!(m!=null&&m.has(N))),...Array.from(m)],bottom:((E=p==null?void 0:p.bottom)!=null?E:[]).filter(N=>!(m!=null&&m.has(N)))}}return{top:((x=p==null?void 0:p.top)!=null?x:[]).filter(N=>!(m!=null&&m.has(N))),bottom:((_=p==null?void 0:p.bottom)!=null?_:[]).filter(N=>!(m!=null&&m.has(N)))}})},n.getCanPin=()=>{var r;const{enableRowPinning:a,enablePinning:l}=o.options;return typeof a=="function"?a(n):(r=a??l)!=null?r:!0},n.getIsPinned=()=>{const r=[n.id],{top:a,bottom:l}=o.getState().rowPinning,c=r.some(m=>a==null?void 0:a.includes(m)),d=r.some(m=>l==null?void 0:l.includes(m));return c?"top":d?"bottom":!1},n.getPinnedIndex=()=>{var r,a;const l=n.getIsPinned();if(!l)return-1;const c=(r=l==="top"?o.getTopRows():o.getBottomRows())==null?void 0:r.map(d=>{let{id:m}=d;return m});return(a=c==null?void 0:c.indexOf(n.id))!=null?a:-1}},createTable:n=>{n.setRowPinning=o=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(o),n.resetRowPinning=o=>{var r,a;return n.setRowPinning(o?Xa():(r=(a=n.initialState)==null?void 0:a.rowPinning)!=null?r:Xa())},n.getIsSomeRowsPinned=o=>{var r;const a=n.getState().rowPinning;if(!o){var l,c;return!!((l=a.top)!=null&&l.length||(c=a.bottom)!=null&&c.length)}return!!((r=a[o])!=null&&r.length)},n._getPinnedRows=(o,r,a)=>{var l;return((l=n.options.keepPinnedRows)==null||l?(r??[]).map(d=>{const m=n.getRow(d,!0);return m.getIsAllParentsExpanded()?m:null}):(r??[]).map(d=>o.find(m=>m.id===d))).filter(Boolean).map(d=>({...d,position:a}))},n.getTopRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(o,r)=>n._getPinnedRows(o,r,"top"),X(n.options,"debugRows")),n.getBottomRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(o,r)=>n._getPinnedRows(o,r,"bottom"),X(n.options,"debugRows")),n.getCenterRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(o,r,a)=>{const l=new Set([...r??[],...a??[]]);return o.filter(c=>!l.has(c.id))},X(n.options,"debugRows"))}},Db={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:xt("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=o=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(o),n.resetRowSelection=o=>{var r;return n.setRowSelection(o?{}:(r=n.initialState.rowSelection)!=null?r:{})},n.toggleAllRowsSelected=o=>{n.setRowSelection(r=>{o=typeof o<"u"?o:!n.getIsAllRowsSelected();const a={...r},l=n.getPreGroupedRowModel().flatRows;return o?l.forEach(c=>{c.getCanSelect()&&(a[c.id]=!0)}):l.forEach(c=>{delete a[c.id]}),a})},n.toggleAllPageRowsSelected=o=>n.setRowSelection(r=>{const a=typeof o<"u"?o:!n.getIsAllPageRowsSelected(),l={...r};return n.getRowModel().rows.forEach(c=>{oo(l,c.id,a,!0,n)}),l}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getCoreRowModel()],(o,r)=>Object.keys(o).length?Ja(n,r):{rows:[],flatRows:[],rowsById:{}},X(n.options,"debugTable")),n.getFilteredSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(o,r)=>Object.keys(o).length?Ja(n,r):{rows:[],flatRows:[],rowsById:{}},X(n.options,"debugTable")),n.getGroupedSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getSortedRowModel()],(o,r)=>Object.keys(o).length?Ja(n,r):{rows:[],flatRows:[],rowsById:{}},X(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const o=n.getFilteredRowModel().flatRows,{rowSelection:r}=n.getState();let a=!!(o.length&&Object.keys(r).length);return a&&o.some(l=>l.getCanSelect()&&!r[l.id])&&(a=!1),a},n.getIsAllPageRowsSelected=()=>{const o=n.getPaginationRowModel().flatRows.filter(l=>l.getCanSelect()),{rowSelection:r}=n.getState();let a=!!o.length;return a&&o.some(l=>!r[l.id])&&(a=!1),a},n.getIsSomeRowsSelected=()=>{var o;const r=Object.keys((o=n.getState().rowSelection)!=null?o:{}).length;return r>0&&r<n.getFilteredRowModel().flatRows.length},n.getIsSomePageRowsSelected=()=>{const o=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:o.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>o=>{n.toggleAllRowsSelected(o.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>o=>{n.toggleAllPageRowsSelected(o.target.checked)}},createRow:(n,o)=>{n.toggleSelected=(r,a)=>{const l=n.getIsSelected();o.setRowSelection(c=>{var d;if(r=typeof r<"u"?r:!l,n.getCanSelect()&&l===r)return c;const m={...c};return oo(m,n.id,r,(d=a==null?void 0:a.selectChildren)!=null?d:!0,o),m})},n.getIsSelected=()=>{const{rowSelection:r}=o.getState();return Mo(n,r)},n.getIsSomeSelected=()=>{const{rowSelection:r}=o.getState();return lo(n,r)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=o.getState();return lo(n,r)==="all"},n.getCanSelect=()=>{var r;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(n):(r=o.options.enableRowSelection)!=null?r:!0},n.getCanSelectSubRows=()=>{var r;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(n):(r=o.options.enableSubRowSelection)!=null?r:!0},n.getCanMultiSelect=()=>{var r;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(n):(r=o.options.enableMultiRowSelection)!=null?r:!0},n.getToggleSelectedHandler=()=>{const r=n.getCanSelect();return a=>{var l;r&&n.toggleSelected((l=a.target)==null?void 0:l.checked)}}}},oo=(n,o,r,a,l)=>{var c;const d=l.getRow(o,!0);r?(d.getCanMultiSelect()||Object.keys(n).forEach(m=>delete n[m]),d.getCanSelect()&&(n[o]=!0)):delete n[o],a&&(c=d.subRows)!=null&&c.length&&d.getCanSelectSubRows()&&d.subRows.forEach(m=>oo(n,m.id,r,a,l))};function Ja(n,o){const r=n.getState().rowSelection,a=[],l={},c=function(d,m){return d.map(p=>{var x;const _=Mo(p,r);if(_&&(a.push(p),l[p.id]=p),(x=p.subRows)!=null&&x.length&&(p={...p,subRows:c(p.subRows)}),_)return p}).filter(Boolean)};return{rows:c(o.rows),flatRows:a,rowsById:l}}function Mo(n,o){var r;return(r=o[n.id])!=null?r:!1}function lo(n,o,r){var a;if(!((a=n.subRows)!=null&&a.length))return!1;let l=!0,c=!1;return n.subRows.forEach(d=>{if(!(c&&!l)&&(d.getCanSelect()&&(Mo(d,o)?c=!0:l=!1),d.subRows&&d.subRows.length)){const m=lo(d,o);m==="all"?c=!0:(m==="some"&&(c=!0),l=!1)}}),l?"all":c?"some":!1}const uo=/([0-9]+)/gm,Mb=(n,o,r)=>Fd(jn(n.getValue(r)).toLowerCase(),jn(o.getValue(r)).toLowerCase()),Tb=(n,o,r)=>Fd(jn(n.getValue(r)),jn(o.getValue(r))),Ob=(n,o,r)=>To(jn(n.getValue(r)).toLowerCase(),jn(o.getValue(r)).toLowerCase()),Lb=(n,o,r)=>To(jn(n.getValue(r)),jn(o.getValue(r))),Pb=(n,o,r)=>{const a=n.getValue(r),l=o.getValue(r);return a>l?1:a<l?-1:0},qb=(n,o,r)=>To(n.getValue(r),o.getValue(r));function To(n,o){return n===o?0:n>o?1:-1}function jn(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function Fd(n,o){const r=n.split(uo).filter(Boolean),a=o.split(uo).filter(Boolean);for(;r.length&&a.length;){const l=r.shift(),c=a.shift(),d=parseInt(l,10),m=parseInt(c,10),p=[d,m].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>m)return 1;if(m>d)return-1}return r.length-a.length}const Hr={alphanumeric:Mb,alphanumericCaseSensitive:Tb,text:Ob,textCaseSensitive:Lb,datetime:Pb,basic:qb},kb={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:xt("sorting",n),isMultiSortEvent:o=>o.shiftKey}),createColumn:(n,o)=>{n.getAutoSortingFn=()=>{const r=o.getFilteredRowModel().flatRows.slice(10);let a=!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 Hr.datetime;if(typeof c=="string"&&(a=!0,c.split(uo).length>1))return Hr.alphanumeric}return a?Hr.text:Hr.basic},n.getAutoSortDir=()=>{const r=o.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(n.id))=="string"?"asc":"desc"},n.getSortingFn=()=>{var r,a;if(!n)throw new Error;return ps(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(r=(a=o.options.sortingFns)==null?void 0:a[n.columnDef.sortingFn])!=null?r:Hr[n.columnDef.sortingFn]},n.toggleSorting=(r,a)=>{const l=n.getNextSortingOrder(),c=typeof r<"u"&&r!==null;o.setSorting(d=>{const m=d==null?void 0:d.find(v=>v.id===n.id),p=d==null?void 0:d.findIndex(v=>v.id===n.id);let x=[],_,j=c?r:l==="desc";if(d!=null&&d.length&&n.getCanMultiSort()&&a?m?_="toggle":_="add":d!=null&&d.length&&p!==d.length-1?_="replace":m?_="toggle":_="replace",_==="toggle"&&(c||l||(_="remove")),_==="add"){var y;x=[...d,{id:n.id,desc:j}],x.splice(0,x.length-((y=o.options.maxMultiSortColCount)!=null?y:Number.MAX_SAFE_INTEGER))}else _==="toggle"?x=d.map(v=>v.id===n.id?{...v,desc:j}:v):_==="remove"?x=d.filter(v=>v.id!==n.id):x=[{id:n.id,desc:j}];return x})},n.getFirstSortDir=()=>{var r,a;return((r=(a=n.columnDef.sortDescFirst)!=null?a:o.options.sortDescFirst)!=null?r:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=r=>{var a,l;const c=n.getFirstSortDir(),d=n.getIsSorted();return d?d!==c&&((a=o.options.enableSortingRemoval)==null||a)&&(!(r&&(l=o.options.enableMultiRemove)!=null)||l)?!1:d==="desc"?"asc":"desc":c},n.getCanSort=()=>{var r,a;return((r=n.columnDef.enableSorting)!=null?r:!0)&&((a=o.options.enableSorting)!=null?a:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var r,a;return(r=(a=n.columnDef.enableMultiSort)!=null?a:o.options.enableMultiSort)!=null?r:!!n.accessorFn},n.getIsSorted=()=>{var r;const a=(r=o.getState().sorting)==null?void 0:r.find(l=>l.id===n.id);return a?a.desc?"desc":"asc":!1},n.getSortIndex=()=>{var r,a;return(r=(a=o.getState().sorting)==null?void 0:a.findIndex(l=>l.id===n.id))!=null?r:-1},n.clearSorting=()=>{o.setSorting(r=>r!=null&&r.length?r.filter(a=>a.id!==n.id):[])},n.getToggleSortingHandler=()=>{const r=n.getCanSort();return a=>{r&&(a.persist==null||a.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(a):!1))}}},createTable:n=>{n.setSorting=o=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(o),n.resetSorting=o=>{var r,a;n.setSorting(o?[]:(r=(a=n.initialState)==null?void 0:a.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())}},$b=[lb,Nb,Sb,jb,ub,cb,Rb,Eb,kb,bb,Ab,Ib,Fb,Db,Cb];function Bb(n){var o,r;const a=[...$b,...(o=n._features)!=null?o:[]];let l={_features:a};const c=l._features.reduce((y,v)=>Object.assign(y,v.getDefaultOptions==null?void 0:v.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 v;p=(v=y.getInitialState==null?void 0:y.getInitialState(p))!=null?v:p});const x=[];let _=!1;const j={_features:a,options:{...c,...n},initialState:p,_queue:y=>{x.push(y),_||(_=!0,Promise.resolve().then(()=>{for(;x.length;)x.shift()();_=!1}).catch(v=>setTimeout(()=>{throw v})))},reset:()=>{l.setState(l.initialState)},setOptions:y=>{const v=vn(y,l.options);l.options=d(v)},getState:()=>l.options.state,setState:y=>{l.options.onStateChange==null||l.options.onStateChange(y)},_getRowId:(y,v,E)=>{var N;return(N=l.options.getRowId==null?void 0:l.options.getRowId(y,v,E))!=null?N:`${E?[E.id,v].join("."):v}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(y,v)=>{let E=(v?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 v;return y=(v=y)!=null?v:{},{header:E=>{const N=E.header.column.columnDef;return N.accessorKey?N.accessorKey:N.accessorFn?N.id:null},cell:E=>{var N,L;return(N=(L=E.renderValue())==null||L.toString==null?void 0:L.toString())!=null?N:null},...l._features.reduce((E,N)=>Object.assign(E,N.getDefaultColumnDef==null?void 0:N.getDefaultColumnDef()),{}),...y}},X(n,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:Z(()=>[l._getColumnDefs()],y=>{const v=function(E,N,L){return L===void 0&&(L=0),E.map(F=>{const $=ob(l,F,L,N),q=F;return $.columns=q.columns?v(q.columns,$,L+1):[],$})};return v(y)},X(n,"debugColumns")),getAllFlatColumns:Z(()=>[l.getAllColumns()],y=>y.flatMap(v=>v.getFlatColumns()),X(n,"debugColumns")),_getAllFlatColumnsById:Z(()=>[l.getAllFlatColumns()],y=>y.reduce((v,E)=>(v[E.id]=E,v),{}),X(n,"debugColumns")),getAllLeafColumns:Z(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(y,v)=>{let E=y.flatMap(N=>N.getLeafColumns());return v(E)},X(n,"debugColumns")),getColumn:y=>l._getAllFlatColumnsById()[y]};Object.assign(l,j);for(let y=0;y<l._features.length;y++){const v=l._features[y];v==null||v.createTable==null||v.createTable(l)}return l}function Dd(){return n=>Z(()=>[n.options.data],o=>{const r={rows:[],flatRows:[],rowsById:{}},a=function(l,c,d){c===void 0&&(c=0);const m=[];for(let x=0;x<l.length;x++){const _=Fo(n,n._getRowId(l[x],x,d),l[x],x,c,void 0,d==null?void 0:d.id);if(r.flatRows.push(_),r.rowsById[_.id]=_,m.push(_),n.options.getSubRows){var p;_.originalSubRows=n.options.getSubRows(l[x],x),(p=_.originalSubRows)!=null&&p.length&&(_.subRows=a(_.originalSubRows,c+1,_))}}return m};return r.rows=a(o),r},X(n.options,"debugTable","getRowModel",()=>n._autoResetPageIndex()))}function Md(n,o,r){return r.options.filterFromLeafRows?Ub(n,o,r):Vb(n,o,r)}function Ub(n,o,r){var a;const l=[],c={},d=(a=r.options.maxLeafRowFilterDepth)!=null?a:100,m=function(p,x){x===void 0&&(x=0);const _=[];for(let y=0;y<p.length;y++){var j;let v=p[y];const E=Fo(r,v.id,v.original,v.index,v.depth,void 0,v.parentId);if(E.columnFilters=v.columnFilters,(j=v.subRows)!=null&&j.length&&x<d){if(E.subRows=m(v.subRows,x+1),v=E,o(v)&&!E.subRows.length){_.push(v),c[v.id]=v,l.push(v);continue}if(o(v)||E.subRows.length){_.push(v),c[v.id]=v,l.push(v);continue}}else v=E,o(v)&&(_.push(v),c[v.id]=v,l.push(v))}return _};return{rows:m(n),flatRows:l,rowsById:c}}function Vb(n,o,r){var a;const l=[],c={},d=(a=r.options.maxLeafRowFilterDepth)!=null?a:100,m=function(p,x){x===void 0&&(x=0);const _=[];for(let y=0;y<p.length;y++){let v=p[y];if(o(v)){var j;if((j=v.subRows)!=null&&j.length&&x<d){const N=Fo(r,v.id,v.original,v.index,v.depth,void 0,v.parentId);N.subRows=m(v.subRows,x+1),v=N}_.push(v),l.push(v),c[v.id]=v}}return _};return{rows:m(n),flatRows:l,rowsById:c}}function zb(){return(n,o)=>Z(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(r,a,l)=>{if(!r.rows.length||!(a!=null&&a.length)&&!l)return r;const c=[...a.map(m=>m.id).filter(m=>m!==o),l?"__global__":void 0].filter(Boolean),d=m=>{for(let p=0;p<c.length;p++)if(m.columnFilters[c[p]]===!1)return!1;return!0};return Md(r.rows,d,n)},X(n.options,"debugTable"))}function Hb(){return(n,o)=>Z(()=>{var r;return[(r=n.getColumn(o))==null?void 0:r.getFacetedRowModel()]},r=>{if(!r)return new Map;let a=new Map;for(let c=0;c<r.flatRows.length;c++){const d=r.flatRows[c].getUniqueValues(o);for(let m=0;m<d.length;m++){const p=d[m];if(a.has(p)){var l;a.set(p,((l=a.get(p))!=null?l:0)+1)}else a.set(p,1)}}return a},X(n.options,"debugTable"))}function Gb(){return n=>Z(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(o,r,a)=>{if(!o.rows.length||!(r!=null&&r.length)&&!a){for(let y=0;y<o.flatRows.length;y++)o.flatRows[y].columnFilters={},o.flatRows[y].columnFiltersMeta={};return o}const l=[],c=[];(r??[]).forEach(y=>{var v;const E=n.getColumn(y.id);if(!E)return;const N=E.getFilterFn();N&&l.push({id:y.id,filterFn:N,resolvedValue:(v=N.resolveFilterValue==null?void 0:N.resolveFilterValue(y.value))!=null?v:y.value})});const d=(r??[]).map(y=>y.id),m=n.getGlobalFilterFn(),p=n.getAllLeafColumns().filter(y=>y.getCanGlobalFilter());a&&m&&p.length&&(d.push("__global__"),p.forEach(y=>{var v;c.push({id:y.id,filterFn:m,resolvedValue:(v=m.resolveFilterValue==null?void 0:m.resolveFilterValue(a))!=null?v:a})}));let x,_;for(let y=0;y<o.flatRows.length;y++){const v=o.flatRows[y];if(v.columnFilters={},l.length)for(let E=0;E<l.length;E++){x=l[E];const N=x.id;v.columnFilters[N]=x.filterFn(v,N,x.resolvedValue,L=>{v.columnFiltersMeta[N]=L})}if(c.length){for(let E=0;E<c.length;E++){_=c[E];const N=_.id;if(_.filterFn(v,N,_.resolvedValue,L=>{v.columnFiltersMeta[N]=L})){v.columnFilters.__global__=!0;break}}v.columnFilters.__global__!==!0&&(v.columnFilters.__global__=!1)}}const j=y=>{for(let v=0;v<d.length;v++)if(y.columnFilters[d[v]]===!1)return!1;return!0};return Md(o.rows,j,n)},X(n.options,"debugTable","getFilteredRowModel",()=>n._autoResetPageIndex()))}function Kb(){return n=>Z(()=>[n.getState().sorting,n.getPreSortedRowModel()],(o,r)=>{if(!r.rows.length||!(o!=null&&o.length))return r;const a=n.getState().sorting,l=[],c=a.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 m=p=>{const x=p.map(_=>({..._}));return x.sort((_,j)=>{for(let v=0;v<c.length;v+=1){var y;const E=c[v],N=d[E.id],L=N.sortUndefined,F=(y=E==null?void 0:E.desc)!=null?y:!1;let $=0;if(L){const q=_.getValue(E.id),V=j.getValue(E.id),O=q===void 0,k=V===void 0;if(O||k){if(L==="first")return O?-1:1;if(L==="last")return O?1:-1;$=O&&k?0:O?L:-L}}if($===0&&($=N.sortingFn(_,j,E.id)),$!==0)return F&&($*=-1),N.invertSorting&&($*=-1),$}return _.index-j.index}),x.forEach(_=>{var j;l.push(_),(j=_.subRows)!=null&&j.length&&(_.subRows=m(_.subRows))}),x};return{rows:m(r.rows),flatRows:l,rowsById:r.rowsById}},X(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 rs(n,o){return n?Wb(n)?T.createElement(n,o):n:null}function Wb(n){return Qb(n)||typeof n=="function"||Yb(n)}function Qb(n){return typeof n=="function"&&(()=>{const o=Object.getPrototypeOf(n);return o.prototype&&o.prototype.isReactComponent})()}function Yb(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function Td(n){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[r]=T.useState(()=>({current:Bb(o)})),[a,l]=T.useState(()=>r.current.initialState);return r.current.setOptions(c=>({...c,...n,state:{...a,...n.state},onStateChange:d=>{l(d),n.onStateChange==null||n.onStateChange(d)}})),r.current}const Zb=({buttonText:n,title:o="",content:r,className:a=""})=>i.jsx("div",{className:`flex items-baseline justify-center mr-4 font-medium ${a}`,children:i.jsxs(hr,{children:[i.jsx(Tc,{asChild:!0,children:i.jsxs(H,{variant:"link",className:"inline-flex items-center font-medium group",children:[i.jsx("span",{className:"underline-offset-4 group-hover:underline",children:n}),i.jsx(Vv,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),i.jsxs(pr,{className:"sm:max-w-[425px]",children:[i.jsx(xr,{children:i.jsx(_r,{children:o})}),i.jsxs(go,{className:"grid gap-4 py-2",children:[r,i.jsx(vr,{children:i.jsx(es,{asChild:!0,children:i.jsx(H,{type:"button",children:b("common.close")})})})]})]})]})});function Xb(n){let a=0;for(let _=0;_<n.length;_++)a=n.charCodeAt(_)+((a<<5)-a);let l="#";for(let _=0;_<3;_++){const j=a>>_*8&255;l+=("00"+j.toString(16)).substr(-2)}const c=parseInt(l.substr(1,2),16),d=parseInt(l.substr(3,2),16),m=parseInt(l.substr(5,2),16),p=`#${(c*.7|0).toString(16).padStart(2,"0")}${(d*.7|0).toString(16).padStart(2,"0")}${(m*.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(m+(255-m)*.7)).toString(16).padStart(2,"0")}`;return[p,x]}const Od=({label:n,className:o})=>{const[r,a]=Xb(n);return i.jsx(mo,{className:o,style:o?{}:{backgroundColor:a,color:r},children:n})};function Ld({table:n,header:o,className:r}){return o.column.getCanSort()?i.jsx("div",{className:pe("flex items-center space-x-2",r),children:i.jsxs(os,{children:[i.jsx(ls,{asChild:!0,children:i.jsxs(H,{"aria-label":o.column.getIsSorted()==="desc"?b("common.sort_desc_description"):o.column.getIsSorted()==="asc"?b("common.sort_asc_description"):b("common.sort_none_description"),size:"sm",variant:"ghost",className:"-ml-3 h-8 data-[state=open]:bg-accent font-bold text-muted-foreground",children:[rs(o.column.columnDef.header,o.getContext()),o.column.getIsSorted()==="desc"?i.jsx(vc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):o.column.getIsSorted()==="asc"?i.jsx(bc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):i.jsx(F0,{className:"w-4 h-4 ml-2 text-muted-foreground/30","aria-hidden":"true"})]})}),i.jsxs(us,{align:"start",children:[o.column.getCanSort()&&i.jsxs(i.Fragment,{children:[i.jsxs(Kr,{onClick:()=>o.column.toggleSorting(!1),"aria-label":b("common.sort_asc"),children:[i.jsx(bc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),b("common.sort_asc")]}),i.jsxs(Kr,{onClick:()=>o.column.toggleSorting(!0),"aria-label":b("common.sort_desc"),children:[i.jsx(vc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),b("common.sort_desc")]})]}),o.column.getCanSort()&&o.column.getCanHide()&&i.jsx(ho,{}),o.column.getCanHide()&&i.jsxs(Kr,{onClick:()=>o.column.toggleVisibility(!1),"aria-label":b("common.hide"),children:[i.jsx(hd,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),b("common.hide")]})]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:pe("data-[state=open]:bg-accent tracking-wide text-ellipsis",r),children:o.isPlaceholder?null:rs(o.column.columnDef.header,o.getContext())}),!1]})}function Jb({table:n,className:o,enablePageSizeSelector:r=!0,visible:a="auto"}){const l=T.useMemo(()=>a===!0,[a]),c=T.useMemo(()=>a==="auto",[a]);return!l||c&&n.getPageCount()<1?null:i.jsxs("div",{className:o,children:[i.jsx("div",{className:"flex-1 text-base text-muted-foreground",children:n.getSelectedRowModel().rows.length>0&&i.jsx(i.Fragment,{children:b("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:b("common.rows_per_page")}),i.jsxs(kn,{value:`${n.getState().pagination.pageSize}`,onValueChange:d=>{n.setPageSize(Number(d))},children:[i.jsx($n,{className:"h-8 w-[70px]",children:i.jsx(Bn,{placeholder:n.getState().pagination.pageSize})}),i.jsx(Un,{side:"top",children:zv.map(d=>i.jsx(Vt,{value:`${d}`,children:d},d))})]})]}),i.jsxs("div",{className:pe("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:b("common.num_page_of_total",{count:n.getState().pagination.pageIndex+1,total:n.getPageCount()})})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsxs(H,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(Hv),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:b("common.go_to_first_page")}),i.jsx(D0,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.previousPage(),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:b("common.go_to_prev_page")}),i.jsx(Gv,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.nextPage(),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:b("common.go_to_next_page")}),i.jsx(Kv,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(n.getPageCount()+1),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:b("common.go_to_last_page")}),i.jsx(M0,{className:"w-4 h-4"})]})]})]})]})]})}function xs({table:n,title:o,description:r,caption:a,paginationOptions:l,headerOptions:c={visible:!0},children:d,className:m,contentClassName:p,footerClassName:x,rowClassName:_,cellClassName:j,onRowClick:y,activeRowIndex:v}){var N;const E=c==null?void 0:c.visible;return i.jsxs(Te,{className:m,children:[(o||r)&&i.jsxs(ct,{className:"pb-0",children:[i.jsx(ze,{children:o}),i.jsx(We,{children:r})]}),i.jsxs(Oe,{className:pe("pt-6",p),children:[d&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex space-x-2",children:d}),i.jsx(bn,{className:"my-4"})]}),i.jsxs(po,{children:[typeof a<"u"&&i.jsx(Wv,{children:a}),E&&n.getHeaderGroups().length&&i.jsx(xo,{children:n.getHeaderGroups().map(L=>i.jsx(wn,{className:_,children:L.headers.map(F=>i.jsx(_o,{colSpan:F.colSpan,style:{width:F.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.getSize()},children:i.jsx(Ld,{table:n,header:F})},F.id))},L.id))}),i.jsx(vo,{children:(N=n.getRowModel().rows)!=null&&N.length?n.getRowModel().rows.map(L=>i.jsx(wn,{onClick:()=>{y&&y(L)},tabIndex:0,"data-state":L.getIsSelected()&&"selected",className:pe(L.getIsSelected()||v===L.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",_),children:L.getVisibleCells().map(F=>i.jsx(Zr,{className:j,style:{width:F.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.column.getSize()},children:rs(F.column.columnDef.cell,F.getContext())},F.id))},L.id)):i.jsx(wn,{className:_,children:i.jsx(Zr,{className:pe("h-24 text-center",j),colSpan:n.getAllColumns.length,children:"No hay datos para mostrar"})})})]})]}),i.jsx(Rt,{className:x,children:i.jsx(Jb,{className:"flex-1",table:n,...l})})]})}function ew({actions:n,rowContext:o}){return i.jsxs(os,{children:[i.jsx(ls,{asChild:!0,children:i.jsxs(H,{size:"icon",variant:"outline",className:"w-8 h-8",children:[i.jsx(P0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:b("common.open_menu")})]})}),i.jsxs(us,{align:"end",children:[i.jsxs(Oc,{children:[b("common.actions")," "]}),n&&n(o).map((r,a)=>r.label==="-"?i.jsx(ho,{},a):i.jsxs(Kr,{onClick:l=>r.onClick?r.onClick(o,l):null,children:[r.icon&&i.jsx(i.Fragment,{children:r.icon}),r.label,r.shortcut&&i.jsx(Qv,{children:r.shortcut})]},a))]})]})}function tw(){return{id:"select",header:({table:n})=>i.jsx(ts,{id:"select-all",checked:n.getIsAllPageRowsSelected()||n.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:o=>n.toggleAllPageRowsSelected(!!o),"aria-label":b("common.select_all"),className:"translate-y-[2px]"}),cell:({row:n})=>i.jsx(ts,{id:`select-row-${n.id}`,checked:n.getIsSelected(),onCheckedChange:o=>{n.toggleSelected(!!o)},"aria-label":b("common.select_row"),className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1}}function _s({columnCount:n,rowCount:o=10,searchableColumnCount:r=0,filterableColumnCount:a=0,showViewOptions:l=!0,cellWidths:c=["auto"],withPagination:d=!0,shrinkZero:m=!1,className:p,...x}){return i.jsxs("div",{className:pe("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((_,j)=>i.jsx(ut,{className:"w-40 h-7 lg:w-60"},j)):null,a>0?Array.from({length:a}).map((_,j)=>i.jsx(ut,{className:"h-7 w-[4.5rem] border-dashed"},j)):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(po,{children:[i.jsx(xo,{children:Array.from({length:1}).map((_,j)=>i.jsx(wn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,v)=>i.jsx(_o,{style:{width:c[v],minWidth:m?c[v]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},v))},j))}),i.jsx(vo,{children:Array.from({length:o}).map((_,j)=>i.jsx(wn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,v)=>i.jsx(Zr,{style:{width:c[v],minWidth:m?c[v]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},v))},j))})]})}),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 vs=({title:n=b("components.empty_state.title"),subtitle:o=b("components.empty_state.subtitle"),buttonText:r=b("components.empty_state.button"),onButtonClick:a=()=>{},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:o}),i.jsxs("div",{className:"items-center mt-6",children:[l&&i.jsx(i.Fragment,{children:l}),!l&&i.jsxs(H,{className:"my-4",onClick:a,children:[i.jsx(Ao,{}),r]})]})]}),nw=jo("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"}}),is=n=>{const{name:o,label:r,hint:a,description:l,placeholder:c,className:d,disabled:m,defaultValue:p,rules:x,readOnly:_,scale:j,variant:y}=n,{control:v}=Hn(),[E,N]=T.useState(""),L={input:F=>{if(typeof F!="object")return F;const $=zt.create(F);if($.isFailure)throw $.error;const q=$.object.toString();return E.endsWith(",")?q.replace(/.0$/,","):q},output:(F,$,q)=>{const{value:V}=q??{value:null};N(V??"");const O=zt.createFromFormattedValue(V);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(bo,{defaultValue:p,control:v,name:o,disabled:m,rules:{max:100,min:0,...x},render:({field:F})=>{const $=L.input(F.value),q=m||F.disabled,V=!!((x==null?void 0:x.required)??!1);return i.jsxs(wo,{className:pe(d,"space-y-3"),children:[r&&i.jsx(Ln,{label:r,hint:a,required:V}),i.jsx(So,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:q,readOnly:_,className:pe(nw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:j!==0,decimalsLimit:j,decimalScale:j,step:1,value:$,onValueChange:(O,k,G)=>F.onChange(L.output(O,k,G))})}),l&&i.jsx(Co,{children:l}),i.jsx(yo,{})]})}})},rw=jo("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"}}),iw=n=>{const{name:o,label:r,hint:a,description:l,placeholder:c,className:d,disabled:m,defaultValue:p,rules:x,readOnly:_,scale:j,variant:y}=n,{control:v}=Hn(),[E,N]=T.useState(""),L={input:F=>{if(typeof F!="object")return F;const $=Sn.create(F);if($.isFailure)throw $.error;const q=$.object.toString();return E.endsWith(",")?q.replace(/.0$/,","):q},output:(F,$,q)=>{const{value:V}=q??{value:null};N(V??"");const O=Sn.createFromFormattedValue(V);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(bo,{defaultValue:p,control:v,name:o,disabled:m,rules:x,render:({field:F})=>{const $=L.input(F.value),q=m||F.disabled,V=!!((x==null?void 0:x.required)??!1);return i.jsxs(wo,{className:pe(d,"space-y-3"),children:[r&&i.jsx(Ln,{label:r,hint:a,required:V}),i.jsx(So,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:q,readOnly:_,className:pe(rw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:j!==0,decimalsLimit:j,decimalScale:j,step:1,value:$,onValueChange:(O,k,G)=>F.onChange(L.output(O,k,G))})}),l&&i.jsx(Co,{children:l}),i.jsx(yo,{})]})}})},sw=jo("",{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"}}),Pn=n=>{const{name:o,label:r,hint:a,description:l,placeholder:c,className:d,disabled:m,rules:p,required:x,type:_,variant:j}=n,{control:y}=Hn();return i.jsx(bo,{control:y,name:o,disabled:m,rules:{required:x,...p},render:({field:v,fieldState:E})=>{const N=!!((p==null?void 0:p.required)??x);return i.jsxs(wo,{className:pe(d,"space-y-3"),children:[r&&i.jsx(Ln,{label:r,hint:a,required:N}),i.jsx(So,{className:"block",children:i.jsx(cs,{type:_,placeholder:c,className:pe(E.error?"border-destructive focus-visible:ring-destructive":"",sw({variant:j,className:d})),...v})}),l&&i.jsx(Co,{children:l}),i.jsx(yo,{})]})}})};function aw(n=!1){const[o,r]=T.useState(n);return[o,()=>r(l=>!l)]}const Gn=()=>{const n=T.useContext(Yv);if(n===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return n};function bs({data:n,columns:o,pageCount:r,enableSorting:a=!1,enableHiding:l=!1,enableRowSelection:c=!1,initialState:d,onPaginationChange:m,meta:p}){const{pagination:x,setPagination:_,sorting:j}=Gn(),[y,v]=On.useState({}),[E,N]=On.useState((d==null?void 0:d.columnVisibility)||{}),L=V=>{if(typeof V=="function"){const O=V(x);_(O)}m&&m(V)},F=V=>{},$=T.useCallback(()=>{const V=o;return c&&V.unshift(tw()),V},[o,c]);return{table:Td({data:n,columns:$(),pageCount:r??-1,meta:p,getCoreRowModel:Dd(),initialState:d,state:{pagination:x,sorting:j,columnVisibility:E,rowSelection:y},enableRowSelection:c,onRowSelectionChange:v,manualSorting:!0,enableSorting:a,getSortedRowModel:Kb(),onSortingChange:F,enableHiding:l,onColumnVisibilityChange:N,manualPagination:!0,onPaginationChange:L,manualFiltering:!0,getFilteredRowModel:Gb(),getFacetedRowModel:zb(),getFacetedUniqueValues:Hb(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const ow=({setSize:n,setControllerCallback:o,setPercentageCallback:r,setErrorCallback:a})=>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"),m=l.headers.get(d?"x-file-size":"content-length"),p=parseInt(m||"0",10);n(()=>p);let x=0;const _=new ReadableStream({start(j){o(j);const y=c.getReader();async function v(){return y.read().then(({done:E,value:N})=>E?j.close():(x+=(N==null?void 0:N.byteLength)||0,N&&j.enqueue(N),r({loaded:x,total:p}),v())).catch(E=>(a(E),y.cancel("Cancelled"),j.error(E)))}return v()}});return new Response(_)},Nc=(n,o,r)=>{const a=[n],l=new Blob(a,{type:r||"application/octet-stream"});if(typeof window.navigator.msSaveBlob<"u")return window.navigator.msSaveBlob(l,o);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",o),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 Rc({customHandleDownload:n,...o}={}){var V;let r=!1;try{r=process?!!((V=process==null?void 0:process.env)!=null&&V.REACT_APP_DEBUG_MODE):!1}catch{r=!1}const[a,l]=T.useState(0),[c,d]=T.useState(0),[m,p]=T.useState(0),[x,_]=T.useState(null),[j,y]=T.useState(!1),v=T.useRef(null),E=T.useCallback(({loaded:O,total:k})=>{const G=Math.round(O/k*100);d(()=>G)},[]),N=T.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"};_(()=>({errorMessage:k[O.message]?k[O.message]:O.message}))},[]),L=T.useCallback(O=>{v.current=O},[]),F=T.useCallback(()=>{v.current&&v.current.error()},[]),$=T.useCallback(()=>{L(null),l(()=>0),d(()=>0),p(()=>0),y(()=>!1)},[L]),q=T.useCallback(async(O,k,G=0,ne={})=>{if(j)return null;$(),_(()=>null),y(()=>!0);const U=setInterval(()=>l(ke=>ke+1),r?1:1e3),re=ow({setSize:p,setControllerCallback:L,setPercentageCallback:E,setErrorCallback:N}),Q=new AbortController,W=setTimeout(()=>{G>0&&Q.abort()},G),we=n||Nc;try{const ke=await fetch(O,{method:"GET",...o,...ne,signal:Q.signal}),tt=await re(ke).blob();we(tt,k),$()}catch(ke){$(),_(J=>{const{message:tt}=ke;return tt!=="Failed to fetch"?{errorMessage:tt}:J}),clearTimeout(W)}finally{clearInterval(U)}},[j,$,r,L,E,N,o,n]);return T.useMemo(()=>({elapsed:a,percentage:c,size:m,download:q,cancel:F,error:x,isInProgress:j,jsDownload:Nc}),[a,c,m,q,F,x,j])}const Pd=()=>{const{i18n:n}=Pt();return qd({locale:n.language})},qd=n=>{const{locale:o}=n,r=T.useCallback(c=>{if(c==null)return"";const{amount:d,scale:m,currency_code:p}=c;return new Intl.NumberFormat(o??"ES",{style:"currency",currency:p,currencyDisplay:"symbol",useGrouping:!0,maximumFractionDigits:m}).format(d===null?0:pc({amount:d,scale:m}))},[o]),a=T.useCallback(c=>{if(c==null)return"";const{amount:d,scale:m}=c;return new Intl.NumberFormat("es",{minimumFractionDigits:m,useGrouping:!0}).format(d===null?0:pc({amount:d,scale:m}))},[o]),l=T.useCallback(c=>{if(c==null)return"";const{amount:d,scale:m}=c;return new Intl.NumberFormat(o,{style:"decimal",minimumFractionDigits:m}).format(d===null?0:d)},[o]);return{formatCurrency:r,formatNumber:a,formatPercentage:l}};function kd(n){const[o,r]=T.useState(!1);return T.useEffect(()=>{function a(c){r(c.matches)}const l=matchMedia(n);return l.addEventListener("change",a),r(l.matches),()=>l.removeEventListener("change",a)},[n]),o}const lw=()=>{const n=T.useContext(Zv);if(n===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return n},Oo=({isDirty:n=!1,title:o=b("hooks.use_unsaved_changes_notifier.title"),subtitle:r=b("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:a=b("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=b("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:c,onCancel:d,type:m="warning"})=>{const p=Xv(n),{show:x}=lw(),_=T.useCallback(()=>n?new Promise(j=>{x({title:o,subtitle:r,confirmText:a,cancelText:l,type:m,onConfirm:()=>{j(!0),c==null||c()},onCancel:()=>{j(!1),d==null||d()}})}):Promise.resolve(!0),[l,a,n,d,c,x,r,o,m]);return T.useEffect(()=>{p.state==="blocked"&&_().then(j=>{j?p.proceed():p.reset()})},[p,_]),T.useEffect(()=>(n&&(window.onbeforeunload=()=>r),()=>{window.onbeforeunload=null}),[n,r]),{confirm:_}},$d=n=>{const{isSubmitting:o,isLoading:r,isValidating:a}=Jv();return i.jsx(No,{disabled:o||r||a,...n})};$d.displayName="FormSubmitButton";const sn=[{code:"es",name:"Español",flagClassName:"fi fi-es"},{code:"en",name:"English",flagClassName:"fi fi-gb"},{code:"fr",name:"Français",flagClassName:"fi fi-fr"}],Bd={"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}}"},Zw=()=>{var j,y,v,E;const{t:n,i18n:o}=Pt(),[r,a]=T.useState(o.language),l=Ht(),{toast:c}=Cn();T.useEffect(()=>{const N=navigator.language.split("-")[0],L=sn.find(F=>F.code===N);L&&d(L.code)},[]);const d=N=>{o.changeLanguage(N),a(N)},{mutate:m,status:p}=I0({onSuccess:N=>{const{success:L,error:F}=N;!L&&F&&x.setError("root",F),L&&l("/quotes",{replace:!0})},onError:N=>{const{message:L}=N;c({description:L,title:n("common.error")}),console.log(N)}}),x=ds({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Pc(_n.object({email:_n.string().email({tlds:{allow:!1}}).required(),password:_n.string().min(4).alphanum().required()}),{messages:Bd})}),_=async N=>{m({email:N.email,password:N.password},{})};return i.jsxs(e0,{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(os,{children:[i.jsx(ls,{asChild:!0,children:i.jsxs(H,{variant:"outline",className:"w-[140px] justify-start",children:[i.jsx("span",{className:"mr-2",children:i.jsx("span",{"aria-hidden":"true",className:(j=sn.find(N=>N.code===r))==null?void 0:j.flagClassName})}),(y=sn.find(N=>N.code===r))==null?void 0:y.name,i.jsx(qc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),i.jsx(us,{className:"w-[140px]",children:sn.map(N=>i.jsxs(Kr,{onSelect:()=>d(N.code),children:[i.jsx("span",{"aria-hidden":"true",className:`mr-2 ${N.flagClassName}`}),N.name]},N.code))})]})}),i.jsxs(Te,{className:"px-12 py-6 bg-muted/50",children:[i.jsxs(ct,{children:[i.jsx(t0,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),i.jsx(ze,{children:i.jsx(oe,{i18nKey:"login_page.title"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"login_page.description"})})]}),i.jsx(Oe,{children:i.jsx(fs,{...x,children:i.jsx("form",{onSubmit:x.handleSubmit(_),children:i.jsxs("div",{className:"grid items-start gap-6",children:[i.jsx("div",{className:"grid gap-6",children:i.jsx(Pn,{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(Pn,{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(oe,{i18nKey:"login_page.forgotten_password"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(oe,{i18nKey:"login_page.contact_us"})})]})]}),((v=x.formState.errors.root)==null?void 0:v.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(gd,{className:"w-4 h-4"}),i.jsx($c,{children:i.jsx(oe,{i18nKey:"common.error"})}),i.jsx(Bc,{children:(E=x.formState.errors.root)==null?void 0:E.message})]}),i.jsx($d,{className:"w-full",disabled:p==="pending"}),i.jsxs("div",{className:"mt-4 text-sm text-center",children:[i.jsx(oe,{i18nKey:"login_page.become_dealer"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(oe,{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.2.3"]})]})]})})})})]}),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"})})]})},uw=n=>{const{onSuccess:o,onError:r,...a}=n||{},l=rn(),c=qn(),{logout:d}=Fc(),m=Ht(),{toast:p}=Cn();return Bt({mutationKey:c().auth().action("logout").get(),mutationFn:d,onSuccess:async(x,_,j)=>{l.clear();const{success:y,redirectTo:v}=x;y&&v&&m(v||"/"),o&&o(x,_,j)},onError:(x,_,j)=>{const{message:y}=x;p({title:b("common.error"),description:y,variant:"destructive"}),r&&r(x,_,j)},...a})},Xw=()=>{const{mutate:n}=uw({});return T.useEffect(()=>n(),[n]),i.jsx(Vn,{})},cw=T.createContext(null),dw=({children:n})=>{const[o,r]=Uc();return i.jsx(cw.Provider,{value:{pagination:o,setPagination:r},children:n})},Jw=({children:n})=>i.jsx(gs,{children:i.jsx(dw,{children:i.jsxs(ei,{className:"catalog-layout",children:[i.jsx(ti,{}),i.jsx(ni,{children:n})]})})}),Ud=n=>{const o=Xr(),r=qn(),{pagination:a,searchTerm:l=[],enabled:c=!0,queryOptions:d}=n;return Io({queryKey:r().data().resource("catalog").action("list").params(n).get(),queryFn:()=>o.getList({resource:"catalog",quickSearchTerm:l,pagination:a}),enabled:c,queryOptions:d})};function Vd({table:n,className:o,children:r,...a}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:m}=Gn(),p=On.useRef(null),[x,_]=On.useState(""),j=On.useCallback(E=>{E.key==="Enter"&&x.trim()&&(E.preventDefault(),d(N=>[...N,x.trim()]),_("")),E.key==="Backspace"&&!x&&l.length>0&&(E.preventDefault(),d(N=>N.slice(0,-1)))},[l,x]),y=On.useCallback(E=>{d(N=>N.filter(L=>L!==E))},[]),v=On.useCallback(()=>{var E;x.trim()&&(d(N=>[...N,x.trim()]),_(""),(E=p.current)==null||E.focus())},[x]);return i.jsx(n0,{children:i.jsxs("div",{className:"w-full space-y-2",...a,children:[i.jsxs("div",{className:pe("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",c?"border-primary":"border-input"),children:[i.jsx(Vc,{className:pe("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(mo,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[E,i.jsxs(H,{variant:"ghost",onClick:()=>y(E),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsx(to,{className:"w-4 h-4"})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.filter.badget_remove_tooltip")})})]}),i.jsx("span",{className:"sr-only",children:b("common.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=>_(E.target.value),onKeyDown:j,placeholder:b("common.filter.input_placeholder"),className:"flex-1 w-full h-8 bg-transparent outline-none placeholder:text-muted-foreground"}),i.jsxs(gr,{children:[c&&i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"ghost",onClick:()=>m(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[i.jsx(to,{className:"w-4 h-4 mr-2"}),b("common.filter.reset_filter")]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.filter.reset_filter")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"default",size:"icon",disabled:!x,onClick:v,className:"w-8 h-8 p-0 transition-all",children:[i.jsx(Ao,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.filter.button_add_term")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:b("common.filter.help_text")})]})})}const fw=()=>{const n=Ht(),{pagination:o,globalFilter:r,isFiltered:a}=Gn(),{data:l,isPending:c,isError:d,error:m}=Ud({pagination:{pageIndex:o.pageIndex,pageSize:o.pageSize},searchTerm:r}),p=T.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:b("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>i.jsx("div",{className:"text-right",children:b("catalog.list.columns.points")}),cell:({renderValue:_})=>i.jsx("div",{className:"text-right",children:_()})},{id:"retail_price",accessorKey:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:b("catalog.list.columns.retail_price")}),cell:({row:_})=>{const j=Ot.create(_.original.retail_price).object;return i.jsx("div",{className:"text-right",children:j.toFormat()})}}],[]),{table:x}=bs({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(br,{subtitle:m.message}):c?i.jsx(Te,{children:i.jsx(Oe,{children:i.jsx(_s,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!a?i.jsx(vs,{subtitle:b("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(xs,{table:x,paginationOptions:{visible:!0},children:i.jsx(Vd,{table:x})})},eS=()=>i.jsxs(mr,{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(oe,{i18nKey:"catalog.list.title"})})})}),i.jsx(fw,{})]}),tS=()=>{const{data:n,status:o}=r0();return i.jsxs(ei,{children:[i.jsx(ti,{}),i.jsx(ni,{children:o==="success"?i.jsx("div",{className:"flex items-center",children:i.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${b("dashboard.welcome")}, ${n==null?void 0:n.name}`})}):i.jsx(ut,{className:"w-[100px] h-[20px] rounded-full"})})]})},nS=({children:n})=>i.jsx(gs,{children:i.jsxs(ei,{className:"dealers-layout",children:[i.jsx(ti,{}),i.jsx(ni,{children:n})]})});function gw({table:n}){return i.jsxs(os,{children:[i.jsx(ls,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[i.jsx(V0,{className:"w-4 h-4 mr-2"}),b("components.data_table.columns")]})}),i.jsxs(us,{align:"end",className:"w-[150px]",children:[i.jsx(Oc,{children:b("components.data_table.columns")}),i.jsx(ho,{}),n.getAllColumns().filter(o=>typeof o.accessorFn<"u"&&o.getCanHide()).map(o=>i.jsx(i0,{className:"capitalize",checked:o.getIsVisible(),onCheckedChange:r=>o.toggleVisibility(!!r),children:i.jsx(i.Fragment,{children:o.columnDef.header})},o.id))]})]})}function zd({table:n,className:o,children:r,...a}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:m}=Gn(),p=x=>{const _=String(x.target.value);_===""?m():d([_])};return i.jsxs("div",{className:pe("flex w-full items-center justify-between space-x-2 overflow-auto p-1",o),...a,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(cs,{placeholder:b("common.filter.input_placeholder"),value:l,onChange:p,className:pe("h-8 w-full transition-all")},"global-filter"),c&&i.jsxs(H,{variant:"outline",onClick:()=>m(),className:"h-8 px-2 transition-all lg:px-3",children:[i.jsx(to,{className:"w-4 h-4 mr-2"}),b("common.filter.reset_filter")]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r,n.options.enableHiding&&i.jsx(gw,{table:n})]})]})}const mw=n=>{const o=Xr(),r=qn(),{pagination:a,searchTerm:l=void 0,enabled:c=!0,queryOptions:d}=n;return Io({queryKey:r().data().resource("dealer").action("list").params(n).get(),queryFn:()=>o.getList({resource:"dealers",quickSearchTerm:l,pagination:a}),enabled:c,queryOptions:d})},hw=()=>{const n=Ht(),{pagination:o,globalFilter:r,isFiltered:a}=Gn(),{data:l,isPending:c,isError:d,error:m}=mw({pagination:{pageIndex:o.pageIndex,pageSize:o.pageSize},searchTerm:r}),p=T.useMemo(()=>[{id:"id",accessorKey:"id",enableResizing:!1,size:10},{id:"name",accessorKey:"name",enableResizing:!1,size:10}],[]),{table:x}=bs({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1});return d?i.jsx(br,{subtitle:m.message}):c?i.jsx(Te,{children:i.jsx(Oe,{children:i.jsx(_s,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!a?i.jsx(vs,{subtitle:b("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(i.Fragment,{children:i.jsx(xs,{table:x,paginationOptions:{visible:!0},children:i.jsx(zd,{table:x})})})},rS=()=>i.jsx(mr,{children:i.jsx(hw,{})}),iS=()=>i.jsx("div",{className:"flex min-h-[100dvh] flex-col items-center justify-center bg-background px-4 py-12 sm:px-6 lg:px-8",children:i.jsxs("div",{className:"max-w-md mx-auto text-center",children:[i.jsx("div",{className:"w-12 h-12 mx-auto text-primary"}),i.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground sm:text-4xl",children:"Oops, page not found!"}),i.jsx("p",{className:"mt-4 text-muted-foreground",children:"The page you're looking for doesn't exist or has been moved."}),i.jsx("div",{className:"mt-6",children:i.jsx(H,{className:"inline-flex items-center px-4 py-2 text-sm font-medium transition-colors rounded-md shadow-sm bg-primary text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",children:"Go to Homepage"})})]})}),Hd=T.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 pw(n){return n.isSorting||n.wasDragging?a0(n):!0}function xw({id:n,children:o,isActive:r=!1,onActivate:a}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:m,setActivatorNodeRef:p,transform:x,transition:_}=s0({animateLayoutChanges:pw,id:n}),j={transform:no.Translate.toString(x),transition:_},y=T.useMemo(()=>({attributes:l,listeners:d,ref:p,isDragging:c}),[l,c,d,p]);return i.jsx(Hd.Provider,{value:y,children:i.jsx(wn,{id:String(n),className:pe(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:m,style:j,onClick:a,onFocusCapture:a,children:o},n)})}const _w=({className:n})=>{const{attributes:o,isDragging:r,listeners:a,ref:l}=T.useContext(Hd);return i.jsxs(H,{ref:l,onClick:c=>{c.preventDefault()},size:"icon",variant:"link",className:pe(r?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground",n),...o,...a,children:[i.jsx(pd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.move_row")})]})};function vw(n,o={}){const{t:r,i18n:a}=Pt(),{enableDragHandleColumn:l=!1,enableSelectionColumn:c=!1,enableActionsColumn:d=!1,rowActionFn:m=void 0}=o;return T.useMemo(()=>(l&&n.unshift({id:"row_drag_handle",header:()=>null,cell:()=>i.jsx(_w,{}),enableSorting:!1,enableHiding:!1,size:40}),c&&n.unshift({id:"select",header:({table:p})=>i.jsx(ts,{id:"select-all",checked:p.getIsAllPageRowsSelected()||p.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>p.toggleAllPageRowsSelected(!!x),"aria-label":r("common.select_all"),className:"translate-y-[0px]"}),cell:({row:p})=>i.jsx(ts,{id:`select-row-${p.id}`,checked:p.getIsSelected(),disabled:!p.getCanSelect(),onCheckedChange:p.getToggleSelectedHandler(),"aria-label":r("common.select_row"),className:"mt-2"}),enableSorting:!1,enableHiding:!1,size:40}),d&&n.push({id:"row_actions",cell:p=>i.jsx(ew,{rowContext:p,actions:m}),enableSorting:!1,enableHiding:!1,size:48}),n),[d,l,c,r,a.resolvedLanguage])}var Gd={exports:{}};(function(n,o){(function(r,a,l){n.exports=l(),n.exports.default=l()})("slugify",ur,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"}`),a=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 m=a[d.locale]||{},p=d.replacement===void 0?"-":d.replacement,x=d.trim===void 0?!0:d.trim,_=c.normalize().split("").reduce(function(j,y){var v=m[y];return v===void 0&&(v=r[y]),v===void 0&&(v=y),v===p&&(v=" "),j+v.replace(d.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return d.strict&&(_=_.replace(/[^A-Za-z0-9\s]/g,"")),x&&(_=_.trim()),_=_.replace(/\s+/g,p),d.lower&&(_=_.toLowerCase()),_}return l.extend=function(c){Object.assign(r,c)},l})})(Gd);var bw=Gd.exports;const ww=o0(bw),wr=()=>{const n=Xr(),o=qn(),{i18n:r}=Pt(),a=T.useCallback(d=>`${n.getApiUrl()}/quotes/${d}/report`,[n]),l=T.useCallback(d=>`quote-${ww(d.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),c={useList:d=>{const m=Xr(),p=qn(),{pagination:x,status:_="draft",quickSearchTerm:j=void 0,enabled:y=!0,queryOptions:v}=d;return Io({queryKey:p().data().resource("quotes").action("list").params(d).get(),queryFn:()=>m.getList({resource:"quotes",quickSearchTerm:j,filters:_!=="all"?[{field:"status",operator:"eq",value:_}]:[{field:"status",operator:"ne",value:"archived"}],pagination:x}),enabled:y,queryOptions:v})},useCreate:()=>{const d=rn();return nb({mutationFn:m=>{const{date:p}=m,x=pn.generateNewID().object.toString();return n.createOne({resource:"quotes",data:{...m,date:new Date(p).toISOString().slice(0,10),status:"draft",id:x}})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useUpdate:d=>{const m=rn();return Bt({mutationKey:o().data().resource("quotes").action("one").id(d).params().get(),mutationFn:p=>n.updateOne({resource:"quotes",id:d,data:p}),onSuccess:()=>{m.invalidateQueries({queryKey:["data","default","quotes"]})}})},useExchangeRate:()=>Bt({mutationFn:({currency:d,date:m})=>n.custom({url:`${n.getApiUrl()}/quotes/exchange-rate?currency=${encodeURIComponent(d)}&date=${encodeURIComponent(m)}`,method:"get"})}),useSetStatus:()=>{const d=rn();return Bt({mutationFn:m=>{const{id:p,newStatus:x}=m;return n.custom({url:`${n.getApiUrl()}/quotes/${p}/setStatus`,method:"put",data:{newStatus:x}})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useDuplicate:()=>{const d=rn();return Bt({mutationFn:m=>{const{id:p}=m;return n.custom({url:`${n.getApiUrl()}/quotes/${p}/duplicate`,method:"post"})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSentTo:d=>{const m=rn();return Bt({mutationKey:o().data().resource("quotes").action("one").id(d).params().get(),mutationFn:p=>{const{sent_date:x}=p;return n.custom({url:`${n.getApiUrl()}/quotes/${d}/send`,method:"put",data:{sent_date:x}})},onSuccess:()=>{m.invalidateQueries({queryKey:["data","default","quotes"]})}})},useOne:(d,m)=>Sd({queryKey:o().data().resource("quotes").action("one").id(d).params({language:r.language}).get(),queryFn:()=>n.getOne({resource:"quotes",id:String(d)}),enabled:!!d,...m}),getQuotePDFDownloadURL:a,getQuotePDFFilename:l,useReport:()=>{const d=n.getApiAuthorization(),[m,p]=T.useState(void 0),{download:x,..._}=Rc({headers:{Authorization:d},customHandleDownload:T.useCallback(y=>{const v=[y],E=new Blob(v,{type:"application/octet-stream"});return p(E),!0},[p])}),j=T.useCallback(y=>x(c.getQuotePDFDownloadURL(y),""),[x]);return{..._,preview:j,report:m}},useDownloader:()=>{const d=n.getApiAuthorization(),m=Rc({headers:{Authorization:d}});return{...m,download:(x,_)=>{const j=c.getQuotePDFDownloadURL(x);return m.download(j,_)}}}};return c},sS=()=>{const n=Ht(),{i18n:o}=Pt(),{toast:r}=Cn(),{useCreate:a}=wr(),{mutateAsync:l,isPending:c}=a(),[d,m]=T.useState(),p=o.resolvedLanguage??o.language,x=sn.some(({code:$})=>$===p)?p:"es",_=T.useMemo(()=>({date:new Date(Date.now()).toUTCString(),lang_code:x,customer_reference:"",customer_information:""}),[x]),j=ds({mode:"onBlur",defaultValues:_,resolver:Pc(_n.object({customer_reference:_n.string(),date:_n.date().required(),customer_information:_n.string().required(),lang_code:_n.string().valid(...sn.map(({code:$})=>$)).required()}),{messages:{es:Bd}})}),{formState:y,reset:v,handleSubmit:E}=j,{isSubmitting:N,isDirty:L}=y;Oo({isDirty:L}),T.useEffect(()=>{d&&n(`/quotes/edit/${d}`,{relative:"path"})},[d,n]);const F=async $=>{try{const q=await l($);v($),r({title:b("quotes.notifications.created"),variant:"default"}),m(q.id)}catch(q){console.debug(q),r({title:b("common.error"),description:q.message,variant:"destructive"})}};return N?i.jsx(Vn,{title:b("quotes.notifications.saving")}):c?i.jsx(Vn,{}):i.jsx(fs,{...j,children:i.jsx("form",{onSubmit:E(F),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(zc,{}),i.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:b("quotes.create.title")})]}),i.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:i.jsxs(ns,{className:"md:col-span-4",title:b("quotes.create.form_groups.general.title"),description:b("quotes.create.form_groups.general.desc"),footerActions:i.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[i.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:()=>n("/quotes"),children:b("common.discard")}),i.jsx(No,{size:"sm",label:b("common.continue")})]}),children:[i.jsx(Pn,{required:!0,name:"customer_reference",label:b("quotes.form_fields.customer_reference.label"),description:b("quotes.form_fields.customer_reference.desc"),placeholder:b("quotes.form_fields.customer_reference.placeholder")}),i.jsx(Hc,{required:!0,label:b("quotes.form_fields.date.label"),description:b("quotes.form_fields.date.desc"),placeholder:b("quotes.form_fields.date.placeholder"),name:"date"}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(zn,{htmlFor:"lang_code",className:"font-semibold",children:b("quotes.form_fields.lang_code.label")}),i.jsx(Jr,{control:j.control,name:"lang_code",render:({field:$})=>i.jsxs(kn,{value:$.value||"es",onValueChange:$.onChange,children:[i.jsx($n,{id:"lang_code","aria-label":b("quotes.form_fields.lang_code.label"),children:i.jsx(Bn,{})}),i.jsx(Un,{children:sn.map(q=>i.jsxs(Vt,{value:q.code,children:[i.jsx("span",{"aria-hidden":"true",className:`mr-2 ${q.flagClassName}`}),q.name]},q.code))})]})}),i.jsx("p",{className:"text-sm text-muted-foreground",children:b("quotes.form_fields.lang_code.desc")})]}),i.jsx(bn,{}),i.jsx(Ut,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:b("quotes.form_fields.customer_information.label"),description:b("quotes.form_fields.customer_information.desc"),placeholder:b("quotes.form_fields.customer_information.placeholder")})]})})]})})})},eo=(n,o=!1)=>{const{discount:r,tax:a,subtotal_price:l}=n||{},c=zt.create(r||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,m=zt.create(a||{amount:null,scale:2});if(m.isFailure)throw m.error;const p=m.object,x=Ot.create(l||{amount:null,scale:2});if(x.isFailure)throw x.error;const _=o?Sw(n.items).convertScale(2):x.object,j=_.percentage(d.toNumber()).convertScale(2),y=_.subtract(j).convertScale(2),v=y.percentage(p.toNumber()).convertScale(2),E=y.add(v).convertScale(2);return{subtotal_price:_,discount:n.discount,discount_price:j,before_tax_price:y,tax:p,tax_price:v,total_price:E}},Sw=n=>{let o=Ot.create({amount:0,scale:2}).object;return n&&n.map(r=>{const a=co(r);o=o.add(a.total_price)}),o},co=n=>{const{quantity:o,unit_price:r,discount:a}=n||{};if((!o||o&&o.amount===null)&&(!r||r&&r.amount===null)&&(!a||a&&a.amount===null))return{quantity:Sn.create({amount:null,scale:0}).object,unit_price:Ot.create({amount:null,scale:2}).object,subtotal_price:Ot.create({amount:null,scale:2}).object,discount:zt.create({amount:null,scale:2}).object,total_price:Ot.create({amount:null,scale:2}).object};const l=Sn.create(o);if(l.isFailure)throw l.error;const c=l.object,d=Ot.create(r);if(d.isFailure)throw d.error;const m=d.object,p=zt.create(a);if(p.isFailure)throw p.error;const x=p.object,_=m.multiply(c.toNumber()),j=_.subtract(_.percentage(x.toNumber()));return{quantity:c,unit_price:m,subtotal_price:_,discount:x,total_price:j}},jw=()=>{const{id:n}=l0();return n};var ss={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
|
||
*/ss.exports;(function(n,o){(function(){var r,a="4.17.21",l=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",d="Expected a function",m="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",x=500,_="__lodash_placeholder__",j=1,y=2,v=4,E=1,N=2,L=1,F=2,$=4,q=8,V=16,O=32,k=64,G=128,ne=256,U=512,re=30,Q="...",W=800,we=16,ke=1,J=2,tt=3,Le=1/0,ge=9007199254740991,$e=17976931348623157e292,ie=NaN,ye=4294967295,_t=ye-1,Sr=ye>>>1,yn=[["ary",G],["bind",L],["bindKey",F],["curry",q],["curryRight",V],["flip",U],["partial",O],["partialRight",k],["rearg",ne]],Kn="[object Arguments]",ri="[object Array]",Zd="[object AsyncFunction]",jr="[object Boolean]",Cr="[object Date]",Xd="[object DOMException]",ii="[object Error]",si="[object Function]",ko="[object GeneratorFunction]",At="[object Map]",yr="[object Number]",Jd="[object Null]",Gt="[object Object]",$o="[object Promise]",ef="[object Proxy]",Nr="[object RegExp]",It="[object Set]",Rr="[object String]",ai="[object Symbol]",tf="[object Undefined]",Er="[object WeakMap]",nf="[object WeakSet]",Ar="[object ArrayBuffer]",Wn="[object DataView]",ws="[object Float32Array]",Ss="[object Float64Array]",js="[object Int8Array]",Cs="[object Int16Array]",ys="[object Int32Array]",Ns="[object Uint8Array]",Rs="[object Uint8ClampedArray]",Es="[object Uint16Array]",As="[object Uint32Array]",rf=/\b__p \+= '';/g,sf=/\b(__p \+=) '' \+/g,af=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Bo=/&(?:amp|lt|gt|quot|#39);/g,Uo=/[&<>"']/g,of=RegExp(Bo.source),lf=RegExp(Uo.source),uf=/<%-([\s\S]+?)%>/g,cf=/<%([\s\S]+?)%>/g,Vo=/<%=([\s\S]+?)%>/g,df=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ff=/^\w*$/,gf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Is=/[\\^$.*+?()[\]{}|]/g,mf=RegExp(Is.source),Fs=/^\s+/,hf=/\s/,pf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xf=/\{\n\/\* \[wrapped with (.+)\] \*/,_f=/,? & /,vf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,bf=/[()=,{}\[\]\/\s]/,wf=/\\(\\)?/g,Sf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zo=/\w*$/,jf=/^[-+]0x[0-9a-f]+$/i,Cf=/^0b[01]+$/i,yf=/^\[object .+?Constructor\]$/,Nf=/^0o[0-7]+$/i,Rf=/^(?:0|[1-9]\d*)$/,Ef=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,oi=/($^)/,Af=/['\n\r\u2028\u2029\\]/g,li="\\ud800-\\udfff",If="\\u0300-\\u036f",Ff="\\ufe20-\\ufe2f",Df="\\u20d0-\\u20ff",Ho=If+Ff+Df,Go="\\u2700-\\u27bf",Ko="a-z\\xdf-\\xf6\\xf8-\\xff",Mf="\\xac\\xb1\\xd7\\xf7",Tf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Of="\\u2000-\\u206f",Lf=" \\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",Wo="A-Z\\xc0-\\xd6\\xd8-\\xde",Qo="\\ufe0e\\ufe0f",Yo=Mf+Tf+Of+Lf,Ds="['’]",Pf="["+li+"]",Zo="["+Yo+"]",ui="["+Ho+"]",Xo="\\d+",qf="["+Go+"]",Jo="["+Ko+"]",el="[^"+li+Yo+Xo+Go+Ko+Wo+"]",Ms="\\ud83c[\\udffb-\\udfff]",kf="(?:"+ui+"|"+Ms+")",tl="[^"+li+"]",Ts="(?:\\ud83c[\\udde6-\\uddff]){2}",Os="[\\ud800-\\udbff][\\udc00-\\udfff]",Qn="["+Wo+"]",nl="\\u200d",rl="(?:"+Jo+"|"+el+")",$f="(?:"+Qn+"|"+el+")",il="(?:"+Ds+"(?:d|ll|m|re|s|t|ve))?",sl="(?:"+Ds+"(?:D|LL|M|RE|S|T|VE))?",al=kf+"?",ol="["+Qo+"]?",Bf="(?:"+nl+"(?:"+[tl,Ts,Os].join("|")+")"+ol+al+")*",Uf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ll=ol+al+Bf,zf="(?:"+[qf,Ts,Os].join("|")+")"+ll,Hf="(?:"+[tl+ui+"?",ui,Ts,Os,Pf].join("|")+")",Gf=RegExp(Ds,"g"),Kf=RegExp(ui,"g"),Ls=RegExp(Ms+"(?="+Ms+")|"+Hf+ll,"g"),Wf=RegExp([Qn+"?"+Jo+"+"+il+"(?="+[Zo,Qn,"$"].join("|")+")",$f+"+"+sl+"(?="+[Zo,Qn+rl,"$"].join("|")+")",Qn+"?"+rl+"+"+il,Qn+"+"+sl,Vf,Uf,Xo,zf].join("|"),"g"),Qf=RegExp("["+nl+li+Ho+Qo+"]"),Yf=/[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"],Xf=-1,Ne={};Ne[ws]=Ne[Ss]=Ne[js]=Ne[Cs]=Ne[ys]=Ne[Ns]=Ne[Rs]=Ne[Es]=Ne[As]=!0,Ne[Kn]=Ne[ri]=Ne[Ar]=Ne[jr]=Ne[Wn]=Ne[Cr]=Ne[ii]=Ne[si]=Ne[At]=Ne[yr]=Ne[Gt]=Ne[Nr]=Ne[It]=Ne[Rr]=Ne[Er]=!1;var Ce={};Ce[Kn]=Ce[ri]=Ce[Ar]=Ce[Wn]=Ce[jr]=Ce[Cr]=Ce[ws]=Ce[Ss]=Ce[js]=Ce[Cs]=Ce[ys]=Ce[At]=Ce[yr]=Ce[Gt]=Ce[Nr]=Ce[It]=Ce[Rr]=Ce[ai]=Ce[Ns]=Ce[Rs]=Ce[Es]=Ce[As]=!0,Ce[ii]=Ce[si]=Ce[Er]=!1;var Jf={À:"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"},eg={"&":"&","<":"<",">":">",'"':""","'":"'"},tg={"&":"&","<":"<",">":">",""":'"',"'":"'"},ng={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rg=parseFloat,ig=parseInt,ul=typeof ur=="object"&&ur&&ur.Object===Object&&ur,sg=typeof self=="object"&&self&&self.Object===Object&&self,He=ul||sg||Function("return this")(),Ps=o&&!o.nodeType&&o,Nn=Ps&&!0&&n&&!n.nodeType&&n,cl=Nn&&Nn.exports===Ps,qs=cl&&ul.process,vt=function(){try{var C=Nn&&Nn.require&&Nn.require("util").types;return C||qs&&qs.binding&&qs.binding("util")}catch{}}(),dl=vt&&vt.isArrayBuffer,fl=vt&&vt.isDate,gl=vt&&vt.isMap,ml=vt&&vt.isRegExp,hl=vt&&vt.isSet,pl=vt&&vt.isTypedArray;function dt(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 ag(C,I,A,z){for(var se=-1,he=C==null?0:C.length;++se<he;){var Be=C[se];I(z,Be,A(Be),C)}return z}function bt(C,I){for(var A=-1,z=C==null?0:C.length;++A<z&&I(C[A],A,C)!==!1;);return C}function og(C,I){for(var A=C==null?0:C.length;A--&&I(C[A],A,C)!==!1;);return C}function xl(C,I){for(var A=-1,z=C==null?0:C.length;++A<z;)if(!I(C[A],A,C))return!1;return!0}function an(C,I){for(var A=-1,z=C==null?0:C.length,se=0,he=[];++A<z;){var Be=C[A];I(Be,A,C)&&(he[se++]=Be)}return he}function ci(C,I){var A=C==null?0:C.length;return!!A&&Yn(C,I,0)>-1}function ks(C,I,A){for(var z=-1,se=C==null?0:C.length;++z<se;)if(A(I,C[z]))return!0;return!1}function Ee(C,I){for(var A=-1,z=C==null?0:C.length,se=Array(z);++A<z;)se[A]=I(C[A],A,C);return se}function on(C,I){for(var A=-1,z=I.length,se=C.length;++A<z;)C[se+A]=I[A];return C}function $s(C,I,A,z){var se=-1,he=C==null?0:C.length;for(z&&he&&(A=C[++se]);++se<he;)A=I(A,C[se],se,C);return A}function lg(C,I,A,z){var se=C==null?0:C.length;for(z&&se&&(A=C[--se]);se--;)A=I(A,C[se],se,C);return A}function Bs(C,I){for(var A=-1,z=C==null?0:C.length;++A<z;)if(I(C[A],A,C))return!0;return!1}var ug=Us("length");function cg(C){return C.split("")}function dg(C){return C.match(vf)||[]}function _l(C,I,A){var z;return A(C,function(se,he,Be){if(I(se,he,Be))return z=he,!1}),z}function di(C,I,A,z){for(var se=C.length,he=A+(z?1:-1);z?he--:++he<se;)if(I(C[he],he,C))return he;return-1}function Yn(C,I,A){return I===I?jg(C,I,A):di(C,vl,A)}function fg(C,I,A,z){for(var se=A-1,he=C.length;++se<he;)if(z(C[se],I))return se;return-1}function vl(C){return C!==C}function bl(C,I){var A=C==null?0:C.length;return A?zs(C,I)/A:ie}function Us(C){return function(I){return I==null?r:I[C]}}function Vs(C){return function(I){return C==null?r:C[I]}}function wl(C,I,A,z,se){return se(C,function(he,Be,Se){A=z?(z=!1,he):I(A,he,Be,Se)}),A}function gg(C,I){var A=C.length;for(C.sort(I);A--;)C[A]=C[A].value;return C}function zs(C,I){for(var A,z=-1,se=C.length;++z<se;){var he=I(C[z]);he!==r&&(A=A===r?he:A+he)}return A}function Hs(C,I){for(var A=-1,z=Array(C);++A<C;)z[A]=I(A);return z}function mg(C,I){return Ee(I,function(A){return[A,C[A]]})}function Sl(C){return C&&C.slice(0,Nl(C)+1).replace(Fs,"")}function ft(C){return function(I){return C(I)}}function Gs(C,I){return Ee(I,function(A){return C[A]})}function Ir(C,I){return C.has(I)}function jl(C,I){for(var A=-1,z=C.length;++A<z&&Yn(I,C[A],0)>-1;);return A}function Cl(C,I){for(var A=C.length;A--&&Yn(I,C[A],0)>-1;);return A}function hg(C,I){for(var A=C.length,z=0;A--;)C[A]===I&&++z;return z}var pg=Vs(Jf),xg=Vs(eg);function _g(C){return"\\"+ng[C]}function vg(C,I){return C==null?r:C[I]}function Zn(C){return Qf.test(C)}function bg(C){return Yf.test(C)}function wg(C){for(var I,A=[];!(I=C.next()).done;)A.push(I.value);return A}function Ks(C){var I=-1,A=Array(C.size);return C.forEach(function(z,se){A[++I]=[se,z]}),A}function yl(C,I){return function(A){return C(I(A))}}function ln(C,I){for(var A=-1,z=C.length,se=0,he=[];++A<z;){var Be=C[A];(Be===I||Be===_)&&(C[A]=_,he[se++]=A)}return he}function fi(C){var I=-1,A=Array(C.size);return C.forEach(function(z){A[++I]=z}),A}function Sg(C){var I=-1,A=Array(C.size);return C.forEach(function(z){A[++I]=[z,z]}),A}function jg(C,I,A){for(var z=A-1,se=C.length;++z<se;)if(C[z]===I)return z;return-1}function Cg(C,I,A){for(var z=A+1;z--;)if(C[z]===I)return z;return z}function Xn(C){return Zn(C)?Ng(C):ug(C)}function Ft(C){return Zn(C)?Rg(C):cg(C)}function Nl(C){for(var I=C.length;I--&&hf.test(C.charAt(I)););return I}var yg=Vs(tg);function Ng(C){for(var I=Ls.lastIndex=0;Ls.test(C);)++I;return I}function Rg(C){return C.match(Ls)||[]}function Eg(C){return C.match(Wf)||[]}var Ag=function C(I){I=I==null?He:Jn.defaults(He.Object(),I,Jn.pick(He,Zf));var A=I.Array,z=I.Date,se=I.Error,he=I.Function,Be=I.Math,Se=I.Object,Ws=I.RegExp,Ig=I.String,wt=I.TypeError,gi=A.prototype,Fg=he.prototype,er=Se.prototype,mi=I["__core-js_shared__"],hi=Fg.toString,_e=er.hasOwnProperty,Dg=0,Rl=function(){var e=/[^.]+$/.exec(mi&&mi.keys&&mi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),pi=er.toString,Mg=hi.call(Se),Tg=He._,Og=Ws("^"+hi.call(_e).replace(Is,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xi=cl?I.Buffer:r,un=I.Symbol,_i=I.Uint8Array,El=xi?xi.allocUnsafe:r,vi=yl(Se.getPrototypeOf,Se),Al=Se.create,Il=er.propertyIsEnumerable,bi=gi.splice,Fl=un?un.isConcatSpreadable:r,Fr=un?un.iterator:r,Rn=un?un.toStringTag:r,wi=function(){try{var e=Dn(Se,"defineProperty");return e({},"",{}),e}catch{}}(),Lg=I.clearTimeout!==He.clearTimeout&&I.clearTimeout,Pg=z&&z.now!==He.Date.now&&z.now,qg=I.setTimeout!==He.setTimeout&&I.setTimeout,Si=Be.ceil,ji=Be.floor,Qs=Se.getOwnPropertySymbols,kg=xi?xi.isBuffer:r,Dl=I.isFinite,$g=gi.join,Bg=yl(Se.keys,Se),Ue=Be.max,Xe=Be.min,Ug=z.now,Vg=I.parseInt,Ml=Be.random,zg=gi.reverse,Ys=Dn(I,"DataView"),Dr=Dn(I,"Map"),Zs=Dn(I,"Promise"),tr=Dn(I,"Set"),Mr=Dn(I,"WeakMap"),Tr=Dn(Se,"create"),Ci=Mr&&new Mr,nr={},Hg=Mn(Ys),Gg=Mn(Dr),Kg=Mn(Zs),Wg=Mn(tr),Qg=Mn(Mr),yi=un?un.prototype:r,Or=yi?yi.valueOf:r,Tl=yi?yi.toString:r;function g(e){if(Ie(e)&&!ae(e)&&!(e instanceof fe)){if(e instanceof St)return e;if(_e.call(e,"__wrapped__"))return Ou(e)}return new St(e)}var rr=function(){function e(){}return function(t){if(!Ae(t))return{};if(Al)return Al(t);e.prototype=t;var s=new e;return e.prototype=r,s}}();function Ni(){}function St(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}g.templateSettings={escape:uf,evaluate:cf,interpolate:Vo,variable:"",imports:{_:g}},g.prototype=Ni.prototype,g.prototype.constructor=g,St.prototype=rr(Ni.prototype),St.prototype.constructor=St;function fe(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ye,this.__views__=[]}function Yg(){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 Xg(){var e=this.__wrapped__.value(),t=this.__dir__,s=ae(e),u=t<0,f=s?e.length:0,h=ch(0,f,this.__views__),w=h.start,S=h.end,R=S-w,D=u?S:w-1,M=this.__iteratees__,P=M.length,B=0,K=Xe(R,this.__takeCount__);if(!s||!u&&f==R&&K==R)return iu(e,this.__actions__);var ee=[];e:for(;R--&&B<K;){D+=t;for(var ue=-1,te=e[D];++ue<P;){var de=M[ue],me=de.iteratee,ht=de.type,it=me(te);if(ht==J)te=it;else if(!it){if(ht==ke)continue e;break e}}ee[B++]=te}return ee}fe.prototype=rr(Ni.prototype),fe.prototype.constructor=fe;function En(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Jg(){this.__data__=Tr?Tr(null):{},this.size=0}function em(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function tm(e){var t=this.__data__;if(Tr){var s=t[e];return s===p?r:s}return _e.call(t,e)?t[e]:r}function nm(e){var t=this.__data__;return Tr?t[e]!==r:_e.call(t,e)}function rm(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Tr&&t===r?p:t,this}En.prototype.clear=Jg,En.prototype.delete=em,En.prototype.get=tm,En.prototype.has=nm,En.prototype.set=rm;function Kt(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 im(){this.__data__=[],this.size=0}function sm(e){var t=this.__data__,s=Ri(t,e);if(s<0)return!1;var u=t.length-1;return s==u?t.pop():bi.call(t,s,1),--this.size,!0}function am(e){var t=this.__data__,s=Ri(t,e);return s<0?r:t[s][1]}function om(e){return Ri(this.__data__,e)>-1}function lm(e,t){var s=this.__data__,u=Ri(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this}Kt.prototype.clear=im,Kt.prototype.delete=sm,Kt.prototype.get=am,Kt.prototype.has=om,Kt.prototype.set=lm;function Wt(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 um(){this.size=0,this.__data__={hash:new En,map:new(Dr||Kt),string:new En}}function cm(e){var t=ki(this,e).delete(e);return this.size-=t?1:0,t}function dm(e){return ki(this,e).get(e)}function fm(e){return ki(this,e).has(e)}function gm(e,t){var s=ki(this,e),u=s.size;return s.set(e,t),this.size+=s.size==u?0:1,this}Wt.prototype.clear=um,Wt.prototype.delete=cm,Wt.prototype.get=dm,Wt.prototype.has=fm,Wt.prototype.set=gm;function An(e){var t=-1,s=e==null?0:e.length;for(this.__data__=new Wt;++t<s;)this.add(e[t])}function mm(e){return this.__data__.set(e,p),this}function hm(e){return this.__data__.has(e)}An.prototype.add=An.prototype.push=mm,An.prototype.has=hm;function Dt(e){var t=this.__data__=new Kt(e);this.size=t.size}function pm(){this.__data__=new Kt,this.size=0}function xm(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s}function _m(e){return this.__data__.get(e)}function vm(e){return this.__data__.has(e)}function bm(e,t){var s=this.__data__;if(s instanceof Kt){var u=s.__data__;if(!Dr||u.length<l-1)return u.push([e,t]),this.size=++s.size,this;s=this.__data__=new Wt(u)}return s.set(e,t),this.size=s.size,this}Dt.prototype.clear=pm,Dt.prototype.delete=xm,Dt.prototype.get=_m,Dt.prototype.has=vm,Dt.prototype.set=bm;function Ol(e,t){var s=ae(e),u=!s&&Tn(e),f=!s&&!u&&mn(e),h=!s&&!u&&!f&&or(e),w=s||u||f||h,S=w?Hs(e.length,Ig):[],R=S.length;for(var D in e)(t||_e.call(e,D))&&!(w&&(D=="length"||f&&(D=="offset"||D=="parent")||h&&(D=="buffer"||D=="byteLength"||D=="byteOffset")||Xt(D,R)))&&S.push(D);return S}function Ll(e){var t=e.length;return t?e[la(0,t-1)]:r}function wm(e,t){return $i(st(e),In(t,0,e.length))}function Sm(e){return $i(st(e))}function Xs(e,t,s){(s!==r&&!Mt(e[t],s)||s===r&&!(t in e))&&Qt(e,t,s)}function Lr(e,t,s){var u=e[t];(!(_e.call(e,t)&&Mt(u,s))||s===r&&!(t in e))&&Qt(e,t,s)}function Ri(e,t){for(var s=e.length;s--;)if(Mt(e[s][0],t))return s;return-1}function jm(e,t,s,u){return cn(e,function(f,h,w){t(u,f,s(f),w)}),u}function Pl(e,t){return e&&kt(t,Ve(t),e)}function Cm(e,t){return e&&kt(t,ot(t),e)}function Qt(e,t,s){t=="__proto__"&&wi?wi(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}function Js(e,t){for(var s=-1,u=t.length,f=A(u),h=e==null;++s<u;)f[s]=h?r:Ma(e,t[s]);return f}function In(e,t,s){return e===e&&(s!==r&&(e=e<=s?e:s),t!==r&&(e=e>=t?e:t)),e}function jt(e,t,s,u,f,h){var w,S=t&j,R=t&y,D=t&v;if(s&&(w=f?s(e,u,f,h):s(e)),w!==r)return w;if(!Ae(e))return e;var M=ae(e);if(M){if(w=fh(e),!S)return st(e,w)}else{var P=Je(e),B=P==si||P==ko;if(mn(e))return ou(e,S);if(P==Gt||P==Kn||B&&!f){if(w=R||B?{}:Nu(e),!S)return R?th(e,Cm(w,e)):eh(e,Pl(w,e))}else{if(!Ce[P])return f?e:{};w=gh(e,P,S)}}h||(h=new Dt);var K=h.get(e);if(K)return K;h.set(e,w),tc(e)?e.forEach(function(te){w.add(jt(te,t,s,te,e,h))}):Ju(e)&&e.forEach(function(te,de){w.set(de,jt(te,t,s,de,e,h))});var ee=D?R?va:_a:R?ot:Ve,ue=M?r:ee(e);return bt(ue||e,function(te,de){ue&&(de=te,te=e[de]),Lr(w,de,jt(te,t,s,de,e,h))}),w}function ym(e){var t=Ve(e);return function(s){return ql(s,e,t)}}function ql(e,t,s){var u=s.length;if(e==null)return!u;for(e=Se(e);u--;){var f=s[u],h=t[f],w=e[f];if(w===r&&!(f in e)||!h(w))return!1}return!0}function kl(e,t,s){if(typeof e!="function")throw new wt(d);return Vr(function(){e.apply(r,s)},t)}function Pr(e,t,s,u){var f=-1,h=ci,w=!0,S=e.length,R=[],D=t.length;if(!S)return R;s&&(t=Ee(t,ft(s))),u?(h=ks,w=!1):t.length>=l&&(h=Ir,w=!1,t=new An(t));e:for(;++f<S;){var M=e[f],P=s==null?M:s(M);if(M=u||M!==0?M:0,w&&P===P){for(var B=D;B--;)if(t[B]===P)continue e;R.push(M)}else h(t,P,u)||R.push(M)}return R}var cn=fu(qt),$l=fu(ta,!0);function Nm(e,t){var s=!0;return cn(e,function(u,f,h){return s=!!t(u,f,h),s}),s}function Ei(e,t,s){for(var u=-1,f=e.length;++u<f;){var h=e[u],w=t(h);if(w!=null&&(S===r?w===w&&!mt(w):s(w,S)))var S=w,R=h}return R}function Rm(e,t,s,u){var f=e.length;for(s=le(s),s<0&&(s=-s>f?0:f+s),u=u===r||u>f?f:le(u),u<0&&(u+=f),u=s>u?0:rc(u);s<u;)e[s++]=t;return e}function Bl(e,t){var s=[];return cn(e,function(u,f,h){t(u,f,h)&&s.push(u)}),s}function Ge(e,t,s,u,f){var h=-1,w=e.length;for(s||(s=hh),f||(f=[]);++h<w;){var S=e[h];t>0&&s(S)?t>1?Ge(S,t-1,s,u,f):on(f,S):u||(f[f.length]=S)}return f}var ea=gu(),Ul=gu(!0);function qt(e,t){return e&&ea(e,t,Ve)}function ta(e,t){return e&&Ul(e,t,Ve)}function Ai(e,t){return an(t,function(s){return Jt(e[s])})}function Fn(e,t){t=fn(t,e);for(var s=0,u=t.length;e!=null&&s<u;)e=e[$t(t[s++])];return s&&s==u?e:r}function Vl(e,t,s){var u=t(e);return ae(e)?u:on(u,s(e))}function nt(e){return e==null?e===r?tf:Jd:Rn&&Rn in Se(e)?uh(e):Sh(e)}function na(e,t){return e>t}function Em(e,t){return e!=null&&_e.call(e,t)}function Am(e,t){return e!=null&&t in Se(e)}function Im(e,t,s){return e>=Xe(t,s)&&e<Ue(t,s)}function ra(e,t,s){for(var u=s?ks:ci,f=e[0].length,h=e.length,w=h,S=A(h),R=1/0,D=[];w--;){var M=e[w];w&&t&&(M=Ee(M,ft(t))),R=Xe(M.length,R),S[w]=!s&&(t||f>=120&&M.length>=120)?new An(w&&M):r}M=e[0];var P=-1,B=S[0];e:for(;++P<f&&D.length<R;){var K=M[P],ee=t?t(K):K;if(K=s||K!==0?K:0,!(B?Ir(B,ee):u(D,ee,s))){for(w=h;--w;){var ue=S[w];if(!(ue?Ir(ue,ee):u(e[w],ee,s)))continue e}B&&B.push(ee),D.push(K)}}return D}function Fm(e,t,s,u){return qt(e,function(f,h,w){t(u,s(f),h,w)}),u}function qr(e,t,s){t=fn(t,e),e=Iu(e,t);var u=e==null?e:e[$t(yt(t))];return u==null?r:dt(u,e,s)}function zl(e){return Ie(e)&&nt(e)==Kn}function Dm(e){return Ie(e)&&nt(e)==Ar}function Mm(e){return Ie(e)&&nt(e)==Cr}function kr(e,t,s,u,f){return e===t?!0:e==null||t==null||!Ie(e)&&!Ie(t)?e!==e&&t!==t:Tm(e,t,s,u,kr,f)}function Tm(e,t,s,u,f,h){var w=ae(e),S=ae(t),R=w?ri:Je(e),D=S?ri:Je(t);R=R==Kn?Gt:R,D=D==Kn?Gt:D;var M=R==Gt,P=D==Gt,B=R==D;if(B&&mn(e)){if(!mn(t))return!1;w=!0,M=!1}if(B&&!M)return h||(h=new Dt),w||or(e)?ju(e,t,s,u,f,h):oh(e,t,R,s,u,f,h);if(!(s&E)){var K=M&&_e.call(e,"__wrapped__"),ee=P&&_e.call(t,"__wrapped__");if(K||ee){var ue=K?e.value():e,te=ee?t.value():t;return h||(h=new Dt),f(ue,te,s,u,h)}}return B?(h||(h=new Dt),lh(e,t,s,u,f,h)):!1}function Om(e){return Ie(e)&&Je(e)==At}function ia(e,t,s,u){var f=s.length,h=f,w=!u;if(e==null)return!h;for(e=Se(e);f--;){var S=s[f];if(w&&S[2]?S[1]!==e[S[0]]:!(S[0]in e))return!1}for(;++f<h;){S=s[f];var R=S[0],D=e[R],M=S[1];if(w&&S[2]){if(D===r&&!(R in e))return!1}else{var P=new Dt;if(u)var B=u(D,M,R,e,t,P);if(!(B===r?kr(M,D,E|N,u,P):B))return!1}}return!0}function Hl(e){if(!Ae(e)||xh(e))return!1;var t=Jt(e)?Og:yf;return t.test(Mn(e))}function Lm(e){return Ie(e)&&nt(e)==Nr}function Pm(e){return Ie(e)&&Je(e)==It}function qm(e){return Ie(e)&&Gi(e.length)&&!!Ne[nt(e)]}function Gl(e){return typeof e=="function"?e:e==null?lt:typeof e=="object"?ae(e)?Ql(e[0],e[1]):Wl(e):mc(e)}function sa(e){if(!Ur(e))return Bg(e);var t=[];for(var s in Se(e))_e.call(e,s)&&s!="constructor"&&t.push(s);return t}function km(e){if(!Ae(e))return wh(e);var t=Ur(e),s=[];for(var u in e)u=="constructor"&&(t||!_e.call(e,u))||s.push(u);return s}function aa(e,t){return e<t}function Kl(e,t){var s=-1,u=at(e)?A(e.length):[];return cn(e,function(f,h,w){u[++s]=t(f,h,w)}),u}function Wl(e){var t=wa(e);return t.length==1&&t[0][2]?Eu(t[0][0],t[0][1]):function(s){return s===e||ia(s,e,t)}}function Ql(e,t){return ja(e)&&Ru(t)?Eu($t(e),t):function(s){var u=Ma(s,e);return u===r&&u===t?Ta(s,e):kr(t,u,E|N)}}function Ii(e,t,s,u,f){e!==t&&ea(t,function(h,w){if(f||(f=new Dt),Ae(h))$m(e,t,w,s,Ii,u,f);else{var S=u?u(ya(e,w),h,w+"",e,t,f):r;S===r&&(S=h),Xs(e,w,S)}},ot)}function $m(e,t,s,u,f,h,w){var S=ya(e,s),R=ya(t,s),D=w.get(R);if(D){Xs(e,s,D);return}var M=h?h(S,R,s+"",e,t,w):r,P=M===r;if(P){var B=ae(R),K=!B&&mn(R),ee=!B&&!K&&or(R);M=R,B||K||ee?ae(S)?M=S:De(S)?M=st(S):K?(P=!1,M=ou(R,!0)):ee?(P=!1,M=lu(R,!0)):M=[]:zr(R)||Tn(R)?(M=S,Tn(S)?M=ic(S):(!Ae(S)||Jt(S))&&(M=Nu(R))):P=!1}P&&(w.set(R,M),f(M,R,u,h,w),w.delete(R)),Xs(e,s,M)}function Yl(e,t){var s=e.length;if(s)return t+=t<0?s:0,Xt(t,s)?e[t]:r}function Zl(e,t,s){t.length?t=Ee(t,function(h){return ae(h)?function(w){return Fn(w,h.length===1?h[0]:h)}:h}):t=[lt];var u=-1;t=Ee(t,ft(Y()));var f=Kl(e,function(h,w,S){var R=Ee(t,function(D){return D(h)});return{criteria:R,index:++u,value:h}});return gg(f,function(h,w){return Jm(h,w,s)})}function Bm(e,t){return Xl(e,t,function(s,u){return Ta(e,u)})}function Xl(e,t,s){for(var u=-1,f=t.length,h={};++u<f;){var w=t[u],S=Fn(e,w);s(S,w)&&$r(h,fn(w,e),S)}return h}function Um(e){return function(t){return Fn(t,e)}}function oa(e,t,s,u){var f=u?fg:Yn,h=-1,w=t.length,S=e;for(e===t&&(t=st(t)),s&&(S=Ee(e,ft(s)));++h<w;)for(var R=0,D=t[h],M=s?s(D):D;(R=f(S,M,R,u))>-1;)S!==e&&bi.call(S,R,1),bi.call(e,R,1);return e}function Jl(e,t){for(var s=e?t.length:0,u=s-1;s--;){var f=t[s];if(s==u||f!==h){var h=f;Xt(f)?bi.call(e,f,1):da(e,f)}}return e}function la(e,t){return e+ji(Ml()*(t-e+1))}function Vm(e,t,s,u){for(var f=-1,h=Ue(Si((t-e)/(s||1)),0),w=A(h);h--;)w[u?h:++f]=e,e+=s;return w}function ua(e,t){var s="";if(!e||t<1||t>ge)return s;do t%2&&(s+=e),t=ji(t/2),t&&(e+=e);while(t);return s}function ce(e,t){return Na(Au(e,t,lt),e+"")}function zm(e){return Ll(lr(e))}function Hm(e,t){var s=lr(e);return $i(s,In(t,0,s.length))}function $r(e,t,s,u){if(!Ae(e))return e;t=fn(t,e);for(var f=-1,h=t.length,w=h-1,S=e;S!=null&&++f<h;){var R=$t(t[f]),D=s;if(R==="__proto__"||R==="constructor"||R==="prototype")return e;if(f!=w){var M=S[R];D=u?u(M,R,S):r,D===r&&(D=Ae(M)?M:Xt(t[f+1])?[]:{})}Lr(S,R,D),S=S[R]}return e}var eu=Ci?function(e,t){return Ci.set(e,t),e}:lt,Gm=wi?function(e,t){return wi(e,"toString",{configurable:!0,enumerable:!1,value:La(t),writable:!0})}:lt;function Km(e){return $i(lr(e))}function Ct(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 h=A(f);++u<f;)h[u]=e[u+t];return h}function Wm(e,t){var s;return cn(e,function(u,f,h){return s=t(u,f,h),!s}),!!s}function Fi(e,t,s){var u=0,f=e==null?u:e.length;if(typeof t=="number"&&t===t&&f<=Sr){for(;u<f;){var h=u+f>>>1,w=e[h];w!==null&&!mt(w)&&(s?w<=t:w<t)?u=h+1:f=h}return f}return ca(e,t,lt,s)}function ca(e,t,s,u){var f=0,h=e==null?0:e.length;if(h===0)return 0;t=s(t);for(var w=t!==t,S=t===null,R=mt(t),D=t===r;f<h;){var M=ji((f+h)/2),P=s(e[M]),B=P!==r,K=P===null,ee=P===P,ue=mt(P);if(w)var te=u||ee;else D?te=ee&&(u||B):S?te=ee&&B&&(u||!K):R?te=ee&&B&&!K&&(u||!ue):K||ue?te=!1:te=u?P<=t:P<t;te?f=M+1:h=M}return Xe(h,_t)}function tu(e,t){for(var s=-1,u=e.length,f=0,h=[];++s<u;){var w=e[s],S=t?t(w):w;if(!s||!Mt(S,R)){var R=S;h[f++]=w===0?0:w}}return h}function nu(e){return typeof e=="number"?e:mt(e)?ie:+e}function gt(e){if(typeof e=="string")return e;if(ae(e))return Ee(e,gt)+"";if(mt(e))return Tl?Tl.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function dn(e,t,s){var u=-1,f=ci,h=e.length,w=!0,S=[],R=S;if(s)w=!1,f=ks;else if(h>=l){var D=t?null:sh(e);if(D)return fi(D);w=!1,f=Ir,R=new An}else R=t?[]:S;e:for(;++u<h;){var M=e[u],P=t?t(M):M;if(M=s||M!==0?M:0,w&&P===P){for(var B=R.length;B--;)if(R[B]===P)continue e;t&&R.push(P),S.push(M)}else f(R,P,s)||(R!==S&&R.push(P),S.push(M))}return S}function da(e,t){return t=fn(t,e),e=Iu(e,t),e==null||delete e[$t(yt(t))]}function ru(e,t,s,u){return $r(e,t,s(Fn(e,t)),u)}function Di(e,t,s,u){for(var f=e.length,h=u?f:-1;(u?h--:++h<f)&&t(e[h],h,e););return s?Ct(e,u?0:h,u?h+1:f):Ct(e,u?h+1:0,u?f:h)}function iu(e,t){var s=e;return s instanceof fe&&(s=s.value()),$s(t,function(u,f){return f.func.apply(f.thisArg,on([u],f.args))},s)}function fa(e,t,s){var u=e.length;if(u<2)return u?dn(e[0]):[];for(var f=-1,h=A(u);++f<u;)for(var w=e[f],S=-1;++S<u;)S!=f&&(h[f]=Pr(h[f]||w,e[S],t,s));return dn(Ge(h,1),t,s)}function su(e,t,s){for(var u=-1,f=e.length,h=t.length,w={};++u<f;){var S=u<h?t[u]:r;s(w,e[u],S)}return w}function ga(e){return De(e)?e:[]}function ma(e){return typeof e=="function"?e:lt}function fn(e,t){return ae(e)?e:ja(e,t)?[e]:Tu(xe(e))}var Qm=ce;function gn(e,t,s){var u=e.length;return s=s===r?u:s,!t&&s>=u?e:Ct(e,t,s)}var au=Lg||function(e){return He.clearTimeout(e)};function ou(e,t){if(t)return e.slice();var s=e.length,u=El?El(s):new e.constructor(s);return e.copy(u),u}function ha(e){var t=new e.constructor(e.byteLength);return new _i(t).set(new _i(e)),t}function Ym(e,t){var s=t?ha(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 Xm(e){return Or?Se(Or.call(e)):{}}function lu(e,t){var s=t?ha(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function uu(e,t){if(e!==t){var s=e!==r,u=e===null,f=e===e,h=mt(e),w=t!==r,S=t===null,R=t===t,D=mt(t);if(!S&&!D&&!h&&e>t||h&&w&&R&&!S&&!D||u&&w&&R||!s&&R||!f)return 1;if(!u&&!h&&!D&&e<t||D&&s&&f&&!u&&!h||S&&s&&f||!w&&f||!R)return-1}return 0}function Jm(e,t,s){for(var u=-1,f=e.criteria,h=t.criteria,w=f.length,S=s.length;++u<w;){var R=uu(f[u],h[u]);if(R){if(u>=S)return R;var D=s[u];return R*(D=="desc"?-1:1)}}return e.index-t.index}function cu(e,t,s,u){for(var f=-1,h=e.length,w=s.length,S=-1,R=t.length,D=Ue(h-w,0),M=A(R+D),P=!u;++S<R;)M[S]=t[S];for(;++f<w;)(P||f<h)&&(M[s[f]]=e[f]);for(;D--;)M[S++]=e[f++];return M}function du(e,t,s,u){for(var f=-1,h=e.length,w=-1,S=s.length,R=-1,D=t.length,M=Ue(h-S,0),P=A(M+D),B=!u;++f<M;)P[f]=e[f];for(var K=f;++R<D;)P[K+R]=t[R];for(;++w<S;)(B||f<h)&&(P[K+s[w]]=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 kt(e,t,s,u){var f=!s;s||(s={});for(var h=-1,w=t.length;++h<w;){var S=t[h],R=u?u(s[S],e[S],S,s,e):r;R===r&&(R=e[S]),f?Qt(s,S,R):Lr(s,S,R)}return s}function eh(e,t){return kt(e,Sa(e),t)}function th(e,t){return kt(e,Cu(e),t)}function Mi(e,t){return function(s,u){var f=ae(s)?ag:jm,h=t?t():{};return f(s,e,Y(u,2),h)}}function ir(e){return ce(function(t,s){var u=-1,f=s.length,h=f>1?s[f-1]:r,w=f>2?s[2]:r;for(h=e.length>3&&typeof h=="function"?(f--,h):r,w&&rt(s[0],s[1],w)&&(h=f<3?r:h,f=1),t=Se(t);++u<f;){var S=s[u];S&&e(t,S,u,h)}return t})}function fu(e,t){return function(s,u){if(s==null)return s;if(!at(s))return e(s,u);for(var f=s.length,h=t?f:-1,w=Se(s);(t?h--:++h<f)&&u(w[h],h,w)!==!1;);return s}}function gu(e){return function(t,s,u){for(var f=-1,h=Se(t),w=u(t),S=w.length;S--;){var R=w[e?S:++f];if(s(h[R],R,h)===!1)break}return t}}function nh(e,t,s){var u=t&L,f=Br(e);function h(){var w=this&&this!==He&&this instanceof h?f:e;return w.apply(u?s:this,arguments)}return h}function mu(e){return function(t){t=xe(t);var s=Zn(t)?Ft(t):r,u=s?s[0]:t.charAt(0),f=s?gn(s,1).join(""):t.slice(1);return u[e]()+f}}function sr(e){return function(t){return $s(fc(dc(t).replace(Gf,"")),e,"")}}function Br(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=rr(e.prototype),u=e.apply(s,t);return Ae(u)?u:s}}function rh(e,t,s){var u=Br(e);function f(){for(var h=arguments.length,w=A(h),S=h,R=ar(f);S--;)w[S]=arguments[S];var D=h<3&&w[0]!==R&&w[h-1]!==R?[]:ln(w,R);if(h-=D.length,h<s)return vu(e,t,Ti,f.placeholder,r,w,D,r,r,s-h);var M=this&&this!==He&&this instanceof f?u:e;return dt(M,this,w)}return f}function hu(e){return function(t,s,u){var f=Se(t);if(!at(t)){var h=Y(s,3);t=Ve(t),s=function(S){return h(f[S],S,f)}}var w=e(t,s,u);return w>-1?f[h?t[w]:w]:r}}function pu(e){return Zt(function(t){var s=t.length,u=s,f=St.prototype.thru;for(e&&t.reverse();u--;){var h=t[u];if(typeof h!="function")throw new wt(d);if(f&&!w&&qi(h)=="wrapper")var w=new St([],!0)}for(u=w?u:s;++u<s;){h=t[u];var S=qi(h),R=S=="wrapper"?ba(h):r;R&&Ca(R[0])&&R[1]==(G|q|O|ne)&&!R[4].length&&R[9]==1?w=w[qi(R[0])].apply(w,R[3]):w=h.length==1&&Ca(h)?w[S]():w.thru(h)}return function(){var D=arguments,M=D[0];if(w&&D.length==1&&ae(M))return w.plant(M).value();for(var P=0,B=s?t[P].apply(this,D):M;++P<s;)B=t[P].call(this,B);return B}})}function Ti(e,t,s,u,f,h,w,S,R,D){var M=t&G,P=t&L,B=t&F,K=t&(q|V),ee=t&U,ue=B?r:Br(e);function te(){for(var de=arguments.length,me=A(de),ht=de;ht--;)me[ht]=arguments[ht];if(K)var it=ar(te),pt=hg(me,it);if(u&&(me=cu(me,u,f,K)),h&&(me=du(me,h,w,K)),de-=pt,K&&de<D){var Me=ln(me,it);return vu(e,t,Ti,te.placeholder,s,me,Me,S,R,D-de)}var Tt=P?s:this,tn=B?Tt[e]:e;return de=me.length,S?me=jh(me,S):ee&&de>1&&me.reverse(),M&&R<de&&(me.length=R),this&&this!==He&&this instanceof te&&(tn=ue||Br(tn)),tn.apply(Tt,me)}return te}function xu(e,t){return function(s,u){return Fm(s,e,t(u),{})}}function Oi(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=gt(s),u=gt(u)):(s=nu(s),u=nu(u)),f=e(s,u)}return f}}function pa(e){return Zt(function(t){return t=Ee(t,ft(Y())),ce(function(s){var u=this;return e(t,function(f){return dt(f,u,s)})})})}function Li(e,t){t=t===r?" ":gt(t);var s=t.length;if(s<2)return s?ua(t,e):t;var u=ua(t,Si(e/Xn(t)));return Zn(t)?gn(Ft(u),0,e).join(""):u.slice(0,e)}function ih(e,t,s,u){var f=t&L,h=Br(e);function w(){for(var S=-1,R=arguments.length,D=-1,M=u.length,P=A(M+R),B=this&&this!==He&&this instanceof w?h:e;++D<M;)P[D]=u[D];for(;R--;)P[D++]=arguments[++S];return dt(B,f?s:this,P)}return w}function _u(e){return function(t,s,u){return u&&typeof u!="number"&&rt(t,s,u)&&(s=u=r),t=en(t),s===r?(s=t,t=0):s=en(s),u=u===r?t<s?1:-1:en(u),Vm(t,s,u,e)}}function Pi(e){return function(t,s){return typeof t=="string"&&typeof s=="string"||(t=Nt(t),s=Nt(s)),e(t,s)}}function vu(e,t,s,u,f,h,w,S,R,D){var M=t&q,P=M?w:r,B=M?r:w,K=M?h:r,ee=M?r:h;t|=M?O:k,t&=~(M?k:O),t&$||(t&=-4);var ue=[e,t,f,K,P,ee,B,S,R,D],te=s.apply(r,ue);return Ca(e)&&Fu(te,ue),te.placeholder=u,Du(te,e,t)}function xa(e){var t=Be[e];return function(s,u){if(s=Nt(s),u=u==null?0:Xe(le(u),292),u&&Dl(s)){var f=(xe(s)+"e").split("e"),h=t(f[0]+"e"+(+f[1]+u));return f=(xe(h)+"e").split("e"),+(f[0]+"e"+(+f[1]-u))}return t(s)}}var sh=tr&&1/fi(new tr([,-0]))[1]==Le?function(e){return new tr(e)}:ka;function bu(e){return function(t){var s=Je(t);return s==At?Ks(t):s==It?Sg(t):mg(t,e(t))}}function Yt(e,t,s,u,f,h,w,S){var R=t&F;if(!R&&typeof e!="function")throw new wt(d);var D=u?u.length:0;if(D||(t&=-97,u=f=r),w=w===r?w:Ue(le(w),0),S=S===r?S:le(S),D-=f?f.length:0,t&k){var M=u,P=f;u=f=r}var B=R?r:ba(e),K=[e,t,s,u,f,M,P,h,w,S];if(B&&bh(K,B),e=K[0],t=K[1],s=K[2],u=K[3],f=K[4],S=K[9]=K[9]===r?R?0:e.length:Ue(K[9]-D,0),!S&&t&(q|V)&&(t&=-25),!t||t==L)var ee=nh(e,t,s);else t==q||t==V?ee=rh(e,t,S):(t==O||t==(L|O))&&!f.length?ee=ih(e,t,s,u):ee=Ti.apply(r,K);var ue=B?eu:Fu;return Du(ue(ee,K),e,t)}function wu(e,t,s,u){return e===r||Mt(e,er[s])&&!_e.call(u,s)?t:e}function Su(e,t,s,u,f,h){return Ae(e)&&Ae(t)&&(h.set(t,e),Ii(e,t,r,Su,h),h.delete(t)),e}function ah(e){return zr(e)?r:e}function ju(e,t,s,u,f,h){var w=s&E,S=e.length,R=t.length;if(S!=R&&!(w&&R>S))return!1;var D=h.get(e),M=h.get(t);if(D&&M)return D==t&&M==e;var P=-1,B=!0,K=s&N?new An:r;for(h.set(e,t),h.set(t,e);++P<S;){var ee=e[P],ue=t[P];if(u)var te=w?u(ue,ee,P,t,e,h):u(ee,ue,P,e,t,h);if(te!==r){if(te)continue;B=!1;break}if(K){if(!Bs(t,function(de,me){if(!Ir(K,me)&&(ee===de||f(ee,de,s,u,h)))return K.push(me)})){B=!1;break}}else if(!(ee===ue||f(ee,ue,s,u,h))){B=!1;break}}return h.delete(e),h.delete(t),B}function oh(e,t,s,u,f,h,w){switch(s){case Wn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Ar:return!(e.byteLength!=t.byteLength||!h(new _i(e),new _i(t)));case jr:case Cr:case yr:return Mt(+e,+t);case ii:return e.name==t.name&&e.message==t.message;case Nr:case Rr:return e==t+"";case At:var S=Ks;case It:var R=u&E;if(S||(S=fi),e.size!=t.size&&!R)return!1;var D=w.get(e);if(D)return D==t;u|=N,w.set(e,t);var M=ju(S(e),S(t),u,f,h,w);return w.delete(e),M;case ai:if(Or)return Or.call(e)==Or.call(t)}return!1}function lh(e,t,s,u,f,h){var w=s&E,S=_a(e),R=S.length,D=_a(t),M=D.length;if(R!=M&&!w)return!1;for(var P=R;P--;){var B=S[P];if(!(w?B in t:_e.call(t,B)))return!1}var K=h.get(e),ee=h.get(t);if(K&&ee)return K==t&&ee==e;var ue=!0;h.set(e,t),h.set(t,e);for(var te=w;++P<R;){B=S[P];var de=e[B],me=t[B];if(u)var ht=w?u(me,de,B,t,e,h):u(de,me,B,e,t,h);if(!(ht===r?de===me||f(de,me,s,u,h):ht)){ue=!1;break}te||(te=B=="constructor")}if(ue&&!te){var it=e.constructor,pt=t.constructor;it!=pt&&"constructor"in e&&"constructor"in t&&!(typeof it=="function"&&it instanceof it&&typeof pt=="function"&&pt instanceof pt)&&(ue=!1)}return h.delete(e),h.delete(t),ue}function Zt(e){return Na(Au(e,r,qu),e+"")}function _a(e){return Vl(e,Ve,Sa)}function va(e){return Vl(e,ot,Cu)}var ba=Ci?function(e){return Ci.get(e)}:ka;function qi(e){for(var t=e.name+"",s=nr[t],u=_e.call(nr,t)?s.length:0;u--;){var f=s[u],h=f.func;if(h==null||h==e)return f.name}return t}function ar(e){var t=_e.call(g,"placeholder")?g:e;return t.placeholder}function Y(){var e=g.iteratee||Pa;return e=e===Pa?Gl:e,arguments.length?e(arguments[0],arguments[1]):e}function ki(e,t){var s=e.__data__;return ph(t)?s[typeof t=="string"?"string":"hash"]:s.map}function wa(e){for(var t=Ve(e),s=t.length;s--;){var u=t[s],f=e[u];t[s]=[u,f,Ru(f)]}return t}function Dn(e,t){var s=vg(e,t);return Hl(s)?s:r}function uh(e){var t=_e.call(e,Rn),s=e[Rn];try{e[Rn]=r;var u=!0}catch{}var f=pi.call(e);return u&&(t?e[Rn]=s:delete e[Rn]),f}var Sa=Qs?function(e){return e==null?[]:(e=Se(e),an(Qs(e),function(t){return Il.call(e,t)}))}:$a,Cu=Qs?function(e){for(var t=[];e;)on(t,Sa(e)),e=vi(e);return t}:$a,Je=nt;(Ys&&Je(new Ys(new ArrayBuffer(1)))!=Wn||Dr&&Je(new Dr)!=At||Zs&&Je(Zs.resolve())!=$o||tr&&Je(new tr)!=It||Mr&&Je(new Mr)!=Er)&&(Je=function(e){var t=nt(e),s=t==Gt?e.constructor:r,u=s?Mn(s):"";if(u)switch(u){case Hg:return Wn;case Gg:return At;case Kg:return $o;case Wg:return It;case Qg:return Er}return t});function ch(e,t,s){for(var u=-1,f=s.length;++u<f;){var h=s[u],w=h.size;switch(h.type){case"drop":e+=w;break;case"dropRight":t-=w;break;case"take":t=Xe(t,e+w);break;case"takeRight":e=Ue(e,t-w);break}}return{start:e,end:t}}function dh(e){var t=e.match(xf);return t?t[1].split(_f):[]}function yu(e,t,s){t=fn(t,e);for(var u=-1,f=t.length,h=!1;++u<f;){var w=$t(t[u]);if(!(h=e!=null&&s(e,w)))break;e=e[w]}return h||++u!=f?h:(f=e==null?0:e.length,!!f&&Gi(f)&&Xt(w,f)&&(ae(e)||Tn(e)))}function fh(e){var t=e.length,s=new e.constructor(t);return t&&typeof e[0]=="string"&&_e.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function Nu(e){return typeof e.constructor=="function"&&!Ur(e)?rr(vi(e)):{}}function gh(e,t,s){var u=e.constructor;switch(t){case Ar:return ha(e);case jr:case Cr:return new u(+e);case Wn:return Ym(e,s);case ws:case Ss:case js:case Cs:case ys:case Ns:case Rs:case Es:case As:return lu(e,s);case At:return new u;case yr:case Rr:return new u(e);case Nr:return Zm(e);case It:return new u;case ai:return Xm(e)}}function mh(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(pf,`{
|
||
/* [wrapped with `+t+`] */
|
||
`)}function hh(e){return ae(e)||Tn(e)||!!(Fl&&e&&e[Fl])}function Xt(e,t){var s=typeof e;return t=t??ge,!!t&&(s=="number"||s!="symbol"&&Rf.test(e))&&e>-1&&e%1==0&&e<t}function rt(e,t,s){if(!Ae(s))return!1;var u=typeof t;return(u=="number"?at(s)&&Xt(t,s.length):u=="string"&&t in s)?Mt(s[t],e):!1}function ja(e,t){if(ae(e))return!1;var s=typeof e;return s=="number"||s=="symbol"||s=="boolean"||e==null||mt(e)?!0:ff.test(e)||!df.test(e)||t!=null&&e in Se(t)}function ph(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ca(e){var t=qi(e),s=g[t];if(typeof s!="function"||!(t in fe.prototype))return!1;if(e===s)return!0;var u=ba(s);return!!u&&e===u[0]}function xh(e){return!!Rl&&Rl in e}var _h=mi?Jt:Ba;function Ur(e){var t=e&&e.constructor,s=typeof t=="function"&&t.prototype||er;return e===s}function Ru(e){return e===e&&!Ae(e)}function Eu(e,t){return function(s){return s==null?!1:s[e]===t&&(t!==r||e in Se(s))}}function vh(e){var t=zi(e,function(u){return s.size===x&&s.clear(),u}),s=t.cache;return t}function bh(e,t){var s=e[1],u=t[1],f=s|u,h=f<(L|F|G),w=u==G&&s==q||u==G&&s==ne&&e[7].length<=t[8]||u==(G|ne)&&t[7].length<=t[8]&&s==q;if(!(h||w))return e;u&L&&(e[2]=t[2],f|=s&L?0:$);var S=t[3];if(S){var R=e[3];e[3]=R?cu(R,S,t[4]):S,e[4]=R?ln(e[3],_):t[4]}return S=t[5],S&&(R=e[5],e[5]=R?du(R,S,t[6]):S,e[6]=R?ln(e[5],_):t[6]),S=t[7],S&&(e[7]=S),u&G&&(e[8]=e[8]==null?t[8]:Xe(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=f,e}function wh(e){var t=[];if(e!=null)for(var s in Se(e))t.push(s);return t}function Sh(e){return pi.call(e)}function Au(e,t,s){return t=Ue(t===r?e.length-1:t,0),function(){for(var u=arguments,f=-1,h=Ue(u.length-t,0),w=A(h);++f<h;)w[f]=u[t+f];f=-1;for(var S=A(t+1);++f<t;)S[f]=u[f];return S[t]=s(w),dt(e,this,S)}}function Iu(e,t){return t.length<2?e:Fn(e,Ct(t,0,-1))}function jh(e,t){for(var s=e.length,u=Xe(t.length,s),f=st(e);u--;){var h=t[u];e[u]=Xt(h,s)?f[h]:r}return e}function ya(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Fu=Mu(eu),Vr=qg||function(e,t){return He.setTimeout(e,t)},Na=Mu(Gm);function Du(e,t,s){var u=t+"";return Na(e,mh(u,Ch(dh(u),s)))}function Mu(e){var t=0,s=0;return function(){var u=Ug(),f=we-(u-s);if(s=u,f>0){if(++t>=W)return arguments[0]}else t=0;return e.apply(r,arguments)}}function $i(e,t){var s=-1,u=e.length,f=u-1;for(t=t===r?u:t;++s<t;){var h=la(s,f),w=e[h];e[h]=e[s],e[s]=w}return e.length=t,e}var Tu=vh(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(gf,function(s,u,f,h){t.push(f?h.replace(wf,"$1"):u||s)}),t});function $t(e){if(typeof e=="string"||mt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Mn(e){if(e!=null){try{return hi.call(e)}catch{}try{return e+""}catch{}}return""}function Ch(e,t){return bt(yn,function(s){var u="_."+s[0];t&s[1]&&!ci(e,u)&&e.push(u)}),e.sort()}function Ou(e){if(e instanceof fe)return e.clone();var t=new St(e.__wrapped__,e.__chain__);return t.__actions__=st(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function yh(e,t,s){(s?rt(e,t,s):t===r)?t=1:t=Ue(le(t),0);var u=e==null?0:e.length;if(!u||t<1)return[];for(var f=0,h=0,w=A(Si(u/t));f<u;)w[h++]=Ct(e,f,f+=t);return w}function Nh(e){for(var t=-1,s=e==null?0:e.length,u=0,f=[];++t<s;){var h=e[t];h&&(f[u++]=h)}return f}function Rh(){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 on(ae(s)?st(s):[s],Ge(t,1))}var Eh=ce(function(e,t){return De(e)?Pr(e,Ge(t,1,De,!0)):[]}),Ah=ce(function(e,t){var s=yt(t);return De(s)&&(s=r),De(e)?Pr(e,Ge(t,1,De,!0),Y(s,2)):[]}),Ih=ce(function(e,t){var s=yt(t);return De(s)&&(s=r),De(e)?Pr(e,Ge(t,1,De,!0),r,s):[]});function Fh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:le(t),Ct(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:le(t),t=u-t,Ct(e,0,t<0?0:t)):[]}function Mh(e,t){return e&&e.length?Di(e,Y(t,3),!0,!0):[]}function Th(e,t){return e&&e.length?Di(e,Y(t,3),!0):[]}function Oh(e,t,s,u){var f=e==null?0:e.length;return f?(s&&typeof s!="number"&&rt(e,t,s)&&(s=0,u=f),Rm(e,t,s,u)):[]}function Lu(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:le(s);return f<0&&(f=Ue(u+f,0)),di(e,Y(t,3),f)}function Pu(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=u-1;return s!==r&&(f=le(s),f=s<0?Ue(u+f,0):Xe(f,u-1)),di(e,Y(t,3),f,!0)}function qu(e){var t=e==null?0:e.length;return t?Ge(e,1):[]}function Lh(e){var t=e==null?0:e.length;return t?Ge(e,Le):[]}function Ph(e,t){var s=e==null?0:e.length;return s?(t=t===r?1:le(t),Ge(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 ku(e){return e&&e.length?e[0]:r}function kh(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:le(s);return f<0&&(f=Ue(u+f,0)),Yn(e,t,f)}function $h(e){var t=e==null?0:e.length;return t?Ct(e,0,-1):[]}var Bh=ce(function(e){var t=Ee(e,ga);return t.length&&t[0]===e[0]?ra(t):[]}),Uh=ce(function(e){var t=yt(e),s=Ee(e,ga);return t===yt(s)?t=r:s.pop(),s.length&&s[0]===e[0]?ra(s,Y(t,2)):[]}),Vh=ce(function(e){var t=yt(e),s=Ee(e,ga);return t=typeof t=="function"?t:r,t&&s.pop(),s.length&&s[0]===e[0]?ra(s,r,t):[]});function zh(e,t){return e==null?"":$g.call(e,t)}function yt(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=le(s),f=f<0?Ue(u+f,0):Xe(f,u-1)),t===t?Cg(e,t,f):di(e,vl,f,!0)}function Gh(e,t){return e&&e.length?Yl(e,le(t)):r}var Kh=ce($u);function $u(e,t){return e&&e.length&&t&&t.length?oa(e,t):e}function Wh(e,t,s){return e&&e.length&&t&&t.length?oa(e,t,Y(s,2)):e}function Qh(e,t,s){return e&&e.length&&t&&t.length?oa(e,t,r,s):e}var Yh=Zt(function(e,t){var s=e==null?0:e.length,u=Js(e,t);return Jl(e,Ee(t,function(f){return Xt(f,s)?+f:f}).sort(uu)),u});function Zh(e,t){var s=[];if(!(e&&e.length))return s;var u=-1,f=[],h=e.length;for(t=Y(t,3);++u<h;){var w=e[u];t(w,u,e)&&(s.push(w),f.push(u))}return Jl(e,f),s}function Ra(e){return e==null?e:zg.call(e)}function Xh(e,t,s){var u=e==null?0:e.length;return u?(s&&typeof s!="number"&&rt(e,t,s)?(t=0,s=u):(t=t==null?0:le(t),s=s===r?u:le(s)),Ct(e,t,s)):[]}function Jh(e,t){return Fi(e,t)}function ep(e,t,s){return ca(e,t,Y(s,2))}function tp(e,t){var s=e==null?0:e.length;if(s){var u=Fi(e,t);if(u<s&&Mt(e[u],t))return u}return-1}function np(e,t){return Fi(e,t,!0)}function rp(e,t,s){return ca(e,t,Y(s,2),!0)}function ip(e,t){var s=e==null?0:e.length;if(s){var u=Fi(e,t,!0)-1;if(Mt(e[u],t))return u}return-1}function sp(e){return e&&e.length?tu(e):[]}function ap(e,t){return e&&e.length?tu(e,Y(t,2)):[]}function op(e){var t=e==null?0:e.length;return t?Ct(e,1,t):[]}function lp(e,t,s){return e&&e.length?(t=s||t===r?1:le(t),Ct(e,0,t<0?0:t)):[]}function up(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:le(t),t=u-t,Ct(e,t<0?0:t,u)):[]}function cp(e,t){return e&&e.length?Di(e,Y(t,3),!1,!0):[]}function dp(e,t){return e&&e.length?Di(e,Y(t,3)):[]}var fp=ce(function(e){return dn(Ge(e,1,De,!0))}),gp=ce(function(e){var t=yt(e);return De(t)&&(t=r),dn(Ge(e,1,De,!0),Y(t,2))}),mp=ce(function(e){var t=yt(e);return t=typeof t=="function"?t:r,dn(Ge(e,1,De,!0),r,t)});function hp(e){return e&&e.length?dn(e):[]}function pp(e,t){return e&&e.length?dn(e,Y(t,2)):[]}function xp(e,t){return t=typeof t=="function"?t:r,e&&e.length?dn(e,r,t):[]}function Ea(e){if(!(e&&e.length))return[];var t=0;return e=an(e,function(s){if(De(s))return t=Ue(s.length,t),!0}),Hs(t,function(s){return Ee(e,Us(s))})}function Bu(e,t){if(!(e&&e.length))return[];var s=Ea(e);return t==null?s:Ee(s,function(u){return dt(t,r,u)})}var _p=ce(function(e,t){return De(e)?Pr(e,t):[]}),vp=ce(function(e){return fa(an(e,De))}),bp=ce(function(e){var t=yt(e);return De(t)&&(t=r),fa(an(e,De),Y(t,2))}),wp=ce(function(e){var t=yt(e);return t=typeof t=="function"?t:r,fa(an(e,De),r,t)}),Sp=ce(Ea);function jp(e,t){return su(e||[],t||[],Lr)}function Cp(e,t){return su(e||[],t||[],$r)}var yp=ce(function(e){var t=e.length,s=t>1?e[t-1]:r;return s=typeof s=="function"?(e.pop(),s):r,Bu(e,s)});function Uu(e){var t=g(e);return t.__chain__=!0,t}function Np(e,t){return t(e),e}function Bi(e,t){return t(e)}var Rp=Zt(function(e){var t=e.length,s=t?e[0]:0,u=this.__wrapped__,f=function(h){return Js(h,e)};return t>1||this.__actions__.length||!(u instanceof fe)||!Xt(s)?this.thru(f):(u=u.slice(s,+s+(t?1:0)),u.__actions__.push({func:Bi,args:[f],thisArg:r}),new St(u,this.__chain__).thru(function(h){return t&&!h.length&&h.push(r),h}))});function Ep(){return Uu(this)}function Ap(){return new St(this.value(),this.__chain__)}function Ip(){this.__values__===r&&(this.__values__=nc(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function Fp(){return this}function Dp(e){for(var t,s=this;s instanceof Ni;){var u=Ou(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 Mp(){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:Bi,args:[Ra],thisArg:r}),new St(t,this.__chain__)}return this.thru(Ra)}function Tp(){return iu(this.__wrapped__,this.__actions__)}var Op=Mi(function(e,t,s){_e.call(e,s)?++e[s]:Qt(e,s,1)});function Lp(e,t,s){var u=ae(e)?xl:Nm;return s&&rt(e,t,s)&&(t=r),u(e,Y(t,3))}function Pp(e,t){var s=ae(e)?an:Bl;return s(e,Y(t,3))}var qp=hu(Lu),kp=hu(Pu);function $p(e,t){return Ge(Ui(e,t),1)}function Bp(e,t){return Ge(Ui(e,t),Le)}function Up(e,t,s){return s=s===r?1:le(s),Ge(Ui(e,t),s)}function Vu(e,t){var s=ae(e)?bt:cn;return s(e,Y(t,3))}function zu(e,t){var s=ae(e)?og:$l;return s(e,Y(t,3))}var Vp=Mi(function(e,t,s){_e.call(e,s)?e[s].push(t):Qt(e,s,[t])});function zp(e,t,s,u){e=at(e)?e:lr(e),s=s&&!u?le(s):0;var f=e.length;return s<0&&(s=Ue(f+s,0)),Ki(e)?s<=f&&e.indexOf(t,s)>-1:!!f&&Yn(e,t,s)>-1}var Hp=ce(function(e,t,s){var u=-1,f=typeof t=="function",h=at(e)?A(e.length):[];return cn(e,function(w){h[++u]=f?dt(t,w,s):qr(w,t,s)}),h}),Gp=Mi(function(e,t,s){Qt(e,s,t)});function Ui(e,t){var s=ae(e)?Ee:Kl;return s(e,Y(t,3))}function Kp(e,t,s,u){return e==null?[]:(ae(t)||(t=t==null?[]:[t]),s=u?r:s,ae(s)||(s=s==null?[]:[s]),Zl(e,t,s))}var Wp=Mi(function(e,t,s){e[s?0:1].push(t)},function(){return[[],[]]});function Qp(e,t,s){var u=ae(e)?$s:wl,f=arguments.length<3;return u(e,Y(t,4),s,f,cn)}function Yp(e,t,s){var u=ae(e)?lg:wl,f=arguments.length<3;return u(e,Y(t,4),s,f,$l)}function Zp(e,t){var s=ae(e)?an:Bl;return s(e,Hi(Y(t,3)))}function Xp(e){var t=ae(e)?Ll:zm;return t(e)}function Jp(e,t,s){(s?rt(e,t,s):t===r)?t=1:t=le(t);var u=ae(e)?wm:Hm;return u(e,t)}function ex(e){var t=ae(e)?Sm:Km;return t(e)}function tx(e){if(e==null)return 0;if(at(e))return Ki(e)?Xn(e):e.length;var t=Je(e);return t==At||t==It?e.size:sa(e).length}function nx(e,t,s){var u=ae(e)?Bs:Wm;return s&&rt(e,t,s)&&(t=r),u(e,Y(t,3))}var rx=ce(function(e,t){if(e==null)return[];var s=t.length;return s>1&&rt(e,t[0],t[1])?t=[]:s>2&&rt(t[0],t[1],t[2])&&(t=[t[0]]),Zl(e,Ge(t,1),[])}),Vi=Pg||function(){return He.Date.now()};function ix(e,t){if(typeof t!="function")throw new wt(d);return e=le(e),function(){if(--e<1)return t.apply(this,arguments)}}function Hu(e,t,s){return t=s?r:t,t=e&&t==null?e.length:t,Yt(e,G,r,r,r,r,t)}function Gu(e,t){var s;if(typeof t!="function")throw new wt(d);return e=le(e),function(){return--e>0&&(s=t.apply(this,arguments)),e<=1&&(t=r),s}}var Aa=ce(function(e,t,s){var u=L;if(s.length){var f=ln(s,ar(Aa));u|=O}return Yt(e,u,t,s,f)}),Ku=ce(function(e,t,s){var u=L|F;if(s.length){var f=ln(s,ar(Ku));u|=O}return Yt(t,u,e,s,f)});function Wu(e,t,s){t=s?r:t;var u=Yt(e,q,r,r,r,r,r,t);return u.placeholder=Wu.placeholder,u}function Qu(e,t,s){t=s?r:t;var u=Yt(e,V,r,r,r,r,r,t);return u.placeholder=Qu.placeholder,u}function Yu(e,t,s){var u,f,h,w,S,R,D=0,M=!1,P=!1,B=!0;if(typeof e!="function")throw new wt(d);t=Nt(t)||0,Ae(s)&&(M=!!s.leading,P="maxWait"in s,h=P?Ue(Nt(s.maxWait)||0,t):h,B="trailing"in s?!!s.trailing:B);function K(Me){var Tt=u,tn=f;return u=f=r,D=Me,w=e.apply(tn,Tt),w}function ee(Me){return D=Me,S=Vr(de,t),M?K(Me):w}function ue(Me){var Tt=Me-R,tn=Me-D,hc=t-Tt;return P?Xe(hc,h-tn):hc}function te(Me){var Tt=Me-R,tn=Me-D;return R===r||Tt>=t||Tt<0||P&&tn>=h}function de(){var Me=Vi();if(te(Me))return me(Me);S=Vr(de,ue(Me))}function me(Me){return S=r,B&&u?K(Me):(u=f=r,w)}function ht(){S!==r&&au(S),D=0,u=R=f=S=r}function it(){return S===r?w:me(Vi())}function pt(){var Me=Vi(),Tt=te(Me);if(u=arguments,f=this,R=Me,Tt){if(S===r)return ee(R);if(P)return au(S),S=Vr(de,t),K(R)}return S===r&&(S=Vr(de,t)),w}return pt.cancel=ht,pt.flush=it,pt}var sx=ce(function(e,t){return kl(e,1,t)}),ax=ce(function(e,t,s){return kl(e,Nt(t)||0,s)});function ox(e){return Yt(e,U)}function zi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new wt(d);var s=function(){var u=arguments,f=t?t.apply(this,u):u[0],h=s.cache;if(h.has(f))return h.get(f);var w=e.apply(this,u);return s.cache=h.set(f,w)||h,w};return s.cache=new(zi.Cache||Wt),s}zi.Cache=Wt;function Hi(e){if(typeof e!="function")throw new wt(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 lx(e){return Gu(2,e)}var ux=Qm(function(e,t){t=t.length==1&&ae(t[0])?Ee(t[0],ft(Y())):Ee(Ge(t,1),ft(Y()));var s=t.length;return ce(function(u){for(var f=-1,h=Xe(u.length,s);++f<h;)u[f]=t[f].call(this,u[f]);return dt(e,this,u)})}),Ia=ce(function(e,t){var s=ln(t,ar(Ia));return Yt(e,O,r,t,s)}),Zu=ce(function(e,t){var s=ln(t,ar(Zu));return Yt(e,k,r,t,s)}),cx=Zt(function(e,t){return Yt(e,ne,r,r,r,t)});function dx(e,t){if(typeof e!="function")throw new wt(d);return t=t===r?t:le(t),ce(e,t)}function fx(e,t){if(typeof e!="function")throw new wt(d);return t=t==null?0:Ue(le(t),0),ce(function(s){var u=s[t],f=gn(s,0,t);return u&&on(f,u),dt(e,this,f)})}function gx(e,t,s){var u=!0,f=!0;if(typeof e!="function")throw new wt(d);return Ae(s)&&(u="leading"in s?!!s.leading:u,f="trailing"in s?!!s.trailing:f),Yu(e,t,{leading:u,maxWait:t,trailing:f})}function mx(e){return Hu(e,1)}function hx(e,t){return Ia(ma(t),e)}function px(){if(!arguments.length)return[];var e=arguments[0];return ae(e)?e:[e]}function xx(e){return jt(e,v)}function _x(e,t){return t=typeof t=="function"?t:r,jt(e,v,t)}function vx(e){return jt(e,j|v)}function bx(e,t){return t=typeof t=="function"?t:r,jt(e,j|v,t)}function wx(e,t){return t==null||ql(e,t,Ve(t))}function Mt(e,t){return e===t||e!==e&&t!==t}var Sx=Pi(na),jx=Pi(function(e,t){return e>=t}),Tn=zl(function(){return arguments}())?zl:function(e){return Ie(e)&&_e.call(e,"callee")&&!Il.call(e,"callee")},ae=A.isArray,Cx=dl?ft(dl):Dm;function at(e){return e!=null&&Gi(e.length)&&!Jt(e)}function De(e){return Ie(e)&&at(e)}function yx(e){return e===!0||e===!1||Ie(e)&&nt(e)==jr}var mn=kg||Ba,Nx=fl?ft(fl):Mm;function Rx(e){return Ie(e)&&e.nodeType===1&&!zr(e)}function Ex(e){if(e==null)return!0;if(at(e)&&(ae(e)||typeof e=="string"||typeof e.splice=="function"||mn(e)||or(e)||Tn(e)))return!e.length;var t=Je(e);if(t==At||t==It)return!e.size;if(Ur(e))return!sa(e).length;for(var s in e)if(_e.call(e,s))return!1;return!0}function Ax(e,t){return kr(e,t)}function Ix(e,t,s){s=typeof s=="function"?s:r;var u=s?s(e,t):r;return u===r?kr(e,t,r,s):!!u}function Fa(e){if(!Ie(e))return!1;var t=nt(e);return t==ii||t==Xd||typeof e.message=="string"&&typeof e.name=="string"&&!zr(e)}function Fx(e){return typeof e=="number"&&Dl(e)}function Jt(e){if(!Ae(e))return!1;var t=nt(e);return t==si||t==ko||t==Zd||t==ef}function Xu(e){return typeof e=="number"&&e==le(e)}function Gi(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ge}function Ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ie(e){return e!=null&&typeof e=="object"}var Ju=gl?ft(gl):Om;function Dx(e,t){return e===t||ia(e,t,wa(t))}function Mx(e,t,s){return s=typeof s=="function"?s:r,ia(e,t,wa(t),s)}function Tx(e){return ec(e)&&e!=+e}function Ox(e){if(_h(e))throw new se(c);return Hl(e)}function Lx(e){return e===null}function Px(e){return e==null}function ec(e){return typeof e=="number"||Ie(e)&&nt(e)==yr}function zr(e){if(!Ie(e)||nt(e)!=Gt)return!1;var t=vi(e);if(t===null)return!0;var s=_e.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&hi.call(s)==Mg}var Da=ml?ft(ml):Lm;function qx(e){return Xu(e)&&e>=-9007199254740991&&e<=ge}var tc=hl?ft(hl):Pm;function Ki(e){return typeof e=="string"||!ae(e)&&Ie(e)&&nt(e)==Rr}function mt(e){return typeof e=="symbol"||Ie(e)&&nt(e)==ai}var or=pl?ft(pl):qm;function kx(e){return e===r}function $x(e){return Ie(e)&&Je(e)==Er}function Bx(e){return Ie(e)&&nt(e)==nf}var Ux=Pi(aa),Vx=Pi(function(e,t){return e<=t});function nc(e){if(!e)return[];if(at(e))return Ki(e)?Ft(e):st(e);if(Fr&&e[Fr])return wg(e[Fr]());var t=Je(e),s=t==At?Ks:t==It?fi:lr;return s(e)}function en(e){if(!e)return e===0?e:0;if(e=Nt(e),e===Le||e===-1/0){var t=e<0?-1:1;return t*$e}return e===e?e:0}function le(e){var t=en(e),s=t%1;return t===t?s?t-s:t:0}function rc(e){return e?In(le(e),0,ye):0}function Nt(e){if(typeof e=="number")return e;if(mt(e))return ie;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=Sl(e);var s=Cf.test(e);return s||Nf.test(e)?ig(e.slice(2),s?2:8):jf.test(e)?ie:+e}function ic(e){return kt(e,ot(e))}function zx(e){return e?In(le(e),-9007199254740991,ge):e===0?e:0}function xe(e){return e==null?"":gt(e)}var Hx=ir(function(e,t){if(Ur(t)||at(t)){kt(t,Ve(t),e);return}for(var s in t)_e.call(t,s)&&Lr(e,s,t[s])}),sc=ir(function(e,t){kt(t,ot(t),e)}),Wi=ir(function(e,t,s,u){kt(t,ot(t),e,u)}),Gx=ir(function(e,t,s,u){kt(t,Ve(t),e,u)}),Kx=Zt(Js);function Wx(e,t){var s=rr(e);return t==null?s:Pl(s,t)}var Qx=ce(function(e,t){e=Se(e);var s=-1,u=t.length,f=u>2?t[2]:r;for(f&&rt(t[0],t[1],f)&&(u=1);++s<u;)for(var h=t[s],w=ot(h),S=-1,R=w.length;++S<R;){var D=w[S],M=e[D];(M===r||Mt(M,er[D])&&!_e.call(e,D))&&(e[D]=h[D])}return e}),Yx=ce(function(e){return e.push(r,Su),dt(ac,r,e)});function Zx(e,t){return _l(e,Y(t,3),qt)}function Xx(e,t){return _l(e,Y(t,3),ta)}function Jx(e,t){return e==null?e:ea(e,Y(t,3),ot)}function e_(e,t){return e==null?e:Ul(e,Y(t,3),ot)}function t_(e,t){return e&&qt(e,Y(t,3))}function n_(e,t){return e&&ta(e,Y(t,3))}function r_(e){return e==null?[]:Ai(e,Ve(e))}function i_(e){return e==null?[]:Ai(e,ot(e))}function Ma(e,t,s){var u=e==null?r:Fn(e,t);return u===r?s:u}function s_(e,t){return e!=null&&yu(e,t,Em)}function Ta(e,t){return e!=null&&yu(e,t,Am)}var a_=xu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=pi.call(t)),e[t]=s},La(lt)),o_=xu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=pi.call(t)),_e.call(e,t)?e[t].push(s):e[t]=[s]},Y),l_=ce(qr);function Ve(e){return at(e)?Ol(e):sa(e)}function ot(e){return at(e)?Ol(e,!0):km(e)}function u_(e,t){var s={};return t=Y(t,3),qt(e,function(u,f,h){Qt(s,t(u,f,h),u)}),s}function c_(e,t){var s={};return t=Y(t,3),qt(e,function(u,f,h){Qt(s,f,t(u,f,h))}),s}var d_=ir(function(e,t,s){Ii(e,t,s)}),ac=ir(function(e,t,s,u){Ii(e,t,s,u)}),f_=Zt(function(e,t){var s={};if(e==null)return s;var u=!1;t=Ee(t,function(h){return h=fn(h,e),u||(u=h.length>1),h}),kt(e,va(e),s),u&&(s=jt(s,j|y|v,ah));for(var f=t.length;f--;)da(s,t[f]);return s});function g_(e,t){return oc(e,Hi(Y(t)))}var m_=Zt(function(e,t){return e==null?{}:Bm(e,t)});function oc(e,t){if(e==null)return{};var s=Ee(va(e),function(u){return[u]});return t=Y(t),Xl(e,s,function(u,f){return t(u,f[0])})}function h_(e,t,s){t=fn(t,e);var u=-1,f=t.length;for(f||(f=1,e=r);++u<f;){var h=e==null?r:e[$t(t[u])];h===r&&(u=f,h=s),e=Jt(h)?h.call(e):h}return e}function p_(e,t,s){return e==null?e:$r(e,t,s)}function x_(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:$r(e,t,s,u)}var lc=bu(Ve),uc=bu(ot);function __(e,t,s){var u=ae(e),f=u||mn(e)||or(e);if(t=Y(t,4),s==null){var h=e&&e.constructor;f?s=u?new h:[]:Ae(e)?s=Jt(h)?rr(vi(e)):{}:s={}}return(f?bt:qt)(e,function(w,S,R){return t(s,w,S,R)}),s}function v_(e,t){return e==null?!0:da(e,t)}function b_(e,t,s){return e==null?e:ru(e,t,ma(s))}function w_(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:ru(e,t,ma(s),u)}function lr(e){return e==null?[]:Gs(e,Ve(e))}function S_(e){return e==null?[]:Gs(e,ot(e))}function j_(e,t,s){return s===r&&(s=t,t=r),s!==r&&(s=Nt(s),s=s===s?s:0),t!==r&&(t=Nt(t),t=t===t?t:0),In(Nt(e),t,s)}function C_(e,t,s){return t=en(t),s===r?(s=t,t=0):s=en(s),e=Nt(e),Im(e,t,s)}function y_(e,t,s){if(s&&typeof s!="boolean"&&rt(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=en(e),t===r?(t=e,e=0):t=en(t)),e>t){var u=e;e=t,t=u}if(s||e%1||t%1){var f=Ml();return Xe(e+f*(t-e+rg("1e-"+((f+"").length-1))),t)}return la(e,t)}var N_=sr(function(e,t,s){return t=t.toLowerCase(),e+(s?cc(t):t)});function cc(e){return Oa(xe(e).toLowerCase())}function dc(e){return e=xe(e),e&&e.replace(Ef,pg).replace(Kf,"")}function R_(e,t,s){e=xe(e),t=gt(t);var u=e.length;s=s===r?u:In(le(s),0,u);var f=s;return s-=t.length,s>=0&&e.slice(s,f)==t}function E_(e){return e=xe(e),e&&lf.test(e)?e.replace(Uo,xg):e}function A_(e){return e=xe(e),e&&mf.test(e)?e.replace(Is,"\\$&"):e}var I_=sr(function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}),F_=sr(function(e,t,s){return e+(s?" ":"")+t.toLowerCase()}),D_=mu("toLowerCase");function M_(e,t,s){e=xe(e),t=le(t);var u=t?Xn(e):0;if(!t||u>=t)return e;var f=(t-u)/2;return Li(ji(f),s)+e+Li(Si(f),s)}function T_(e,t,s){e=xe(e),t=le(t);var u=t?Xn(e):0;return t&&u<t?e+Li(t-u,s):e}function O_(e,t,s){e=xe(e),t=le(t);var u=t?Xn(e):0;return t&&u<t?Li(t-u,s)+e:e}function L_(e,t,s){return s||t==null?t=0:t&&(t=+t),Vg(xe(e).replace(Fs,""),t||0)}function P_(e,t,s){return(s?rt(e,t,s):t===r)?t=1:t=le(t),ua(xe(e),t)}function q_(){var e=arguments,t=xe(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var k_=sr(function(e,t,s){return e+(s?"_":"")+t.toLowerCase()});function $_(e,t,s){return s&&typeof s!="number"&&rt(e,t,s)&&(t=s=r),s=s===r?ye:s>>>0,s?(e=xe(e),e&&(typeof t=="string"||t!=null&&!Da(t))&&(t=gt(t),!t&&Zn(e))?gn(Ft(e),0,s):e.split(t,s)):[]}var B_=sr(function(e,t,s){return e+(s?" ":"")+Oa(t)});function U_(e,t,s){return e=xe(e),s=s==null?0:In(le(s),0,e.length),t=gt(t),e.slice(s,s+t.length)==t}function V_(e,t,s){var u=g.templateSettings;s&&rt(e,t,s)&&(t=r),e=xe(e),t=Wi({},t,u,wu);var f=Wi({},t.imports,u.imports,wu),h=Ve(f),w=Gs(f,h),S,R,D=0,M=t.interpolate||oi,P="__p += '",B=Ws((t.escape||oi).source+"|"+M.source+"|"+(M===Vo?Sf:oi).source+"|"+(t.evaluate||oi).source+"|$","g"),K="//# sourceURL="+(_e.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xf+"]")+`
|
||
`;e.replace(B,function(te,de,me,ht,it,pt){return me||(me=ht),P+=e.slice(D,pt).replace(Af,_g),de&&(S=!0,P+=`' +
|
||
__e(`+de+`) +
|
||
'`),it&&(R=!0,P+=`';
|
||
`+it+`;
|
||
__p += '`),me&&(P+=`' +
|
||
((__t = (`+me+`)) == null ? '' : __t) +
|
||
'`),D=pt+te.length,te}),P+=`';
|
||
`;var ee=_e.call(t,"variable")&&t.variable;if(!ee)P=`with (obj) {
|
||
`+P+`
|
||
}
|
||
`;else if(bf.test(ee))throw new se(m);P=(R?P.replace(rf,""):P).replace(sf,"$1").replace(af,"$1;"),P="function("+(ee||"obj")+`) {
|
||
`+(ee?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(S?", __e = _.escape":"")+(R?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+P+`return __p
|
||
}`;var ue=gc(function(){return he(h,K+"return "+P).apply(r,w)});if(ue.source=P,Fa(ue))throw ue;return ue}function z_(e){return xe(e).toLowerCase()}function H_(e){return xe(e).toUpperCase()}function G_(e,t,s){if(e=xe(e),e&&(s||t===r))return Sl(e);if(!e||!(t=gt(t)))return e;var u=Ft(e),f=Ft(t),h=jl(u,f),w=Cl(u,f)+1;return gn(u,h,w).join("")}function K_(e,t,s){if(e=xe(e),e&&(s||t===r))return e.slice(0,Nl(e)+1);if(!e||!(t=gt(t)))return e;var u=Ft(e),f=Cl(u,Ft(t))+1;return gn(u,0,f).join("")}function W_(e,t,s){if(e=xe(e),e&&(s||t===r))return e.replace(Fs,"");if(!e||!(t=gt(t)))return e;var u=Ft(e),f=jl(u,Ft(t));return gn(u,f).join("")}function Q_(e,t){var s=re,u=Q;if(Ae(t)){var f="separator"in t?t.separator:f;s="length"in t?le(t.length):s,u="omission"in t?gt(t.omission):u}e=xe(e);var h=e.length;if(Zn(e)){var w=Ft(e);h=w.length}if(s>=h)return e;var S=s-Xn(u);if(S<1)return u;var R=w?gn(w,0,S).join(""):e.slice(0,S);if(f===r)return R+u;if(w&&(S+=R.length-S),Da(f)){if(e.slice(S).search(f)){var D,M=R;for(f.global||(f=Ws(f.source,xe(zo.exec(f))+"g")),f.lastIndex=0;D=f.exec(M);)var P=D.index;R=R.slice(0,P===r?S:P)}}else if(e.indexOf(gt(f),S)!=S){var B=R.lastIndexOf(f);B>-1&&(R=R.slice(0,B))}return R+u}function Y_(e){return e=xe(e),e&&of.test(e)?e.replace(Bo,yg):e}var Z_=sr(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),Oa=mu("toUpperCase");function fc(e,t,s){return e=xe(e),t=s?r:t,t===r?bg(e)?Eg(e):dg(e):e.match(t)||[]}var gc=ce(function(e,t){try{return dt(e,r,t)}catch(s){return Fa(s)?s:new se(s)}}),X_=Zt(function(e,t){return bt(t,function(s){s=$t(s),Qt(e,s,Aa(e[s],e))}),e});function J_(e){var t=e==null?0:e.length,s=Y();return e=t?Ee(e,function(u){if(typeof u[1]!="function")throw new wt(d);return[s(u[0]),u[1]]}):[],ce(function(u){for(var f=-1;++f<t;){var h=e[f];if(dt(h[0],this,u))return dt(h[1],this,u)}})}function ev(e){return ym(jt(e,j))}function La(e){return function(){return e}}function tv(e,t){return e==null||e!==e?t:e}var nv=pu(),rv=pu(!0);function lt(e){return e}function Pa(e){return Gl(typeof e=="function"?e:jt(e,j))}function iv(e){return Wl(jt(e,j))}function sv(e,t){return Ql(e,jt(t,j))}var av=ce(function(e,t){return function(s){return qr(s,e,t)}}),ov=ce(function(e,t){return function(s){return qr(e,s,t)}});function qa(e,t,s){var u=Ve(t),f=Ai(t,u);s==null&&!(Ae(t)&&(f.length||!u.length))&&(s=t,t=e,e=this,f=Ai(t,Ve(t)));var h=!(Ae(s)&&"chain"in s)||!!s.chain,w=Jt(e);return bt(f,function(S){var R=t[S];e[S]=R,w&&(e.prototype[S]=function(){var D=this.__chain__;if(h||D){var M=e(this.__wrapped__),P=M.__actions__=st(this.__actions__);return P.push({func:R,args:arguments,thisArg:e}),M.__chain__=D,M}return R.apply(e,on([this.value()],arguments))})}),e}function lv(){return He._===this&&(He._=Tg),this}function ka(){}function uv(e){return e=le(e),ce(function(t){return Yl(t,e)})}var cv=pa(Ee),dv=pa(xl),fv=pa(Bs);function mc(e){return ja(e)?Us($t(e)):Um(e)}function gv(e){return function(t){return e==null?r:Fn(e,t)}}var mv=_u(),hv=_u(!0);function $a(){return[]}function Ba(){return!1}function pv(){return{}}function xv(){return""}function _v(){return!0}function vv(e,t){if(e=le(e),e<1||e>ge)return[];var s=ye,u=Xe(e,ye);t=Y(t),e-=ye;for(var f=Hs(u,t);++s<e;)t(s);return f}function bv(e){return ae(e)?Ee(e,$t):mt(e)?[e]:st(Tu(xe(e)))}function wv(e){var t=++Dg;return xe(e)+t}var Sv=Oi(function(e,t){return e+t},0),jv=xa("ceil"),Cv=Oi(function(e,t){return e/t},1),yv=xa("floor");function Nv(e){return e&&e.length?Ei(e,lt,na):r}function Rv(e,t){return e&&e.length?Ei(e,Y(t,2),na):r}function Ev(e){return bl(e,lt)}function Av(e,t){return bl(e,Y(t,2))}function Iv(e){return e&&e.length?Ei(e,lt,aa):r}function Fv(e,t){return e&&e.length?Ei(e,Y(t,2),aa):r}var Dv=Oi(function(e,t){return e*t},1),Mv=xa("round"),Tv=Oi(function(e,t){return e-t},0);function Ov(e){return e&&e.length?zs(e,lt):0}function Lv(e,t){return e&&e.length?zs(e,Y(t,2)):0}return g.after=ix,g.ary=Hu,g.assign=Hx,g.assignIn=sc,g.assignInWith=Wi,g.assignWith=Gx,g.at=Kx,g.before=Gu,g.bind=Aa,g.bindAll=X_,g.bindKey=Ku,g.castArray=px,g.chain=Uu,g.chunk=yh,g.compact=Nh,g.concat=Rh,g.cond=J_,g.conforms=ev,g.constant=La,g.countBy=Op,g.create=Wx,g.curry=Wu,g.curryRight=Qu,g.debounce=Yu,g.defaults=Qx,g.defaultsDeep=Yx,g.defer=sx,g.delay=ax,g.difference=Eh,g.differenceBy=Ah,g.differenceWith=Ih,g.drop=Fh,g.dropRight=Dh,g.dropRightWhile=Mh,g.dropWhile=Th,g.fill=Oh,g.filter=Pp,g.flatMap=$p,g.flatMapDeep=Bp,g.flatMapDepth=Up,g.flatten=qu,g.flattenDeep=Lh,g.flattenDepth=Ph,g.flip=ox,g.flow=nv,g.flowRight=rv,g.fromPairs=qh,g.functions=r_,g.functionsIn=i_,g.groupBy=Vp,g.initial=$h,g.intersection=Bh,g.intersectionBy=Uh,g.intersectionWith=Vh,g.invert=a_,g.invertBy=o_,g.invokeMap=Hp,g.iteratee=Pa,g.keyBy=Gp,g.keys=Ve,g.keysIn=ot,g.map=Ui,g.mapKeys=u_,g.mapValues=c_,g.matches=iv,g.matchesProperty=sv,g.memoize=zi,g.merge=d_,g.mergeWith=ac,g.method=av,g.methodOf=ov,g.mixin=qa,g.negate=Hi,g.nthArg=uv,g.omit=f_,g.omitBy=g_,g.once=lx,g.orderBy=Kp,g.over=cv,g.overArgs=ux,g.overEvery=dv,g.overSome=fv,g.partial=Ia,g.partialRight=Zu,g.partition=Wp,g.pick=m_,g.pickBy=oc,g.property=mc,g.propertyOf=gv,g.pull=Kh,g.pullAll=$u,g.pullAllBy=Wh,g.pullAllWith=Qh,g.pullAt=Yh,g.range=mv,g.rangeRight=hv,g.rearg=cx,g.reject=Zp,g.remove=Zh,g.rest=dx,g.reverse=Ra,g.sampleSize=Jp,g.set=p_,g.setWith=x_,g.shuffle=ex,g.slice=Xh,g.sortBy=rx,g.sortedUniq=sp,g.sortedUniqBy=ap,g.split=$_,g.spread=fx,g.tail=op,g.take=lp,g.takeRight=up,g.takeRightWhile=cp,g.takeWhile=dp,g.tap=Np,g.throttle=gx,g.thru=Bi,g.toArray=nc,g.toPairs=lc,g.toPairsIn=uc,g.toPath=bv,g.toPlainObject=ic,g.transform=__,g.unary=mx,g.union=fp,g.unionBy=gp,g.unionWith=mp,g.uniq=hp,g.uniqBy=pp,g.uniqWith=xp,g.unset=v_,g.unzip=Ea,g.unzipWith=Bu,g.update=b_,g.updateWith=w_,g.values=lr,g.valuesIn=S_,g.without=_p,g.words=fc,g.wrap=hx,g.xor=vp,g.xorBy=bp,g.xorWith=wp,g.zip=Sp,g.zipObject=jp,g.zipObjectDeep=Cp,g.zipWith=yp,g.entries=lc,g.entriesIn=uc,g.extend=sc,g.extendWith=Wi,qa(g,g),g.add=Sv,g.attempt=gc,g.camelCase=N_,g.capitalize=cc,g.ceil=jv,g.clamp=j_,g.clone=xx,g.cloneDeep=vx,g.cloneDeepWith=bx,g.cloneWith=_x,g.conformsTo=wx,g.deburr=dc,g.defaultTo=tv,g.divide=Cv,g.endsWith=R_,g.eq=Mt,g.escape=E_,g.escapeRegExp=A_,g.every=Lp,g.find=qp,g.findIndex=Lu,g.findKey=Zx,g.findLast=kp,g.findLastIndex=Pu,g.findLastKey=Xx,g.floor=yv,g.forEach=Vu,g.forEachRight=zu,g.forIn=Jx,g.forInRight=e_,g.forOwn=t_,g.forOwnRight=n_,g.get=Ma,g.gt=Sx,g.gte=jx,g.has=s_,g.hasIn=Ta,g.head=ku,g.identity=lt,g.includes=zp,g.indexOf=kh,g.inRange=C_,g.invoke=l_,g.isArguments=Tn,g.isArray=ae,g.isArrayBuffer=Cx,g.isArrayLike=at,g.isArrayLikeObject=De,g.isBoolean=yx,g.isBuffer=mn,g.isDate=Nx,g.isElement=Rx,g.isEmpty=Ex,g.isEqual=Ax,g.isEqualWith=Ix,g.isError=Fa,g.isFinite=Fx,g.isFunction=Jt,g.isInteger=Xu,g.isLength=Gi,g.isMap=Ju,g.isMatch=Dx,g.isMatchWith=Mx,g.isNaN=Tx,g.isNative=Ox,g.isNil=Px,g.isNull=Lx,g.isNumber=ec,g.isObject=Ae,g.isObjectLike=Ie,g.isPlainObject=zr,g.isRegExp=Da,g.isSafeInteger=qx,g.isSet=tc,g.isString=Ki,g.isSymbol=mt,g.isTypedArray=or,g.isUndefined=kx,g.isWeakMap=$x,g.isWeakSet=Bx,g.join=zh,g.kebabCase=I_,g.last=yt,g.lastIndexOf=Hh,g.lowerCase=F_,g.lowerFirst=D_,g.lt=Ux,g.lte=Vx,g.max=Nv,g.maxBy=Rv,g.mean=Ev,g.meanBy=Av,g.min=Iv,g.minBy=Fv,g.stubArray=$a,g.stubFalse=Ba,g.stubObject=pv,g.stubString=xv,g.stubTrue=_v,g.multiply=Dv,g.nth=Gh,g.noConflict=lv,g.noop=ka,g.now=Vi,g.pad=M_,g.padEnd=T_,g.padStart=O_,g.parseInt=L_,g.random=y_,g.reduce=Qp,g.reduceRight=Yp,g.repeat=P_,g.replace=q_,g.result=h_,g.round=Mv,g.runInContext=C,g.sample=Xp,g.size=tx,g.snakeCase=k_,g.some=nx,g.sortedIndex=Jh,g.sortedIndexBy=ep,g.sortedIndexOf=tp,g.sortedLastIndex=np,g.sortedLastIndexBy=rp,g.sortedLastIndexOf=ip,g.startCase=B_,g.startsWith=U_,g.subtract=Tv,g.sum=Ov,g.sumBy=Lv,g.template=V_,g.times=vv,g.toFinite=en,g.toInteger=le,g.toLength=rc,g.toLower=z_,g.toNumber=Nt,g.toSafeInteger=zx,g.toString=xe,g.toUpper=H_,g.trim=G_,g.trimEnd=K_,g.trimStart=W_,g.truncate=Q_,g.unescape=Y_,g.uniqueId=wv,g.upperCase=Z_,g.upperFirst=Oa,g.each=Vu,g.eachRight=zu,g.first=ku,qa(g,function(){var e={};return qt(g,function(t,s){_e.call(g.prototype,s)||(e[s]=t)}),e}(),{chain:!1}),g.VERSION=a,bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){g[e].placeholder=g}),bt(["drop","take"],function(e,t){fe.prototype[e]=function(s){s=s===r?1:Ue(le(s),0);var u=this.__filtered__&&!t?new fe(this):this.clone();return u.__filtered__?u.__takeCount__=Xe(s,u.__takeCount__):u.__views__.push({size:Xe(s,ye),type:e+(u.__dir__<0?"Right":"")}),u},fe.prototype[e+"Right"]=function(s){return this.reverse()[e](s).reverse()}}),bt(["filter","map","takeWhile"],function(e,t){var s=t+1,u=s==ke||s==tt;fe.prototype[e]=function(f){var h=this.clone();return h.__iteratees__.push({iteratee:Y(f,3),type:s}),h.__filtered__=h.__filtered__||u,h}}),bt(["head","last"],function(e,t){var s="take"+(t?"Right":"");fe.prototype[e]=function(){return this[s](1).value()[0]}}),bt(["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=ce(function(e,t){return typeof e=="function"?new fe(this):this.map(function(s){return qr(s,e,t)})}),fe.prototype.reject=function(e){return this.filter(Hi(Y(e)))},fe.prototype.slice=function(e,t){e=le(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=le(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(ye)},qt(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],h=u||/^find/.test(t);f&&(g.prototype[t]=function(){var w=this.__wrapped__,S=u?[1]:arguments,R=w instanceof fe,D=S[0],M=R||ae(w),P=function(de){var me=f.apply(g,on([de],S));return u&&B?me[0]:me};M&&s&&typeof D=="function"&&D.length!=1&&(R=M=!1);var B=this.__chain__,K=!!this.__actions__.length,ee=h&&!B,ue=R&&!K;if(!h&&M){w=ue?w:new fe(this);var te=e.apply(w,S);return te.__actions__.push({func:Bi,args:[P],thisArg:r}),new St(te,B)}return ee&&ue?e.apply(this,S):(te=this.thru(P),ee?u?te.value()[0]:te.value():te)})}),bt(["pop","push","shift","sort","splice","unshift"],function(e){var t=gi[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 h=this.value();return t.apply(ae(h)?h:[],f)}return this[s](function(w){return t.apply(ae(w)?w:[],f)})}}),qt(fe.prototype,function(e,t){var s=g[t];if(s){var u=s.name+"";_e.call(nr,u)||(nr[u]=[]),nr[u].push({name:t,func:s})}}),nr[Ti(r,F).name]=[{name:"wrapper",func:r}],fe.prototype.clone=Yg,fe.prototype.reverse=Zg,fe.prototype.value=Xg,g.prototype.at=Rp,g.prototype.chain=Ep,g.prototype.commit=Ap,g.prototype.next=Ip,g.prototype.plant=Dp,g.prototype.reverse=Mp,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=Tp,g.prototype.first=g.prototype.head,Fr&&(g.prototype[Fr]=Fp),g},Jn=Ag();Nn?((Nn.exports=Jn)._=Jn,Ps._=Jn):He._=Jn}).call(ur)})(ss,ss.exports);var Fe=ss.exports;const Cw=n=>{const o=zt.create(n[1]||{amount:null,scale:2});if(o.isFailure)throw o.error;const r=o.object,a=zt.create(n[2]||{amount:null,scale:2});if(a.isFailure)throw a.error;const l=a.object,c=Ot.create(n[0]||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,m=d.percentage(r.toNumber()).convertScale(2),p=d.subtract(m).convertScale(2),x=p.percentage(l.toNumber()).convertScale(2),_=p.add(x).convertScale(2);return{subtotalPrice:d.toObject(),discount:r.toObject(),discountPrice:m.toObject(),priceBeforeTaxes:p.toObject(),tax:l.toObject(),taxesPrice:x.toObject(),totalPrice:_.toObject()}},yw=({currency:n})=>{const{formState:o,control:r}=Hn(),{formatNumber:a}=Pd(),l=hn({control:r,name:["subtotal_price","discount","tax"]}),c=hn({control:r,name:"tax_label"})||b("quotes.form_fields.tax.label"),d=Cw(l),m=a(d.subtotalPrice),p=a(d.discountPrice),x=a(d.taxesPrice),_=a(d.totalPrice),j=T.useMemo(()=>n.symbol||"",[n]);return i.jsx(Te,{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(We,{className:"text-sm",children:b("quotes.form_fields.subtotal_price.label")}),i.jsxs(ze,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[m,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:j})]})]})}),i.jsx(bn,{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(We,{className:"text-sm",children:b("quotes.form_fields.discount.label")}),i.jsx(is,{scale:2,disabled:o.disabled,placeholder:b("quotes.form_fields.discount.placeholder"),name:"discount",onChange:y=>{}})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(We,{className:"text-sm text-right",children:b("quotes.form_fields.discount_price.label")}),i.jsxs(ze,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[p,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:j})]})]})]}),i.jsx(bn,{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(We,{className:"text-sm",children:c}),i.jsx(is,{scale:2,disabled:o.disabled,placeholder:b("quotes.form_fields.tax.placeholder"),name:"tax"})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(We,{className:"text-sm text-right",children:b("quotes.form_fields.tax_price.label",{label:""})}),i.jsxs(ze,{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:j})]})]})]})," ",i.jsx(bn,{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(We,{className:"text-sm font-semibold text-right text-foreground",children:b("quotes.form_fields.total_price.label")}),i.jsxs(ze,{className:"flex items-baseline justify-end gap-1 text-3xl tabular-nums",children:[_,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:j})]})]})})]})})},Kd=n=>{const{percentage:o,cancel:r,error:a,isInProgress:l,onFinishDownload:c}=n,d=T.useId();return T.useEffect(()=>{l&&!a&&o===100&&c&&c()},[o,l,a,c]),i.jsx(hr,{open:l,children:i.jsxs(pr,{className:"sm:max-w-md",children:[i.jsxs(xr,{children:[i.jsx(_r,{children:b("quotes.downloading_dialog.title")}),i.jsx(ms,{children:b("quotes.downloading_dialog.description")})]}),i.jsxs("div",{className:"mb-4 space-y-2",id:d,children:[i.jsx(zn,{children:b("quotes.downloading_dialog.progress.label",{status:b(l?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),i.jsx(Gc,{value:o,max:100,getValueLabel:()=>b("quotes.downloading_dialog.progress.label",{})}),a&&i.jsxs("p",{children:["Error: ",JSON.stringify(a)]})]}),i.jsx(vr,{className:"sm:justify-end",children:i.jsx(es,{asChild:!0,children:i.jsx(H,{type:"button",variant:"secondary",onClick:()=>r(),children:b("quotes.downloading_dialog.cancel_button")})})})]})})},Nw=({isInProgress:n,percentage:o,elapsed:r,cancel:a,error:l,className:c})=>{const[d,m]=T.useState(10);return T.useEffect(()=>{if(n&&o>0){const p=r/o*100;m(Math.max(0,Math.round(p-r)))}},[n,o,r]),!n&&!(l!=null&&l.errorMessage)?null:i.jsxs(Te,{className:pe("overflow-hidden",c),children:[i.jsx(ct,{children:i.jsxs(ze,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?b("quotes.pdf_generation.error"):b("quotes.pdf_generation.title"),n&&i.jsx($0,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&i.jsx(O0,{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:`${o}%`}}),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(Gc,{value:o,className:"w-full"}),i.jsxs("div",{className:"text-sm text-center text-muted-foreground",children:[i.jsx("p",{children:b("quotes.pdf_generation.progress",{percentage:o})}),i.jsxs("div",{className:"hidden",children:[i.jsx("p",{children:b("quotes.pdf_generation.elapsed",{elapsed:r})}),d>0&&i.jsx("p",{children:b("quotes.pdf_generation.remaining",{estimatedTime:d})})]})]}),i.jsx(H,{variant:"destructive",onClick:a,className:"hidden",children:b("quotes.pdf_generation.cancel")})]})})]})},Wd=({quote:n,className:o})=>{const{useReport:r,getQuotePDFFilename:a,useDownloader:l}=wr(),{download:c}=l(),{report:d,preview:m,isInProgress:p,...x}=r(),[_,j]=T.useState(void 0),y=T.useCallback(()=>{n&&c(n.id,a(n))},[n]);return T.useEffect(()=>{const v=setTimeout(()=>{n&&n.id&&m(n.id)},200);return()=>clearTimeout(v)},[n]),T.useEffect(()=>{if(!p&&d){const v=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(d):window.webkitURL.createObjectURL(d);return console.log(v),j(v),()=>{j(void 0),window.URL.revokeObjectURL(v)}}},[d,p]),n?p?i.jsx(Nw,{isInProgress:p,...x}):i.jsx(u0,{file:_,className:"object-contain",onThumbnailClick:y}):i.jsx(Te,{className:pe("overflow-hidden",o),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:b("quotes.list.resume.select_quote")})})})};Wd.whyDidYouRender=!0;const Gr=rb();function Rw({row:n,table:o}){var l;const r=(l=o.options.meta)==null?void 0:l.catalogPicker;if(!r)return null;const a=r.quantities[n.index]??1;return i.jsx(cs,{type:"number",name:"quantity",min:1,className:"w-24",value:a,onChange:c=>{const d=c.target.value;r.setQuantity(n.index,d===""?"":Number(d))}})}function Ew({row:n,table:o}){var a;const r=(a=o.options.meta)==null?void 0:a.catalogPicker;return i.jsxs(H,{size:"sm",variant:"outline",className:"h-8 gap-1",onClick:l=>{l.preventDefault(),r==null||r.selectArticle(n.original,n.index)},children:[i.jsx(Eo,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only xl:not-sr-only xl:whitespace-nowrap",children:r==null?void 0:r.t("common.add")})]})}const fo=({onSelect:n})=>{const o=Ht(),{t:r,i18n:a}=Pt(),{pagination:l,globalFilter:c,isFiltered:d}=Gn(),[m,p]=T.useState([]),x=T.useCallback(($,q)=>{p(V=>{const O=[...V];return O[$]=q,O})},[]),_=()=>{p([])},{data:j,isPending:y,isError:v,error:E}=Ud({pagination:{pageIndex:l.pageIndex,pageSize:l.pageSize},searchTerm:c});T.useEffect(()=>{_()},[l,c,d]);const N=T.useMemo(()=>({catalogPicker:{quantities:m,t:r,setQuantity:x,selectArticle:($,q)=>n($,m[q]===""?1:m[q]??1)}}),[x,n,m,r]),L=T.useMemo(()=>[Gr.accessor("description",{id:"description",header:()=>i.jsx(i.Fragment,{children:r("catalog.list.columns.description")})}),Gr.accessor("points",{id:"points",header:()=>i.jsx("div",{className:"text-right",children:r("catalog.list.columns.points")}),cell:({renderValue:$})=>i.jsx("div",{className:"text-right",children:$()})}),Gr.accessor("retail_price",{id:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:r("catalog.list.columns.retail_price")}),cell:({row:$})=>{const q=Ot.create($.original.retail_price).object;return i.jsx("div",{className:"text-right",children:q.toFormat()})}}),Gr.display({id:"quantity",header:()=>i.jsx("div",{className:"font-medium text-right text-foreground",children:r("catalog.list.columns.quantity")}),cell:Rw}),Gr.display({id:"row-actions",header:()=>null,cell:Ew})],[r,a.resolvedLanguage]),{table:F}=bs({data:[...(j==null?void 0:j.items)||[]],columns:L,pageCount:(j==null?void 0:j.total_pages)??-1,meta:N});return v?i.jsx(br,{subtitle:E.message}):y?i.jsx(_s,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(j==null?void 0:j.total_items)===0&&!d?i.jsx(vs,{subtitle:r("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>o("/catalog/add")}):i.jsx(xs,{className:"bg-transparent border-0 shadow-none",table:F,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:i.jsx(Vd,{table:F})})},Lo=T.forwardRef(({label:n=b("common.append_block"),className:o,...r},a)=>i.jsxs(H,{type:"button",variant:"outline",ref:a,...r,children:[" ",i.jsx(Eo,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Lo.displayName="AppendBlockRowButton";const Po=T.forwardRef(({label:n=b("common.append_article"),className:o,...r},a)=>i.jsxs(H,{type:"button",variant:"outline",ref:a,...r,children:[" ",i.jsx(Eo,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Po.displayName="AppendCatalogArticleRowButton";const qo=T.forwardRef(({label:n=b("common.append_empty_row"),className:o,...r},a)=>i.jsxs(H,{type:"button",variant:"outline",ref:a,...r,children:[i.jsx(T0,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));qo.displayName="AppendEmptyRowButton";const Aw=({table:n,showLineDiscountColumn:o,hasLineDiscounts:r,onShowLineDiscountColumnChange:a})=>{const l=n.getSelectedRowModel().rows.length,[c,d]=T.useState(!1),m=x=>{if(!x&&o&&r){d(!0);return}a(x)},p=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.jsx("div",{className:"grid gap-0.5",children:i.jsx(Ln,{label:b("quotes.discount_column.label")})}),i.jsx(hs,{id:"show-line-discount-column",checked:o,onCheckedChange:m})]}),i.jsx(hr,{open:c,onOpenChange:d,children:i.jsxs(pr,{children:[i.jsxs(xr,{children:[i.jsx(_r,{children:b("quotes.discount_column.confirmation.title")}),i.jsx(ms,{children:b("quotes.discount_column.confirmation.description")})]}),i.jsxs(vr,{children:[i.jsx(H,{type:"button",variant:"secondary",onClick:()=>d(!1),children:b("common.cancel")}),i.jsx(H,{type:"button",onClick:()=>{a(!1),d(!1)},children:b("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(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{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(L0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:b("common.duplicate_selected_rows")})]})}),i.jsx(Ze,{children:b("common.duplicate_selected_rows_tooltip")})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{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(_d,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:b("common.remove_selected_rows")})]})}),i.jsx(Ze,{children:b("common.remove_selected_rows_tooltip")})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>n.resetRowSelection(),children:[i.jsx(B0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:b("common.reset_selected_rows")})]})}),i.jsx(Ze,{children:b("common.reset_selected_rows_tooltip")})]}),i.jsx(bn,{orientation:"vertical",className:"h-6 ml-1 mr-4"}),i.jsx("p",{className:"text-sm font-normal",children:b("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(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsx(qo,{variant:"link",onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.appendItem()}})}),i.jsx(Ze,{children:b("common.append_empty_row_tooltip")})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsx(Po,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickCatalogArticle&&((x=n.options.meta)==null||x.pickCatalogArticle())}})}),i.jsx(Ze,{children:b("common.append_article_tooltip")})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsx(Lo,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickBlock&&((x=n.options.meta)==null||x.pickBlock())}})}),i.jsx(Ze,{children:b("common.append_block_tooltip")})]})]}),p]})},Iw=({row:n,table:o,onDelete:r})=>{const a=()=>{var l;(l=o.options.meta)==null||l.deleteItems(n.index),r()};return i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=o.options.meta)==null?void 0:l.insertItem(n.index)},children:[i.jsx(c0,{className:"w-4 h-4 mr-2"}),b("common.insert_row_above")]}),i.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=o.options.meta)==null?void 0:l.insertItem(n.index+1)},children:[i.jsx(qc,{className:"w-4 h-4 mr-2"}),b("common.insert_row_below")]}),i.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=o.options.meta)==null?void 0:l.duplicateItems(n.index)},children:[i.jsx(Ro,{className:"w-4 h-4 mr-2"}),b("common.duplicate_row")]}),i.jsxs(Kc,{children:[i.jsx(Wc,{asChild:!0,children:i.jsxs(H,{type:"button",variant:"destructive",size:"sm",children:[i.jsx(_d,{className:"w-4 h-4 mr-2"}),b("common.remove_row")]})}),i.jsxs(Qc,{children:[i.jsxs(Yc,{children:[i.jsx(Zc,{children:b("quotes.inline_row_actions.delete_confirmation.title")}),i.jsx(Xc,{children:b("quotes.inline_row_actions.delete_confirmation.description")})]}),i.jsxs(Jc,{children:[i.jsx(ed,{children:b("common.cancel")}),i.jsx(td,{asChild:!0,children:i.jsx(H,{type:"button",variant:"destructive",onClick:a,children:b("quotes.inline_row_actions.delete_confirmation.confirm")})})]})]})]})]})},Fw={droppable:{strategy:m0.Always}},Dw={keyframes({transform:n}){return[{opacity:1,transform:no.Transform.toString(n.initial)},{opacity:0,transform:no.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 Ec({columns:n,data:o,defaultValues:r,initialState:a,actions:l,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:m}){const[p,x]=T.useState({}),[_,j]=T.useState(),[y,v]=T.useState(null),E=T.useMemo(()=>o.map(O=>O.id),[o]),N=Td({data:o,columns:n,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:a,state:{rowSelection:p,columnVisibility:{...a==null?void 0:a.columnVisibility,discount:c}},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:x,getCoreRowModel:Dd(),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 G=((k=l.getItem)==null?void 0:k.call(l,O))??N.getRowModel().rows[O].original;l.insert(O+1,{...G,id:void 0},{shouldFocus:!0})}else if(N.getSelectedRowModel().rows.length){const G=N.getSelectedRowModel().rows[N.getSelectedRowModel().rows.length-1].index,ne=N.getSelectedRowModel().rows.map(U=>({...U.original,id:void 0}));N.getRowModel().rows.length<G+1?l.append(ne):l.insert(G+1,ne,{shouldFocus:!0}),N.resetRowSelection()}},deleteItems:O=>{if(O!=null)l.remove(O);else if(N.getSelectedRowModel().rows.length>0){let k=N.getSelectedRowModel().rows.length-1;for(;k>=0;k--){const G=E.indexOf(String(N.getSelectedRowModel().rows[k].id));l.remove(G),E.splice(G,1)}N.resetRowSelection()}else l.remove()},updateItem:(O,k,G,ne)=>{l.update(O,{...k,[`${G}`]:ne})}}}),L=d0(Qi(S0,{}),Qi(w0,{}),Qi(b0,{}),Qi(v0,{}));function F(O){var ne;let k=O.active.id,G=(ne=O.over)==null?void 0:ne.id;if(G!==void 0&&k!==G){let U=E.indexOf(String(G));if(N.getSelectedRowModel().rows.length>1)N.getSelectedRowModel().rows.forEach((re,Q)=>{const W=E.indexOf(String(re.id));Q>0&&(k=re.id,U=E.indexOf(String(G)),U<W&&(U=U+1)),l.move(W,U),E.splice(U,0,E.splice(W,1)[0]),G=re.id});else{const re=E.indexOf(String(k));l.move(re,U)}}j(null)}function $({active:O}){N.getSelectedRowModel().rowsById[O.id]||N.resetRowSelection(),j(O.id)}function q(){j(null)}function V(O){return _?O.filter(k=>{const G=typeof k=="string"?k:k.id;return G===_||!N.getSelectedRowModel().rowsById[G]}):O}return i.jsx(f0,{measuring:Fw,sensors:L,onDragEnd:F,onDragStart:$,onDragCancel:q,collisionDetection:g0,children:i.jsxs(Te,{children:[i.jsx(ct,{className:"sticky z-10 top-16 bg-card/90",children:i.jsx(ze,{children:i.jsx(Aw,{table:N,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:m})})}),i.jsxs(Oe,{children:[i.jsxs(po,{className:"table-fixed",children:[i.jsx(xo,{className:"sticky top-0 z-10 bg-background",children:N.getHeaderGroups().map(O=>i.jsx(wn,{className:"hover:bg-transparent",children:O.headers.map(k=>i.jsx(_o,{className:"px-2 py-1",style:{width:k.getSize()===Number.MAX_SAFE_INTEGER?"auto":k.getSize()},children:k.isPlaceholder?null:i.jsx(Ld,{table:N,header:k})},k.id))},O.id))}),i.jsx(vo,{children:i.jsx(p0,{items:V(E),strategy:x0,children:V(N.getRowModel().rows).map(O=>{const k=O,G=k.id===y;return i.jsxs(T.Fragment,{children:[i.jsx(xw,{id:k.id,isActive:G,onActivate:()=>v(k.id),children:k.getVisibleCells().map(ne=>i.jsx(Zr,{className:"px-2 py-2 align-top",style:{width:ne.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":ne.column.getSize()},children:rs(ne.column.columnDef.cell,ne.getContext())},ne.id))}),G&&i.jsx(wn,{className:"border border-t-0 border-destructive/30 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5",children:i.jsx(Zr,{colSpan:k.getVisibleCells().length,className:"px-2 py-2",children:i.jsx(Iw,{row:k,table:N,onDelete:()=>v(null)})})})]},k.id)})})})]}),h0.createPortal(i.jsx(_0,{dropAnimation:Dw,className:"z-40 opacity-100",children:_&&i.jsx("div",{className:"relative flex flex-wrap",children:N.getSelectedRowModel().rows.length?i.jsx(mo,{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:N.getSelectedRowModel().rows.length}):null})}),document.body),!1]}),i.jsx(Rt,{children:i.jsxs(gr,{children:[i.jsx(qo,{onClick:()=>{var O;return(O=N.options.meta)==null?void 0:O.appendItem()}}),i.jsx(Po,{onClick:()=>{var O;N.options.meta&&N.options.meta.pickCatalogArticle&&((O=N.options.meta)==null||O.pickCatalogArticle())}}),i.jsx(Lo,{onClick:()=>{var O;N.options.meta&&N.options.meta.pickBlock&&((O=N.options.meta)==null||O.pickBlock())}})]})})]})})}const Ac={es:[{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`},{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: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: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:54,code:"CAP_CLA_SEMI_SUSPENDIDO_ES",title:"Acabado: MELAMINA / color: A DETERMINAR",body:`Medida de Hueco: 2450x3000 mm.\r
|
||
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: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:`}],en:[{id:2000000098,code:"CAP_CLA_SEMI_SUSPENDIDO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Size of opening: 2450x3000 mm.\r
|
||
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`}],fr:[{id:2000000121,code:"CAP_CLA_SEMI_SUSPENDIDO_FR",title:"Finition : MÉLAMINE / Couleur : À DÉTERMINER",body:`Épaisseur du bloc : 19 mm / Épaisseur des accessoires : 19 mm\r
|
||
Barres de penderie : CHROME / NOIR\r
|
||
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
|
||
Poignée des tiroirs : xxxxx\r
|
||
Tiroirs : 4 DE 180 MM\r
|
||
Porte de chaussures : OUI / NON\r
|
||
Finition du profil : LAQUÉ NOIR / ARGENT MAT\r
|
||
Finition du verre de la porte de chaussures : FLOAT BRONZE C-424\r
|
||
Composé de :`},{id:2000000123,code:"CAP_FRE_ARM_ABATIBLE_FR",title:"Dimension de l’ouverture : 2275x1390 mm",body:`Modèle : ARGO / Finition : LAQUÉE / Couleur : À DÉTERMINER\r
|
||
Épaisseur des vantaux : 22 ou 19 mm\r
|
||
Finition des vantaux : LISSES\r
|
||
Poignée : PRISE DE MAIN À DÉTERMINER\r
|
||
Finition des ferrures : CHROMÉ OU ANTHRACITE\r
|
||
Jambages périmétraux : APPARENTS, ENCASTRÉS OU COMBINÉS À DÉTERMINER\r
|
||
Nombre de vantaux : 2\r
|
||
Composé de :`},{id:2000000125,code:"CAP_FRE_ARM_CORREDERA_FR",title:"Dimension de l’ouverture : 2440x5180mm",body:`Modèle : PANORAMIC P.O. / Finition : LAQUÉE / Couleur : BLANC\r
|
||
Nombre de listels : SANS LISTELS\r
|
||
Finition des panneaux : PANNEAU LAQUÉ\r
|
||
Poignée :\r
|
||
Encadrement périmétral :\r
|
||
Nombre de vantaux :\r
|
||
FREIN HYDRAULIQUE INTÉGRÉ (non disponible pour les portes inférieures à 650 mm) OU FREIN MAGNÉTIQUE INTÉGRÉ\r
|
||
Composé de :`},{id:2000000129,code:"CAP_INT_ARM_FORRADO_FR",title:"Finition : MÉLAMINE / Couleur : À DÉTERMINER",body:`Épaisseur du bloc : 19 mm / Épaisseur des accessoires : 19 mm\r
|
||
Barres de penderie : CHROME / NOIR\r
|
||
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
|
||
Poignée des tiroirs : xxxxx\r
|
||
Tiroirs : 4 DE 180 MM\r
|
||
Composé de :`},{id:2000000131,code:"CAP_INT_EST_CRISTAL_FR",title:"Finition des cadres : ANODISÉ NOIR",body:`Finition des panneaux des cadres latéraux : VERRE TREMPÉ FLOAT BRONZE C-424\r
|
||
Finition du dos : VERRE TREMPÉ FLOAT BRONZE C-424\r
|
||
Finition des accessoires : MÉLAMINE / Couleur : CHÊNE DENBER M-242\r
|
||
Épaisseur des accessoires : 25 mm\r
|
||
Barres de penderie : NOIRES\r
|
||
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
|
||
Poignée des tiroirs : xxxxx\r
|
||
Tiroirs : 4 DE 180 MM\r
|
||
Composé de :`}]},Ic=({onSelect:n})=>{const{i18n:o}=Pt(),r=o.resolvedLanguage||"es",a=Ac[r.toLowerCase()]??Ac.es;return i.jsx(go,{className:"h-96",children:i.jsx("div",{className:"flex flex-col gap-2 p-4 pt-0",children:a&&a.filter(({title:l,body:c})=>l||c).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))})})},Mw=({isOpen:n,onOpenChange:o,onSelect:r})=>kd("(min-width: 768px)")?i.jsx(hr,{modal:!0,open:n,onOpenChange:o,children:i.jsxs(pr,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(xr,{children:[i.jsx(_r,{children:b("quotes.blocks_picker_dialog.title")}),i.jsx(ms,{children:b("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ic,{onSelect:r}),i.jsx(vr,{children:i.jsx(H,{type:"submit",onClick:()=>o(!1),children:b("common.close")})})]})}):i.jsx(nd,{open:n,onOpenChange:o,children:i.jsxs(rd,{children:[i.jsxs(id,{className:"text-left",children:[i.jsx(sd,{children:b("quotes.blocks_picker_dialog.title")}),i.jsx(ad,{children:b("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(H,{variant:"outline",children:b("common.close")})})})]})}),Tw=({isOpen:n,onOpenChange:o,onSelect:r})=>kd("(min-width: 768px)")?i.jsx(hr,{modal:!0,open:n,onOpenChange:o,children:i.jsxs(pr,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(xr,{children:[i.jsx(_r,{children:b("quotes.catalog_picker_dialog.title")}),i.jsx(ms,{children:b("quotes.catalog_picker_dialog.description")})]}),i.jsx(mr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(fo,{onSelect:r})}),i.jsx(vr,{children:i.jsx(H,{type:"submit",onClick:()=>o(!1),children:b("common.close")})})]})}):i.jsx(nd,{open:n,onOpenChange:o,children:i.jsxs(rd,{children:[i.jsxs(id,{className:"text-left",children:[i.jsx(sd,{children:b("quotes.catalog_picker_dialog.title")}),i.jsx(ad,{children:b("quotes.catalog_picker_dialog.description")})]}),i.jsx(mr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(fo,{onSelect:r})}),i.jsx(od,{className:"pt-2",children:i.jsx(ld,{asChild:!0,children:i.jsx(H,{variant:"outline",children:b("common.close")})})})]})}),Ow=({currency:n,language:o,defaultValues:r})=>{var ne;const{toast:a}=Cn(),{control:l,getValues:c,setValue:d,watch:m}=Hn(),p=m("show_line_discount_column")??!0,x=!!((ne=c("items"))!=null&&ne.some(U=>{var re;return Number((re=U.discount)==null?void 0:re.amount)>0})),[_]=T.useState("dialog"),[j,y]=T.useState(!1),[v,E]=T.useState(!1),{fields:N,...L}=j0({control:l,name:"items"}),F=vw([{id:"description",accessorKey:"description",header:b("quotes.form_fields.items.description.label"),cell:({row:{index:U,original:re}})=>re!=null&&re.id_article?i.jsx("div",{className:"min-h-10 whitespace-pre-wrap px-3 py-2 text-sm",children:re.localized_description??re.description}):i.jsx(Ut,{autoSize:!0,name:`items.${U}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>i.jsx("div",{className:"text-right",children:b("quotes.form_fields.items.quantity.label")}),cell:({row:{index:U}})=>i.jsx(iw,{scale:0,className:"text-right",name:`items.${U}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>i.jsx("div",{className:"text-right",children:b("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:U}})=>i.jsx(Va,{currency:n,language:o,scale:2,className:"text-right",name:`items.${U}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>i.jsx("div",{className:"text-right",children:b("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:U}})=>i.jsx(Va,{variant:"ghost",currency:n,language:o,scale:2,readOnly:!0,className:"text-right",name:`items.${U}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>i.jsx("div",{className:"text-right",children:b("quotes.form_fields.items.discount.label")}),cell:({row:{index:U}})=>i.jsx(is,{scale:2,className:"text-right",name:`items.${U}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>i.jsx("div",{className:"text-right",children:b("quotes.form_fields.items.total_price.label")}),cell:({row:{index:U}})=>i.jsx(Va,{variant:"ghost",currency:n,language:o,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${U}.total_price`}),size:150}],{enableDragHandleColumn:!0,enableSelectionColumn:!0}),$=T.useCallback((U,re=1)=>{L.append({...U,quantity:{amount:100*re,scale:Sn.DEFAULT_SCALE},unit_price:U.retail_price,discount:{amount:null,scale:2}}),a({title:b("quotes.catalog_picker_dialog.toast_article_added"),description:U.description})},[L]),q=T.useCallback(U=>{L.append({id_article:"",description:`${U.title}
|
||
${U.body}`,quantity:{amount:null,scale:Sn.DEFAULT_SCALE},unit_price:{amount:null,scale:X0.DEFAULT_SCALE},discount:{amount:null,scale:2}}),a({title:b("quotes.blocks_picker_dialog.toast_article_added"),description:U.title})},[L]),[V,O]=T.useState(!1),k=[265,440,655],G=4;return _==="dialog"?i.jsxs("div",{className:"relative",children:[i.jsx(Ec,{actions:{...L,getItem:U=>c(`items.${U}`),pickCatalogArticle:()=>y(!0),pickBlock:()=>E(!0)},columns:F,data:N,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:U=>d("show_line_discount_column",U,{shouldDirty:!0})}),i.jsx(Tw,{onSelect:$,isOpen:j,onOpenChange:y}),i.jsx(Mw,{onSelect:q,isOpen:v,onOpenChange:E})]}):i.jsxs(z0,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[i.jsx(wc,{defaultSize:k[0],collapsedSize:G,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{O(!0)},onExpand:()=>{O(!1)},className:pe(V&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:i.jsx(Ec,{actions:{...L,getItem:U=>c(`items.${U}`)},columns:F,data:N,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:U=>d("show_line_discount_column",U,{shouldDirty:!0})})}),i.jsx(H0,{withHandle:!0,className:"mx-3"}),i.jsx(wc,{defaultSize:k[1],minSize:10,children:i.jsx(mr,{syncWithLocation:!1,children:i.jsx(fo,{onSelect:$})})})]})},Lw=()=>{const{formState:n,control:o}=Hn();return i.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[i.jsxs(ns,{className:"md:col-span-6",title:b("quotes.create.form_groups.general.title"),description:b("quotes.create.form_groups.general.desc"),actions:i.jsxs("div",{className:"grid min-w-48 gap-1",children:[i.jsx(zn,{htmlFor:"lang_code",className:"text-xs text-muted-foreground",children:b("quotes.form_fields.lang_code.label")}),i.jsx(Jr,{control:o,name:"lang_code",render:({field:r})=>i.jsxs(kn,{value:r.value||"es",onValueChange:r.onChange,children:[i.jsx($n,{id:"lang_code","aria-label":b("quotes.form_fields.lang_code.label"),children:i.jsx(Bn,{placeholder:b("quotes.form_fields.lang_code.placeholder")})}),i.jsx(Un,{children:sn.map(a=>i.jsxs(Vt,{value:a.code,children:[i.jsx("span",{"aria-hidden":"true",className:`mr-2 ${a.flagClassName}`}),a.name]},a.code))})]})})]}),children:[i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(Pn,{required:!0,className:"col-span-2",label:b("quotes.form_fields.customer_reference.label"),description:b("quotes.form_fields.customer_reference.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),i.jsx(Hc,{required:!0,label:b("quotes.form_fields.date.label"),description:b("quotes.form_fields.date.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(Pn,{label:b("quotes.form_fields.validity.label"),description:b("quotes.form_fields.validity.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.validity.placeholder"),name:"validity"}),i.jsx(Ut,{className:"col-span-2",label:b("quotes.form_fields.payment_method.label"),description:b("quotes.form_fields.payment_method.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.payment_method.placeholder"),name:"payment_method"})]}),i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(Ut,{className:"col-span-3",required:!0,label:b("quotes.form_fields.customer_information.label"),description:b("quotes.form_fields.customer_information.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:n.errors}),i.jsx(Ut,{className:"col-span-3",label:b("quotes.form_fields.notes.label"),description:b("quotes.form_fields.notes.desc"),disabled:n.disabled,placeholder:b("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),i.jsx(ns,{className:"hidden md:col-span-2",title:b("quotes.create.form_groups.status.title"),description:b("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(zn,{htmlFor:"status",children:b("quotes.create.form_groups.status.title")}),i.jsxs(kn,{children:[i.jsx($n,{id:"status","aria-label":b("quotes.list.select_status"),children:i.jsx(Bn,{placeholder:b("quotes.list.select_status")})}),i.jsxs(Un,{children:[i.jsx(Vt,{value:"draft",children:b("quotes.status.draft")}),i.jsx(Vt,{value:"published",children:b("quotes.status.ready")}),i.jsx(Vt,{value:"archived",children:b("quotes.status.archived")})]})]})]}),i.jsx(Pn,{required:!0,label:b("quotes.form_fields.currency_code.label"),description:b("quotes.form_fields.currency_code.desc"),placeholder:b("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Pw=n=>{const o=new Date(n);if(Number.isNaN(o.getTime()))return;const r=new Date,a=o>r?r:o,l=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0");return`${l}-${c}-${d}`},qw=()=>{const{control:n,formState:o,getValues:r,setValue:a}=Hn(),{formatNumber:l}=Pd(),{useExchangeRate:c}=wr(),{mutate:d,isPending:m}=c(),p=!!hn({control:n,name:"additional_currency_code"}),x=hn({control:n,name:"additional_currency_code"}),_=hn({control:n,name:"date"}),j=hn({control:n,name:"additional_currency_date"}),y=hn({control:n,name:"additional_currency_rate"}),v=hn({control:n,name:"total_price"}),E=_?new Date(_).getTime():void 0,N=T.useRef(E),L=Object.values(Wr.CURRENCIES),F=["EUR","USD","GBP","CHF","SAR"],$=F.map(re=>L.find(Q=>Q.code===re)).filter(re=>!!re),q=L.filter(re=>!F.includes(re.code)).sort((re,Q)=>re.code.localeCompare(Q.code)),V=(v==null?void 0:v.amount)!=null&&y?v.amount/100*Number(y):null,O=V===null?null:l({amount:Math.round(V*100),scale:2,currency_code:x}),k=T.useMemo(()=>x?Wr.createFromCode(x).object.symbol:"",[x]),G=T.useCallback((re,Q=_)=>{const W=Pw(Q);!re||!W||d({currency:re,date:W},{onSuccess:we=>{r("additional_currency_code")===we.currency_code&&(a("additional_currency_rate",we.rate,{shouldDirty:!0}),a("additional_currency_date",we.date,{shouldDirty:!0}))}})},[r,d,_,a]),ne=()=>G(x);T.useEffect(()=>{N.current!==E&&(N.current=E,p&&x&&G(x,_))},[x,p,_,E,G]);const U=re=>{if(!re){a("additional_currency_code",null,{shouldDirty:!0}),a("additional_currency_rate",null,{shouldDirty:!0}),a("additional_currency_date",null,{shouldDirty:!0});return}const Q="USD";a("additional_currency_code",Q,{shouldDirty:!0}),!j&&!y&&G(Q)};return i.jsx(ns,{title:b("quotes.additional_currency.title"),description:b("quotes.additional_currency.description"),actions:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ln,{label:b("quotes.additional_currency.enabled")}),i.jsx(hs,{id:"additional_currency_enabled",checked:p,disabled:o.disabled,onCheckedChange:U})]}),children:p&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-12",children:[i.jsxs("div",{className:"grid gap-2 md:col-span-3",children:[i.jsx(Ln,{label:b("quotes.additional_currency.currency")}),i.jsx(Jr,{control:n,name:"additional_currency_code",render:({field:re})=>i.jsxs(kn,{value:re.value||"USD",onValueChange:Q=>{re.onChange(Q),a("additional_currency_rate",null,{shouldDirty:!0}),a("additional_currency_date",null,{shouldDirty:!0}),G(Q)},children:[i.jsx($n,{id:"additional_currency_code",disabled:o.disabled,children:i.jsx(Bn,{})}),i.jsxs(Un,{children:[$.map(Q=>i.jsxs(Vt,{value:Q.code,disabled:Q.code==="EUR",children:[Q.code," - ",Q.name]},Q.code)),i.jsx(C0,{}),q.map(Q=>i.jsxs(Vt,{value:Q.code,children:[Q.code," - ",Q.name]},Q.code))]})]})})]}),i.jsxs("div",{className:"grid gap-2 md:col-span-2",children:[i.jsx(Ln,{label:b("quotes.additional_currency.refresh")}),i.jsxs(H,{id:"additional_currency_refresh",className:"w-full",type:"button",variant:"secondary",size:"sm",disabled:o.disabled||!x||!_||m,onClick:ne,children:[i.jsx(ud,{className:"w-4 h-4 mr-2"}),b("quotes.additional_currency.refresh")]})]}),i.jsxs("div",{className:"grid content-center gap-1 md:col-span-2",children:[i.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:b("quotes.additional_currency.date")}),i.jsx("p",{className:"font-medium tabular-nums",children:j?new Date(j).toLocaleDateString():"—"})]}),i.jsxs("div",{className:"grid content-center gap-1 md:col-span-3",children:[i.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:b("quotes.additional_currency.rate")}),i.jsx("p",{className:"font-medium tabular-nums",children:y?`1 EUR = ${Number(y).toLocaleString()} ${x}`:"—"})]}),i.jsxs("div",{className:"p-3 text-right rounded-md bg-muted md:col-span-2",children:[i.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:b("quotes.additional_currency.total",{code:x})}),i.jsxs("p",{className:"flex items-baseline justify-end text-2xl font-bold tabular-nums",children:[O??"—",O&&i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:k})]})]})]})})},Qd=({id:n,onSentTo:o,disabled:r})=>{const a=()=>{o(n)};return i.jsxs(Kc,{children:[i.jsx(Wc,{asChild:!0,disabled:r,children:i.jsxs(H,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[i.jsx(U0,{className:"w-4 h-4"}),b("quotes.quote_sent_to_editor.trigger_button")]})}),i.jsxs(Qc,{children:[i.jsxs(Yc,{children:[i.jsx(Zc,{children:b("quotes.quote_sent_to_editor.title")}),i.jsx(Xc,{children:b("quotes.quote_sent_to_editor.description")})]}),i.jsxs(Jc,{children:[i.jsx(ed,{children:b("common.cancel")}),i.jsx(td,{asChild:!0,children:i.jsx(H,{onClick:a,children:b("common.continue")})})]})]})]})},kw=["draft","ready","delivered","accepted","rejected","archived"],$w={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:o,onChangeStatus:r})=>{const[a,l]=T.useState(o),c=m=>l(m);T.useEffect(()=>{o&&l(o)},[o]);const d=()=>{a!==o&&r(a,o)};return i.jsxs(hr,{children:[i.jsx(Tc,{asChild:!0,children:n==="button"?i.jsxs(H,{size:"sm",variant:"outline",className:"h-8 gap-1",children:[i.jsx(ud,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only md:not-sr-only md:whitespace-nowrap",children:b("quotes.quote_status_editor.trigger_button")})]}):i.jsx(y0,{status:o,isEditable:!0})}),i.jsxs(pr,{children:[i.jsx(xr,{children:i.jsx(_r,{children:b("quotes.quote_status_editor.title")})}),i.jsx(N0,{}),i.jsx("div",{className:"grid gap-4 py-4",children:kw.map(m=>{const p=!$w[o].includes(m);return i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx(hs,{id:m,checked:a===m,onCheckedChange:()=>c(m),disabled:p}),i.jsxs("div",{className:"grid gap-1.5 leading-none",children:[i.jsx(zn,{htmlFor:m,className:pe("font-medium",p?"text-input":"text-foreground"),children:b(`quotes.quote_status_editor.status.${m}.title`)}),i.jsx("p",{className:pe("text-sm",p?"text-input":"text-muted-foreground"),children:b(`quotes.quote_status_editor.status.${m}.description`)})]})]},m)})}),i.jsxs(vr,{className:"pt-6 border-t",children:[i.jsx(es,{asChild:!0,children:i.jsx(H,{type:"button",variant:"secondary",children:b("common.cancel")})}),i.jsx(es,{asChild:!0,children:i.jsx(H,{onClick:d,disabled:a===o,children:b("quotes.quote_status_editor.submit_button")})})]})]})]})},Bw=({quoteId:n,className:o})=>{const r=Ht(),{toast:a}=Cn(),{useOne:l,useSetStatus:c,useSentTo:d,useDownloader:m,useDuplicate:p,getQuotePDFFilename:x}=wr(),{data:_,status:j}=l(n),{mutate:y}=c(),{mutate:v}=d(n),{mutate:E}=p(),{download:N,...L}=m(),{formatCurrency:F,formatNumber:$}=qd({locale:(_==null?void 0:_.lang_code)||"ES"}),q=T.useMemo(()=>_?{subtotal_price:F(_.subtotal_price),discount:$(_.discount),discount_price:F(_.discount_price),tax:$(_.tax),tax_price:F(_.tax_price),total_price:F(_.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[_]),V=T.useMemo(()=>(_==null?void 0:_.status)==="accepted"&&!(_!=null&&_.date_sent),[_]),O=T.useMemo(()=>(_==null?void 0:_.status)==="accepted"&&!!(_!=null&&_.date_sent),[_]),k=W=>{y({id:_.id,newStatus:W},{onSuccess:()=>{a({description:b("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},G=W=>{v({sent_date:R0(new Date)},{onSuccess:()=>{a({description:b("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},ne=T.useCallback(()=>{a({description:b("quotes.downloading_dialog.toast_success"),variant:"success"})},[a]),U=T.useCallback(()=>{_&&N(_.id,x(_))},[_]);if(j==="error"||j!=="success")return null;if(!_)return i.jsx(Te,{className:pe("overflow-hidden",o),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:b("quotes.list.resume.select_quote")})})});const re=W=>{E({id:W},{onSuccess(we){a({description:b("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${we.id}`,{relative:"path"})}})},Q=W=>{y({id:W,newStatus:"archived"},{onSuccess:()=>{a({description:b("quotes.quote_status_editor.toast_status_changed",{newStatus:b("quotes.status.archived")}),variant:"success"})}})};return i.jsxs(i.Fragment,{children:[i.jsx(Kd,{...L,onFinishDownload:ne}),i.jsx(cd,{defaultValue:"resume",children:i.jsxs(Te,{className:"w-[390px] overflow-hidden",children:[i.jsxs(ct,{className:"gap-3 border-b bg-accent",children:[i.jsxs(ze,{className:"flex items-center justify-between text-lg",children:[i.jsx("span",{children:b("quotes.list.resume.title")}),i.jsx(Yd,{status:_.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(gr,{className:"gap-0",children:[i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",disabled:O,onClick:W=>{W.preventDefault(),r(`/quotes/edit/${_.id}`,{relative:"path"})},children:[i.jsx(xd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.edit")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.edit")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",onClick:W=>{W.preventDefault(),re(_.id)},children:[i.jsx(Ro,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.duplicate")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.duplicate")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",onClick:U,children:[i.jsx(md,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.download")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.download")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",disabled:O,onClick:W=>{W.preventDefault(),Q(_.id)},children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:b("common.archive")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:b("common.archive")})})]})]}),i.jsx(gr,{children:i.jsx(Qd,{disabled:O||!V,id:_.id,onSentTo:G})})]})})]}),i.jsxs(Oe,{className:"p-6 text-sm",children:[i.jsxs(dd,{className:"grid w-full grid-cols-2",children:[i.jsx(ro,{value:"resume",children:b("quotes.list.resume.tabs.resume")}),i.jsx(ro,{value:"preview",children:b("quotes.list.resume.tabs.preview")})]}),i.jsx(io,{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:b("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:b("quotes.form_fields.reference.label")}),i.jsx("dd",{className:"font-medium",children:_.reference})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:b("quotes.form_fields.date.label")}),i.jsx("dd",{className:"font-medium",children:new Date(_.date).toLocaleDateString()})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:b("quotes.form_fields.customer_reference.label")}),i.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:_.customer_reference})]})]})]}),i.jsx(bn,{className:"my-4"}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:b("quotes.list.resume.customer_information")}),i.jsx("div",{children:_.customer_information})]}),i.jsx(bn,{className:"my-4"}),i.jsx("div",{className:"font-semibold",children:b("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:b("quotes.form_fields.subtotal_price.label")}),i.jsx("span",{children:q.subtotal_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:b("quotes.form_fields.discount_value.label",{value:q.discount})}),i.jsx("span",{children:q.discount_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:b("quotes.form_fields.tax_value.label",{label:_.tax_label,value:q.tax})}),i.jsx("span",{children:q.tax_price})]}),i.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[i.jsx("span",{className:"text-muted-foreground",children:b("quotes.form_fields.total_price.label")}),i.jsx("span",{children:q.total_price})]})]})]})}),i.jsx(io,{value:"preview",children:i.jsx(Wd,{quote:_})})]}),i.jsx(Rt,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:i.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Uw=({status:n="all",preview:o=!1})=>{const r=Ht(),{toast:a}=Cn(),{t:l,i18n:c}=Pt(),d=T.useId(),m=T.useId(),{pagination:p,globalFilter:x,isFiltered:_}=Gn(),[j,y]=T.useState(void 0),{useList:v,useDownloader:E,useSetStatus:N,useDuplicate:L,getQuotePDFFilename:F}=wr(),{mutate:$}=N(),{mutate:q}=L(),{data:V,isPending:O,isError:k,error:G}=v({pagination:{pageIndex:p.pageIndex,pageSize:p.pageSize},status:n,quickSearchTerm:x}),{download:ne,...U}=E(),re=ge=>{y(ge)},Q=T.useCallback(()=>{a({description:l("quotes.downloading_dialog.toast_success")})},[a]),W=T.useCallback(ge=>{r(`/quotes/edit/${ge.id}`,{relative:"path"})},[r,a]),we=ge=>{q({id:ge},{onSuccess($e){a({description:l("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${$e.id}`,{relative:"path"})}})},ke=ge=>{$({id:ge,newStatus:"archived"},{onSuccess:()=>{a({description:l("quotes.quote_status_editor.toast_status_changed",{newStatus:l("quotes.status.archived")}),variant:"success"})}})},J=(ge,$e)=>{$({id:ge,newStatus:$e},{onSuccess:()=>{a({description:l("quotes.quote_status_editor.toast_status_changed",{newStatus:l(`quotes.status.${$e}`)}),variant:"success"})}})},tt=T.useMemo(()=>{const ge=[{id:"reference",accessorKey:"reference",header:()=>i.jsx(i.Fragment,{children:l("quotes.list.columns.reference")}),cell:({row:{original:ie},renderValue:ye})=>{const _t=!!((ie==null?void 0:ie.status)==="accepted"&&(ie!=null&&ie.date_sent));return i.jsx(H,{size:"sm",variant:"link",disabled:_t,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:Sr=>{Sr.preventDefault(),W(ie)},children:i.jsx("div",{className:"",children:ye()})})}},{id:"status",accessorKey:"status",header:()=>i.jsx(i.Fragment,{children:l("quotes.list.columns.status")}),cell:({row:{original:ie}})=>i.jsx(Yd,{type:"badge",status:ie.status,onChangeStatus:ye=>J(ie.id,ye)})},{id:"date_sent",accessor:"date_sent",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:l("quotes.list.columns.date_sent")}),cell:({row:{original:ie}})=>{const ye=cr.create(ie.date_sent),_t=ye.isSuccess&&!ye.object.isEmpty();return i.jsx("div",{className:"text-left text-ellipsis",children:_t?i.jsx(Od,{label:ye.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:l("quotes.list.columns.date")}),cell:({row:{original:ie}})=>{const ye=cr.create(ie.date);return i.jsx("div",{className:"text-left text-ellipsis",children:ye.isSuccess?ye.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>i.jsx(i.Fragment,{children:l("quotes.list.columns.customer_reference")}),cell:({renderValue:ie})=>i.jsx("div",{className:"text-left text-ellipsis",children:ie()})},{id:"customer_information",accessorKey:"customer_information",header:()=>i.jsx(i.Fragment,{children:l("quotes.list.columns.customer_information")}),cell:({row:{original:ie}})=>i.jsx("div",{className:"text-left text-ellipsis",children:ie.customer_information.split(`
|
||
`).map((ye,_t)=>i.jsxs("span",{className:_t===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[ye,i.jsx("br",{})]},_t))}),size:500}],$e=[{id:"row-actions",header:()=>null,cell:({row:{original:ie}})=>{const ye=(ie==null?void 0:ie.status)==="accepted"&&!(ie!=null&&ie.date_sent),_t=(ie==null?void 0:ie.status)==="accepted"&&!!(ie!=null&&ie.date_sent),Sr=(ie==null?void 0:ie.status)==="archived";return i.jsxs("div",{className:"flex gap-1",children:[i.jsxs(gr,{className:"gap-0",children:[i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",disabled:_t,onClick:yn=>{yn.preventDefault(),W(ie)},children:[i.jsx(xd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:l("common.edit")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:l("common.edit")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",onClick:yn=>{yn.preventDefault(),we(ie.id)},children:[i.jsx(Ro,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:l("common.duplicate")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:l("common.duplicate")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",onClick:()=>{ne(ie.id,F(ie))},children:[i.jsx(md,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:l("common.download")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:l("common.download")})})]}),i.jsxs(Qe,{children:[i.jsx(Ye,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",disabled:Sr||_t,onClick:yn=>{yn.preventDefault(),ke(ie.id)},children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:l("common.archive")})]})}),i.jsx(Ze,{children:i.jsx("p",{children:l("common.archive")})})]})]}),i.jsx(gr,{children:i.jsx(Qd,{id:ie.id,onSentTo:()=>null,disabled:_t||!ye})})]})}}];return o?ge:[...ge,...$e]},[o,l,c.resolvedLanguage]),{table:Le}=bs({data:(V==null?void 0:V.items)??[],columns:tt,pageCount:(V==null?void 0:V.total_pages)??-1});return T.useEffect(()=>{Le&&V&&(V==null?void 0:V.total_pages)>0&&y(Le.getRowModel().rows[0])},[V,Le]),k?i.jsx(br,{subtitle:G.message}):O?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(Te,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:i.jsx(Oe,{children:i.jsx(_s,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),i.jsx("div",{})]}):(V==null?void 0:V.total_items)===0&&!_?i.jsx(Te,{children:i.jsx(Oe,{children:i.jsx(vs,{subtitle:l("quotes.list.empty_state.subtitle"),buttonText:l("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:d,className:"flex items-stretch flex-1",children:i.jsx(xs,{table:Le,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:re,activeRowIndex:j==null?void 0:j.index,children:i.jsx(zd,{table:Le})})}),o&&i.jsx("div",{id:m,className:"flex items-stretch ",children:i.jsx(Bw,{quoteId:j==null?void 0:j.original.id})})]}),i.jsx(Kd,{...U,onFinishDownload:Q})]})},aS=()=>{const n=Ht(),o=jw(),{toast:r}=Cn(),[a,l]=T.useState(Wr.createDefaultCode().object),[c,d]=T.useState(Qr.createDefaultCode().object),m=T.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",show_line_discount_column:!0,additional_currency_code:null,additional_currency_rate:null,additional_currency_date:null,additional_currency_total:null,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:a.code},subtotal_price:{amount:null,scale:2,currency_code:a.code},discount:{amount:null,scale:2},total_price:{amount:null,scale:2,currency_code:a.code}}]}),[a.code]),{useOne:p,useUpdate:x}=wr(),{data:_,status:j,error:y}=p(o),{mutate:v,isPending:E}=x(String(o)),N=ds({mode:"onBlur",defaultValues:m}),{getValues:L,reset:F,handleSubmit:$,formState:q,control:V,watch:O,setValue:k}=N,{isSubmitting:G,isDirty:ne}=q;Oo({isDirty:ne}),T.useEffect(()=>{if(!ne)return;const{unsubscribe:Q}=O((W,{name:we,type:ke})=>{if(we==="items"){W.items&&W.items.map((tt,Le)=>{if(tt){const ge=co(tt);Fe.isEqual(ge.subtotal_price.toObject(),tt.subtotal_price)||k(`items.${Le}.subtotal_price`,ge.subtotal_price.toObject()),Fe.isEqual(ge.total_price.toObject(),tt.total_price)||k(`items.${Le}.total_price`,ge.total_price.toObject())}});const J=eo(W,!0);Fe.isEqual(J.subtotal_price.toObject(),W.total_price)||k("subtotal_price",J.subtotal_price.toObject()),Fe.isEqual(J.discount_price.toObject(),W.total_price)||k("discount_price",J.discount_price.toObject()),Fe.isEqual(J.before_tax_price.toObject(),W.before_tax_price)||k("before_tax_price",J.before_tax_price.toObject()),Fe.isEqual(J.tax_price.toObject(),W.tax_price)||k("tax_price",J.tax_price.toObject()),Fe.isEqual(J.total_price.toObject(),W.total_price)||k("total_price",J.total_price.toObject())}else if(we&&ke==="change"){if(we==="currency_code"){const J=Wr.createFromCode(W.currency_code??Wr.DEFAULT_CURRENCY_CODE);if(J.isFailure)throw console.error(J.error),J.error;l(J.object)}if(we==="lang_code"){const J=Qr.createFromCode(W.lang_code??Qr.DEFAULT_LANGUAGE_CODE);if(J.isFailure)throw console.error(J.error),J.error;d(J.object)}if(["discount","tax"].includes(we)){const J=eo(W,!0);Fe.isEqual(J.subtotal_price.toObject(),W.total_price)||k("subtotal_price",J.subtotal_price.toObject()),Fe.isEqual(J.discount_price.toObject(),W.total_price)||k("discount_price",J.discount_price.toObject()),Fe.isEqual(J.before_tax_price.toObject(),W.before_tax_price)||k("before_tax_price",J.before_tax_price.toObject()),Fe.isEqual(J.tax_price.toObject(),W.tax_price)||k("tax_price",J.tax_price.toObject()),Fe.isEqual(J.total_price.toObject(),W.total_price)||k("total_price",J.total_price.toObject())}if(we!=null&&we.startsWith("items")){const J=Number(we.split(".")[1]),tt=we.split(".")[2];if(["quantity","unit_price","discount"].includes(tt)&&W.items&&W.items[J]){const Le=W.items[J],ge=co(Le);Fe.isEqual(ge.quantity.toObject(),Le.quantity)||k(`items.${J}.quantity`,ge.quantity.toObject()),Fe.isEqual(ge.unit_price.toObject(),Le.unit_price)||k(`items.${J}.unit_price`,ge.unit_price.toObject()),Fe.isEqual(ge.discount.toObject(),Le.discount)||k(`items.${J}.discount`,ge.discount.toObject()),Fe.isEqual(ge.subtotal_price.toObject(),Le.subtotal_price)||k(`items.${J}.subtotal_price`,ge.subtotal_price.toObject()),Fe.isEqual(ge.total_price.toObject(),Le.total_price)||k(`items.${J}.total_price`,ge.total_price.toObject());const $e=eo(W,!0);Fe.isEqual($e.subtotal_price.toObject(),W.total_price)||k("subtotal_price",$e.subtotal_price.toObject()),Fe.isEqual($e.discount_price.toObject(),W.total_price)||k("discount_price",$e.discount_price.toObject()),Fe.isEqual($e.before_tax_price.toObject(),W.before_tax_price)||k("before_tax_price",$e.before_tax_price.toObject()),Fe.isEqual($e.tax_price.toObject(),W.tax_price)||k("tax_price",$e.tax_price.toObject()),Fe.isEqual($e.total_price.toObject(),W.total_price)||k("total_price",$e.total_price.toObject())}}}});return()=>Q()},[O,ne,k]);const U=async(Q,W)=>{const we={...Q,items:Q.items.map(({localized_description:ke,...J})=>J)};v(we,{onError:ke=>{console.error(ke),r({title:b("common.error"),description:ke.message,variant:"destructive"})},onSuccess:()=>{F(L()),r({title:b("quotes.notifications.saved"),variant:"success"}),W&&n("/quotes")}})},re=T.useCallback(()=>{n("/quotes",{state:{id:o}})},[n,o]);return T.useEffect(()=>{j==="success"&&_&&F(_)},[j,_,F]),j==="error"?i.jsx(br,{errorMessage:y.message}):j!=="success"?i.jsx(Vn,{}):i.jsxs(i.Fragment,{children:[(G||E)&&i.jsx(Vn,{title:b("quotes.notifications.saving")}),i.jsx(fs,{...N,children:i.jsx("form",{onSubmit:$(Q=>U(Q,!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(zc,{}),i.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[b("quotes.edit.title")," ",_.reference]}),i.jsx(Od,{label:b(`quotes.status.${_.status}`),className:"ml-auto sm:ml-0"}),i.jsxs("div",{className:"items-center hidden gap-2 md:ml-auto md:flex",children:[i.jsx(E0,{label:b("common.close"),variant:"secondary",size:"sm",onClick:re}),i.jsx(No,{label:b("common.save"),size:"sm",disabled:q.isSubmitting||q.isLoading||q.isValidating}),i.jsx(H,{size:"sm",disabled:q.isSubmitting||q.isLoading||q.isValidating,onClick:$(Q=>U(Q,!0)),children:b("common.save_close")})]})]}),i.jsx(Lw,{}),i.jsx(yw,{currency:a}),i.jsx(qw,{}),i.jsx(Ow,{currency:a,language:c,defaultValues:m}),i.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[i.jsx(H,{variant:"outline",size:"sm",children:b("common.discard")}),i.jsx(H,{onClick:$(Q=>U(Q,!1)),size:"sm",children:b("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Vw=T.createContext(null),zw=({children:n})=>{const[o,r]=Uc();return i.jsx(Vw.Provider,{value:{pagination:o,setPagination:r},children:n})},oS=({children:n})=>i.jsx(gs,{children:i.jsx(zw,{children:i.jsxs(ei,{className:"quotes-layout",children:[i.jsx(ti,{}),i.jsx(ni,{children:n})]})})}),lS=()=>{const{t:n}=Pt(),o=Ht(),[r,a]=T.useState("all"),[l,c]=aw(!0),d=[{value:"all",label:n("quotes.list.tabs.all")},{value:"draft",label:n("quotes.list.tabs.draft")},{value:"ready",label:n("quotes.list.tabs.ready")},{value:"delivered",label:n("quotes.list.tabs.delivered")},{value:"accepted",label:n("quotes.list.tabs.accepted")},{value:"rejected",label:n("quotes.list.tabs.rejected")},{value:"archived",label:n("quotes.list.tabs.archived")}];return i.jsxs(mr,{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(oe,{i18nKey:"quotes.list.title"})}),i.jsx("p",{className:"text-muted-foreground",children:i.jsx(oe,{i18nKey:"quotes.list.subtitle"})})]}),i.jsx("div",{className:"flex items-center space-x-2",children:i.jsxs(H,{onClick:()=>o("/quotes/add"),children:[i.jsx(Ao,{className:"w-4 h-4 mr-2"}),n("quotes.create.title")]})})]}),i.jsxs(cd,{value:r,onValueChange:a,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(dd,{className:"hidden sm:flex",children:d.map(m=>i.jsx(ro,{value:m.value,children:m.label},m.value))}),i.jsxs("div",{className:"flex items-center w-full space-x-2 sm:hidden",children:[i.jsx(zn,{children:n("quotes.list.tabs_title")}),i.jsxs(kn,{value:r,onValueChange:a,children:[i.jsx($n,{children:i.jsx(Bn,{placeholder:n("quotes.list.select_status")})}),i.jsx(Un,{children:d.map(m=>i.jsx(Vt,{value:m.value,children:m.label},m.value))})]})]})]}),i.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:i.jsx(Zb,{buttonText:n("common.help"),title:n("quotes.list.status_help.title"),content:i.jsx(Hw,{})})}),i.jsx("div",{className:"flex items-center gap-2 ml-auto",children:i.jsx(A0,{"aria-label":n("quotes.list.preview_aria"),variant:"outline",defaultPressed:!1,pressed:l,onPressedChange:c,children:l?i.jsxs(i.Fragment,{children:[i.jsx(hd,{className:"w-4 h-4 mr-2"}),n("common.disable_preview")]}):i.jsxs(i.Fragment,{children:[i.jsx(q0,{className:"w-4 h-4 mr-2"}),n("common.enable_preview")]})})})]}),d.map(m=>i.jsx(io,{value:m.value,children:i.jsx(Uw,{status:m.value,preview:l})},m.value))]})]})},Hw=()=>{const{t:n}=Pt();return i.jsxs(go,{className:"grid gap-4 py-4",children:[i.jsx("p",{children:n("quotes.list.status_help.intro")}),i.jsx("p",{children:n("quotes.list.status_help.possible")}),i.jsxs("ul",{className:"pl-6 space-y-2 list-disc",children:[i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.draft"),":"]})," ",n("quotes.quote_status_editor.status.draft.description")]}),i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.ready"),":"]})," ",n("quotes.quote_status_editor.status.ready.description")]}),i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.delivered"),":"]})," ",n("quotes.quote_status_editor.status.delivered.description")]}),i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.accepted"),":"]})," ",n("quotes.quote_status_editor.status.accepted.description")]}),i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.rejected"),":"]})," ",n("quotes.quote_status_editor.status.rejected.description")]}),i.jsxs("li",{children:[i.jsxs("strong",{children:[n("quotes.status.archived"),":"]})," ",n("quotes.quote_status_editor.status.archived.description")]})]}),i.jsx("p",{children:n("quotes.list.status_help.outro")})]})},Gw=n=>{const o=Xr(),r=qn(),a=r().data().resource("settings").action("one").id("me").params().get(),l=r().auth().action("profile").get();return{useOne:()=>Sd({queryKey:a,queryFn:()=>o.getOne({resource:"profile",id:""}),...n}),useUpdate:()=>{const c=rn();return Bt({mutationKey:a,mutationFn:d=>o.updateOne({resource:"profile",data:d,id:""}),onSuccess:(d,m)=>{const p=x=>x&&{...x,lang_code:m.lang_code??x.lang_code,dealer:{...x.dealer,...d}};return c.setQueryData(a,p),c.setQueryData(l,p),Promise.all([c.invalidateQueries({queryKey:a}),c.invalidateQueries({queryKey:l})])}})},useUploadLogo:()=>{const c=rn(),{mutate:d,mutateAsync:m,...p}=Bt({mutationKey:["data","default","settings"],mutationFn:x=>o.uploadFile({path:"profile/logo",file:x,key:"logo"}),onError:()=>c.invalidateQueries({queryKey:["data","default","settings"]}),onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","settings"]})}});return{upload:d,uploadAsync:m,...p}}}},uS=()=>{var k,G;const[n,o]=T.useState("profile"),{useOne:r,useUpdate:a,useUploadLogo:l}=Gw(),{toast:c}=Cn(),{i18n:d}=Pt(),{data:m,status:p,error:x}=r(),_=T.useMemo(()=>({lang_code:"es",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:j}=a(),{upload:y}=l(),v=ds({mode:"onBlur",values:m?{...m.dealer,lang_code:m.lang_code}:void 0,defaultValues:_}),{formState:E,reset:N,getValues:L,handleSubmit:F}=v,{isSubmitting:$,isDirty:q}=E,V=ne=>{var re;const U=(re=ne.target.files)==null?void 0:re[0];if(U){if(U.type!=="image/png"&&U.type!=="image/jpeg"){alert(b("settings.form_fields.logo.invalid_format"));return}const Q=new FileReader;Q.onloadend=()=>{const W=new Image;W.onload=()=>{const we=W.width,ke=W.height,J=we/ke===2;we<200||ke<100||!J?alert(b("settings.form_fields.logo.invalid_dimensions")):y(U)},W.src=Q.result},Q.readAsDataURL(U)}};Oo({isDirty:q});const O=async ne=>{j(ne,{onError:U=>{console.debug(U),c({title:b("common.error"),description:U.message,variant:"destructive"})},onSuccess:()=>{d.language!==ne.lang_code&&d.changeLanguage(ne.lang_code??"es"),N(L()),c({description:b("settings.notifications.saved"),variant:"success"})}})};return $?i.jsx(Vn,{title:b("settings.notifications.saving")}):p==="error"?i.jsx(br,{errorMessage:x.message}):p!=="success"?i.jsx(Vn,{}):i.jsx(fs,{...v,children:i.jsx("form",{onSubmit:F(O),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:[((k=v.formState.errors.root)==null?void 0:k.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(gd,{className:"w-4 h-4"}),i.jsx($c,{children:i.jsx(oe,{i18nKey:"common.error"})}),i.jsx(Bc,{children:(G=v.formState.errors.root)==null?void 0:G.message})]}),i.jsxs("nav",{className:"grid gap-4 text-sm text-muted-foreground",children:[i.jsx("a",{onClick:()=>o("profile"),className:n==="profile"?"font-semibold text-primary":"cursor-pointer",children:i.jsx(oe,{i18nKey:"settings.edit.tabs.profile"})}),i.jsx("a",{onClick:()=>o("quotes"),className:n==="quotes"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(oe,{i18nKey:"settings.edit.tabs.quotes"})}),i.jsx("a",{onClick:()=>o("legal"),className:n==="legal"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(oe,{i18nKey:"settings.edit.tabs.legal"})})]}),i.jsxs("div",{className:pe("grid gap-6",n==="profile"?"visible":"hidden"),children:[i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.language.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.language.desc"})})]}),i.jsx(Oe,{children:i.jsx(Jr,{control:v.control,name:"lang_code",render:({field:ne})=>i.jsxs(kn,{value:ne.value,onValueChange:ne.onChange,children:[i.jsx($n,{"aria-label":b("settings.form_fields.language.label"),children:i.jsx(Bn,{placeholder:b("settings.form_fields.language.placeholder")})}),i.jsx(Un,{children:sn.map(U=>i.jsxs(Vt,{value:U.code,children:[i.jsx("span",{"aria-hidden":"true",className:`mr-2 ${U.flagClassName}`}),U.name]},U.code))})]})})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.contact_information.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),i.jsx(Oe,{children:i.jsx(Ut,{rows:8,placeholder:b("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.logo.label"})}),i.jsx(We,{children:i.jsx(oe,{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:m.dealer.logo?m.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(oe,{i18nKey:"settings.form_fields.logo.requirements"})})})]})}),i.jsxs(Rt,{className:"px-6 py-4 border-t",children:[i.jsx(zn,{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(oe,{i18nKey:"settings.form_fields.logo.upload"})}),i.jsx(cs,{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg",onChange:V,className:"hidden"})]})]})]}),i.jsxs("div",{className:pe("grid gap-6",n==="quotes"?"visible":"hidden"),children:[i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_show_line_discount_column.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_show_line_discount_column.desc"})})]}),i.jsx(Oe,{children:i.jsx(Jr,{control:v.control,name:"default_show_line_discount_column",render:({field:ne})=>i.jsx(hs,{checked:ne.value??!0,onCheckedChange:ne.onChange})})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_tax.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),i.jsxs(Oe,{children:[i.jsx(Pn,{maxLength:32,placeholder:b("settings.form_fields.default_tax_label.placeholder"),name:"default_tax_label",required:!0,description:b("settings.form_fields.default_tax_label.desc")}),i.jsx("br",{}),i.jsx(is,{scale:2,disabled:E.disabled,placeholder:b("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0,description:b("settings.form_fields.default_tax.desc")})]}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_payment_method.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),i.jsx(Oe,{children:i.jsx(Ut,{autoSize:!0,placeholder:b("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:v.formState.errors})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),i.jsx(Oe,{children:i.jsx(Ut,{autoSize:!0,placeholder:b("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]}),i.jsxs(Te,{children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_notes.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),i.jsx(Oe,{children:i.jsx(Ut,{autoSize:!0,placeholder:b("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]})]}),i.jsx("div",{className:pe("grid gap-6",n==="legal"?"visible":"hidden"),children:i.jsxs(Te,{className:"h-",children:[i.jsxs(ct,{children:[i.jsx(ze,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),i.jsx(We,{children:i.jsx(oe,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),i.jsx(Oe,{children:i.jsx(Ut,{rows:25,placeholder:b("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),i.jsx(Rt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(oe,{i18nKey:"common.save"})})})]})})]})})})},Kw=T.createContext(null),Ww=({children:n})=>i.jsx(Kw.Provider,{value:{},children:n}),cS=({children:n})=>i.jsx(gs,{children:i.jsx(Ww,{children:i.jsxs(ei,{className:"settings-layout",children:[i.jsx(ti,{}),i.jsxs(ni,{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(oe,{i18nKey:"settings.edit.title"})})}),n]})]})})});export{Jw as CatalogLayout,eS as CatalogList,tS as DashboardPage,nS as DealerLayout,rS as DealersList,iS as ErrorPage,Zw as LoginPageWithLanguageSelector,Xw as LogoutPage,sS as QuoteCreate,aS as QuoteEdit,oS as QuotesLayout,lS as QuotesList,uS as SettingsEditor,cS as SettingsLayout};
|