PageSourceSearch

https://cirfren.com.ar/assets/app-core-EV8Jcl9K.js

js cirfren.com.ar collected 2026-10-07 00:53:20 UTC 101,109 bytes, 18 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-CY0dnwJo.css","assets/500-BCr-Ycu3.css","assets/600-BKQIJbvy.css","assets/700-CFB4RuUd.css","assets/400-WFOKBYV6.css","assets/500-C9oGlv8Y.css","assets/600-B7Ikl3KO.css","assets/700-E5xu9sOm.css","assets/400-DCI5Veq3.css","assets/500-DGNBLxBd.css","assets/700-CbU3GGHX.css","assets/400-q1oScHLn.css","assets/500-CUjSSFeP.css","assets/600-C6AwBqtE.css","assets/700-Ckf_Wdne.css"])))=>i.map(i=>d[i]);
2var Ur=Object.defineProperty,jr=Object.defineProperties;var zr=Object.getOwnPropertyDescriptors;var lt=Object.getOwnPropertySymbols;var vn=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var Tn=(e,t,n)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t)=>{for(var n in t||(t={}))vn.call(t,n)&&Tn(e,n,t[n]);if(lt)for(var n of lt(t))wn.call(t,n)&&Tn(e,n,t[n]);return e},re=(e,t)=>jr(e,zr(t));var Cn=(e,t)=>{var n={};for(var r in e)vn.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lt)for(var r of lt(e))t.indexOf(r)<0&&wn.call(e,r)&&(n[r]=e[r]);return n};var $=(e,t,n)=>new Promise((r,o)=>{var s=c=>{try{l(n.next(c))}catch(f){o(f)}},i=c=>{try{l(n.throw(c))}catch(f){o(f)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,i);l((n=n.apply(e,t)).next())});import{r as u,j as Pe,u as cr}from"./vendor-react-gOCRXY4A.js";import{s as Wr,r as Hr,q as Gr}from"./shared-o2PD5__J.js";const qr="modulepreload",Vr=function(e){return"/"+e},In={},ce=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let c=function(f){return Promise.all(f.map(b=>Promise.resolve(b).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=c(n.map(f=>{if(f=Vr(f),f in In)return;In[f]=!0;const b=f.endsWith(".css"),_=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${_}`))return;const p=document.createElement("link");if(p.rel=b?"stylesheet":qr,b||(p.as="script"),p.crossOrigin="",p.href=f,l&&p.setAttribute("nonce",l),document.head.appendChild(p),b)return new Promise((g,h)=>{p.addEventListener("load",g),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return o.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},On="/api";function kn(e){return $(this,null,function*(){if(!(e!=null&&e.bypassCache)&&typeof window!="undefined"){const t=window.__SP_CONFIG__;if(t&&t.tenant&&t.config)return t}try{const t=e!=null&&e.bypassCache?`${On}/config.php?_t=${Date.now()}`:`${On}/config.php`,n=yield fetch(t,e!=null&&e.bypassCache?{cache:"no-store"}:void 0);if(!n.ok)return null;const r=yield n.json();return!r.success||!r.data?null:r.data}catch(t){return null}})}function ur(e){if(!e||!e.startsWith("#")||e.length<7)return e;let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255;function o(d){return d<=.04045?d/12.92:Math.pow((d+.055)/1.055,2.4)}function s(d,E,y){return .2126*o(d)+.7152*o(E)+.0722*o(y)}function i(d,E,y){return 1.05/(s(d,E,y)+.05)}if(i(t,n,r)>=4.5)return e;const l=Math.max(t,n,r),c=Math.min(t,n,r);let f=0,b=0,_=(l+c)/2;if(l!==c){const d=l-c;b=_>.5?d/(2-l-c):d/(l+c),l===t?f=((n-r)/d+(n<r?6:0))/6:l===n?f=((r-t)/d+2)/6:f=((t-n)/d+4)/6}function p(d,E,y){if(E===0)return[y,y,y];const S=y<.5?y*(1+E):y+E-y*E,C=2*y-S,I=A=>(A<0&&(A+=1),A>1&&(A-=1),A<1/6?C+(S-C)*6*A:A<1/2?S:A<2/3?C+(S-C)*(2/3-A)*6:C);return[I(d+1/3),I(d),I(d-1/3)]}function g(d){return Math.round(d*255).toString(16).padStart(2,"0")}let h=_;for(let d=0;d<30;d++){h=Math.max(0,h-.03);const[E,y,S]=p(f,b,h);if(i(E,y,S)>=4.5)return`#${g(E)}${g(y)}${g(S)}`}return"#1a1a1a"}function Fa(e){if(!e||!e.startsWith("#")||e.length<7)return 1;const t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,o=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);return 1.05/(.2126*o(t)+.7152*o(n)+.0722*o(r)+.05)}function xa(e){return e>=4.5?{label:"AA",valid:!0,color:"#16A34A"}:e>=3?{label:"AA grande",valid:!0,color:"#D97706"}:{label:"Insuficiente",valid:!1,color:"#DC2626"}}function Ma(e){if(!e||!e.startsWith("#")||e.length<7)return{backgroundColor:"#F3F4F6",color:"#374151"};const t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16),o=Math.round(255*.85+t*.15),s=Math.round(255*.85+n*.15),i=Math.round(255*.85+r*.15);return{backgroundColor:`#${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`,color:ur(e)}}function $a(e){if(!e||!e.startsWith("#")||e.length<7)return"#F3F4F6";const t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16),o=Math.round(255*.85+t*.15),s=Math.round(255*.85+n*.15),i=Math.round(255*.85+r*.15);return`#${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Jr(e){const t={"--sidebar-text-strong":"rgba(255,255,255,1)","--sidebar-text":"rgba(255,255,255,0.85)","--sidebar-text-muted":"rgba(255,255,255,0.65)","--sidebar-text-faint":"rgba(255,255,255,0.45)","--sidebar-border":"rgba(255,255,255,0.10)","--sidebar-hover-bg":"rgba(255,255,255,0.06)","--sidebar-chevron":"rgba(255,255,255,0.55)","--sidebar-badge-bg":"rgba(255,255,255,0.10)"};if(!e||!e.startsWith("#")||e.length<7)return t;const n=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,o=parseInt(e.slice(5,7),16)/255,s=l=>l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4),i=.2126*s(n)+.7152*s(r)+.0722*s(o);return i<.18?t:i<.45?{"--sidebar-text-strong":"rgba(255,255,255,1)","--sidebar-text":"rgba(255,255,255,0.95)","--sidebar-text-muted":"rgba(255,255,255,0.80)","--sidebar-text-faint":"rgba(255,255,255,0.65)","--sidebar-border":"rgba(255,255,255,0.18)","--sidebar-hover-bg":"rgba(0,0,0,0.10)","--sidebar-chevron":"rgba(255,255,255,0.75)","--sidebar-badge-bg":"rgba(0,0,0,0.18)"}:{"--sidebar-text-strong":"rgba(0,0,0,0.95)","--sidebar-text":"rgba(0,0,0,0.85)","--sidebar-text-muted":"rgba(0,0,0,0.70)","--sidebar-text-faint":"rgba(0,0,0,0.55)","--sidebar-border":"rgba(0,0,0,0.15)","--sidebar-hover-bg":"rgba(0,0,0,0.06)","--sidebar-chevron":"rgba(0,0,0,0.55)","--sidebar-badge-bg":"rgba(0,0,0,0.10)"}}const Rn=new Set;function Yr(e){return $(this,null,function*(){var r;if(Rn.has(e))return;Rn.add(e);const t={"Plus Jakarta Sans":()=>$(null,null,function*(){yield Promise.all([ce(()=>Promise.resolve({}),__vite__mapDeps([0])),ce(()=>Promise.resolve({}),__vite__mapDeps([1])),ce(()=>Promise.resolve({}),__vite__mapDeps([2])),ce(()=>Promise.resolve({}),__vite__mapDeps([3]))])}),Inter:()=>$(null,null,function*(){yield Promise.all([ce(()=>Promise.resolve({}),__vite__mapDeps([4])),ce(()=>Promise.resolve({}),__vite__mapDeps([5])),ce(()=>Promise.resolve({}),__vite__mapDeps([6])),ce(()=>Promise.resolve({}),__vite__mapDeps([7]))])}),"DM Sans":()=>$(null,null,function*(){yield Promise.all([ce(()=>Promise.resolve({}),__vite__mapDeps([8])),ce(()=>Promise.resolve({}),__vite__mapDeps([9])),ce(()=>Promise.resolve({}),__vite__mapDeps([10]))])}),Nunito:()=>$(null,null,function*(){yield Promise.all([ce(()=>Promise.resolve({}),__vite__mapDeps([11])),ce(()=>Promise.resolve({}),__vite__mapDeps([12])),ce(()=>Promise.resolve({}),__vite__mapDeps([13])),ce(()=>Promise.resolve({}),__vite__mapDeps([14]))])})};yield((r=t[e])!=null?r:t["Plus Jakarta Sans"])()})}const lr=u.createContext(void 0);function Ba({children:e}){const t=typeof window!="undefined"?window.__SP_CONFIG__:null,[n,r]=u.useState(t!=null?t:null),[o,s]=u.useState(!t);function i(c){var y,S,C,I;r(c),document.documentElement.style.setProperty("--color-primario-brand",c.config.color_primario),document.documentElement.style.setProperty("--color-secundario-brand",c.config.color_secundario),document.documentElement.style.setProperty("--color-acento-brand",c.config.color_acento);const f=(y=c.config.color_acento_texto_override)==null?void 0:y.trim(),b=f&&/^#[0-9A-Fa-f]{6}$/.test(f)?f:ur(c.config.color_acento);document.documentElement.style.setProperty("--color-acento-texto",b),document.documentElement.style.setProperty("--color-fondo-brand",c.config.color_fondo),document.documentElement.style.setProperty("--color-texto-brand",c.config.color_texto),document.documentElement.style.setProperty("--color-texto-acento",(S=c.config.color_texto_sobre_acento)!=null?S:"#111111"),document.documentElement.style.setProperty("--color-texto-primario",(C=c.config.color_texto_sobre_primario)!=null?C:"#ffffff");const _=Jr(c.config.color_primario);Object.entries(_).forEach(([A,v])=>{document.documentElement.style.setProperty(A,v)});const p=(I=c.config.frontend_theme)!=null?I:"default";if(p!=="default"){document.body.setAttribute("data-theme",p);const A=document.getElementById("frontend-theme-css"),v="/themes/frontend-"+p+".css";if(A)A.getAttribute("href")!==v&&A.setAttribute("href",v);else{const U=document.createElement("link");U.id="frontend-theme-css",U.rel="stylesheet",U.href=v,document.head.appendChild(U)}}else{document.body.removeAttribute("data-theme");const A=document.getElementById("frontend-theme-css");A&&A.remove()}document.documentElement.removeAttribute("data-dashboard-theme");const g=document.getElementById("dashboard-theme-css");g&&g.remove();const h=c.config.font_family;if(h){const A=`'${h}', system-ui, -apple-system, sans-serif`;document.documentElement.style.setProperty("--font-family-sans",A),document.documentElement.style.setProperty("--font-family-display",A),document.documentElement.style.setProperty("--font-sans",A),h!=="Plus Jakarta Sans"&&Yr(h)}const d=Number(c.config.font_size_base)||16;document.documentElement.style.setProperty("--font-size-base-user",`${d}px`);const E=c.config.text_primary_color;E&&/^#[0-9A-Fa-f]{6}$/.test(E)&&document.documentElement.style.setProperty("--text-primary",E),c.config.seo_titulo?document.title=c.config.seo_titulo:document.title=c.config.nombre_negocio}function l(){kn({bypassCache:!0}).then(c=>{c&&i(c)})}return u.useEffect(()=>{if(t){i(t);return}kn().then(c=>{c&&i(c),s(!1)})},[]),Pe.jsx(lr.Provider,{value:{fullConfig:n,isLoading:o,refetchConfig:l},children:e})}function ht(){const e=u.useContext(lr);if(!e)throw new Error("useData debe usarse dentro de <DataProvider>");return e}const fr=u.createContext(null),Nn="sp_wishlist";function Ua({children:e}){const[t,n]=u.useState(()=>{try{const i=localStorage.getItem(Nn);return i?JSON.parse(i):[]}catch(i){return[]}});u.useEffect(function(){try{localStorage.setItem(Nn,JSON.stringify(t))}catch(i){}},[t]);function r(i){n(function(l){return l.includes(i)?l.filter(function(c){return c!==i}):[...l,i]})}function o(i){return t.includes(i)}function s(){n([])}return Pe.jsx(fr.Provider,{value:{ids:t,toggle:r,isInWishlist:o,clear:s,count:t.length},children:e})}function ja(){const e=u.useContext(fr);if(!e)throw new Error("useWishlist debe usarse dentro de WishlistProvider");return e}function Fe(...e){try{typeof window.gtag=="function"&&window.gtag(...e)}catch(t){}}function xe(...e){try{typeof window.fbq=="function"&&window.fbq(...e)}catch(t){}}function en(e){var t;return{id:String(e.item_id),quantity:(t=e.quantity)!=null?t:1,item_price:e.price}}function tn(e){return e.reduce((t,n)=>{var r;return t+n.price*((r=n.quantity)!=null?r:1)},0)}function za(e,t="ARS"){var r;const n=e.price*((r=e.quantity)!=null?r:1);Fe("event","view_item",{currency:t,value:n,items:[e]}
2),xe("track","ViewContent",{content_ids:[String(e.item_id)],content_name:e.item_name,content_type:"product",content_category:e.item_category,value:n,currency:t})}function Xr(e,t="ARS"){const n=tn(e);Fe("event","add_to_cart",{currency:t,value:n,items:e}),xe("track","AddToCart",{content_ids:e.map(r=>String(r.item_id)),content_type:"product",contents:e.map(en),value:n,currency:t})}function Wa(e,t="ARS",n){const r=tn(e);Fe("event","begin_checkout",{currency:t,value:r,items:e,user_data:n}),xe("track","InitiateCheckout",{content_ids:e.map(o=>String(o.item_id)),content_type:"product",contents:e.map(en),num_items:e.reduce((o,s)=>{var i;return o+((i=s.quantity)!=null?i:1)},0),value:r,currency:t})}function Ha(e){var o,s;const t=(o=e.currency)!=null?o:"ARS",n=(s=e.value)!=null?s:tn(e.items),r=`purchase_pedido_${e.transaction_id}`;return Fe("event","purchase",{transaction_id:String(e.transaction_id),currency:t,value:n,tax:e.tax,shipping:e.shipping,coupon:e.coupon,items:e.items,user_data:e.userData}),xe("track","Purchase",{content_ids:e.items.map(i=>String(i.item_id)),content_type:"product",contents:e.items.map(en),value:n,currency:t},{eventID:r}),r}function Ga(e){!e||e.length<2||(Fe("event","search",{search_term:e}),xe("track","Search",{search_string:e}))}function qa(e="email",t){Fe("event","sign_up",{method:e,user_data:t}),xe("track","CompleteRegistration",{status:!0})}function Va(e={}){var n;const t=(n=e.currency)!=null?n:"ARS";Fe("event","generate_lead",{currency:t,value:e.value,content_name:e.content_name}),xe("track","Lead",{value:e.value,currency:t,content_name:e.content_name})}const Dn="/api",ke="cliente_token",dr=u.createContext({cliente:null,token:null,loading:!0,login:()=>$(null,null,function*(){return{success:!1}}),registro:()=>$(null,null,function*(){return{success:!1}}),loginConToken:()=>{},logout:()=>{}});function Ja({children:e}){const[t,n]=u.useState(null),[r,o]=u.useState(null),[s,i]=u.useState(!0);u.useEffect(function(){var _=localStorage.getItem(ke);if(!_){i(!1);return}try{var p=_.split("."),g=JSON.parse(atob(p[1]));if(g.exp&&g.exp*1e3<Date.now()){localStorage.removeItem(ke),i(!1);return}if(g.rol!=="CLIENTE"){localStorage.removeItem(ke),i(!1);return}o(_),n({id:g.sub,nombre:g.nombre,apellido:g.apellido,email:g.email})}catch(h){localStorage.removeItem(ke)}i(!1)},[]);var l=u.useCallback(function(_,p){return $(this,null,function*(){var d;try{var g=yield fetch(Dn+"/auth_login_cliente.php",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:_,password:p})}),h=yield g.json();return h.success&&h.token?(localStorage.setItem(ke,h.token),o(h.token),n(h.cliente),{success:!0}):{success:!1,error:(d=h.error)!=null?d:"Error al iniciar sesión"}}catch(E){return{success:!1,error:"Error de conexión"}}})},[]),c=u.useCallback(function(_){return $(this,null,function*(){var h;try{var p=yield fetch(Dn+"/auth_registro_cliente.php",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}),g=yield p.json();return g.success&&g.token?(localStorage.setItem(ke,g.token),o(g.token),n(g.cliente),{success:!0}):{success:!1,error:(h=g.error)!=null?h:"Error al registrarse"}}catch(d){return{success:!1,error:"Error de conexión"}}})},[]),f=u.useCallback(function(_,p){localStorage.setItem(ke,_),o(_),n(p)},[]),b=u.useCallback(function(){localStorage.removeItem(ke),o(null),n(null)},[]);return Pe.jsx(dr.Provider,{value:{cliente:t,token:r,loading:s,login:l,registro:c,loginConToken:f,logout:b},children:e})}function Kr(){return u.useContext(dr)}const Zr="/api";function Qr(e){return!e||e.length===0?"":e.map(t=>"g"+t.grupo_id+"-"+t.opciones.slice().sort((n,r)=>n.id-r.id).map(n=>n.cantidad&&n.cantidad>1?n.id+"x"+n.cantidad:String(n.id)).join(".")).sort().join("|")}function he(e,t,n,r){const o=Qr(r),s=t!=null?e+"@v"+t:String(e),i=!n||Object.keys(n).length===0?s:s+"::"+JSON.stringify(n,Object.keys(n).sort());return o?i+"##"+o:i}function eo(e){return e!=null&&e.stock_limita&&typeof e.stock_maximo=="number"?e.stock_maximo:null}const mr=u.createContext(null),Ln="sp_carrito";function Ya({children:e}){const[t,n]=u.useState(()=>{try{const D=localStorage.getItem(Ln);return D?JSON.parse(D):[]}catch(D){return[]}}),[r,o]=u.useState(!1),[s,i]=u.useState({}),[l,c]=u.useState(null),[f,b]=u.useState(null),[_,p]=u.useState(null),[g,h]=u.useState(null),[d,E]=u.useState(null),[y,S]=u.useState(""),[C,I]=u.useState(!1),{token:A}=Kr();u.useEffect(()=>{localStorage.setItem(Ln,JSON.stringify(t))},[t]);const v=u.useCallback(()=>$(null,null,function*(){var D,G,w,L,x;if(t.length===0){i({}),c(null),b(null),p(null),h(null),E(null);return}try{const oe={"Content-Type":"application/json"};A&&(oe.Authorization="Bearer "+A);const z=t.map(X=>{var Ce;return{id:X.id,cantidad:X.cantidad,variante_id:(Ce=X.variante_id)!=null?Ce:void 0,opciones:X.opciones&&Object.keys(X.opciones).length>0?X.opciones:void 0,modificadores:X.modificadores&&X.modificadores.length>0?X.modificadores.map(se=>({grupo_id:se.grupo_id,opciones:se.opciones.map(_e=>{var de;return{id:_e.id,cantidad:(de=_e.cantidad)!=null?de:1}})})):void 0}}),ge=yield(yield fetch(Zr+"/carrito_recalcular.php",{method:"POST",headers:oe,body:JSON.stringify({items:z,cupon_codigo:y||""})})).json();if(ge.success&&Array.isArray(ge.items)){const X={};for(const se of ge.items){const _e=typeof se.pos=="number"?se.pos:-1,de=_e>=0&&_e<t.length?t[_e]:void 0;de&&de.id===se.id?X[he(de.id,de.variante_id,de.opciones,de.modificadores)]=se:de&&console.warn("[carrito] posición",_e,"no coincide (local",de.id,"vs backend",se.id,") — línea sin recalcular")}let Ce=!1;if(Object.keys(s).length>0)for(const se in X){const _e=s[se];
2if(_e&&Math.abs(_e.precio_final-X[se].precio_final)>.01){Ce=!0;break}}i(X),c((D=ge.cliente_grupo)!=null?D:null),b((G=ge.escala)!=null?G:null),p((w=ge.transferencia)!=null?w:null),h((L=ge.cupon)!=null?L:null),E((x=ge.resumen)!=null?x:null),Ce&&I(!0)}}catch(oe){}}),[t,A,y]);u.useEffect(()=>{v()},[v]);const U=t.reduce((D,G)=>D+G.cantidad,0),O=u.useCallback((D,G=1)=>{var L;Xr([{item_id:D.id,item_name:D.nombre,price:D.precio?parseFloat(D.precio):0,quantity:G,item_category:(L=D.categoria_nombre)!=null?L:void 0}],D.moneda||"ARS");const w=he(D.id,D.variante_id,D.opciones,D.modificadores);n(x=>x.find(z=>he(z.id,z.variante_id,z.opciones,z.modificadores)===w)?x.map(z=>he(z.id,z.variante_id,z.opciones,z.modificadores)===w?re(J({},z),{cantidad:z.cantidad+G}):z):[...x,re(J({},D),{cantidad:G})])},[]),k=u.useCallback(D=>{n(G=>G.filter(w=>he(w.id,w.variante_id,w.opciones,w.modificadores)!==D))},[]),M=u.useCallback((D,G)=>{if(G<=0){n(w=>w.filter(L=>he(L.id,L.variante_id,L.opciones,L.modificadores)!==D));return}n(w=>w.map(L=>he(L.id,L.variante_id,L.opciones,L.modificadores)===D?re(J({},L),{cantidad:G}):L))},[]),V=u.useCallback((D,G)=>{n(w=>w.map(L=>he(L.id,L.variante_id,L.opciones,L.modificadores)===D?re(J({},L),{nota:G}):L))},[]),q=u.useCallback(()=>{n([]),S(""),h(null)},[]),F=u.useCallback(()=>I(!1),[]),N=u.useCallback(D=>S(D.trim().toUpperCase()),[]),P=u.useCallback(()=>{S(""),h(null)},[]),j=u.useCallback((D,G,w,L)=>{const x=he(D,L,G,w);return t.some(oe=>he(oe.id,oe.variante_id,oe.opciones,oe.modificadores)===x)},[t]),Y=u.useCallback((D,G,w,L)=>he(D,L,G,w),[]),te=u.useCallback(()=>o(!0),[]),H=u.useCallback(()=>o(!1),[]),Se=u.useMemo(()=>{var G;const D=[];for(const w of t){const L=he(w.id,w.variante_id,w.opciones,w.modificadores),x=(G=s[L])!=null?G:s[String(w.id)];if(x!=null&&x.requiere_variante)continue;const oe=eo(x);oe!==null&&w.cantidad>oe&&D.push({key:L,id:w.id,nombre:w.nombre,cantidad:w.cantidad,maximo:oe})}return D},[t,s]),we=u.useMemo(()=>{var G;const D=[];for(const w of t){const L=he(w.id,w.variante_id,w.opciones,w.modificadores),x=(G=s[L])!=null?G:s[String(w.id)];x!=null&&x.requiere_variante&&D.push({key:L,id:w.id,nombre:w.nombre,slug:w.slug})}return D},[t,s]);return Pe.jsx(mr.Provider,{value:{items:t,totalItems:U,agregarItem:O,quitarItem:k,cambiarCantidad:M,cambiarNota:V,vaciarCarrito:q,estaEnCarrito:j,getItemKey:Y,isOpen:r,abrirCarrito:te,cerrarCarrito:H,preciosRecalculados:s,lineasSinStock:Se,lineasSinVariante:we,clienteGrupo:l,escala:f,transferencia:_,resumen:d,recalcularPrecios:v,cupon:g,cuponCodigo:y,aplicarCupon:N,quitarCupon:P,precioCambioReciente:C,descartarAvisoCambio:F},children:e})}function Xa(){const e=u.useContext(mr);if(!e)throw new Error("useCarrito debe usarse dentro de CarritoProvider");return e}const to={open:!1,message:"",title:"Confirmar",danger:!0,confirmText:"Confirmar",cancelText:"Cancelar"};let Ye=null,Vt=null;function Ka(e){Ye=e}function Za(e){const t=Vt;Vt=null,Ye==null||Ye(to),t==null||t(e)}function Qa(e){const t=typeof e=="string"?{message:e}:e;return Ye?new Promise(n=>{var r,o,s;Vt=n,Ye({open:!0,message:t.message,title:(r=t.title)!=null?r:"Confirmar",danger:t.danger!==!1,confirmText:(o=t.confirmText)!=null?o:"Confirmar",cancelText:(s=t.cancelText)!=null?s:"Cancelar"})}):Promise.resolve(window.confirm(t.message))}function no(){try{return!!localStorage.getItem("sp_token")||!!localStorage.getItem("sp_original_token")}catch(e){return!1}}const ro="https://connect.facebook.net/en_US/fbevents.js";let Pn=null,xt=null;function oo(){const e=function(...t){e.callMethod?e.callMethod.apply(e,t):e.queue.push(t)};return e.queue=[],e.push=e,e.loaded=!0,e.version="2.0",e}function ao(){if(document.querySelector('script[src*="fbevents.js"]'))return;const e=document.createElement("script");e.async=!0,e.src=ro,document.head.appendChild(e)}function io(e,t){const n=window;if(typeof n.requestIdleCallback=="function"){const o=n.requestIdleCallback(e,{timeout:t});return()=>{typeof n.cancelIdleCallback=="function"&&n.cancelIdleCallback(o)}}const r=window.setTimeout(e,200);return()=>window.clearTimeout(r)}function so(e){if(!e)return()=>{};if(Pn===e)return()=>{};Pn=e;const t=window;if(!t.fbq){const n=oo();t.fbq=n,t._fbq||(t._fbq=n)}return t.fbq("init",e),t.fbq("track","PageView"),xt=io(ao,2e3),()=>{xt&&xt()}}function co(e){return e.startsWith("/dashboard")||e.startsWith("/superadmin")}function Fn(e,t=2e3){const n=window;if(typeof n.requestIdleCallback=="function"){const o=n.requestIdleCallback(e,{timeout:t});return()=>{typeof n.cancelIdleCallback=="function"&&n.cancelIdleCallback(o)}}const r=window.setTimeout(e,200);return()=>window.clearTimeout(r)}function ei(){var l,c,f;const{fullConfig:e}=ht(),{pathname:t}=cr(),n=co(t)||no(),r=e==null?void 0:e.config,o=(l=r==null?void 0:r.ga_id)!=null?l:"",s=(c=r==null?void 0:r.gtm_id)!=null?c:"",i=(f=r==null?void 0:r.meta_pixel_id)!=null?f:"";u.useEffect(()=>n||!s||document.getElementById("gtm-script")?void 0:Fn(()=>
2{if(document.getElementById("gtm-script"))return;const _=document.createElement("script");_.id="gtm-script",_.innerHTML=`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
5'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
6})(window,document,'script','dataLayer','${s}');`,document.head.appendChild(_);const p=document.createElement("noscript");p.id="gtm-noscript";const g=document.createElement("iframe");g.src=`https://www.googletagmanager.com/ns.html?id=${s}`,g.height="0",g.width="0",g.style.display="none",g.style.visibility="hidden",p.appendChild(g),document.body.insertBefore(p,document.body.firstChild)}),[s,n]),u.useEffect(()=>n||!o||s||document.getElementById("ga-script")?void 0:Fn(()=>{if(document.getElementById("ga-script"))return;const _=document.createElement("script");_.id="ga-script",_.async=!0,_.src=`https://www.googletagmanager.com/gtag/js?id=${o}`,document.head.appendChild(_);const p=document.createElement("script");p.id="ga-init",p.innerHTML=`
7        window.dataLayer = window.dataLayer || [];
8        function gtag(){dataLayer.push(arguments);}
9        gtag('js', new Date());
10        gtag('config', '${o}');
11      `,document.head.appendChild(p)}),[o,s,n]),u.useEffect(()=>{if(!n&&i)return so(i)},[i,n])}const xn="/api";function ti(){var i,l;const e=cr(),{fullConfig:t}=ht(),n=t==null?void 0:t.config,r=(i=n==null?void 0:n.ga_id)!=null?i:"",o=(l=n==null?void 0:n.meta_pixel_id)!=null?l:"",s=u.useRef("");u.useEffect(()=>{const c=e.pathname.startsWith("/dashboard")||e.pathname.startsWith("/superadmin");o&&typeof window.fbq=="function"&&window.fbq("consent",c?"revoke":"grant"),r&&(window["ga-disable-"+r]=c)},[e.pathname,r,o]),u.useEffect(()=>{const c=e.pathname+e.search,f=document.title;if(s.current===c)return;const b=!s.current&&!!r,_=!s.current;s.current=c;const p=e.pathname,g=p.startsWith("/dashboard")||p.startsWith("/superadmin");if(!g&&r&&window.gtag&&!b&&window.gtag("event","page_view",{page_path:c,page_title:f,send_to:r}),!g&&o&&window.fbq&&!_&&window.fbq("track","PageView"),!g&&!p.startsWith("/login")&&!p.startsWith("/suspendida")){const d=JSON.stringify({pagina:p,referrer:document.referrer||null});typeof navigator.sendBeacon=="function"?navigator.sendBeacon(`${xn}/metricas_registrar.php`,new Blob([d],{type:"application/json"})):fetch(`${xn}/metricas_registrar.php`,{method:"POST",headers:{"Content-Type":"application/json"},body:d,keepalive:!0}).catch(()=>{})}},[e.pathname,e.search,r,o])}const ze="/api",pr=u.createContext(null);function Mn(e){for(const t of["sp_token","sp_original_token","sp_original_user","sp_impersonate_mode"])try{localStorage.removeItem(t)}catch(n){}window.location.replace(e)}function ni({children:e}){var U;const[t,n]=u.useState(null),[r,o]=u.useState(null),[s,i]=u.useState(!0);u.useEffect(()=>{let O=!1;const M=new URLSearchParams(window.location.search).get("impersonate_token");M&&(localStorage.setItem("sp_impersonate_mode","1"),localStorage.setItem("sp_token",M),window.history.replaceState({},"",window.location.pathname));function V(){return $(this,null,function*(){if(localStorage.getItem("sp_impersonate_mode")||localStorage.getItem("sp_original_token"))return!1;try{const N=yield(yield fetch(`${ze}/auth_refresh.php`,{method:"POST",credentials:"include"})).json().catch(()=>null);return N!=null&&N.token&&(N!=null&&N.user)?(localStorage.setItem("sp_token",N.token),O||(o(N.token),n(N.user)),!0):!1}catch(F){return!1}})}function q(){return $(this,null,function*(){const F=localStorage.getItem("sp_token");if(F)try{const N=yield fetch(`${ze}/auth_me.php`,{headers:{Authorization:`Bearer ${F}`}});if(N.ok){const P=yield N.json();if(P!=null&&P.id){O||(o(F),n(P));return}}localStorage.removeItem("sp_token"),yield V();return}catch(N){yield V();return}yield V()})}return q().finally(()=>{O||i(!1)}),()=>{O=!0}},[]),u.useEffect(()=>{if(r)try{const M=JSON.parse(atob(r.split(".")[1])).exp*1e3-Date.now();if(M<=0){localStorage.removeItem("sp_token"),o(null),n(null);return}const V=setTimeout(()=>Mn("/login"),M);return()=>clearTimeout(V)}catch(O){}},[r]);function l(O,k){return $(this,null,function*(){var M;try{const q=yield(yield fetch(`${ze}/auth_login.php`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O,password:k})})).json();return q!=null&&q.requires_verification?{success:!1,requires_verification:!0}
11:q!=null&&q.token&&(q!=null&&q.user)?(localStorage.setItem("sp_token",q.token),o(q.token),n(q.user),{success:!0}):{success:!1,error:(M=q.error)!=null?M:"Credenciales incorrectas"}}catch(V){return{success:!1,error:"Error de conexión"}}})}function c(O,k){localStorage.setItem("sp_token",O),o(O),n(k)}function f(O="/"){return $(this,null,function*(){r&&(yield fetch(`${ze}/auth_logout.php`,{method:"POST",credentials:"include",headers:{Authorization:`Bearer ${r}`}}).catch(()=>{})),Mn(O)})}function b(O){localStorage.setItem("sp_token",O),o(O)}function _(){return $(this,null,function*(){const O=localStorage.getItem("sp_token");if(O)try{const k=yield fetch(`${ze}/auth_me.php`,{headers:{Authorization:`Bearer ${O}`}});if(k.ok){const M=yield k.json();M!=null&&M.id&&n(M)}}catch(k){}})}const p=!!localStorage.getItem("sp_original_token")||!!localStorage.getItem("sp_impersonate_mode");function g(O){return $(this,null,function*(){if(!r)return!1;try{const M=yield(yield fetch(`${ze}/auth_impersonate.php`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({user_id:O})})).json();if(M.success&&M.token)return localStorage.setItem("sp_original_token",r),localStorage.setItem("sp_original_user",JSON.stringify(t)),localStorage.setItem("sp_token",M.token),o(M.token),n(M.user),!0}catch(k){}return!1})}function h(){const O=localStorage.getItem("sp_original_token"),k=localStorage.getItem("sp_original_user");if(O&&k){localStorage.setItem("sp_token",O),o(O),n(JSON.parse(k)),localStorage.removeItem("sp_original_token"),localStorage.removeItem("sp_original_user"),localStorage.removeItem("sp_impersonate_mode");return}localStorage.getItem("sp_impersonate_mode")&&(localStorage.removeItem("sp_impersonate_mode"),localStorage.removeItem("sp_token"),window.close())}const d=(U=t==null?void 0:t.rol)!=null?U:null,E=d==="SUPERADMIN",y=d==="ADMIN"||E,C=d==="ENCARGADO"||y,I=d==="EDITOR"||C,A=d==="ASISTENTE"||C,v=d==="CONTADOR";return Pe.jsx(pr.Provider,{value:{user:t,token:r,loading:s,login:l,loginConToken:c,logout:f,refreshToken:b,refreshUser:_,impersonate:g,exitImpersonate:h,isImpersonating:p,isSuperAdmin:E,isAdmin:y,canEdit:I,canViewCRM:A,canOperate:C,isContador:v},children:e})}function bt(){const e=u.useContext(pr);if(!e)throw new Error("useAuth debe usarse dentro de AuthProvider");return e}const Jt={nombre:"",telefono:"",email:"",domicilio:"",localidad:"",zonaId:null,notas:"",propinaPct:null,metodo:""},gr=u.createContext(void 0),_r="sp_carrito_menu_v1";function uo(e){const t=e.modificadores.reduce((n,r)=>n+r.opciones.reduce((o,s)=>o+(Number(s.precio_extra)||0),0),0);return(e.precio_base+t)*e.cantidad}function hr(e,t){const n=t.map(r=>r.grupo_id+":"+r.opciones.map(o=>o.id).sort().join(",")).sort().join("|");return`i${e}_${n||"sin"}`}function lo(){var e,t,n;try{const r=localStorage.getItem(_r);if(!r)return null;const o=JSON.parse(r);return{lineas:Array.isArray(o.lineas)?o.lineas.filter(i=>!!i&&typeof i=="object"&&typeof i.item_id=="number").map(i=>{var l;return re(J({},i),{modificadores:Array.isArray(i.modificadores)?i.modificadores:[],cantidad:Number(i.cantidad)>0?Number(i.cantidad):1,precio_base:Number(i.precio_base)||0,nota:(l=i.nota)!=null?l:null,uid:i.uid||hr(i.item_id,Array.isArray(i.modificadores)?i.modificadores:[])})}):[],modoEntrega:o.modoEntrega==="take_away"||o.modoEntrega==="delivery"?o.modoEntrega:"mesa",mesa:(e=o.mesa)!=null?e:null,mesaSlug:(t=o.mesaSlug)!=null?t:null,checkout:J(J({},Jt),(n=o.checkout)!=null?n:{})}}catch(r){return null}}function ri({children:e}){var O,k,M,V,q;const t=u.useRef(void 0);t.current===void 0&&(t.current=lo());const n=t.current,[r,o]=u.useState((O=n==null?void 0:n.lineas)!=null?O:[]),[s,i]=u.useState((k=n==null?void 0:n.modoEntrega)!=null?k:"mesa"),[l,c]=u.useState((M=n==null?void 0:n.mesa)!=null?M:null),[f,b]=u.useState((V=n==null?void 0:n.mesaSlug)!=null?V:null),[_,p]=u.useState((q=n==null?void 0:n.checkout)!=null?q:Jt);u.useEffect(()=>{try{const F={lineas:r,modoEntrega:s,mesa:l,mesaSlug:f,checkout:_};localStorage.setItem(_r,JSON.stringify(F))}catch(F){}},[r,s,l,f,_]);function g(F){var j;const N=(j=F.cantidad)!=null?j:1,P=hr(F.item_id,F.modificadores);o(Y=>Y.find(H=>H.uid===P)?Y.map(H=>H.uid===P?re(J({},H),{cantidad:H.cantidad+N}):H):[...Y,re(J({},F),{uid:P,cantidad:N})])}function h(F,N){if(N<=0){o(P=>P.filter(j=>j.uid!==F));return}o(P=>P.map(j=>j.uid===F?re(J({},j),{cantidad:N}):j))}function d(F){o(N=>N.filter(P=>P.uid!==F))}function E(F,N){o(P=>P.map(j=>j.uid===F?re(J({},j),{nota:N.trim()||null}):j))}function y(F){i(F),F!=="mesa"&&(c(null),b(null))}function S(F,N=null){c(F),b(N),F&&i("mesa")}function C(F){p(N=>J(J({},N),F))}function I(){o([]),p(Jt)}const A=r.length,v=r.reduce((F,N)=>F+N.cantidad,0),U=r.reduce((F,N)=>F+uo(N),0);return Pe.jsx(gr.Provider,{value:{lineas:r,modoEntrega:s,mesa:l,mesaSlug:f,checkout:_,agregarLinea:g,cambiarCantidad:h,quitarLinea:d,cambiarNota:E,setModoEntrega:y,setMesa:S,setCheckout:C,vaciar:I,totalLineas:A,totalItems:v,subtotal:U},children:e})}function oi(){const e=u.useContext(gr);if(!e)throw new Error("useCarritoMenu debe usarse dentro de <CarritoMenuProvider>");return e}const fo="/api",mo=["portfolio","cotizador","turnos","blog","descuentos","marketing","inventario","inteligencia","asistente","contabilidad"];function po(e){return mo.includes(e)}const $n="sp_plan_no_verificado";function go(e){const t={cuando:new Date().toISOString(),motivo:e,ruta:window.location.pathname};console.error("[SP][PLAN] candado CERRADO: no se pudo verificar el plan —",e,t);try{const n=localStorage.getItem($n),r=n?JSON.parse(n):[],o=Array.isArray(r)?r:[];o.push(t),localStorage.setItem($n,JSON.stringify(o.slice(-20)))}catch(n){}}const br=u.createContext(null);function ai({children:e}){const{user:t,token:n}=bt(),[r,o]=u.useState(null),[s,i]=u.useState("inicial"),[l,c]=u.useState(null),f=u.useRef(0),b=u.useCallback(()=>$(null,null,function*(){const g=++f.current,h=()=>f.current===g;if(!t||!n){o(null),i("inicial");return}if(t.rol==="SUPERADMIN"){o(null),i("listo");return}i("cargando");let d="sin respuesta";for(let E=1;E<=3;E++){try{const y=yield fetch(`${fo}/admin_mi_plan.php`,{headers:{Authorization:`Bearer ${n}`}});if(!y.ok)d=`HTTP ${y.status}`;else{const S=yield y.json();if(S!=null&&S.success&&S.data){if(!h())return;o(S.data),i("listo");return}
11d=typeof(S==null?void 0:S.error)=="string"?S.error:"respuesta sin data"}}catch(y){d=y instanceof Error?y.message:"error de red"}if(!h())return;E<3&&(yield new Promise(y=>setTimeout(y,E*1500)))}h()&&(o(null),i("error"),go(d))}),[t,n]);u.useEffect(()=>{b()},[b]),u.useEffect(()=>{document.documentElement.setAttribute("data-plan-estado",s)},[s]);const _=u.useCallback(g=>{if((t==null?void 0:t.rol)==="SUPERADMIN")return!0;if(r){const h=r.capabilities[g];return h?h.acceso:!0}return!po(g)},[r,t]),p=u.useCallback(g=>{var d;if(!r)return null;const h=r.capabilities[g];return(d=h==null?void 0:h.cortesia_vence)!=null?d:null},[r]);return Pe.jsx(br.Provider,{value:{planInfo:r,loading:s==="cargando",estado:s,planVerificado:s==="listo",refresh:b,puede:_,cortesiaActiva:p,paywall:l,abrirPaywall:(g,h)=>c({modulo:g,accion:h}),cerrarPaywall:()=>c(null)},children:e})}function ii(){const e=u.useContext(br);if(!e)throw new Error("usePlan debe usarse dentro de PlanProvider");return e}function si(e){const t=u.useRef(!1),n=u.useRef("");n.current||(n.current=Wr("overlay"));const r=u.useCallback(i=>{i?Hr(n.current):Gr(n.current)},[]),o=u.useCallback(i=>{t.current=i.target===i.currentTarget},[]),s=u.useCallback(i=>{t.current&&i.target===i.currentTarget&&e(),t.current=!1},[e]);return{ref:r,onPointerDown:o,onPointerUp:s,"data-cierre-modal":!0}}const _o=" | ";function ci({titulo:e,descripcion:t,imagen:n,tipo:r="website",canonicalPath:o,noIndex:s=!1}={}){var p,g,h,d;const{fullConfig:i}=ht(),l=i==null?void 0:i.config,c=(p=l==null?void 0:l.nombre_negocio)!=null?p:"",f=(g=l==null?void 0:l.seo_descripcion)!=null?g:"",b=(h=l==null?void 0:l.og_imagen_url)!=null?h:null,_=(d=l==null?void 0:l.sitio_url)!=null?d:typeof window!="undefined"?window.location.origin:"";u.useEffect(()=>{const E=e?`${e}${c?_o+c:""}`:c||"Inicio";document.title=E;function y(U,O,k="content"){if(!O)return;let M=document.querySelector(U);if(!M){M=document.createElement("meta");const[V,q]=U.replace("meta[","").replace("]","").split("=");M.setAttribute(V.trim(),q.replace(/['"]/g,"").trim()),document.head.appendChild(M)}M.setAttribute(k,O)}function S(U,O){if(!O)return;let k=document.querySelector(`link[rel="${U}"]`);k||(k=document.createElement("link"),k.rel=U,document.head.appendChild(k)),k.href=O}const C=t||f;y('meta[name="description"]',C),s&&y('meta[name="robots"]',"noindex, follow"),y('meta[property="og:title"]',E),y('meta[property="og:description"]',C),y('meta[property="og:type"]',r),y('meta[property="og:site_name"]',c);const I=n!=null?n:b,A=_.replace(/\/$/,""),v=I?I.startsWith("http")?I:A+(I.startsWith("/")?I:"/"+I):null;if(y('meta[property="og:image"]',v),o&&_){const U=A+o;y('meta[property="og:url"]',U),S("canonical",U)}y('meta[name="twitter:card"]',v?"summary_large_image":"summary"),y('meta[name="twitter:title"]',E),y('meta[name="twitter:description"]',C),y('meta[name="twitter:image"]',v)},[e,t,n,r,o,s,c,f,b,_])}function Bn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ho(e){if(Array.isArray(e))return e}function bo(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,i,l=[],c=!0,f=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(b){f=!0,o=b}finally{try{if(!c&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw o}}return l}}function So(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
12In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yo(e,t){return ho(e)||bo(e,t)||Eo(e,t)||So()}function Eo(e,t){if(e){if(typeof e=="string")return Bn(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}const Sr=Object.entries,Un=Object.setPrototypeOf,Ao=Object.isFrozen,To=Object.getPrototypeOf,vo=Object.getOwnPropertyDescriptor;let fe=Object.freeze,be=Object.seal,Je=Object.create,yr=typeof Reflect!="undefined"&&Reflect,Yt=yr.apply,Xt=yr.construct;fe||(fe=function(t){return t});be||(be=function(t){return t});Yt||(Yt=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)});Xt||(Xt=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const We=ee(Array.prototype.forEach),wo=ee(Array.prototype.lastIndexOf),jn=ee(Array.prototype.pop),He=ee(Array.prototype.push),Co=ee(Array.prototype.splice),ue=Array.isArray,nt=ee(String.prototype.toLowerCase),Mt=ee(String.prototype.toString),zn=ee(String.prototype.match),Ge=ee(String.prototype.replace),Wn=ee(String.prototype.indexOf),Io=ee(String.prototype.trim),Oo=ee(Number.prototype.toString),ko=ee(Boolean.prototype.toString),Hn=typeof BigInt=="undefined"?null:ee(BigInt.prototype.toString),Gn=typeof Symbol=="undefined"?null:ee(Symbol.prototype.toString),K=ee(Object.prototype.hasOwnProperty),et=ee(Object.prototype.toString),ie=ee(RegExp.prototype.test),ft=Ro(TypeError);function ee(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Yt(e,t,r)}}function Ro(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Xt(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nt;if(Un&&Un(e,null),!ue(t))return e;let r=t.length;for(;r--;){let o=t[r];
vendor: 4,425 bytes, line 12
12if(typeof o=="string"){const s=n(o);s!==o&&(Ao(t)||(t[r]=s),o=s)}e[o]=!0}return e}function No(e){for(let t=0;t<e.length;t++)K(e,t)||(e[t]=null);return e}function pe(e){const t=Je(null);for(const r of Sr(e)){var n=yo(r,2);const o=n[0],s=n[1];K(e,o)&&(ue(s)?t[o]=No(s):s&&typeof s=="object"&&s.constructor===Object?t[o]=pe(s):t[o]=s)}return t}function Do(e){switch(typeof e){case"string":return e;case"number":return Oo(e);case"boolean":return ko(e);case"bigint":return Hn?Hn(e):"0";case"symbol":return Gn?Gn(e):"Symbol()";case"undefined":return et(e);case"function":case"object":{if(e===null)return et(e);const t=e,n=De(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:et(r)}return et(e)}default:return et(e)}}function De(e,t){for(;e!==null;){const r=vo(e,t);if(r){if(r.get)return ee(r.get);if(typeof r.value=="function")return ee(r.value)}e=To(e)}function n(){return null}return n}function Lo(e){try{return ie(e,""),!0}catch(t){return!1}}const qn=fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","selectedcontent","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$t=fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Bt=fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Po=fe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ut=fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Fo=fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Vn=fe(["#text"]),Jn=fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
12spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),jt=fe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Yn=fe(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),dt=fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xo=be(/{{[\w\W]*|^[\w\W]*}}/g),Mo=be(/<%[\w\W]*|^[\w\W]*%>/g),$o=be(/\${[\w\W]*/g),Bo=be(/^data-[\-\w.\u00B7-\uFFFF]+$/),Uo=be(/^aria-[\-\w]+$/),Xn=be(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jo=be(/^(?:\w+script|data):/i),zo=be(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wo=be(/^html$/i),Ho=be(/^[a-z][.\w]*(-[.\w]+)+$/i),qe={element:1,text:3,progressingInstruction:7,comment:8,document:9},Go=function(){return typeof window=="undefined"?null:window},qo=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch(i){return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Kn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Er(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Go();const t=R=>Er(R);if(t.version="3.4.4",t.removed=[],!e||!e.document||e.document.nodeType!==qe.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript,s=e.DocumentFragment,i=e.HTMLTemplateElement,l=e.Node,c=e.Element,f=e.NodeFilter,b=e.NamedNodeMap,_=b===void 0?e.NamedNodeMap||e.MozNamedAttrMap:b,p=e.HTMLFormElement,g=e.DOMParser,h=e.trustedTypes,d=c.prototype,E=De(d,"cloneNode"),y=De(d,"remove"),S=De(d,"nextSibling"),C=De(d,"childNodes"),I=De(d,"parentNode"),A=l&&l.prototype?De(l.prototype,"nodeType"):null;if(typeof i=="function"){const R=n.createElement("template");R.content&&R.content.ownerDocument&&(n=R.content.ownerDocument)}let v,U="";const O=n,k=O.implementation,M=O.createNodeIterator,V=O.createDocumentFragment,q=O.getElementsByTagName,F=r.importNode;let N=Kn();t.isSupported=typeof Sr=="function"&&typeof I=="function"&&k&&k.createHTMLDocument!==void 0;const P=xo,j=Mo,Y=$o,te=Bo,H=Uo,Se=jo,we=zo,D=Ho;let G=Xn,w=null;const L=B({},[...qn,...$t,...Bt,...Ut,...Vn]);let x=null;const oe=B({},[...Jn,...jt,...Yn,...dt]);let z=Object.seal(Je(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,ge=null;
vendor: 2,534 bytes, line 12
12const X=Object.seal(Je(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ce=!0,se=!0,_e=!1,de=!0,Ie=!1,Ke=!0,Re=!1,Tt=!1,vt=!1,$e=!1,ot=!1,at=!1,on=!0,an=!1;const sn="user-content-";let wt=!0,Ze=!1,Be={},Ee=null;const Ct=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let cn=null;const un=B({},["audio","video","img","source","image","track"]);let It=null;const ln=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),it="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",Ae="http://www.w3.org/1999/xhtml";let Ue=Ae,Ot=!1,kt=null;const Lr=B({},[it,st,Ae],Mt);let Rt=B({},["mi","mo","mn","ms","mtext"]),Nt=B({},["annotation-xml"]);const Pr=B({},["title","style","font","a","script"]);let Qe=null;const Fr=["application/xhtml+xml","text/html"],xr="text/html";let ne=null,je=null;const Mr=n.createElement("form"),fn=function(a){return a instanceof RegExp||a instanceof Function},Dt=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(je&&je===a)return;(!a||typeof a!="object")&&(a={}),a=pe(a),Qe=Fr.indexOf(a.PARSER_MEDIA_TYPE)===-1?xr:a.PARSER_MEDIA_TYPE,ne=Qe==="application/xhtml+xml"?Mt:nt,w=K(a,"ALLOWED_TAGS")&&ue(a.ALLOWED_TAGS)?B({},a.ALLOWED_TAGS,ne):L,x=K(a,"ALLOWED_ATTR")&&ue(a.ALLOWED_ATTR)?B({},a.ALLOWED_ATTR,ne):oe,kt=K(a,"ALLOWED_NAMESPACES")&&ue(a.ALLOWED_NAMESPACES)?B({},a.ALLOWED_NAMESPACES,Mt):Lr,It=K(a,"ADD_URI_SAFE_ATTR")&&ue(a.ADD_URI_SAFE_ATTR)?B(pe(ln),a.ADD_URI_SAFE_ATTR,ne):ln,cn=K(a,"ADD_DATA_URI_TAGS")&&ue(a.ADD_DATA_URI_TAGS)?B(pe(un),a.ADD_DATA_URI_TAGS,ne):un,Ee=K(a,"FORBID_CONTENTS")&&ue(a.FORBID_CONTENTS)?B({},a.FORBID_CONTENTS,ne):Ct,Me=K(a,"FORBID_TAGS")&&ue(a.FORBID_TAGS)?B({},a.FORBID_TAGS,ne):pe({}),ge=K(a,"FORBID_ATTR")&&ue(a.FORBID_ATTR)?B({},a.FORBID_ATTR,ne):pe({}),Be=K(a,"USE_PROFILES")?a.USE_PROFILES&&typeof a.USE_PROFILES=="object"?pe(a.USE_PROFILES):a.USE_PROFILES:!1,Ce=a.ALLOW_ARIA_ATTR!==!1,se=a.ALLOW_DATA_ATTR!==!1,_e=a.ALLOW_UNKNOWN_PROTOCOLS||!1,de=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ie=a.SAFE_FOR_TEMPLATES||!1,Ke=a.SAFE_FOR_XML!==!1,Re=a.WHOLE_DOCUMENT||!1,$e=a.RETURN_DOM||!1,ot=a.RETURN_DOM_FRAGMENT||!1,at=a.RETURN_TRUSTED_TYPE||!1,vt=a.FORCE_BODY||!1,on=a.SANITIZE_DOM!==!1,an=a.SA
12NITIZE_NAMED_PROPS||!1,wt=a.KEEP_CONTENT!==!1,Ze=a.IN_PLACE||!1,G=Lo(a.ALLOWED_URI_REGEXP)?a.ALLOWED_URI_REGEXP:Xn,Ue=typeof a.NAMESPACE=="string"?a.NAMESPACE:Ae,Rt=K(a,"MATHML_TEXT_INTEGRATION_POINTS")&&a.MATHML_TEXT_INTEGRATION_POINTS&&typeof a.MATHML_TEXT_INTEGRATION_POINTS=="object"?pe(a.MATHML_TEXT_INTEGRATION_POINTS):B({},["mi","mo","mn","ms","mtext"]),Nt=K(a,"HTML_INTEGRATION_POINTS")&&a.HTML_INTEGRATION_POINTS&&typeof a.HTML_INTEGRATION_POINTS=="object"?pe(a.HTML_INTEGRATION_POINTS):B({},["annotation-xml"]);const m=K(a,"CUSTOM_ELEMENT_HANDLING")&&a.CUSTOM_ELEMENT_HANDLING&&typeof a.CUSTOM_ELEMENT_HANDLING=="object"?pe(a.CUSTOM_ELEMENT_HANDLING):Je(null);if(z=Je(null),K(m,"tagNameCheck")&&fn(m.tagNameCheck)&&(z.tagNameCheck=m.tagNameCheck),K(m,"attributeNameCheck")&&fn(m.attributeNameCheck)&&(z.attributeNameCheck=m.attributeNameCheck),K(m,"allowCustomizedBuiltInElements")&&typeof m.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=m.allowCustomizedBuiltInElements),Ie&&(se=!1),ot&&($e=!0),Be&&(w=B({},Vn),x=Je(null),Be.html===!0&&(B(w,qn),B(x,Jn)),Be.svg===!0&&(B(w,$t),B(x,jt),B(x,dt)),Be.svgFilters===!0&&(B(w,Bt),B(x,jt),B(x,dt)),Be.mathMl===!0&&(B(w,Ut),B(x,Yn),B(x,dt))),X.tagCheck=null,X.attributeCheck=null,K(a,"ADD_TAGS")&&(typeof a.ADD_TAGS=="function"?X.tagCheck=a.ADD_TAGS:ue(a.ADD_TAGS)&&(w===L&&(w=pe(w)),B(w,a.ADD_TAGS,ne))),K(a,"ADD_ATTR")&&(typeof a.ADD_ATTR=="function"?X.attributeCheck=a.ADD_ATTR:ue(a.ADD_ATTR)&&(x===oe&&(x=pe(x)),B(x,a.ADD_ATTR,ne))),K(a,"ADD_URI_SAFE_ATTR")&&ue(a.ADD_URI_SAFE_ATTR)&&B(It,a.ADD_URI_SAFE_ATTR,ne),K(a,"FORBID_CONTENTS")&&ue(a.FORBID_CONTENTS)&&(Ee===Ct&&(Ee=pe(Ee)),B(Ee,a.FORBID_CONTENTS,ne)),K(a,"ADD_FORBID_CONTENTS")&&ue(a.ADD_FORBID_CONTENTS)&&(Ee===Ct&&(Ee=pe(Ee)),B(Ee,a.ADD_FORBID_CONTENTS,ne)),wt&&(w["#text"]=!0),Re&&B(w,["html","head","body"]),w.table&&(B(w,["tbody"]),delete Me.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw ft('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ft('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=a.TRUSTED_TYPES_POLICY,U=v.createHTML("")}else v===void 0&&(v=qo(h,o)),v!==null&&typeof U=="string"&&(U=v.createHTML(""));fe&&fe(a),je=a},dn=B({},[...$t,...Bt,...Po]),mn=B({},[...Ut,...Fo]),$r=function(a){let m=I(a);(!m||!m.tagName)&&(m={namespaceURI:Ue,tagName:"template"});const T=nt(a.tagName),W=nt(m.tagName);return kt[a.namespaceURI]?a.namespaceURI===st?m.namespaceURI===Ae?T==="svg":m.namespaceURI===it?T==="svg"&&(W==="annotation-xml"||Rt[W]):!!dn[T]:a.namespaceURI===it?m.namespaceURI===Ae?T==="math":m.namespaceURI===st?T==="math"&&Nt[W]:!!mn[T]:a.namespaceURI===Ae?m.namespaceURI===st&&!Nt[W]||m.namespaceURI===it&&!Rt[W]?!1:!mn[T]&&(Pr[T]||!dn[T]):!!(Qe==="application/xhtml+xml"&&kt[a.namespaceURI]):!1},ye=function(a){He(t.removed,{element:a});try{I(a).removeChild(a)}catch(m){y(a)}},Ne=function(a,m){try{He(t.removed,{attribute:m.getAttributeNode(a),from:m})}catch(T){He(t.removed,{attribute:null,from:m})}if(m.removeAttribute(a),a==="is")if($e||ot)try{ye(m)}catch(T){}else try{m.setAttribute(a,"")}catch(T){}},pn=function(a){let m=null,T=null;if(vt)a="<remove></remove>"+a;else{const Q=zn(a,/^[\r\n\t ]+/);T=Q&&Q[0]}Qe==="application/xhtml+xml"&&Ue===Ae&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");const W=v?v.createHTML(a):a;if(Ue===Ae)try{m=new g().parseFromString(W,Qe)}catch(Q){}if(!m||!m.documentElement){m=k.createDocument(Ue,"template",null);try{m.documentElement.innerHTML=Ot?U:W}catch(Q){}}const Z=m.body||m.documentElement;return a&&T&&Z.insertBefore(n.createTextNode(T),Z.childNodes[0]||null),Ue===Ae?q.call(m,Re?"html":"body")[0]:Re?m.documentElement:Z},gn=function(a){return M.call(a.ownerDocument||a,a,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},_n=function(a){a.normalize();const m=M.call(a.ownerDocument||a,a,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let T=m.nextNode();for(;T;){let W=T.data;We([P,j,Y],Z=>{W=Ge(W,Z," ")}),T.data=W,T=m.nextNode()}},Lt=function(a){return a instanceof p&&(typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||!(a.attributes instanceof _)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function")}
vendor: 1,481 bytes, line 12
12,ct=function(a){if(!A||typeof a!="object"||a===null)return!1;try{return typeof A(a)=="number"}catch(m){return!1}};function Te(R,a,m){We(R,T=>{T.call(t,a,m,je)})}const hn=function(a){let m=null;if(Te(N.beforeSanitizeElements,a,null),Lt(a))return ye(a),!0;const T=ne(a.nodeName);if(Te(N.uponSanitizeElement,a,{tagName:T,allowedTags:w}),Ke&&a.hasChildNodes()&&!ct(a.firstElementChild)&&ie(/<[/\w!]/g,a.innerHTML)&&ie(/<[/\w!]/g,a.textContent)||Ke&&a.namespaceURI===Ae&&T==="style"&&ct(a.firstElementChild)||a.nodeType===qe.progressingInstruction||Ke&&a.nodeType===qe.comment&&ie(/<[/\w]/g,a.data))return ye(a),!0;if(Me[T]||!(X.tagCheck instanceof Function&&X.tagCheck(T))&&!w[T]){if(!Me[T]&&Sn(T)&&(z.tagNameCheck instanceof RegExp&&ie(z.tagNameCheck,T)||z.tagNameCheck instanceof Function&&z.tagNameCheck(T)))return!1;if(wt&&!Ee[T]){const W=I(a)||a.parentNode,Z=C(a)||a.childNodes;if(Z&&W){const Q=Z.length;for(let me=Q-1;me>=0;--me){const Oe=E(Z[me],!0);W.insertBefore(Oe,S(a))}}}return ye(a),!0}return a instanceof c&&!$r(a)||(T==="noscript"||T==="noembed"||T==="noframes")&&ie(/<\/no(script|embed|frames)/i,a.innerHTML)?(ye(a),!0):(Ie&&a.nodeType===qe.text&&(m=a.textContent,We([P,j,Y],W=>{m=Ge(m,W," ")}),a.textContent!==m&&(He(t.removed,{element:a.cloneNode()}),a.textContent=m)),Te(N.afterSanitizeElements,a,null),!1)},bn=function(a,m,T){if(ge[m]||on&&(m==="id"||m==="name")&&(T in n||T in Mr))return!1;const W=x[m]||X.attributeCheck instanceof Function&&X.attributeCheck(m,a);
12if(!(se&&!ge[m]&&ie(te,m))){if(!(Ce&&ie(H,m))){if(!W||ge[m]){if(!(Sn(a)&&(z.tagNameCheck instanceof RegExp&&ie(z.tagNameCheck,a)||z.tagNameCheck instanceof Function&&z.tagNameCheck(a))&&(z.attributeNameCheck instanceof RegExp&&ie(z.attributeNameCheck,m)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(m,a))||m==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&ie(z.tagNameCheck,T)||z.tagNameCheck instanceof Function&&z.tagNameCheck(T))))return!1}else if(!It[m]){if(!ie(G,Ge(T,we,""))){if(!((m==="src"||m==="xlink:href"||m==="href")&&a!=="script"&&Wn(T,"data:")===0&&cn[a])){if(!(_e&&!ie(Se,Ge(T,we,"")))){if(T)return!1}}}}}}return!0},Br=B({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Sn=function(a){return!Br[nt(a)]&&ie(D,a)},yn=function(a){Te(N.beforeSanitizeAttributes,a,null);const m=a.attributes;if(!m||Lt(a))return;const T={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:x,forceKeepAttr:void 0};let W=m.length;for(;W--;){const Z=m[W],Q=Z.name,me=Z.namespaceURI,Oe=Z.value,ve=ne(Q),Ft=Oe;let ae=Q==="value"?Ft:Io(Ft);if(T.attrName=ve,T.attrValue=ae,T.keepAttr=!0,T.forceKeepAttr=void 0,Te(N.uponSanitizeAttribute,a,T),ae=T.attrValue,an&&(ve==="id"||ve==="name")&&Wn(ae,sn)!==0&&(Ne(Q,a),ae=sn+ae),Ke&&ie(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ae)){Ne(Q,a);continue}if(ve==="attributename"&&zn(ae,"href")){Ne(Q,a);continue}if(T.forceKeepAttr)continue;if(!T.keepAttr){Ne(Q,a);continue}if(!de&&ie(/\/>/i,ae)){Ne(Q,a);continue}Ie&&We([P,j,Y],An=>{ae=Ge(ae,An," ")});const En=ne(a.nodeName);if(!bn(En,ve,ae)){Ne(Q,a);continue}if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!me)switch(h.getAttributeType(En,ve)){case"TrustedHTML":{ae=v.createHTML(ae);break}case"TrustedScriptURL":{ae=v.createScriptURL(ae);break}}if(ae!==Ft)try{me?a.setAttributeNS(me,Q,ae):a.setAttribute(Q,ae),Lt(a)?ye(a):jn(t.removed)}catch(An){Ne(Q,a)}}Te(N.afterSanitizeAttributes,a,null)},Pt=function(a){let m=null;const T=gn(a);for(Te(N.beforeSanitizeShadowDOM,a,null);m=T.nextNode();)Te(N.uponSanitizeShadowNode,m,null),hn(m),yn(m),m.content instanceof s&&Pt(m.content);Te(N.afterSanitizeShadowDOM,a,null)},ut=function(a){if(a.nodeType===qe.element&&a.shadowRoot instanceof s){const W=a.shadowRoot;ut(W),Pt(W)}const m=a.childNodes;if(!m)return;const T=[];We(m,W=>{He(T,W)});for(const W of T)ut(W)};return t.sanitize=function(R){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=null,T=null,W=null,Z=null;if(Ot=!R,Ot&&(R="<!-->"),typeof R!="string"&&!ct(R)&&(R=Do(R),typeof R!="string"))throw ft("dirty is not a string, aborting");if(!t.isSupported)return R;if(Tt||Dt(a),t.removed=[],typeof R=="string"&&(Ze=!1),Ze){const Oe=R.nodeName;if(typeof Oe=="string"){const ve=ne(Oe);if(!w[ve]||Me[ve])throw ft("root node is forbidden and cannot be sanitized in-place")}ut(R)}else if(ct(R))m=pn("<!---->"),T=m.ownerDocument.importNode(R,!0),T.nodeType===qe.element&&T.nodeName==="BODY"||T.nodeName==="HTML"?m=T:m.appendChild(T),ut(T);else{if(!$e&&!Ie&&!Re&&R.indexOf("<")===-1)return v&&at?v.createHTML(R):R;if(m=pn(R),!m)return $e?null:at?U:""}m&&vt&&ye(m.firstChild);const Q=gn(Ze?R:m);for(;W=Q.nextNode();)hn(W),yn(W),W.content instanceof s&&Pt(W.content);if(Ze)return Ie&&_n(R),R;if($e){if(Ie&&_n(m),ot)for(Z=V.call(m.ownerDocument);m.firstChild;)Z.appendChild(m.firstChild);else Z=m;return(x.shadowroot||x.shadowrootmode)&&(Z=F.call(r,Z,!0)),Z}let me=Re?m.outerHTML:m.innerHTML;return Re&&w["!doctype"]&&m.ownerDocument&&m.ownerDocument.doctype&&m.ownerDocument.doctype.name&&ie(Wo,m.ownerDocument.doctype.name)&&(me="<!DOCTYPE "+m.ownerDocument.doctype.name+`>
13`+me),Ie&&We([P,j,Y],Oe=>{me=Ge(me,Oe," ")}),v&&at?v.createHTML(me):me},t.setConfig=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dt(R),Tt=!0},t.clearConfig=function(){je=null,Tt=!1},t.isValidAttribute=function(R,a,m){je||Dt({});const T=ne(R),W=ne(a);return bn(T,W,m)},t.addHook=function(R,a){typeof a=="function"&&He(N[R],a)},t.removeHook=function(R,a){if(a!==void 0){const m=wo(N[R],a);return m===-1?void 0:Co(N[R],m,1)[0]}return jn(N[R])},t.removeHooks=function(R){N[R]=[]},t.removeAllHooks=function(){N=Kn()},t}var Vo=Er();const Jo=["h1","h2","h3","h4","h5","h6","p","br","hr","strong","em","b","i","u","s","ul","ol","li","a","img","blockquote","cite","table","thead","tbody","tr","td","th","span","div","pre","code"],Yo=["href","target","rel","src","alt","width","height","loading","class","colspan","rowspan"];function ui(e){return e?Vo.sanitize(e,{ALLOWED_TAGS:Jo,ALLOWED_ATTR:Yo,ADD_ATTR:["target"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i,WHOLE_DOCUMENT:!1,USE_PROFILES:{html:!0}}):""}const Xo=[160,320,800];function Ar(e){return!e||e.startsWith("data:")||e.startsWith("blob:")?!1:e.includes("/uploads/")}function li(e,t){return Ar(e)?`${e}__w${t}.webp`:e}function fi(e){if(!Ar(e))return;const t=Xo.map(n=>`${e}__w${n}.webp ${n}w`);return t.push(`${e} 1216w`),t.join(", ")}function di(e,t=300){const[n,r]=u.useState(e);return u.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}
13function mi(e,t,n){const r=(t!=null?t:"").trim();if(r)return r;const o=typeof e=="string"?parseInt(e,10):e;return o!=null&&Number.isFinite(o)&&o>0?`Plazo de entrega: ${o} ${o===1?"día":"días"}`:(n!=null?n:"").trim()||null}function Zn(e){var t;return(t=e.modo_efectivo)!=null?t:e.modo_gestion_stock}function Ko(e){return e.length>3&&/es$/i.test(e)?e.slice(0,-2):e.length>2&&/s$/i.test(e)?e.slice(0,-1):e}function Zo(e){return!e||e==="a_stock"}function pi(e,t){var _;if(Number(e.stock_activo)!==1)return null;const n=e.stock_disponible;if(n==null)return null;const r=(_=e.stock_unidad)!=null?_:"unidades",o=p=>p===1?Ko(r):r;if(!Zo(Zn(e))){if(Zn(e)==="mixto"){const p=e.stock_online===null||e.stock_online===void 0?Number(n):Number(e.stock_online);return p>0?{principal:`${p} ${o(p)} para envío inmediato`,secundaria:null,tono:"normal"}:null}return Number(n)>0?{principal:`${n} ${o(Number(n))}`,secundaria:null,tono:"normal"}:null}const i=e.stock_online===null||e.stock_online===void 0?Number(n):Number(e.stock_online),l=Math.max(0,Number(n)-i),c=i===0?"critico":i<=3?"bajo":"normal",f=i===0?"Sin envío inmediato":l>0?`${i} ${o(i)} para envío inmediato`:i<=3?`¡Solo queda${i===1?"":"n"} ${i} ${o(i)}!`:`${i} ${o(i)} disponibles`,b=l>0?t?`${l} en ${t}`:`${l} sin envío inmediato`:null;return{principal:f,secundaria:b,tono:c}}function gi(e){var n,r,o;const t=(n=e.modo_precio)!=null?n:"";return t==="suscripcion"||t==="inicial_suscripcion"?!0:t==="consultar"||t==="gratis"?!1:Number((r=e.precio_recurrente)!=null?r:0)>0&&String((o=e.periodo_recurrente)!=null?o:"").trim()!==""}const Qo={diario:"por día",semanal:"por semana",quincenal:"cada 15 días",mensual:"por mes",trimestral:"cada 3 meses",cuatrimestral:"cada 4 meses",semestral:"cada 6 meses",anual:"por año"};function _i(e){return ea(e.periodo_recurrente)}function ea(e){var n;const t=String(e!=null?e:"").trim().toLowerCase();return(n=Qo[t])!=null?n:t?"por período":"por mes"}function ta(e){if(e.tipo==="unico")return 1;const t=Number(e.max_seleccion);return Number.isFinite(t)&&t>0?t:1/0}function Tr(e){const t=Number(e.min_seleccion)||0;return e.requerido&&t<1?1:t}function hi(e,t,n){return e.tipo==="unico"?t.length===1&&t[0]===n&&Tr(e)===0?[]:[n]:t.indexOf(n)>=0?t.filter(r=>r!==n):t.length>=ta(e)?t:t.concat([n])}function bi(e,t){return e.filter(n=>{var r;return((r=t[n.id])!=null?r:[]).length<Tr(n)})}function Si(e,t){var r,o;let n=0;for(const s of e)for(const i of(r=t[s.id])!=null?r:[]){const l=s.opciones.find(c=>c.id===i);l&&(n+=Number((o=l.precio_extra)!=null?o:0)||0)}return n}function yi(e){return Object.entries(e).filter(([,t])=>t.length>0).map(([t,n])=>"g"+t+"-"+[...n].sort((r,o)=>r-o).join(".")).sort().join("|")}function Ei(e){return Object.entries(e).filter(([,t])=>t.length>0).map(([t,n])=>({grupo_id:Number(t),opciones:n}))}const zt="/api";function Ai(e,t){var _,p,g,h;const[n,r]=u.useState([]),[o,s]=u.useState([]),[i,l]=u.useState([]);u.useEffect(()=>{fetch(zt+"/geo.php?recurso=paises").then(d=>d.json()).then(d=>{d.paises&&r(d.paises)}).catch(()=>{})},[]),u.useEffect(()=>{if(!e){s([]);return}fetch(zt+"/geo.php?recurso=divisiones1&pais="+encodeURIComponent(e)).then(d=>d.json()).then(d=>{d.divisiones1&&s(d.divisiones1)}).catch(()=>{})},[e]),u.useEffect(()=>{if(!t){l([]);return}fetch(zt+"/geo.php?recurso=divisiones2&div1="+t).then(d=>d.json()).then(d=>{d.divisiones2&&l(d.divisiones2)}).catch(()=>{})},[t]);const c=(_=n.find(d=>d.codigo_iso2===e))!=null?_:null,f=(p=o.find(d=>d.id===t))!=null?p:null,b=!!(f!=null&&f.es_capital_federal);return{paises:n,divisiones1:o,divisiones2:i,nivel1Label:(g=c==null?void 0:c.nivel1_label)!=null?g:"Provincia",nivel2Label:(h=c==null?void 0:c.nivel2_label)!=null?h:"Localidad",esCapitalFederal:b}}function le(e){return String(e).trim().replace(/\s+/g," ").toLocaleLowerCase("es")}function Ti(e){var n;const t=new Map;for(const r of e)for(const o of Object.keys((n=r.combinacion)!=null?n:{})){const s=le(o);t.has(s)||t.set(s,o)}return[...t.values()]}function vi(e,t){const n=le(e);return t.some(r=>le(r)===n)}function nn(e,t){const n=le(t);for(const[r,o]of Object.entries(e))if(le(r)===n)return typeof o=="str
13ing"?o:"";return""}function Kt(e,t){var r;const n=le(t);for(const[o,s]of Object.entries((r=e.combinacion)!=null?r:{}))if(le(o)===n)return String(s);return""}function na(e,t){return e.length>0&&e.every(n=>nn(t,n).trim()!=="")}function wi(e,t,n){var r;return na(t,n)&&(r=e.find(o=>o.activo!==0&&t.every(s=>le(Kt(o,s))===le(nn(n,s)))))!=null?r:null}function ra(e,t){return e==null||e.activo===0?!1:!t||e.stock_online>0}function Ci(e,t,n,r,o,s=!0){const i=le(n),l=le(r);return e.some(c=>!ra(c,s)||le(Kt(c,n))!==l?!1:t.every(f=>{if(le(f)===i)return!0;const b=nn(o,f);return b.trim()===""||le(Kt(c,f))===le(b)}))}const St="es-AR";function oa(e,t="ARS",n={}){var s;const r=yt(e);if(r===null)return"—";const o=(s=n.decimales)!=null?s:2;try{return new Intl.NumberFormat(St,{style:"currency",currency:t,minimumFractionDigits:o,maximumFractionDigits:o}).format(r)}catch(i){return`${t} ${vr(r,o)}`}}function Ii(e,t="ARS"){return oa(e,t,{decimales:0})}function Oi(e,t=2){const n=yt(e);return n===null?"—":new Intl.NumberFormat(St,{minimumFractionDigits:0,maximumFractionDigits:t}).format(n)+"%"}function ki(e){const t=yt(e);return t===null?"—":Number.isInteger(t)?new Intl.NumberFormat(St).format(t):vr(t)}function vr(e,t=2){const n=yt(e);return n===null?"—":new Intl.NumberFormat(St,{minimumFractionDigits:0,maximumFractionDigits:t}).format(n)}function wr(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=String(e).trim().replace(/[^\d.,\-]/g,"");if(!t)return null;const n=t.includes(","),r=t.includes(".");let o;if(n&&r){const i=t.lastIndexOf(","),l=t.lastIndexOf(".");i>l?o=t.replace(/\./g,"").replace(",","."):o=t.replace(/,/g,"")}else if(n){const i=t.split(",");i.length===2&&i[1].length===3&&i[0].length<=3?o=t.replace(",",""):o=t.replace(/,/g,".")}else if(r){const i=t.split(".");i.length>2?o=t.replace(/\./g,""):i.length===2&&i[1].length===3&&i[0].length<=3?o=t.replace(".",""):o=t}else o=t;const s=parseFloat(o);return Number.isFinite(s)?s:null}function Ri(e){var t;return(t=wr(e))!=null?t:0}function yt(e){return e==null||e===""?null:typeof e=="number"?Number.isFinite(e)?e:null:wr(e)}const Qn={efectivo:"Efectivo",tarjeta:"Tarjeta",transferencia:"Transferencia",mixto:"Pago mixto",mercadopago:"MercadoPago",presencial:"Presencial",manual:"Registrado a mano"};function Ni(e){const t=(e!=null?e:"").trim();if(!t)return"—";const n=t.toLowerCase();return Qn[n]?Qn[n]:t.charAt(0).toUpperCase()+t.slice(1)}function Di(e){switch((e!=null?e:"").toLowerCase()){case"transferencia":return"bg-orange-100 text-orange-700";case"efectivo":return"bg-emerald-100 text-emerald-700";case"tarjeta":return"bg-violet-100 text-violet-700";case"mixto":return"bg-amber-100 text-amber-700";case"mercadopago":return"bg-blue-100 text-blue-700";default:return"bg-gray-100 text-gray-700"}}const er=e=>{const t=typeof e=="number"?e:parseFloat(String(e!=null?e:"0"));return Number.isFinite(t)?t:0};function Cr(e){return e?e==="online"?"Venta online":e:"Venta online"}function Ir(e,t){const n=Math.round(e.reduce((o,s)=>o+s.subtotal,0)*100)/100,r=Math.round(Math.max(0,n-t)*100)/100;return{subtotal:n,descuento:r}}function Or(e){if(!e)return"";const t=new Date(String(e).replace(" ","T"));return isNaN(t.getTime())?String(e):t.toLocaleString("es-AR")}function Li(e){var s,i,l,c,f,b,_,p,g,h,d,E,y,S,C;const t=((s=e.items_json)!=null?s:[]).map(I=>{var v,U,O,k,M;const A=er(I.precio);return{nombre:I.nombre,cantidad:I.cantidad,precio_unitario:A,subtotal:Math.round(A*I.cantidad*100)/100,opciones:(v=I.opciones)!=null?v:null,modificadores:I.modificadores,variante_aplicada:(U=I.variante_aplicada)!=null?U:null,variante_grupo:(O=I.variante_grupo)!=null?O:null,variante_nombre:(k=I.variante_nombre)!=null?k:null,nota:(M=I.nota)!=null?M:null}}),n=er(e.total),{subtotal:r,descuento:o}=Ir(t,n);return{id:e.id,numero:e.numero,total:n,subtotal:r,descuento:o,metodo_pago:e.metodo_pago||"mercadopago",cambio:0,facturado:!!e.factura_numero,numero_factura:(i=e.factura_numero)!=null?i:null,cae:(l=e.factura_cae)!=null?l:null,items:t,cliente_nombre:(c=e.nombre)!=null?c:"",vendedor:Cr(e.canal),fecha:Or(e.creado_en),moneda:(f=e.moneda)!=null?f:"ARS",entrega:e.domicilio||e.envio_referencia||e.mensaje||e.envio_receptor_nombre||e.envio_receptor_telefono||e.localidad?{domicilio:(b=e.domicilio)!=null?b:null,numero:(_=e.domicilio_numero)!=null?_:null,piso_depto:(p=e.envio_piso_depto)!=null?p:null,localidad:(g=e.localidad)!=null?g:null,provincia:(h=e.provincia)!=null?h:null,cp:(d=e.cp)!=null?d:null,referencia:(E=e.envio_referencia)!=null?E:null,nota:(y=e.mensaje)!=null?y:null,receptor_nombre:(S=e.envio_receptor_nombre)!=null?S:null,receptor_telefono:(C=e.envio_receptor_telefono)!=null?C:null}:null}}function Pi(e){var o,s,i,l,c,f,b,_;const t=((o=e.items)!=null?o:[]).map(p=>{var g,h,d,E,y;return{nombre:p.nombre,cantidad:p.cantidad,precio_unitario:p.precio_unitario,subtotal:p.subtotal,opciones:(g=p.opciones)!=null?g:null,modificadores:p.modificadores,variante_aplicada:(h=p.variante)!=null?h:null,variante_grupo:(d=p.variante_grupo)!=null?d:null,variante_nombre:(E=p.variante_nombre)!=null?E:null,nota:(y=p.nota)!=null?y:null}}),{subtotal:n,descuento:r}=Ir(t,e.total);return{id:e.id,numero:e.numero,total:e.total,subtotal:n,descuento:r,metodo_pago:e.metodo_pago||"mercadopago",cambio:0,facturado:!!((s=e.factura)!=null&&s.numero),numero_factura:(l=(i=e.factura)==null?void 0:i.numero)!=null?l:null,cae:(f=(c=e.factura)==null?void 0:c.cae)!=null?f:null,items:t,cliente_nombre:(b=e.cliente_nombre)!=null?b:"",vendedor:Cr(e.canal),fecha:Or(e.creado_en),moneda:(_=e.moneda)!=null?_:"ARS"}}let Wt=null;function kr(){const e=window.AudioContext||window.webkitAudioContext;return e?(Wt||(Wt=new e),Wt):null}function Xe(){const e=kr();e&&e.state==="suspended"&&e.resume().catch(()=>{}),document.removeEventListener("click",Xe),document.removeEventListener("touchstart",Xe),document.removeEventListener("keydown",Xe)}typeof document!="undefined"&&(document.addEventListener("click",Xe,{once:!1}),document.addEventListener("touchstart",Xe,{once:!1}),document.addEventListener("keydown",Xe,{once:!1}));function Rr(){try{const e=kr();if(!e)return;e.state==="suspended"&&e.resume().catch(()=>{});const t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.type="sine",t.frequency.setValueAtTime(1318,e.currentTime),n.gain.setValueAtTime(1e-4,e.currentTime),n.gain.exponentialRampToValueAtTime(.12,e.currentTime+.01),n.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+.5),t.start(),t.stop(e.currentTime+.51)}catch(e){}}const aa=45e3,mt=new Map;function Nr(e){const t=performance.now();for(const[n,r]of mt)t-r>aa&&mt.delete(n);return mt.has(e)?!0:(mt.set(e,t),!1)}function tr(){Rr()}function ia(e){Nr(e)||Rr()}const Ht="/api";function sa(e){const t=(e.url||"").match(/\/(\d+)(?:[/?#]|$)/),n=t?t[1]:String(e.id);return`${e.tipo==="mensaje_chat_widget"||e.tipo==="mensajes"?"mensajes":e.tipo==="pedido_wa"?"pedidos":e.tipo}-${n}`}function Fi(e={}){const{token:t}=bt(),{pagina:n=1,tipo:r="",q:o="",enabled:s=!0}=e,[i,l]=u.useState([]),[c,f]=u.useState(0),[b,_]=u.useState(0),[p,g]=u.useState(1),[h,d]=u.useState([]),[E,y]=u.useState(!0),[S,C]=u.useState(null),[I,A]=u.useState(null),v=u.useRef(new Set),U=u.useRef(!0),O=u.useCallback(function(){return $(this,null,function*(){var P,j,Y,te;if(!(!t||!s||document.hidden))try{const H=new URLSearchParams;n>1&&H.set("pagina",String(n)),r&&r!=="todas"&&H.set("tipo",r),o.trim()&&H.set("q",o.trim());const Se=H.toString()?`?${H}`:"",D=yield(yield fetch(`${Ht}/admin_notificaciones.php${Se}`,{headers:{Authorization:`Bearer ${t}`}})).json();if(!D.success){C(D.error||"El servidor no devolvió los avisos.");return}const G=(P=D.data)!=null?P:[];if(C(null),l(G),f((j=D.unread_count)!=null?j:0),_((Y=D.total_grupos)!=null?Y:G.length),g(Math.max(1,(te=D.total_paginas)!=null?te:1)),!(n===1&&(!r||r==="todas")&&!o.trim()))v.current=ne
13w Set([...v.current,...G.map(L=>L.id)]);else if(U.current)v.current=new Set(G.map(L=>L.id)),U.current=!1;else{const L=[];for(const x of G)v.current.has(x.id)||(L.push(x),v.current.add(x.id));if(L.length>0){d(L);let x=!0;try{x=localStorage.getItem("panel_sonido_notif")!=="0"}catch(oe){}x&&L.some(z=>!Nr(sa(z)))&&tr()}}}catch(H){C("No se pudo consultar si hay avisos.")}finally{y(!1)}})},[t,n,r,o,s]);u.useEffect(function(){if(!s){y(!1);return}O();const P=setInterval(O,3e4);function j(){document.hidden||O()}document.addEventListener("visibilitychange",j);function Y(te){if(!te.data||te.data.type!=="PUSH_RECIBIDO")return;let H=!0;try{H=localStorage.getItem("panel_sonido_notif")!=="0"}catch(we){}if(!H)return;const Se=typeof te.data.tagBase=="string"?te.data.tagBase:"";Se?ia(Se):tr(),document.hidden||O()}return"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",Y),function(){clearInterval(P),document.removeEventListener("visibilitychange",j),"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",Y)}},[O]);const k=u.useCallback(function(Y){return $(this,arguments,function*(P,j=`${Ht}/admin_notificaciones.php`){const te=yield fetch(j,{method:"PUT",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:P?JSON.stringify(P):void 0}),H=yield te.json();if(!te.ok||!H.success)throw new Error(H.error||"no se guardó");return H})},[t]),M=u.useCallback(function(P){return $(this,null,function*(){if(t)try{yield k({accion:"leer",id:P}),l(j=>j.map(Y=>Y.id===P?re(J({},Y),{leida:!0}):Y)),f(j=>Math.max(0,j-1))}catch(j){A("No se pudo marcar como leída. Sigue pendiente.")}})},[t,k]),V=u.useCallback(function(P){return $(this,null,function*(){if(!(!t||!P||P.length===0))try{yield k({accion:"leer_grupo",ids:P});const j=new Set(P);let Y=0;l(te=>te.map(H=>{var Se;return H.ids_grupo&&H.ids_grupo.some(we=>j.has(we))?(Y+=(Se=H.no_leidas)!=null?Se:0,re(J({},H),{leida:!0,no_leidas:0})):typeof H.id=="number"&&j.has(H.id)&&!H.leida?(Y++,re(J({},H),{leida:!0})):H})),f(te=>Math.max(0,te-Y))}catch(j){A("No se pudieron marcar como leídas. Siguen pendientes.")}})},[t,k]),q=u.useCallback(function(){return $(this,null,function*(){if(t)try{yield k(null,`${Ht}/admin_notificaciones.php?accion=leer_todas`),l(P=>P.map(j=>re(J({},j),{leida:!0}))),f(0)}catch(P){A("No se pudieron marcar como leídas. Siguen pendientes.")}})},[t,k]),F=u.useCallback(function(){d([])},[]);u.useEffect(function(){if(h.length===0)return;const P=setTimeout(F,500);return function(){clearTimeout(P)}},[h,F]);const N=u.useCallback(function(){y(!0),C(null),O()},[O]);return{notificaciones:i,unreadCount:c,nuevas:h,marcarLeida:M,marcarGrupoLeido:V,marcarTodasLeidas:q,loading:E,error:S,errorAccion:I,reintentar:N,totalGrupos:b,totalPaginas:p}}const rt="es-AR";function Et(e){if(!e)return null;const t=String(e).trim();if(!t)return null;const n=t.includes("T")?t:t.includes(" ")?t.replace(" ","T"):t+"T12:00:00",r=new Date(n);return isNaN(r.getTime())?null:r}function xi(e){const t=Et(e);return t?t.toLocaleDateString(rt,{day:"2-digit",month:"2-digit",year:"numeric"}):"—"}function Mi(e){const t=Et(e);return t?t.toLocaleDateString(rt,{day:"2-digit",month:"short",year:"numeric"}):"—"}function $i(e){const t=Et(e);return t?t.toLocaleDateString(rt,{weekday:"long",day:"numeric",month:"long"}):"—"}function Bi(e){const t=Et(e);return t?t.toLocaleDateString(rt,{day:"2-digit",month:"short"})+", "+t.toLocaleTimeString(rt,{hour:"2-digit",minute:"2-digit"}):"—"}function At(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Ui(){return At(new Date)}function ji(e){const t=new Date;return t.setDate(t.getDate()+e),At(t)}function zi(){const e=new Date;return At(new Date(e.getFullYear(),e.getMonth(),1))}function ca(e){return`${At(e)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function Wi(e){return ca(e).slice(0,16)}const pt="/api";function ua(e){const t=e,n=/Edg\//.test(navigator.userAgent),r="brave"in navigator;switch(t.name){case"NotAllowedError":return n?"Windows o Edge bloqueó las notificaciones. Revisá: (1) Configuración de Windows → Sistema → Notificaciones (activadas para Edge), (2) que el Asistente de concentración esté desactivado, (3) el permiso del sitio en el candado de la barra.":"El navegador bloqueó las notificaciones. Tocá el candado en la barra de direcciones y permití notificaciones para este sitio.";case"NotSupportedError":return r?'Brave bloquea las notificaciones push por defecto. Activá "Google Services para push messaging" en brave://settings/privacy y reintentá.':"Tu navegador no soporta notificaciones push. Probá con Chrome, Edge o Safari 16.4+ en iOS.";case"AbortError":return"El sistema rechazó la suscripción. Verificá que las notificaciones de Windows estén activadas para tu navegador y reintentá.";case"InvalidStateError":return"Hay un estado previo de notificaciones que quedó inconsistente. Desactivá y volvé a activar las notificaciones en este device.";default:return t.message||"No se pudieron activar las notificaciones. Reintentá o probá con otro navegador."}}function nr(e,t,n){let r;const o=new Promise((s,i)=>{r=setTimeout(()=>{const l=new Error(n);l.name="TimeoutError",i(l)},t)});return Promise.race([e,o]).finally(()=>clearTimeout(r))}function la(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),o=new ArrayBuffer(r.length),s=new Uint8Array(o);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return o}function Hi(){const{token:e}=bt(),[t,n]=u.useState({status:"pendiente",cargando:!0,error:null}),r=u.useCallback(c=>$(null,null,function*(){var p,g,h,d;const f=c.toJSON(),b=(g=(p=f.keys)==null?void 0:p.p256dh)!=null?g:"",_=(d=(h=f.keys)==null?void 0:h.auth)!=null?d:"";if(!b||!_)return!1;try{return!!(yield(yield fetch(`${pt}/push_subscribe.php`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({endpoint:c.endpoint,p256dh:b,auth:_,user_agent:navigator.userAgent})})).json()).ok}catch(E){return!1}}),[e]),o=u.useCallback(()=>$(null,null,function*(){n(c=>re(J({},c),{cargando:!0,error:null}));
13try{if(!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)){n({status:"no-soportado",cargando:!1,error:null});return}if(Notification.permission==="denied"){n({status:"denegado",cargando:!1,error:null});return}if(Notification.permission==="default"){n({status:"pendiente",cargando:!1,error:null});return}const f=yield(yield navigator.serviceWorker.ready).pushManager.getSubscription();if(!f){n({status:"no-suscrito",cargando:!1,error:null});return}e&&(yield r(f)),n({status:"suscrito",cargando:!1,error:null})}catch(c){n({status:"no-soportado",cargando:!1,error:c.message})}}),[e,r]);u.useEffect(()=>{o()},[o]);const s=u.useCallback(()=>$(null,null,function*(){n(c=>re(J({},c),{cargando:!0,error:null}));try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return n({status:"no-soportado",cargando:!1,error:"Tu navegador no soporta notificaciones push"}),!1;const c=yield Notification.requestPermission();if(c!=="granted")return n({status:c==="denied"?"denegado":"pendiente",cargando:!1,error:null}),!1;const f=yield nr(navigator.serviceWorker.ready,1e4,"El navegador tardó demasiado en preparar las notificaciones. Recargá la página y reintentá."),_=yield(yield fetch(`${pt}/push_subscribe.php?action=public_key`)).json();if(!_.ok||!_.public_key)return n({status:"no-suscrito",cargando:!1,error:"No se pudo obtener la clave del servidor"}),!1;const p=yield nr(f.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:la(_.public_key)}),2e4,"El servicio de notificaciones no respondió. Reintentá; si sigue igual, probá con otro navegador.");return(yield r(p))?(n({status:"suscrito",cargando:!1,error:null}),!0):(n({status:"no-suscrito",cargando:!1,error:"No se pudo guardar la suscripción en el servidor"}),!1)}catch(c){return n({status:"no-suscrito",cargando:!1,error:ua(c)}),!1}}),[e,r]),i=u.useCallback(()=>$(null,null,function*(){try{const f=yield(yield navigator.serviceWorker.ready).pushManager.getSubscription();if(f){const b=new TextEncoder().encode(f.endpoint),_=yield crypto.subtle.digest("SHA-256",b),p=Array.from(new Uint8Array(_)).map(g=>g.toString(16).padStart(2,"0")).join("");yield fetch(`${pt}/push_subscribe.php?endpoint_hash=${p}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}}),yield f.unsubscribe()}return n({status:"no-suscrito",cargando:!1,error:null}),!0}catch(c){return n(f=>re(J({},f),{error:c.message})),!1}}),[e]),l=u.useCallback(()=>$(null,null,function*(){var c;try{const b=yield(yield fetch(`${pt}/push_test.php`,{method:"POST",headers:{Authorization:`Bearer ${e}`}})).json();return!!(b.ok&&((c=b.resultado)==null?void 0:c.enviados)>0)}catch(f){return!1}}),[e]);return{state:t,activar:s,desactivar:i,enviarPrueba:l,refrescar:o}}const Le="sp_autosave:",rn=10080*60*1e3;function rr(e){try{const t=localStorage.getItem(Le+e);if(!t)return null;const n=JSON.parse(t);return n&&typeof n=="object"&&typeof n.__sp_ts=="number"?Date.now()-n.__sp_ts>rn?(localStorage.removeItem(Le+e),null):n.data:(localStorage.removeItem(Le+e),null)}catch(t){return null}}function fa(e){try{const t=localStorage.getItem(Le+e);if(!t)return null;const n=JSON.parse(t);return n&&typeof n=="object"&&typeof n.__sp_ts=="number"?Date.now()-n.__sp_ts>rn?null:n.__sp_ts:null}catch(t){return null}}function gt(e,t){try{localStorage.setItem(Le+e,JSON.stringify({__sp_ts:Date.now(),data:t}))}catch(n){}}function Gt(e){try{localStorage.removeItem(Le+e)}catch(t){}}let or=!1;function da(){if(!or){or=!0;try{const e=[];for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(!(!n||!n.startsWith(Le)))try{const r=JSON.parse(localStorage.getItem(n)||"");(typeof(r==null?void 0:r.__sp_ts)!="number"||Date.now()-r.__sp_ts>rn)&&e.push(n)}catch(r){e.push(n)}}for(const t of e)localStorage.removeItem(t)}catch(e){}}}function ma(e){return typeof e=="object"&&e!==null&&"baseGuardada"in e}function Gi(e){const{key:t,data:n,onSave:r,intervalMs:o=3e4,enabled:s=!0,saveOnMount:i=!1,localOnly:l=!1,onDirtyChange:c}=e,[f,b]=u.useState("idle"),[_,p]=u.useState(null),[g,h]=u.useState(!1),d=u.useRef(!1),E=u.useRef(i?null:JSON.stringify(n)),y=u.useRef(!1),S=u.useRef(n);u.useEffect(()=>{S.current=n},[n]);const C=u.useRef(!1);u.useEffect(()=>{da(),C.current=rr(t)!==null},[]);const I=u.useCallback(()=>$(null,null,function*(){if(y.current||!s)return!1;const A=JSON.stringify(S.current);if(E.current===A)return!1;if(l)return gt(t,S.current),E.current=A,p(Date.now()),b("guardado"),!0;y.current=!0,b("guardando");try{const v=yield r(S.current);return E.current=ma(v)?JSON.stringify(v.baseGuardada):A,p(Date.now()),b("guardado"),Gt(t),!0}catch(v){return gt(t,S.current),b("error"),console.warn("[useAutosave] save falló, draft persistido en localStorage:",v),!1}finally{y.current=!1}}),[t,r,s,l]);return u.useEffect(()=>{if(!s)return;const A=setInterval(()=>{I()},o);return()=>clearInterval(A)},[s,o,I]),u.useEffect(()=>{const A=s&&E.current!==JSON.stringify(n);h(A),c==null||c(A)},[n,s,_,c]),u.useEffect(()=>{if(!s)return;const A=()=>{E.current!==JSON.stringify(S.current)&&gt(t,S.current)};return window.addEventListener("beforeunload",A),()=>{window.removeEventListener("beforeunload",A),E.current!==JSON.stringify(S.current)&&gt(t,S.current)}},[t,s]),{estado:f,ultimoGuardado:_,forzarGuardado:I,hayDraftLocal:C.current,restaurarLocal:()=>rr(t),descartarLocal:()=>Gt(t),tsDraftLocal:()=>fa(t),sincronizarBase:()=>{E.current=JSON.stringify(S.current),h(!1),c==null||c(!1)},marcarGuardado:A=>{E.current=JSON.stringify(A),p(Date.now()),b("guardado"),Gt(t)},fijarBase:A=>{E.current=JSON.stringify(A);const v=s&&E.current!==JSON.stringify(S.current);h(v),c==null||c(v)},hayCambios:g,hayCambiosAhora:()=>!d.current&&s&&E.current!==JSON.stringify(S.current),sinAviso:A=>{d.current=!0;try{A()}finally{d.current=!1}}}}function Zt(e,t){return Object.is(e,t)?!0:e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function qi(e,t){if(!t)return J({},e);const n={};
13for(const r of Object.keys(e))Zt(e[r],t[r])||(n[r]=e[r]);return n}function Vi(e,t,n,r,o){const s=J({},e);for(const i of Object.keys(n))Zt(e[i],t[i])&&(o&&!r.has(i)&&!Zt(t[i],o[i])||(s[i]=n[i]));return s}const Ji={nombre:150,descripcion_corta:300},pa="/api";function Yi(e,t,n){return $(this,null,function*(){try{const r=yield fetch(`${pa}/admin_seccion_config.php`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n!=null?n:""}`},body:JSON.stringify({seccion:e,eyebrow:t.trim()})}),o=yield r.json().catch(()=>({}));return r.ok&&o.success!==!1}catch(r){return!1}})}const _t="/api";let ga=0;const _a=()=>({_uid:"nueva-"+ ++ga,nombre:"",precio:"",activo:1});function Xi(e,t){const[n,r]=u.useState([]),[o,s]=u.useState([]),[i,l]=u.useState(null),c=u.useCallback(g=>$(null,null,function*(){var h;try{const E=yield(yield fetch(_t+"/admin_menu_envio_zonas.php",{headers:{Authorization:"Bearer "+g}})).json().catch(()=>null);if(!E||typeof E!="object"){l("No se pudo consultar las zonas de envío en este momento.");return}if(E.tabla_pendiente){l(String((h=E.aviso)!=null?h:""));return}l(null);const y=(Array.isArray(E.data)?E.data:[]).map(S=>{var C,I,A;return{id:S.id,_uid:"z"+S.id,nombre:String((C=S.nombre)!=null?C:""),precio:String((I=S.precio)!=null?I:0),activo:Number((A=S.activo)!=null?A:1)}});r(y),s(y)}catch(d){l("No se pudo consultar las zonas de envío en este momento.")}}),[]);u.useEffect(()=>{e&&c(e)},[e,c]);function f(g,h,d){r(E=>E.map(y=>y._uid===g?re(J({},y),{[h]:d}):y)),t==null||t()}function b(g){r(h=>h.filter(d=>d._uid!==g)),t==null||t()}function _(){r(g=>[...g,_a()]),t==null||t()}function p(g){return $(this,null,function*(){var y;if(i)return null;const h={"Content-Type":"application/json",Authorization:"Bearer "+g};let d=null;const E=n.filter(S=>S.nombre.trim()!=="");for(const S of o)S.id&&!E.some(C=>C.id===S.id)&&(yield fetch(`${_t}/admin_menu_envio_zonas.php?id=${S.id}`,{method:"DELETE",headers:h}));for(let S=0;S<E.length;S++){const C=E[S],I={nombre:C.nombre.trim(),precio:parseFloat(C.precio)||0,activo:C.activo,orden:S},A=o.find(O=>O.id===C.id);let v;if(!C.id)v=yield fetch(_t+"/admin_menu_envio_zonas.php",{method:"POST",headers:h,body:JSON.stringify(I)});else if(!A||A.nombre!==I.nombre||parseFloat(A.precio)!==I.precio||A.activo!==C.activo)v=yield fetch(`${_t}/admin_menu_envio_zonas.php?id=${C.id}`,{method:"PUT",headers:h,body:JSON.stringify(I)});else continue;const U=yield v.json().catch(()=>null);(!v.ok||!U||U.success!==!0)&&(d=d!=null?d:(y=U==null?void 0:U.error)!=null?y:`No se pudo guardar la zona «${I.nombre}»`)}return yield c(g),d})}return{zonas:n,pendienteDDL:i,cargarZonas:c,guardarZonas:p,tocarZona:f,quitarZona:b,agregarZona:_,cantidad:n.filter(g=>g.nombre.trim()!=="").length}}const ha=["failed to fetch","networkerror","load failed","network request failed","fetch failed","the internet connection appears to be offline"],ba="No se pudo conectar con el servidor. Revisá tu conexión y volvé a intentar.";function Ki(e,t=ba){if(!(e instanceof Error))return t;const n=(e.message||"").trim();if(!n)return t;const r=n.toLowerCase();return ha.some(o=>r.includes(o))?t:n}function Zi(e,t){function n(l){if(!l||l.length<7)return 0;const c=parseInt(l.slice(1,3),16)/255,f=parseInt(l.slice(3,5),16)/255,b=parseInt(l.slice(5,7),16)/255,_=p=>p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return .2126*_(c)+.7152*_(f)+.0722*_(b)}const r=n(e),o=n(t),s=Math.max(r,o),i=Math.min(r,o);return(s+.05)/(i+.05)}const Dr="/api",Qt=new Map,Sa=5e3,ya=3,Ea=15e3;function Aa(e,t){const n=t.split("?")[0];return`${e.toUpperCase()}:${n}`}const Ta="/auth_refresh.php",va=new Set(["/auth_refresh.php","/auth_me.php"]);let tt=null;function wa(){return $(this,null,function*(){return tt||(tt=$(null,null,function*(){try{const e=yield fetch(`${Dr}${Ta}`,{method:"POST",credentials:"include"});if(!e.ok)return!1;const t=yield e.json();if(t!=null&&t.token){try{localStorage.setItem("sp_token",t.token)}catch(n){}return!0}return!1}catch(e){return!1}finally{setTimeout(()=>{tt=null},0)}}),tt)})}function Ca(e){const t=Qt.get(e);return t&&Date.now()<t.bloqueadoHasta&&t.hits.length>0?t.hits[t.hits.length-1].result:null}function ar(e,t){var o;const n=Date.now(),r=(o=Qt.get(e))!=null?o:{hits:[],bloqueadoHasta:0};r.hits=r.hits.filter(s=>n-s.at<Sa),r.hits.push({at:n,result:t}),r.hits.length>=ya&&(r.bloqueadoHasta=n+Ea),Qt.set(e,r)}function Ia(){try{return localStorage.getItem("sp_token")}catch(e){return null}}function qt(e,t=240){return e.length<=t?e:e.slice(0,t-3)+"..."}function Qi(n){return $(this,arguments,function*(e,t={}){var d;const h=t,{noAuth:r,headers:o}=h,s=Cn(h,["noAuth","headers"]),i=e.startsWith("http")?e:`${Dr}${e.startsWith("/")?e:"/"+e}`,l=((d=s.method)!=null?d:"GET").toUpperCase(),c=Aa(l,e),f=e.split("?")[0],b=va.has(f);if(!b){const E=Ca(c);if(E)return E}function _(){return $(this,null,function*(){var O;const E={Accept:"application/json"};if(s.body&&!(s.body instanceof FormData)&&!(o!=null&&o["Content-Type"])&&(E["Content-Type"]="application/json"),!r){const k=Ia();k&&(E.Authorization=`Bearer ${k}`)}o&&Object.assign(E,o);let y;try{y=yield fetch(i,re(J({},s),{headers:E}))}catch(k){return{ok:!1,status:0,error:"Sin conexión con el servidor. Verificá tu red.",raw:k instanceof Error?k.message:String(k)}}const S=yield y.text(),C=y.status;let I=null,A=!1;if(S.trim().length>0)try{I=JSON.parse(S),A=!0}catch(k){A=!1}if(C>=400){if(A&&I&&typeof I=="object"){const V=I,q=V.error||V.mensaje||V.message;if(q){const F={ok:!1,status:C,error:q,data:V,raw:S};return(C===401||C===403)&&!b&&ar(c,F),F}}let k=`Error del servidor (HTTP ${C})`;if(S.length>0)if(S.includes("<")&&S.includes(">")){const V=S.match(/Parse error[^<\n]*|Fatal error[^<\n]*|Warning[^<\n]*/);V?k+=`
14PHP: ${V[0].trim()}`:k+=`
15Respuesta: ${qt(S.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())}`}else k+=`
16Respuesta: ${qt(S)}`;const M={ok:!1,status:C,error:k,raw:S};return(C===401||C===403)&&!b&&ar(c,M),M}if(!A)return{ok:!1,status:C,error:`El servidor respondió con un formato inesperado.
17Respuesta: ${qt(S)}`,raw:S};const v=I;if(((O=v.success)!=null?O:v.ok)===!1){const k=v.error||v.mensaje||v.message||"El servidor reportó un error sin detalle.";return{ok:!1,status:C,error:k,data:v,raw:S}}return{ok:!0,status:C,data:v,raw:S}})}const p=yield _(),g=f.startsWith("/auth_");return p.status===401&&!r&&!g&&(yield wa())?_():p})}const ir="/api",es=[{key:"clientes",titulo:"Clientes",descripcion:"Tu cartera completa con sus datos de contacto"},{key:"consultas",titulo:"Consultas CRM",descripcion:"Historial completo de consultas"},{key:"catalogo",titulo:"Catálogo",descripcion:"Todos tus productos y servicios"},{key:"portfolio",titulo:"Portfolio",descripcion:"Todos tus trabajos realizados"},{key:"blog",titulo:"Blog",descripcion:"Todos tus artículos publicados"},{key:"newsletter",titulo:"Newsletter",descripcion:"Suscriptores del newsletter"}];function Oa(e){return e==="newsletter"?`${ir}/newsletter.php?formato=csv`:`${ir}/admin_export.php?modulo=${encodeURIComponent(e)}`}function ka(e){const t=e.charCodeAt(0)===65279?e.slice(1):e;let n=0,r=!1,o=!1;for(let s=0;s<t.length;s++){const i=t[s];if(r){i==='"'&&(t[s+1]==='"'?s++:r=!1);continue}if(i==='"'){r=!0,o=!0;continue}if(i===`
18`){o&&n++,o=!1;continue}i!=="\r"&&(o=!0)}return o&&n++,Math.max(0,n-1)}
18function Ra(e,t,n){return $(this,null,function*(){var r;try{const o=yield fetch(e,{headers:t?{Authorization:`Bearer ${t}`}:{}});if(!o.ok){const _=yield o.text().catch(()=>"");return o.status===403&&_.includes("suscripcion")?{ok:!1,filas:0,error:"No se pudo descargar por el estado de tu suscripción. Escribinos y te lo enviamos: tus datos son tuyos."}:{ok:!1,filas:0,error:`No se pudo generar el archivo (error ${o.status}). Probá de nuevo en un momento.`}}const s=yield o.text(),i=ka(s),l=new Blob([s],{type:"text/csv;charset=utf-8;"}),c=window.URL.createObjectURL(l),f=document.createElement("a");f.href=c;const b=o.headers.get("content-disposition");return f.download=((r=b==null?void 0:b.split("filename=")[1])==null?void 0:r.replace(/"/g,"").trim())||n,document.body.appendChild(f),f.click(),f.remove(),window.URL.revokeObjectURL(c),{ok:!0,filas:i,error:""}}catch(o){return{ok:!1,filas:0,error:"No se pudo conectar con el servidor. Revisá tu conexión y probá de nuevo."}}})}function ts(e,t){return $(this,null,function*(){return Ra(Oa(e),t,`sentidopro_${e}.csv`)})}const Ve={profesional:"Profesional",departamento:"Departamento",especialidad:"Especialidad",profesional_plural:"Profesionales",departamento_plural:"Departamentos",especialidad_plural:"Especialidades"};function ns(){const{fullConfig:e}=ht(),t=e==null?void 0:e.config,n=(r,o)=>{const s=t==null?void 0:t["turnos_label_"+r];return typeof s=="string"&&s.trim()?s.trim():o};return{profesional:n("profesional",Ve.profesional),departamento:n("departamento",Ve.departamento),especialidad:n("especialidad",Ve.especialidad),profesional_plural:n("profesional_plural",Ve.profesional_plural),departamento_plural:n("departamento_plural",Ve.departamento_plural),especialidad_plural:n("especialidad_plural",Ve.especialidad_plural)}}function rs(e){const t=e.replace(/-/g,"");if(t.length!==11)return!1;const n=[5,4,3,2,7,6,5,4,3,2];let r=0;for(let i=0;i<10;i++)r+=parseInt(t[i])*n[i];const o=r%11;return(o===0?0:o===1?9:11-o)===parseInt(t[10])}function os(e){const t=e.replace(/\D/g,"").slice(0,11);return t.length<=2?t:t.length<=10?t.slice(0,2)+"-"+t.slice(2):t.slice(0,2)+"-"+t.slice(2,10)+"-"+t.slice(10,11)}const as=[{id:"profesional",nombre:"Profesional",rubro:"Contadores, abogados, consultoras",descripcion:"Sobrio y confiable. Transmite autoridad y seriedad corporativa.",colores:{primario:"#1E3A5F",acento:"#2563EB",fondo:"#FFFFFF",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#FFFFFF"},fuente:"Inter",heroEstilo:"oscuro",preview:{primario:"#1E3A5F",acento:"#2563EB",fondo:"#F8FAFC"}},{id:"salud",nombre:"Salud",rubro:"Médicos, psicólogos, nutricionistas",descripcion:"Limpio y sereno. Verde menta que transmite calma y bienestar.",colores:{primario:"#0D9488",acento:"#10B981",fondo:"#F0FDFA",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#FFFFFF"},fuente:"Inter",heroEstilo:"claro",preview:{primario:"#0D9488",acento:"#10B981",fondo:"#F0FDFA"}},{id:"belleza",nombre:"Belleza",rubro:"Estéticas, peluquerías, spa",descripcion:"Elegante y femenino. Rosa suave con toques dorados premium.",colores:{primario:"#831843",acento:"#D4A76A",fondo:"#FDF2F8",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#1A1A1A"},fuente:"DM Sans",heroEstilo:"oscuro",preview:{primario:"#831843",acento:"#D4A76A",fondo:"#FDF2F8"}},{id:"gastronomia",nombre:"Gastronomía",rubro:"Restaurantes, cafés, pastelerías",descripcion:"Cálido y apetitoso. Terracota con toques crema que abre el apetito.",colores:{primario:"#7C2D12",acento:"#DC2626",fondo:"#FFFBEB",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#FFFFFF"},fuente:"DM Sans",heroEstilo:"oscuro",preview:{primario:"#7C2D12",acento:"#DC2626",fondo:"#FFFBEB"}},{id:"turismo",nombre:"Turismo",rubro:"Hoteles, agencias, guías",descripcion:"Aspiracional y vibrante. Azul cielo con arena que evoca destinos.",colores:{primario:"#0C4A6E",acento:"#F59E0B",fondo:"#F0F9FF",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#1A1A1A"},fuente:"Plus Jakarta Sans",heroEstilo:"oscuro",preview:{primario:"#0C4A6E",acento:"#F59E0B",fondo:"#F0F9FF"}},{id:"educacion",nombre:"Educación",rubro:"Institutos, profesores, academias",descripcion:"Dinámico y accesible. Violeta con toques de energía amarilla.",colores:{primario:"#5B21B6",acento:"#EAB308",fondo:"#FAFAFA",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#1A1A1A"},fuente:"Nunito",heroEstilo:"oscuro",preview:{primario:"#5B21B6",acento:"#EAB308",fondo:"#FAFAFA"}},{id:"comercio",nombre:"Comercio",rubro:"Tiendas, mueblerías, productos",descripcion:"Moderno y premium. Negro con dorado que eleva cualquier producto.",colores:{primario:"#111111",acento:"#C9A84C",fondo:"#FFFFFF",texto_sobre_primario:"#FFFFFF",texto_sobre_acento:"#111111"},fuente:"Plus Jakarta Sans",heroEstilo:"oscuro",preview:{primario:"#111111",acento:"#C9A84C",fondo:"#F9FAFB"}}],sr="/api",is=(e,t)=>String(e).padStart(4,"0")+"-"+String(t).padStart(8,"0");function ss(e){const{token:t}=bt(),[n,r]=u.useState(null),[o,s]=u.useState(!0),[i,l]=u.useState(!1),[c,f]=u.useState(null),b=u.useCallback(()=>$(null,null,function*(){if(!t){s(!1);return}try{const g=yield(yield fetch(`${sr}
18/admin_facturar_pedido.php?pedido_id=${e}`,{headers:{Authorization:`Bearer ${t}`}})).json();g.success&&r(g)}catch(p){}finally{s(!1)}}),[t,e]);u.useEffect(()=>{b()},[b]);const _=u.useCallback(()=>$(null,null,function*(){if(!t)return!1;l(!0),f(null);try{const g=yield(yield fetch(`${sr}/admin_facturar_pedido.php?pedido_id=${e}`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})).json();return g.success?(yield b(),!0):(f(g.mensaje||g.error||"ARCA no autorizó el comprobante."),!1)}catch(p){return f("No se pudo conectar con el servidor."),!1}finally{l(!1)}}),[t,e,b]);return{estado:n,cargando:o,facturando:i,error:c,facturar:_,recargar:b}}const Na=["salida","venta","venta_mostrador","transferencia_salida","reserva"];function cs(e){const t=e.stock_antes,n=e.stock_despues;if(t!==null&&n!==null&&Number.isFinite(t)&&Number.isFinite(n)){const r=n-t;if(r!==0)return r>0?1:-1;if(e.cantidad!==0)return 0}return Na.includes(e.tipo)||e.cantidad<0?-1:1}export{is as $,ji as A,Xi as B,to as C,Ki as D,Ma as E,$a as F,Zi as G,Qi as H,ce as I,ts as J,Mi as K,Ji as L,es as M,ea as N,ns as O,rs as P,os as Q,Ii as R,Oi as S,as as T,At as U,Ri as V,Ra as W,Li as X,Di as Y,ss as Z,Za as _,Ka as a,ta as a0,Tr as a1,bi as a2,Si as a3,hi as a4,Ei as a5,Zn as a6,Zo as a7,yi as a8,ki as a9,za as aA,gi as aB,_i as aC,Ci as aD,Va as aE,oi as aF,uo as aG,Ha as aH,Wa as aI,eo as aJ,le as aK,qa as aL,Pi as aM,$i as aN,Bi as aO,cs as aa,zi as ab,xi as ac,Wi as ad,ja as ae,Xa as af,Kr as ag,no as ah,ei as ai,ti as aj,Ba as ak,ni as al,ai as am,Ja as an,Ya as ao,ri as ap,Ua as aq,ci as ar,ui as as,pi as at,mi as au,Ga as av,Ti as aw,wi as ax,vi as ay,ra as az,li as b,vr as c,Ai as d,Ar as e,oa as f,bt as g,ca as h,fi as i,Hi as j,ii as k,ht as l,Ni as m,Fi as n,di as o,wr as p,Gi as q,qi as r,Qa as s,Ui as t,si as u,Vi as v,ur as w,Fa as x,xa as y,Yi as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.