tempest-react-sdk 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("react"),be=require("react-dom"),je=require("@tanstack/react-query"),at=require("zustand"),Se=require("zustand/middleware"),ct=require("dexie"),lt=require("react-hook-form");function y(...e){const t=[];for(const n of e)if(!(n==null||n===!1||n===!0)){if(typeof n=="string")n&&t.push(n);else if(typeof n=="number"||typeof n=="bigint")t.push(String(n));else if(Array.isArray(n)){const r=y(...n);r&&t.push(r)}}return t.join(" ")}const ut="tempest_alert_7cYyI",dt="tempest_content_UXnmZ",pt="tempest_title_abGgF",ft="tempest_description_pXPvw",mt="tempest_icon_Zg6SB",ht="tempest_close_narep",_t="tempest_neutral_J7MH1",gt="tempest_solid_s-oW5",yt="tempest_outline_v7w9b",bt="tempest_info_9r3r1",wt="tempest_success_1bzoB",xt="tempest_warning_q-j1Q",vt="tempest_danger_CiZkW",M={alert:ut,content:dt,title:pt,description:ft,icon:mt,close:ht,neutral:_t,solid:gt,outline:yt,info:bt,success:wt,warning:xt,danger:vt};function jt({variant:e="info",appearance:t="soft",title:n,description:r,icon:s,onClose:o,closeLabel:i="Dismiss",className:l,children:c,...d}){return a.jsxs("div",{role:"alert",className:y(M.alert,M[e],t==="solid"&&M.solid,t==="outline"&&M.outline,l),...d,children:[s&&a.jsx("span",{className:M.icon,children:s}),a.jsxs("div",{className:M.content,children:[n&&a.jsx("p",{className:M.title,children:n}),r&&a.jsx("p",{className:M.description,children:r}),c]}),o&&a.jsx("button",{type:"button",className:M.close,onClick:o,"aria-label":i,children:a.jsx(St,{})})]})}function St(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:a.jsx("path",{d:"M6 6l12 12M18 6L6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const kt="tempest_avatar_3xMuZ",$t="tempest_image_ieqGp",Et="tempest_xs_oSaLL",Nt="tempest_sm_sZ2bk",Ct="tempest_md_Fdkbz",Tt="tempest_lg_pTTUA",It="tempest_xl_mW58F",Lt="tempest_status_ISBnL",Pt="tempest_dot_Wgfo-",Rt="tempest_online_-aWoW",Dt="tempest_offline_-StX3",Mt="tempest_busy_TbwuF",K={avatar:kt,image:$t,xs:Et,sm:Nt,md:Ct,lg:Tt,xl:It,status:Lt,dot:Pt,online:Rt,offline:Dt,busy:Mt};function Ft(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2):`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`}function At({src:e,alt:t,name:n="",size:r="md",status:s,className:o,onClick:i}){const[l,c]=u.useState(!1),d=u.useMemo(()=>Ft(n),[n]),p=e&&!l,f=i?"button":void 0,m=i?0:void 0;return a.jsxs("span",{className:y(K.avatar,K[r],s&&K.status,o),role:f,tabIndex:m,onClick:i,onKeyDown:i?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),i())}:void 0,children:[p?a.jsx("img",{src:e,alt:t??n,className:K.image,onError:()=>c(!0)}):a.jsx("span",{"aria-label":t??n,children:d}),s&&a.jsx("span",{className:y(K.dot,K[s]),"aria-hidden":!0})]})}const Wt="tempest_badge_RsuMz",Ot="tempest_sm_LYsCn",Bt="tempest_md_4Or8q",zt="tempest_lg_Bseje",qt="tempest_square_l63D-",Ut="tempest_neutral_lulSm",Jt="tempest_solid_0Leug",Gt="tempest_outline_x06HL",Ht="tempest_success_u9JiS",Kt="tempest_warning_nsGp-",Vt="tempest_danger_PD2hz",Qt="tempest_info_na6DQ",Zt="tempest_primary_S0WCS",Yt="tempest_dot_i0c-G",J={badge:Wt,sm:Ot,md:Bt,lg:zt,square:qt,neutral:Ut,solid:Jt,outline:Gt,success:Ht,warning:Kt,danger:Vt,info:Qt,primary:Zt,dot:Yt};function Xt({variant:e="neutral",appearance:t="soft",size:n="md",shape:r="pill",dot:s=!1,className:o,children:i,...l}){return a.jsxs("span",{className:y(J.badge,J[e],t==="solid"&&J.solid,t==="outline"&&J.outline,J[n],r==="square"&&J.square,o),...l,children:[s&&a.jsx("span",{className:J.dot,"aria-hidden":!0}),i]})}const en="tempest_nav_H4g6P",tn="tempest_item_O4g3P",nn="tempest_link_7WM67",rn="tempest_current_JdlcS",sn="tempest_separator_zGWyJ",Y={nav:en,item:tn,link:nn,current:rn,separator:sn};function on({items:e,separator:t="/",className:n}){return a.jsx("nav",{"aria-label":"breadcrumb",className:y(Y.nav,n),children:e.map((r,s)=>{const o=s===e.length-1,i=!o&&(r.href||r.onClick);return a.jsxs(u.Fragment,{children:[a.jsx("span",{className:Y.item,children:i?a.jsx("a",{href:r.href,onClick:l=>{r.onClick&&(l.preventDefault(),r.onClick())},className:Y.link,children:r.label}):a.jsx("span",{"aria-current":o?"page":void 0,className:o?Y.current:void 0,children:r.label})}),!o&&a.jsx("span",{className:Y.separator,"aria-hidden":!0,children:t})]},s)})})}const an="tempest_button_2ZuB7",cn="tempest_primary_s1sM6",ln="tempest_secondary_R0waJ",un="tempest_danger_V4fX8",dn="tempest_success_w6qB6",pn="tempest_ghost_1KINV",fn="tempest_soft_c3kzm",mn="tempest_outline_F5jq-",hn="tempest_link_Zt5hw",_n="tempest_xs_cF6m0",gn="tempest_sm_NhG0g",yn="tempest_md_hH4h3",bn="tempest_lg_2plQf",wn="tempest_xl_nx4V0",xn="tempest_iconOnly_WCpTS",vn="tempest_pill_lx8lt",jn="tempest_fullWidth_36oJT",Sn="tempest_loading_EQAt2",kn="tempest_hiddenText_hIiJ2",$n="tempest_spinner_ZExvW",En="tempest_tempest-spin_UOSVC",F={button:an,primary:cn,secondary:ln,danger:un,success:dn,ghost:pn,soft:fn,outline:mn,link:hn,xs:_n,sm:gn,md:yn,lg:bn,xl:wn,iconOnly:xn,pill:vn,fullWidth:jn,loading:Sn,hiddenText:kn,spinner:$n,tempestSpin:En};function oe({variant:e="primary",size:t="md",loading:n=!1,fullWidth:r=!1,iconOnly:s=!1,pill:o=!1,leftIcon:i,rightIcon:l,disabled:c,className:d,children:p,...f}){return a.jsxs("button",{className:y(F.button,F[e],F[t],s&&F.iconOnly,o&&F.pill,n&&F.loading,r&&F.fullWidth,d),disabled:c||n,...f,children:[n&&a.jsx("span",{className:F.spinner,"aria-hidden":!0,children:a.jsx(Nn,{})}),a.jsxs("span",{className:y(n&&F.hiddenText),children:[i,p,l]})]})}function Nn(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Cn="tempest_card_Cb1o4",Tn="tempest_flat_LRpce",In="tempest_raised_WmIqk",Ln="tempest_elevated_5VEDw",Pn="tempest_interactive_B8Tah",Rn="tempest_padded_oOxwN",Dn="tempest_flush_aiDZi",Mn="tempest_header_PTXf2",Fn="tempest_title_mSgoo",An="tempest_body_W441Z",Wn="tempest_footer_Mu-JC",P={card:Cn,flat:Tn,raised:In,elevated:Ln,interactive:Pn,padded:Rn,flush:Dn,header:Mn,title:Fn,body:An,footer:Wn};function On({title:e,actions:t,footer:n,flush:r=!1,interactive:s=!1,elevation:o="default",className:i,children:l,...c}){const d=!!(e||t);return a.jsxs("div",{className:y(P.card,o==="flat"&&P.flat,o==="raised"&&P.raised,o==="elevated"&&P.elevated,s&&P.interactive,!d&&!r&&P.padded,r&&P.flush,i),tabIndex:s?c.tabIndex??0:c.tabIndex,...c,children:[d&&a.jsxs("header",{className:P.header,children:[typeof e=="string"?a.jsx("h3",{className:P.title,children:e}):e,t]}),d?a.jsx("div",{className:P.body,children:l}):l,n&&a.jsx("footer",{className:P.footer,children:n})]})}const Bn="tempest_wrapper_rpthW",zn="tempest_disabled_x7-eg",qn="tempest_input_2kt-h",Un="tempest_box_OCPee",Jn="tempest_labelWrap_Ktbp0",Gn="tempest_label_cwRtI",Hn="tempest_description_rMhG1",G={wrapper:Bn,disabled:zn,input:qn,box:Un,labelWrap:Jn,label:Gn,description:Hn},Kn=u.forwardRef(function({label:t,description:n,indeterminate:r,disabled:s,wrapperClassName:o,className:i,...l},c){const d=u.useRef(null);u.useEffect(()=>{d.current&&(d.current.indeterminate=!!r)},[r]);function p(f){d.current=f,typeof c=="function"?c(f):c&&(c.current=f)}return a.jsxs("label",{className:y(G.wrapper,s&&G.disabled,o),children:[a.jsx("input",{ref:p,type:"checkbox",disabled:s,className:y(G.input,i),...l}),a.jsx("span",{className:G.box,"aria-hidden":!0,children:r?a.jsx(Qn,{}):a.jsx(Vn,{})}),(t||n)&&a.jsxs("span",{className:G.labelWrap,children:[t&&a.jsx("span",{className:G.label,children:t}),n&&a.jsx("span",{className:G.description,children:n})]})]})});function Vn(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qn(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})}const Zn="tempest_wrapper_KR4-F",Yn="tempest_label_Mz-wX",Xn="tempest_field_iIBJw",er="tempest_error_O9n-9",tr="tempest_chip_GEwrc",nr="tempest_remove_JYDIq",rr="tempest_input_frJmk",sr="tempest_helper_Yts53",or="tempest_errorText_llJGq",A={wrapper:Zn,label:Yn,field:Xn,error:er,chip:tr,remove:nr,input:rr,helper:sr,errorText:or};function ir({value:e,onChange:t,label:n,placeholder:r="Adicionar e pressionar Enter…",helperText:s,error:o,commitKeys:i=["Enter",",","Tab"],normalize:l=!0,className:c}){const[d,p]=u.useState(""),f=u.useRef(null);function m(){const h=l?d.trim().toLowerCase():d.trim();if(h){if(e.includes(h)){p("");return}t([...e,h]),p("")}}function _(h){if(i.includes(h.key)){h.preventDefault(),m();return}h.key==="Backspace"&&!d&&e.length>0&&t(e.slice(0,-1))}function g(h){const w=e.slice();w.splice(h,1),t(w)}return a.jsxs("div",{className:y(A.wrapper,o&&A.error,c),children:[n&&a.jsx("label",{className:A.label,children:n}),a.jsxs("div",{className:A.field,onClick:()=>f.current?.focus(),children:[e.map((h,w)=>a.jsxs("span",{className:A.chip,children:[h,a.jsx("button",{type:"button",className:A.remove,"aria-label":`Remover ${h}`,onClick:()=>g(w),children:"×"})]},`${h}-${w}`)),a.jsx("input",{ref:f,className:A.input,value:d,placeholder:e.length===0?r:"",onChange:h=>p(h.target.value),onKeyDown:_,onBlur:m})]}),o?a.jsx("span",{className:A.errorText,children:o}):s?a.jsx("span",{className:A.helper,children:s}):null]})}const ar="tempest_overlay_dd9h1",cr="tempest_tempest-fade-in_DvgSp",lr="tempest_dialog_ptM-K",ur="tempest_tempest-modal-in_UoxQC",dr="tempest_sm_K5k3W",pr="tempest_md_gvyR7",fr="tempest_lg_BgB1a",mr="tempest_xl_MR-68",hr="tempest_header_ILG9i",_r="tempest_title_A5OeE",gr="tempest_close_-ER1C",yr="tempest_body_lVhql",br="tempest_footer_rro2w",z={overlay:ar,tempestFadeIn:cr,dialog:lr,tempestModalIn:ur,sm:dr,md:pr,lg:fr,xl:mr,header:hr,title:_r,close:gr,body:yr,footer:br};function Pe({open:e,onClose:t,title:n,children:r,footer:s,size:o="md",closeOnBackdrop:i=!0,closeOnEsc:l=!0,className:c,hideCloseButton:d=!1}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:be.createPortal(a.jsx("div",{className:z.overlay,role:"presentation",onClick:()=>{i&&t()},children:a.jsxs("div",{role:"dialog","aria-modal":"true",className:y(z.dialog,z[o],c),onClick:p=>p.stopPropagation(),children:[(n||!d)&&a.jsxs("header",{className:z.header,children:[a.jsx("h3",{className:z.title,children:n}),!d&&a.jsx("button",{type:"button",className:z.close,"aria-label":"Fechar",onClick:t,children:a.jsx(wr,{})})]}),a.jsx("div",{className:z.body,children:r}),s&&a.jsx("footer",{className:z.footer,children:s})]})}),document.body)}function wr(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function xr({open:e,title:t,description:n,confirmLabel:r="Confirmar",cancelLabel:s="Cancelar",variant:o="primary",loading:i=!1,onConfirm:l,onCancel:c}){return a.jsx(Pe,{open:e,onClose:c,title:t,size:"sm",footer:a.jsxs(a.Fragment,{children:[a.jsx(oe,{variant:"secondary",onClick:c,disabled:i,children:s}),a.jsx(oe,{variant:o,loading:i,onClick:()=>{l()},children:r})]}),children:n})}const vr="tempest_wrapper_iHNUs",jr="tempest_label_-OEBL",Sr="tempest_required_CTss-",kr="tempest_field_65yGJ",$r="tempest_input_WjT81",Er="tempest_sizeSm_cgds6",Nr="tempest_sizeMd_EPFGy",Cr="tempest_sizeLg_5Cq8k",Tr="tempest_hasLeftIcon_xYO-v",Ir="tempest_hasRightIcon_C7uyr",Lr="tempest_iconLeft_KrUhI",Pr="tempest_iconRight_Ssr47",Rr="tempest_error_VLISa",Dr="tempest_helper_7Vc-s",Mr="tempest_errorText_xz4xS",k={wrapper:vr,label:jr,required:Sr,field:kr,input:$r,sizeSm:Er,sizeMd:Nr,sizeLg:Cr,hasLeftIcon:Tr,hasRightIcon:Ir,iconLeft:Lr,iconRight:Pr,error:Rr,helper:Dr,errorText:Mr},ie=u.forwardRef(function({label:t,helperText:n,error:r,leftIcon:s,rightIcon:o,wrapperClassName:i,className:l,id:c,required:d,size:p="md",...f},m){const _=u.useId(),g=c??_,h=r?`${g}-error`:n?`${g}-helper`:void 0,w=p==="sm"?k.sizeSm:p==="lg"?k.sizeLg:k.sizeMd;return a.jsxs("div",{className:y(k.wrapper,r&&k.error,i),children:[t&&a.jsxs("label",{htmlFor:g,className:k.label,children:[t,d&&a.jsx("span",{className:k.required,children:"*"})]}),a.jsxs("div",{className:k.field,children:[s&&a.jsx("span",{className:k.iconLeft,children:s}),a.jsx("input",{ref:m,id:g,"aria-invalid":!!r,"aria-describedby":h,required:d,className:y(k.input,w,s&&k.hasLeftIcon,o&&k.hasRightIcon,l),...f}),o&&a.jsx("span",{className:k.iconRight,children:o})]}),r?a.jsx("span",{id:`${g}-error`,className:k.errorText,children:r}):n?a.jsx("span",{id:`${g}-helper`,className:k.helper,children:n}):null]})}),Fr=u.forwardRef(function({value:t,onChange:n,mode:r="date",...s},o){return a.jsx(ie,{...s,ref:o,type:r,value:t,onChange:i=>n(i.target.value)})}),Ar="tempest_divider_KSGsi",Wr="tempest_horizontal_pZ05Y",Or="tempest_bare_elDbS",Br="tempest_vertical_p-jD4",zr="tempest_dashed_JWxCU",qr="tempest_alignStart_QAIi1",Ur="tempest_alignEnd_eZDwa",I={divider:Ar,horizontal:Wr,bare:Or,vertical:Br,dashed:zr,alignStart:qr,alignEnd:Ur};function Jr({orientation:e="horizontal",variant:t="solid",label:n,align:r="center",className:s,...o}){return e==="vertical"?a.jsx("span",{role:"separator","aria-orientation":"vertical",className:y(I.divider,I.vertical,t==="dashed"&&I.dashed,s),...o}):n?a.jsx("div",{role:"separator","aria-orientation":"horizontal",className:y(I.divider,I.horizontal,t==="dashed"&&I.dashed,r==="start"&&I.alignStart,r==="end"&&I.alignEnd,s),...o,children:n}):a.jsx("hr",{className:y(I.divider,I.horizontal,I.bare,t==="dashed"&&I.dashed,s)})}const Gr="tempest_overlay_hcG1G",Hr="tempest_tempest-drawer-overlay_XFbxY",Kr="tempest_panel_wUX0N",Vr="tempest_right_-oX-6",Qr="tempest_tempest-drawer-in-right_pWYHv",Zr="tempest_left_xi3nD",Yr="tempest_tempest-drawer-in-left_o7JSb",Xr="tempest_top_7rGCn",es="tempest_tempest-drawer-in-top_kn6AF",ts="tempest_bottom_zd-25",ns="tempest_tempest-drawer-in-bottom_0x3u7",rs="tempest_header_sYoP1",ss="tempest_title_LqUOu",os="tempest_close_tYPhU",is="tempest_body_aV9FG",as="tempest_footer_AuvUP",q={overlay:Gr,tempestDrawerOverlay:Hr,panel:Kr,right:Vr,tempestDrawerInRight:Qr,left:Zr,tempestDrawerInLeft:Yr,top:Xr,tempestDrawerInTop:es,bottom:ts,tempestDrawerInBottom:ns,header:rs,title:ss,close:os,body:is,footer:as};function cs({open:e,onClose:t,placement:n="right",title:r,children:s,footer:o,closeOnBackdrop:i=!0,closeOnEsc:l=!0,hideCloseButton:c=!1,className:d}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:be.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:q.overlay,onClick:()=>{i&&t()}}),a.jsxs("aside",{role:"dialog","aria-modal":"true",className:y(q.panel,q[n],d),children:[(r||!c)&&a.jsxs("header",{className:q.header,children:[a.jsx("h3",{className:q.title,children:r}),!c&&a.jsx("button",{type:"button","aria-label":"Fechar",className:q.close,onClick:t,children:a.jsx(ls,{})})]}),a.jsx("div",{className:q.body,children:s}),o&&a.jsx("footer",{className:q.footer,children:o})]})]}),document.body)}function ls(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const us="tempest_wrapper_gzyTd",ds="tempest_icon_qVCyh",ps="tempest_title_xPfUf",fs="tempest_description_oWwH1",ms="tempest_action_dqxw1",X={wrapper:us,icon:ds,title:ps,description:fs,action:ms};function hs({icon:e,title:t,description:n,action:r,className:s}){return a.jsxs("div",{className:y(X.wrapper,s),children:[e&&a.jsx("div",{className:X.icon,children:e}),a.jsx("h4",{className:X.title,children:t}),n&&a.jsx("p",{className:X.description,children:n}),r&&a.jsx("div",{className:X.action,children:r})]})}const _s="tempest_wrapper_luRyF",gs="tempest_icon_dEdBl",ys="tempest_title_StutD",bs="tempest_description_A2XCb",ws="tempest_action_vm1LC",ee={wrapper:_s,icon:gs,title:ys,description:bs,action:ws};function xs({title:e="Algo deu errado",description:t="Não foi possível carregar essas informações.",onRetry:n,retryLabel:r="Tentar novamente",icon:s,className:o}){return a.jsxs("div",{className:y(ee.wrapper,o),children:[a.jsx("div",{className:ee.icon,children:s??a.jsx(vs,{})}),a.jsx("h4",{className:ee.title,children:e}),t&&a.jsx("p",{className:ee.description,children:t}),n&&a.jsx("div",{className:ee.action,children:a.jsx(oe,{variant:"secondary",onClick:n,children:r})})]})}function vs(){return a.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const js="tempest_wrapper_E0qHs",Ss="tempest_label_lbMkx",ks="tempest_dropzone_jqua0",$s="tempest_active_CG9Uk",Es="tempest_disabled_WNUUl",Ns="tempest_icon_i9fGH",Cs="tempest_title_bTVFl",Ts="tempest_subtitle_S54OV",Is="tempest_files_WljYm",Ls="tempest_file_Lp-dR",Ps="tempest_fileMeta_LTnN2",Rs="tempest_remove_jskra",Ds="tempest_hidden_ReEq6",C={wrapper:js,label:Ss,dropzone:ks,active:$s,disabled:Es,icon:Ns,title:Cs,subtitle:Ts,files:Is,file:Ls,fileMeta:Ps,remove:Rs,hidden:Ds};function Ms(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Fs(e,t){if(!t)return!0;const n=t.split(",").map(o=>o.trim().toLowerCase()),r=e.name.toLowerCase(),s=e.type.toLowerCase();return n.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?s.startsWith(o.replace("/*","/")):s===o)}function As({value:e,onChange:t,label:n,accept:r,multiple:s=!1,maxSize:o,onReject:i,disabled:l,title:c="Arraste arquivos aqui ou clique para selecionar",subtitle:d,className:p}){const[f,m]=u.useState(!1),_=u.useRef(null);function g(b){const x=[],v=[];for(const N of Array.from(b)){if(!Fs(N,r)){v.push({file:N,reason:"type"});continue}if(o&&N.size>o){v.push({file:N,reason:"size"});continue}x.push(N)}if(v.length>0&&i?.(v),x.length===0)return;const $=s?[...e,...x]:x.slice(0,1);t($)}function h(b){b.preventDefault(),m(!1),!l&&b.dataTransfer?.files&&g(b.dataTransfer.files)}function w(b){const x=e.slice();x.splice(b,1),t(x)}return a.jsxs("div",{className:y(C.wrapper,p),children:[n&&a.jsx("label",{className:C.label,children:n}),a.jsxs("div",{className:y(C.dropzone,f&&C.active,l&&C.disabled),role:"button",tabIndex:l?-1:0,onClick:()=>!l&&_.current?.click(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),_.current?.click())},onDragEnter:b=>{b.preventDefault(),l||m(!0)},onDragOver:b=>b.preventDefault(),onDragLeave:()=>m(!1),onDrop:h,children:[a.jsx("div",{className:C.icon,"aria-hidden":!0,children:a.jsx(Ws,{})}),a.jsx("p",{className:C.title,children:c}),d&&a.jsx("p",{className:C.subtitle,children:d}),a.jsx("input",{ref:_,type:"file",accept:r,multiple:s,disabled:l,className:C.hidden,onChange:b=>{b.target.files&&g(b.target.files),b.target.value=""}})]}),e.length>0&&a.jsx("ul",{className:C.files,children:e.map((b,x)=>a.jsxs("li",{className:C.file,children:[a.jsxs("div",{children:[a.jsx("div",{children:b.name}),a.jsx("div",{className:C.fileMeta,children:Ms(b.size)})]}),a.jsx("button",{type:"button","aria-label":`Remover ${b.name}`,className:C.remove,onClick:()=>w(x),children:"×"})]},`${b.name}-${x}`))})]})}function Ws(){return a.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Os="tempest_form_jNBDR",Bs="tempest_stack_O1Hl-",zs="tempest_inline_LBQAv",qs="tempest_grid_-B86T",Us="tempest_section_HGqw3",Js="tempest_sectionHeader_ji9hQ",Gs="tempest_sectionTitle_GTPwe",Hs="tempest_sectionDescription_KjW7k",Ks="tempest_sectionBody_Vp2wz",Vs="tempest_row_1EkVR",Qs="tempest_actions_hK95I",Zs="tempest_start_gXnm3",Ys="tempest_center_mKkz4",Xs="tempest_end_O3yDQ",eo="tempest_between_tte2z",D={form:Os,stack:Bs,inline:zs,grid:qs,section:Us,sectionHeader:Js,sectionTitle:Gs,sectionDescription:Hs,sectionBody:Ks,row:Vs,actions:Qs,start:Zs,center:Ys,end:Xs,between:eo};function ae(e,t){return e===void 0?`${t*4}px`:typeof e=="number"?`${e*4}px`:e}function Re(e){return e===void 0?"repeat(2, minmax(0, 1fr))":typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e}const to=u.forwardRef(function({layout:t="stack",columns:n,gap:r,className:s,style:o,children:i,...l},c){const d={gap:ae(r,4),...t==="grid"?{gridTemplateColumns:Re(n)}:null,...o};return a.jsx("form",{ref:c,className:y(D.form,D[t],s),style:d,...l,children:i})});function no({title:e,description:t,layout:n="stack",columns:r,gap:s,className:o,style:i,children:l,...c}){const d={gap:ae(s,4),...n==="grid"?{gridTemplateColumns:Re(r)}:null};return a.jsxs("section",{className:y(D.section,o),style:i,...c,children:[(e||t)&&a.jsxs("header",{className:D.sectionHeader,children:[e&&a.jsx("h3",{className:D.sectionTitle,children:e}),t&&a.jsx("p",{className:D.sectionDescription,children:t})]}),a.jsx("div",{className:y(D.sectionBody,D[n]),style:d,children:l})]})}function ro({gap:e,className:t,style:n,children:r,...s}){const o={gap:ae(e,3),...n};return a.jsx("div",{className:y(D.row,t),style:o,...s,children:r})}function so({align:e="end",gap:t,className:n,style:r,children:s,...o}){const i={gap:ae(t,2),...r};return a.jsx("div",{className:y(D.actions,D[e],n),style:i,...o,children:s})}const oo="tempest_container_fJfOt",io="tempest_sm_k8D4-",ao="tempest_md_EnpYy",co="tempest_lg_UU-Ig",lo="tempest_xl_2TEWj",uo="tempest_full_l8bvG",po="tempest_stack_sxR8u",fo="tempest_vertical_2TMf5",mo="tempest_horizontal_r7-c-",ho="tempest_center_EDSAh",_o="tempest_start_ucQ-K",go="tempest_end_pnKlF",yo="tempest_stretch_pX6l7",bo="tempest_justifyStart_lHYsS",wo="tempest_justifyCenter_JH2m6",xo="tempest_justifyEnd_EBisT",vo="tempest_justifyBetween_mAJwT",jo="tempest_wrap_-xxOh",So="tempest_grid_o-JIX",L={container:oo,sm:io,md:ao,lg:co,xl:lo,full:uo,stack:po,vertical:fo,horizontal:mo,center:ho,start:_o,end:go,stretch:yo,justifyStart:bo,justifyCenter:wo,justifyEnd:xo,justifyBetween:vo,wrap:jo,grid:So};function ko({size:e="lg",className:t,children:n,...r}){return a.jsx("div",{className:y(L.container,L[e],t),...r,children:n})}function $o({direction:e="vertical",gap:t=2,align:n,justify:r,wrap:s=!1,className:o,style:i,children:l,...c}){const p={gap:typeof t=="number"?`${t*4}px`:t,...i},f=r==="between"?L.justifyBetween:r==="center"?L.justifyCenter:r==="end"?L.justifyEnd:r==="start"?L.justifyStart:void 0;return a.jsx("div",{className:y(L.stack,e==="vertical"?L.vertical:L.horizontal,n&&L[n],f,s&&L.wrap,o),style:p,...c,children:l})}function Eo({columns:e=2,gap:t=4,className:n,style:r,children:s,...o}){const i=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e,l=typeof t=="number"?`${t*4}px`:t;return a.jsx("div",{className:y(L.grid,n),style:{gridTemplateColumns:i,gap:l,...r},...o,children:s})}const No="tempest_kbd_jgbYx",Co="tempest_sm_9WPWA",To="tempest_md_BePC0",Io="tempest_lg_cBKum",ke={kbd:No,sm:Co,md:To,lg:Io};function Lo({size:e="md",className:t,children:n,...r}){return a.jsx("kbd",{className:y(ke.kbd,ke[e],t),...r,children:n})}const Po="tempest_wrapper_cRGQm",Ro="tempest_controls_fdL-y",Do="tempest_page_WjG0l",Mo="tempest_active_1kqsJ",Fo="tempest_ellipsis_V294k",Ao="tempest_sizeSelect_ZayTo",U={wrapper:Po,controls:Ro,page:Do,active:Mo,ellipsis:Fo,sizeSelect:Ao};function Wo(e,t,n){const r=n+4;if(t<=r)return Array.from({length:t},(l,c)=>c+1);const s=Math.max(2,e-Math.floor(n/2)),o=Math.min(t-1,s+n-1),i=[1];s>2&&i.push("...");for(let l=s;l<=o;l++)i.push(l);return o<t-1&&i.push("..."),i.push(t),i}function Oo({page:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:s,pageSizeOptions:o=[10,25,50,100],totalItems:i,siblingCount:l=3,className:c}){const d=u.useMemo(()=>Wo(e,t,l),[e,t,l]);return t<=1&&!s?null:a.jsxs("div",{className:y(U.wrapper,c),children:[a.jsx("div",{children:typeof i=="number"?`${i} resultado${i===1?"":"s"}`:null}),a.jsxs("div",{className:U.controls,children:[a.jsx("button",{type:"button",className:U.page,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,"aria-label":"Página anterior",children:"‹"}),d.map((p,f)=>p==="..."?a.jsx("span",{className:U.ellipsis,children:"…"},`ellipsis-${f}`):a.jsx("button",{type:"button",className:y(U.page,p===e&&U.active),onClick:()=>n(p),"aria-current":p===e?"page":void 0,children:p},p)),a.jsx("button",{type:"button",className:U.page,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,"aria-label":"Próxima página",children:"›"}),s&&a.jsx("select",{className:U.sizeSelect,value:r,onChange:p=>s(Number(p.target.value)),"aria-label":"Itens por página",children:o.map(p=>a.jsxs("option",{value:p,children:[p," / página"]},p))})]})]})}const Bo="tempest_wrapper_BQek1",zo="tempest_bar_uC-0x",qo="tempest_fill_vmg7x",Uo="tempest_success_gWJ8U",Jo="tempest_warning_DGkPO",Go="tempest_danger_gfwHh",Ho="tempest_indeterminate_HojUj",Ko="tempest_tempest-progress-loop_0nEdF",Vo="tempest_label_qqHJM",V={wrapper:Bo,bar:zo,fill:qo,success:Uo,warning:Jo,danger:Go,indeterminate:Ho,tempestProgressLoop:Ko,label:Vo};function Qo({value:e=0,max:t=100,variant:n="primary",indeterminate:r=!1,showLabel:s=!1,label:o,className:i}){const l=r?0:Math.max(0,Math.min(100,e/t*100));return a.jsxs("div",{className:y(V.wrapper,i),children:[(s||o)&&a.jsxs("div",{className:V.label,children:[o&&a.jsx("span",{children:o}),s&&!r&&a.jsxs("span",{children:[Math.round(l),"%"]})]}),a.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":r?void 0:e,className:y(V.bar,r&&V.indeterminate),children:a.jsx("div",{className:y(V.fill,n!=="primary"&&V[n]),style:{width:r?void 0:`${l}%`}})})]})}const Zo="tempest_wrapper_P-gFm",Yo="tempest_disabled_0-cna",Xo="tempest_input_7R8ZN",ei="tempest_dot_P7ejP",ti="tempest_labelWrap_iQ1HR",ni="tempest_label_vAFIP",ri="tempest_description_bEB8u",si="tempest_group_oi329",oi="tempest_horizontal_1Ovgu",B={wrapper:Zo,disabled:Yo,input:Xo,dot:ei,labelWrap:ti,label:ni,description:ri,group:si,horizontal:oi},De=u.createContext(null),ii=u.forwardRef(function({label:t,description:n,value:r,disabled:s,name:o,checked:i,onChange:l,wrapperClassName:c,className:d,...p},f){const m=u.useContext(De),_=m?.name??o,g=m?.disabled??s,h=m?m.value===r:i;function w(b){m&&m.onChange?.(r),l?.(b)}return a.jsxs("label",{className:y(B.wrapper,g&&B.disabled,c),children:[a.jsx("input",{ref:f,type:"radio",name:_,value:r,checked:h,disabled:g,onChange:w,className:y(B.input,d),...p}),a.jsx("span",{className:B.dot,"aria-hidden":!0}),(t||n)&&a.jsxs("span",{className:B.labelWrap,children:[t&&a.jsx("span",{className:B.label,children:t}),n&&a.jsx("span",{className:B.description,children:n})]})]})});function ai({value:e,defaultValue:t,onChange:n,name:r,disabled:s,horizontal:o=!1,className:i,children:l}){const c=u.useId(),d=r??c,[p,f]=u.useState(t),m=e!==void 0,_=m?e:p;function g(h){m||f(h),n?.(h)}return a.jsx(De.Provider,{value:{name:d,value:_,onChange:g,disabled:s},children:a.jsx("div",{role:"radiogroup",className:y(B.group,o&&B.horizontal,i),children:l})})}const ci="tempest_wrapper_dKXJJ",li="tempest_input_m0lPc",ui="tempest_iconLeft_030-U",di="tempest_clear_nb6lG",se={wrapper:ci,input:li,iconLeft:ui,clear:di},pi=u.forwardRef(function({value:t,onChange:n,onClear:r,wrapperClassName:s,placeholder:o="Buscar...",className:i,...l},c){function d(){n(""),r?.()}return a.jsxs("div",{className:y(se.wrapper,s),children:[a.jsx("span",{className:se.iconLeft,"aria-hidden":!0,children:a.jsx(fi,{})}),a.jsx("input",{ref:c,type:"search",value:t,onChange:p=>n(p.target.value),placeholder:o,className:y(se.input,i),...l}),t&&a.jsx("button",{type:"button",className:se.clear,"aria-label":"Limpar busca",onClick:d,children:a.jsx(mi,{})})]})});function fi(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{cx:"11",cy:"11",r:"7",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function mi(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const hi="tempest_wrapper_KS2K3",_i="tempest_label_Lmgos",gi="tempest_required_PvDVJ",yi="tempest_field_h-wBy",bi="tempest_select_cjdcr",wi="tempest_caret_MdCao",xi="tempest_error_sw9MU",vi="tempest_helper_frosK",ji="tempest_errorText_-zd6i",W={wrapper:hi,label:_i,required:gi,field:yi,select:bi,caret:wi,error:xi,helper:vi,errorText:ji},Si=u.forwardRef(function({label:t,helperText:n,error:r,options:s,placeholder:o,wrapperClassName:i,className:l,children:c,id:d,required:p,...f},m){const _=u.useId(),g=d??_;return a.jsxs("div",{className:y(W.wrapper,r&&W.error,i),children:[t&&a.jsxs("label",{htmlFor:g,className:W.label,children:[t,p&&a.jsx("span",{className:W.required,children:"*"})]}),a.jsxs("div",{className:W.field,children:[a.jsxs("select",{ref:m,id:g,"aria-invalid":!!r,required:p,className:y(W.select,l),...f,children:[o&&a.jsx("option",{value:"",disabled:!0,hidden:!0,children:o}),s?.map(h=>a.jsx("option",{value:h.value,disabled:h.disabled,children:h.label},h.value)),c]}),a.jsx("span",{className:W.caret,"aria-hidden":!0,children:a.jsx(ki,{})})]}),r?a.jsx("span",{className:W.errorText,children:r}):n?a.jsx("span",{className:W.helper,children:n}):null]})});function ki(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 9l6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const $i="tempest_skeleton_CB4uF",Ei="tempest_text_-A8IF",Ni="tempest_circle_DYcl8",pe={skeleton:$i,text:Ei,circle:Ni};function Ci({variant:e="rect",width:t,height:n,className:r,style:s}){return a.jsx("span",{"aria-hidden":!0,className:y(pe.skeleton,e==="text"&&pe.text,e==="circle"&&pe.circle,r),style:{width:t,height:n,...s}})}const Ti="tempest_spinner_GpFZS",Ii="tempest_tempest-spinner_wKVCY",Li="tempest_xs_p8BFI",Pi="tempest_sm_3sIoD",Ri="tempest_md_M2sPj",Di="tempest_lg_IxTw2",Mi="tempest_xl_cgwqq",$e={spinner:Ti,tempestSpinner:Ii,xs:Li,sm:Pi,md:Ri,lg:Di,xl:Mi};function Fi({size:e="md",className:t,label:n="Carregando"}){return a.jsx("span",{role:"status","aria-label":n,className:y($e.spinner,$e[e],t)})}const Ai="tempest_stepper_w3qjQ",Wi="tempest_vertical_d4mOs",Oi="tempest_step_s2nqL",Bi="tempest_dot_d1bSL",zi="tempest_completed_gcFHM",qi="tempest_active_kL-CH",Ui="tempest_label_8irAI",Ji="tempest_connector_lyeWp",O={stepper:Ai,vertical:Wi,step:Oi,dot:Bi,completed:zi,active:qi,label:Ui,connector:Ji};function Gi({steps:e,current:t,orientation:n="horizontal",className:r}){return a.jsx("ol",{className:y(O.stepper,n==="vertical"&&O.vertical,r),children:e.map((s,o)=>{const i=o<t,l=o===t;return a.jsxs(u.Fragment,{children:[a.jsxs("li",{className:y(O.step,i&&O.completed,l&&O.active),"aria-current":l?"step":void 0,children:[a.jsx("span",{className:O.dot,children:i?"✓":o+1}),a.jsx("span",{className:O.label,children:s.label})]}),o<e.length-1&&a.jsx("span",{className:y(O.connector,i&&O.completed),"aria-hidden":!0})]},o)})})}const Hi="tempest_wrapper_kudO9",Ki="tempest_disabled_2aZ0V",Vi="tempest_input_5BPNu",Qi="tempest_track_7ObdZ",Zi="tempest_thumb_-FTeK",Yi="tempest_label_LrH7V",Q={wrapper:Hi,disabled:Ki,input:Vi,track:Qi,thumb:Zi,label:Yi},Xi=u.forwardRef(function({label:t,disabled:n,wrapperClassName:r,className:s,...o},i){return a.jsxs("label",{className:y(Q.wrapper,n&&Q.disabled,r),children:[a.jsx("input",{ref:i,type:"checkbox",role:"switch",disabled:n,className:y(Q.input,s),...o}),a.jsx("span",{className:Q.track,"aria-hidden":!0,children:a.jsx("span",{className:Q.thumb})}),t&&a.jsx("span",{className:Q.label,children:t})]})}),ea="tempest_scroll_unrJp",ta="tempest_table_Dkosn",na="tempest_th_PNuEx",ra="tempest_td_jv9tA",sa="tempest_tr_7UG8J",oa="tempest_clickable_B6Si-",ia="tempest_alignRight_9hY0G",aa="tempest_alignCenter_YiUQy",ca="tempest_emptyRow_kdMiv",R={scroll:ea,table:ta,th:na,td:ra,tr:sa,clickable:oa,alignRight:ia,alignCenter:aa,emptyRow:ca};function la({columns:e,data:t,rowKey:n,onRowClick:r,emptyMessage:s="Nenhum registro encontrado.",className:o}){return a.jsx("div",{className:y(R.scroll,o),children:a.jsxs("table",{className:R.table,children:[a.jsx("thead",{children:a.jsx("tr",{children:e.map(i=>a.jsx("th",{className:y(R.th,i.align==="right"&&R.alignRight,i.align==="center"&&R.alignCenter),style:{width:i.width},children:i.header},i.key))})}),a.jsx("tbody",{children:t.length===0?a.jsx("tr",{children:a.jsx("td",{className:R.emptyRow,colSpan:e.length,children:s})}):t.map((i,l)=>a.jsx("tr",{className:y(R.tr,r&&R.clickable),onClick:r?()=>r(i):void 0,children:e.map(c=>{const d=c.render?c.render(i,l):i[c.key];return a.jsx("td",{className:y(R.td,c.align==="right"&&R.alignRight,c.align==="center"&&R.alignCenter,c.className),children:d},c.key)})},n(i,l)))})]})})}const ua="tempest_tablist_WR6ag",da="tempest_tab_IdDYc",pa="tempest_active_PTNtG",fa="tempest_panel_08i9c",ma="tempest_pill_lGuqn",te={tablist:ua,tab:da,active:pa,panel:fa,pill:ma};function ha({items:e,defaultId:t,activeId:n,onChange:r,variant:s="underline",className:o}){const i=e.find(_=>!_.disabled),[l,c]=u.useState(t??i?.id),d=n!==void 0,p=d?n:l,f=e.find(_=>_.id===p)??i;function m(_){d||c(_),r?.(_)}return a.jsxs("div",{className:o,children:[a.jsx("div",{role:"tablist",className:y(te.tablist,s==="pill"&&te.pill),children:e.map(_=>{const g=_.id===f?.id;return a.jsx("button",{type:"button",role:"tab","aria-selected":g,"aria-controls":`panel-${_.id}`,id:`tab-${_.id}`,disabled:_.disabled,className:y(te.tab,g&&te.active),onClick:()=>m(_.id),children:_.label},_.id)})}),f&&a.jsx("div",{role:"tabpanel",id:`panel-${f.id}`,"aria-labelledby":`tab-${f.id}`,className:te.panel,children:f.content})]})}const _a="tempest_wrapper_C0gfg",ga="tempest_label_cWLXP",ya="tempest_required_rDZXE",ba="tempest_textarea_Z-y6g",wa="tempest_error_NWC9f",xa="tempest_helper_gedut",va="tempest_errorText_ey07q",H={wrapper:_a,label:ga,required:ya,textarea:ba,error:wa,helper:xa,errorText:va},ja=u.forwardRef(function({label:t,helperText:n,error:r,wrapperClassName:s,className:o,id:i,required:l,...c},d){const p=u.useId(),f=i??p;return a.jsxs("div",{className:y(H.wrapper,r&&H.error,s),children:[t&&a.jsxs("label",{htmlFor:f,className:H.label,children:[t,l&&a.jsx("span",{className:H.required,children:"*"})]}),a.jsx("textarea",{ref:d,id:f,"aria-invalid":!!r,required:l,className:y(H.textarea,o),...c}),r?a.jsx("span",{className:H.errorText,children:r}):n?a.jsx("span",{className:H.helper,children:n}):null]})}),Sa="tempest_trigger_Dmc5E",ka="tempest_bubble_TPGHB",$a="tempest_tempest-tooltip-in_csYeZ",Ea="tempest_top_m2tnn",Na="tempest_bottom_9Twz4",Ca="tempest_left_UPdrG",Ta="tempest_right_CV--T",fe={trigger:Sa,bubble:ka,tempestTooltipIn:$a,top:Ea,bottom:Na,left:Ca,right:Ta};function Ia({content:e,placement:t="top",children:n,disabled:r=!1,openDelay:s=150}){const[o,i]=u.useState(!1),l=u.useId();let c=null;function d(){r||(c&&clearTimeout(c),c=setTimeout(()=>i(!0),s))}function p(){c&&(clearTimeout(c),c=null),i(!1)}const f=u.cloneElement(n,{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p,"aria-describedby":o?l:void 0});return a.jsxs("span",{className:fe.trigger,children:[f,o&&a.jsx("span",{id:l,role:"tooltip",className:y(fe.bubble,fe[t]),children:e})]})}const La="tempest_container_x4-Qm",Pa="tempest_toast_FLdHz",Ra="tempest_tempest-toast-in_E2d-A",Da="tempest_success_Oy694",Ma="tempest_warning_84GC8",Fa="tempest_error_hrQAA",Aa="tempest_info_eq5bQ",Wa="tempest_title_-H6R2",Oa="tempest_description_-QwfC",Ba="tempest_close_i10-s",Z={container:La,toast:Pa,tempestToastIn:Ra,success:Da,warning:Ma,error:Fa,info:Aa,title:Wa,description:Oa,close:Ba},Me=u.createContext(null);function za(){const e=u.useContext(Me);if(!e)throw new Error("useToast must be used inside a <ToastProvider>");return e}function qa({children:e,defaultDuration:t=4e3}){const[n,r]=u.useState([]),s=u.useRef(0),o=u.useCallback(c=>{r(d=>d.filter(p=>p.id!==c))},[]),i=u.useCallback(c=>{const d=c.id??`toast-${++s.current}`,p={id:d,title:c.title,description:c.description,variant:c.variant??"info",duration:c.duration??t};return r(f=>[...f,p]),d},[t]),l=u.useMemo(()=>({show:i,dismiss:o,success:(c,d)=>i({...d,description:c,variant:"success"}),error:(c,d)=>i({...d,description:c,variant:"error"}),warning:(c,d)=>i({...d,description:c,variant:"warning"}),info:(c,d)=>i({...d,description:c,variant:"info"})}),[i,o]);return a.jsxs(Me.Provider,{value:l,children:[e,a.jsx(Ua,{toasts:n,onDismiss:o})]})}function Ua({toasts:e,onDismiss:t}){return typeof document>"u"?null:be.createPortal(a.jsx("div",{className:Z.container,"aria-live":"polite","aria-atomic":"true",children:e.map(n=>a.jsx(Ja,{toast:n,onDismiss:t},n.id))}),document.body)}function Ja({toast:e,onDismiss:t}){return u.useEffect(()=>{if(!e.duration)return;const n=setTimeout(()=>t(e.id),e.duration);return()=>clearTimeout(n)},[e.id,e.duration,t]),a.jsxs("div",{className:y(Z.toast,Z[e.variant]),role:"status",children:[a.jsxs("div",{children:[e.title&&a.jsx("p",{className:Z.title,children:e.title}),e.description&&a.jsx("p",{className:Z.description,children:e.description})]}),a.jsx("button",{type:"button",className:Z.close,"aria-label":"Fechar notificação",onClick:()=>t(e.id),children:a.jsx(Ga,{})})]})}function Ga(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Ha="tempest_scroll_8Giwl",Ka="tempest_spacer_P3Pvl",Va="tempest_row_Ff0VU",me={scroll:Ha,spacer:Ka,row:Va};function Qa({items:e,itemHeight:t,renderItem:n,height:r,overscan:s=4,getKey:o,className:i,style:l}){const c=u.useRef(null),[d,p]=u.useState(0),[f,m]=u.useState(0);u.useEffect(()=>{const b=c.current;if(!b||(m(b.clientHeight),typeof ResizeObserver>"u"))return;const x=new ResizeObserver(()=>m(b.clientHeight));return x.observe(b),()=>x.disconnect()},[]);const _=e.length*t,g=Math.max(0,Math.floor(d/t)-s),h=Math.ceil(f/t)+s*2,w=Math.min(e.length,g+h);return a.jsx("div",{ref:c,className:y(me.scroll,i),style:{height:r,...l},onScroll:b=>p(b.target.scrollTop),role:"list",children:a.jsx("div",{className:me.spacer,style:{height:_},children:e.slice(g,w).map((b,x)=>{const v=g+x,$=o?o(b,v):v;return a.jsx("div",{role:"listitem",className:me.row,style:{top:v*t,height:t},children:n(b,v)},$)})})})}function Za(e,t=300){const[n,r]=u.useState(e);return u.useEffect(()=>{const s=setTimeout(()=>r(e),t);return()=>clearTimeout(s)},[e,t]),n}function Ya(e=1,t=50){const[n,r]=u.useState(e),[s,o]=u.useState(t),i=u.useCallback(()=>r(1),[]);return{page:n,size:s,setPage:r,setSize:o,reset:i}}function Xa(e,t,n){return u.useMemo(()=>{const r=t.trim().toLowerCase();return r?typeof n=="function"?e.filter(s=>n(s,r)):e.filter(s=>n.some(o=>{const i=s[o];return i!=null&&String(i).toLowerCase().includes(r)})):e},[e,t,n])}function ec(e){const[t,n]=u.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return u.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(e),s=o=>n(o.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function tc(){const[e,t]=u.useState(()=>typeof navigator>"u"?!0:navigator.onLine);return u.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n),window.addEventListener("offline",r),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}},[]),e}function nc(){const[e,t]=u.useState(()=>typeof document>"u"?"visible":document.visibilityState);return u.useEffect(()=>{if(typeof document>"u")return;const n=()=>t(document.visibilityState);return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e}function rc(e,t={}){const[n,r]=u.useState(null),{once:s=!1,root:o,rootMargin:i,threshold:l}=t;return u.useEffect(()=>{const c=e.current;if(!c||typeof IntersectionObserver>"u")return;const d=new IntersectionObserver(([p])=>{p&&(r(p),s&&p.isIntersecting&&d.unobserve(c))},{root:o,rootMargin:i,threshold:l});return d.observe(c),()=>d.disconnect()},[e,s,o,i,l]),n}function sc(e){const[t,n]=u.useState(null);return u.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=new ResizeObserver(o=>{const i=o[0];if(!i)return;const l=i.contentRect;n({width:l.width,height:l.height})});return s.observe(r),()=>s.disconnect()},[e]),t}function oc(e={}){const{resetAfter:t=1500}=e,[n,r]=u.useState(!1),s=u.useRef(null),o=u.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r(!1)},[]);u.useEffect(()=>()=>o(),[o]);const i=u.useCallback(async l=>{try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)await navigator.clipboard.writeText(l);else if(typeof document<"u"){const c=document.createElement("textarea");c.value=l,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c)}else return!1;return r(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>r(!1),t),!0}catch{return!1}},[t]);return{copied:n,copy:i,reset:o}}function ic(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;const n=!!t.ctrl,r=!!t.meta,s=!!t.shift,o=!!t.alt;if(t.mod){if(!e.ctrlKey&&!e.metaKey)return!1}else if(e.ctrlKey!==n||e.metaKey!==r)return!1;return!(e.shiftKey!==s||e.altKey!==o)}function ac(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"?!0:e.isContentEditable}function cc(e,t,n={}){const{disabled:r=!1,ignoreInput:s=!0}=n;u.useEffect(()=>{if(r||typeof window>"u")return;const o=i=>{s&&ac(i.target)||ic(i,e)&&t(i)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r,s,e.key,e.ctrl,e.meta,e.shift,e.alt,e.mod,t])}function lc(){const[e,t]=u.useState(null),[n,r]=u.useState(!1);u.useEffect(()=>{if(typeof window>"u")return;const o=l=>{l.preventDefault(),t(l)},i=()=>{t(null),r(!0)};return window.addEventListener("beforeinstallprompt",o),window.addEventListener("appinstalled",i),()=>{window.removeEventListener("beforeinstallprompt",o),window.removeEventListener("appinstalled",i)}},[]);const s=u.useCallback(async()=>{if(!e)return"unsupported";await e.prompt();const o=await e.userChoice;return t(null),o.outcome==="accepted"&&r(!0),o.outcome},[e]);return{installable:!!e,installed:n,prompt:s}}const Ee=["mousemove","mousedown","keydown","touchstart","wheel","scroll"];function uc(e=6e4){const[t,n]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;let r=setTimeout(()=>n(!0),e);function s(){n(!1),clearTimeout(r),r=setTimeout(()=>n(!0),e)}for(const o of Ee)window.addEventListener(o,s,{passive:!0});return()=>{clearTimeout(r);for(const o of Ee)window.removeEventListener(o,s)}},[e]),t}function dc(e={}){const{watch:t=!1,disabled:n=!1,...r}=e,[s,o]=u.useState({loading:!n,error:null,coords:null,timestamp:null});return u.useEffect(()=>{if(n||typeof navigator>"u"||!navigator.geolocation){o(c=>({...c,loading:!1}));return}const i=c=>{o({loading:!1,error:null,coords:c.coords,timestamp:c.timestamp})},l=c=>{o(d=>({...d,loading:!1,error:c}))};if(t){const c=navigator.geolocation.watchPosition(i,l,r);return()=>navigator.geolocation.clearWatch(c)}navigator.geolocation.getCurrentPosition(i,l,r)},[n,t,r.enableHighAccuracy,r.maximumAge,r.timeout]),s}function pc(e){u.useEffect(()=>{if(!e||typeof document>"u")return;const t=document.body,n=t.style.overflow;return t.style.overflow="hidden",()=>{t.style.overflow=n}},[e])}const fc=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function mc(e,t){u.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement;function s(){return Array.from(n?.querySelectorAll(fc)??[]).filter(l=>{if(l.hasAttribute("aria-hidden"))return!1;const c=typeof window<"u"?window.getComputedStyle(l):null;return!(c&&(c.display==="none"||c.visibility==="hidden"))})}function o(l){if(l.key!=="Tab")return;const c=s();if(c.length===0){l.preventDefault();return}const d=c[0],p=c[c.length-1],f=document.activeElement;l.shiftKey?(f===d||!f||!n?.contains(f))&&(l.preventDefault(),p.focus()):f===p&&(l.preventDefault(),d.focus())}return s()[0]?.focus(),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),r?.focus?.()}},[e,t])}function hc(e){const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>t.current(...n),[])}function ge(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>ge(s,t[o]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>ge(e[s],t[s]))}function _c(e){const t=u.useRef(e);return ge(t.current,e)||(t.current=e),t.current}function gc(e,t,n){const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(n)for(const[s,o]of Object.entries(n))o!=null&&r.searchParams.set(s,String(o));return r.toString()}function yc(e){return typeof FormData<"u"&&e instanceof FormData}async function Ne(e){let t=null;try{t=await e.clone().json()}catch{try{t=await e.text()}catch{t=null}}const n=(typeof t=="object"&&t!==null?t.detail??t.message:void 0)??`Erro ${e.status}`;return{status:e.status,detail:String(n),body:t}}function bc(e){const t=e.fetcher??globalThis.fetch.bind(globalThis);function n(){const i=e.getToken?.();return i?{Authorization:`Bearer ${i}`}:{}}async function r(i,l){const{body:c,params:d,headers:p,...f}=l,m=yc(c),_={...m?{}:{"Content-Type":"application/json"},...e.headers,...n(),...p},g={...f,headers:_,credentials:e.withCredentials?"include":f.credentials,body:c==null?void 0:m?c:JSON.stringify(c)};return t(gc(e.baseURL,i,d),g)}async function s(i,l={}){let c=await r(i,l);if(c.status===401)if(e.refresh)try{await e.refresh(),c=await r(i,l)}catch{throw await e.onUnauthorized?.(c),await Ne(c)}else await e.onUnauthorized?.(c);if(!c.ok)throw await Ne(c);return c.status===204?void 0:(c.headers.get("content-type")??"").includes("application/json")?await c.json():await c.text()}async function o(i,l,c="POST"){return s(i,{method:c,body:l})}return{request:s,get:(i,l)=>s(i,{...l,method:"GET"}),post:(i,l)=>s(i,{...l,method:"POST"}),put:(i,l)=>s(i,{...l,method:"PUT"}),patch:(i,l)=>s(i,{...l,method:"PATCH"}),delete:(i,l)=>s(i,{...l,method:"DELETE"}),upload:o}}function wc(e,t,n){const r=e.safeParse(t);if(r.success)return r.data;if(typeof process<"u"&&(process.env?.NODE_ENV==="development"||process.env?.NODE_ENV==="test")){const o=r.error.issues.map(i=>` - ${i.path.join(".")||"<root>"}: ${i.message}`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("react"),ve=require("react-dom"),$e=require("@tanstack/react-query"),mt=require("zustand"),Ne=require("zustand/middleware"),ht=require("dexie"),_t=require("react-hook-form");function b(...e){const t=[];for(const n of e)if(!(n==null||n===!1||n===!0)){if(typeof n=="string")n&&t.push(n);else if(typeof n=="number"||typeof n=="bigint")t.push(String(n));else if(Array.isArray(n)){const r=b(...n);r&&t.push(r)}}return t.join(" ")}const gt="tempest_alert_7cYyI",bt="tempest_content_UXnmZ",yt="tempest_title_abGgF",wt="tempest_description_pXPvw",xt="tempest_icon_Zg6SB",vt="tempest_close_narep",jt="tempest_neutral_J7MH1",kt="tempest_solid_s-oW5",St="tempest_outline_v7w9b",$t="tempest_info_9r3r1",Nt="tempest_success_1bzoB",Et="tempest_warning_q-j1Q",Ct="tempest_danger_CiZkW",B={alert:gt,content:bt,title:yt,description:wt,icon:xt,close:vt,neutral:jt,solid:kt,outline:St,info:$t,success:Nt,warning:Et,danger:Ct};function Tt({variant:e="info",appearance:t="soft",title:n,description:r,icon:s,onClose:o,closeLabel:a="Dismiss",className:c,children:l,...d}){return i.jsxs("div",{role:"alert",className:b(B.alert,B[e],t==="solid"&&B.solid,t==="outline"&&B.outline,c),...d,children:[s&&i.jsx("span",{className:B.icon,children:s}),i.jsxs("div",{className:B.content,children:[n&&i.jsx("p",{className:B.title,children:n}),r&&i.jsx("p",{className:B.description,children:r}),l]}),o&&i.jsx("button",{type:"button",className:B.close,onClick:o,"aria-label":a,children:i.jsx(It,{})})]})}function It(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:i.jsx("path",{d:"M6 6l12 12M18 6L6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Lt="tempest_avatar_3xMuZ",Rt="tempest_image_ieqGp",Pt="tempest_xs_oSaLL",Dt="tempest_sm_sZ2bk",Mt="tempest_md_Fdkbz",At="tempest_lg_pTTUA",Ft="tempest_xl_mW58F",Bt="tempest_status_ISBnL",Wt="tempest_dot_Wgfo-",Ot="tempest_online_-aWoW",zt="tempest_offline_-StX3",qt="tempest_busy_TbwuF",V={avatar:Lt,image:Rt,xs:Pt,sm:Dt,md:Mt,lg:At,xl:Ft,status:Bt,dot:Wt,online:Ot,offline:zt,busy:qt};function Ut(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2):`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`}function Gt({src:e,alt:t,name:n="",size:r="md",status:s,className:o,onClick:a}){const[c,l]=u.useState(!1),d=u.useMemo(()=>Ut(n),[n]),p=e&&!c,f=a?"button":void 0,m=a?0:void 0;return i.jsxs("span",{className:b(V.avatar,V[r],s&&V.status,o),role:f,tabIndex:m,onClick:a,onKeyDown:a?h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),a())}:void 0,children:[p?i.jsx("img",{src:e,alt:t??n,className:V.image,onError:()=>l(!0)}):i.jsx("span",{"aria-label":t??n,children:d}),s&&i.jsx("span",{className:b(V.dot,V[s]),"aria-hidden":!0})]})}const Ht="tempest_badge_RsuMz",Jt="tempest_sm_LYsCn",Kt="tempest_md_4Or8q",Vt="tempest_lg_Bseje",Qt="tempest_square_l63D-",Zt="tempest_neutral_lulSm",Xt="tempest_solid_0Leug",Yt="tempest_outline_x06HL",en="tempest_success_u9JiS",tn="tempest_warning_nsGp-",nn="tempest_danger_PD2hz",rn="tempest_info_na6DQ",sn="tempest_primary_S0WCS",on="tempest_dot_i0c-G",H={badge:Ht,sm:Jt,md:Kt,lg:Vt,square:Qt,neutral:Zt,solid:Xt,outline:Yt,success:en,warning:tn,danger:nn,info:rn,primary:sn,dot:on};function an({variant:e="neutral",appearance:t="soft",size:n="md",shape:r="pill",dot:s=!1,className:o,children:a,...c}){return i.jsxs("span",{className:b(H.badge,H[e],t==="solid"&&H.solid,t==="outline"&&H.outline,H[n],r==="square"&&H.square,o),...c,children:[s&&i.jsx("span",{className:H.dot,"aria-hidden":!0}),a]})}const cn="tempest_nav_H4g6P",ln="tempest_item_O4g3P",un="tempest_link_7WM67",dn="tempest_current_JdlcS",pn="tempest_separator_zGWyJ",Y={nav:cn,item:ln,link:un,current:dn,separator:pn};function fn({items:e,separator:t="/",className:n}){return i.jsx("nav",{"aria-label":"breadcrumb",className:b(Y.nav,n),children:e.map((r,s)=>{const o=s===e.length-1,a=!o&&(r.href||r.onClick);return i.jsxs(u.Fragment,{children:[i.jsx("span",{className:Y.item,children:a?i.jsx("a",{href:r.href,onClick:c=>{r.onClick&&(c.preventDefault(),r.onClick())},className:Y.link,children:r.label}):i.jsx("span",{"aria-current":o?"page":void 0,className:o?Y.current:void 0,children:r.label})}),!o&&i.jsx("span",{className:Y.separator,"aria-hidden":!0,children:t})]},s)})})}const mn="tempest_button_2ZuB7",hn="tempest_primary_s1sM6",_n="tempest_secondary_R0waJ",gn="tempest_danger_V4fX8",bn="tempest_success_w6qB6",yn="tempest_ghost_1KINV",wn="tempest_soft_c3kzm",xn="tempest_outline_F5jq-",vn="tempest_link_Zt5hw",jn="tempest_xs_cF6m0",kn="tempest_sm_NhG0g",Sn="tempest_md_hH4h3",$n="tempest_lg_2plQf",Nn="tempest_xl_nx4V0",En="tempest_iconOnly_WCpTS",Cn="tempest_pill_lx8lt",Tn="tempest_fullWidth_36oJT",In="tempest_loading_EQAt2",Ln="tempest_hiddenText_hIiJ2",Rn="tempest_spinner_ZExvW",Pn="tempest_tempest-spin_UOSVC",W={button:mn,primary:hn,secondary:_n,danger:gn,success:bn,ghost:yn,soft:wn,outline:xn,link:vn,xs:jn,sm:kn,md:Sn,lg:$n,xl:Nn,iconOnly:En,pill:Cn,fullWidth:Tn,loading:In,hiddenText:Ln,spinner:Rn,tempestSpin:Pn};function ie({variant:e="primary",size:t="md",loading:n=!1,fullWidth:r=!1,iconOnly:s=!1,pill:o=!1,leftIcon:a,rightIcon:c,disabled:l,className:d,children:p,...f}){return i.jsxs("button",{className:b(W.button,W[e],W[t],s&&W.iconOnly,o&&W.pill,n&&W.loading,r&&W.fullWidth,d),disabled:l||n,...f,children:[n&&i.jsx("span",{className:W.spinner,"aria-hidden":!0,children:i.jsx(Dn,{})}),i.jsxs("span",{className:b(n&&W.hiddenText),children:[a,p,c]})]})}function Dn(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Mn="tempest_card_Cb1o4",An="tempest_flat_LRpce",Fn="tempest_raised_WmIqk",Bn="tempest_elevated_5VEDw",Wn="tempest_interactive_B8Tah",On="tempest_padded_oOxwN",zn="tempest_flush_aiDZi",qn="tempest_header_PTXf2",Un="tempest_title_mSgoo",Gn="tempest_body_W441Z",Hn="tempest_footer_Mu-JC",M={card:Mn,flat:An,raised:Fn,elevated:Bn,interactive:Wn,padded:On,flush:zn,header:qn,title:Un,body:Gn,footer:Hn};function Jn({title:e,actions:t,footer:n,flush:r=!1,interactive:s=!1,elevation:o="default",className:a,children:c,...l}){const d=!!(e||t);return i.jsxs("div",{className:b(M.card,o==="flat"&&M.flat,o==="raised"&&M.raised,o==="elevated"&&M.elevated,s&&M.interactive,!d&&!r&&M.padded,r&&M.flush,a),tabIndex:s?l.tabIndex??0:l.tabIndex,...l,children:[d&&i.jsxs("header",{className:M.header,children:[typeof e=="string"?i.jsx("h3",{className:M.title,children:e}):e,t]}),d?i.jsx("div",{className:M.body,children:c}):c,n&&i.jsx("footer",{className:M.footer,children:n})]})}const Kn="tempest_wrapper_rpthW",Vn="tempest_disabled_x7-eg",Qn="tempest_input_2kt-h",Zn="tempest_box_OCPee",Xn="tempest_labelWrap_Ktbp0",Yn="tempest_label_cwRtI",er="tempest_description_rMhG1",J={wrapper:Kn,disabled:Vn,input:Qn,box:Zn,labelWrap:Xn,label:Yn,description:er},tr=u.forwardRef(function({label:t,description:n,indeterminate:r,disabled:s,wrapperClassName:o,className:a,...c},l){const d=u.useRef(null);u.useEffect(()=>{d.current&&(d.current.indeterminate=!!r)},[r]);function p(f){d.current=f,typeof l=="function"?l(f):l&&(l.current=f)}return i.jsxs("label",{className:b(J.wrapper,s&&J.disabled,o),children:[i.jsx("input",{ref:p,type:"checkbox",disabled:s,className:b(J.input,a),...c}),i.jsx("span",{className:J.box,"aria-hidden":!0,children:r?i.jsx(rr,{}):i.jsx(nr,{})}),(t||n)&&i.jsxs("span",{className:J.labelWrap,children:[t&&i.jsx("span",{className:J.label,children:t}),n&&i.jsx("span",{className:J.description,children:n})]})]})});function nr(){return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})})}function rr(){return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})}const sr="tempest_wrapper_KR4-F",or="tempest_label_Mz-wX",ir="tempest_field_iIBJw",ar="tempest_error_O9n-9",cr="tempest_chip_GEwrc",lr="tempest_remove_JYDIq",ur="tempest_input_frJmk",dr="tempest_helper_Yts53",pr="tempest_errorText_llJGq",O={wrapper:sr,label:or,field:ir,error:ar,chip:cr,remove:lr,input:ur,helper:dr,errorText:pr};function fr({value:e,onChange:t,label:n,placeholder:r="Adicionar e pressionar Enter…",helperText:s,error:o,commitKeys:a=["Enter",",","Tab"],normalize:c=!0,className:l}){const[d,p]=u.useState(""),f=u.useRef(null);function m(){const _=c?d.trim().toLowerCase():d.trim();if(_){if(e.includes(_)){p("");return}t([...e,_]),p("")}}function h(_){if(a.includes(_.key)){_.preventDefault(),m();return}_.key==="Backspace"&&!d&&e.length>0&&t(e.slice(0,-1))}function g(_){const w=e.slice();w.splice(_,1),t(w)}return i.jsxs("div",{className:b(O.wrapper,o&&O.error,l),children:[n&&i.jsx("label",{className:O.label,children:n}),i.jsxs("div",{className:O.field,onClick:()=>f.current?.focus(),children:[e.map((_,w)=>i.jsxs("span",{className:O.chip,children:[_,i.jsx("button",{type:"button",className:O.remove,"aria-label":`Remover ${_}`,onClick:()=>g(w),children:"×"})]},`${_}-${w}`)),i.jsx("input",{ref:f,className:O.input,value:d,placeholder:e.length===0?r:"",onChange:_=>p(_.target.value),onKeyDown:h,onBlur:m})]}),o?i.jsx("span",{className:O.errorText,children:o}):s?i.jsx("span",{className:O.helper,children:s}):null]})}const mr="tempest_overlay_dd9h1",hr="tempest_tempest-fade-in_DvgSp",_r="tempest_dialog_ptM-K",gr="tempest_tempest-modal-in_UoxQC",br="tempest_sm_K5k3W",yr="tempest_md_gvyR7",wr="tempest_lg_BgB1a",xr="tempest_xl_MR-68",vr="tempest_size2xl_-PH9e",jr="tempest_size3xl_iqDwN",kr="tempest_fullscreen_o84Xi",Sr="tempest_fullscreenOnMobile_0bDwe",$r="tempest_body_lVhql",Nr="tempest_header_ILG9i",Er="tempest_footer_rro2w",Cr="tempest_title_A5OeE",Tr="tempest_close_-ER1C",R={overlay:mr,tempestFadeIn:hr,dialog:_r,tempestModalIn:gr,sm:br,md:yr,lg:wr,xl:xr,size2Xl:vr,size3Xl:jr,fullscreen:kr,fullscreenOnMobile:Sr,body:$r,header:Nr,footer:Er,title:Cr,close:Tr};function Ae({open:e,onClose:t,title:n,children:r,footer:s,size:o="md",closeOnBackdrop:a=!0,closeOnEsc:c=!0,className:l,hideCloseButton:d=!1,fullscreen:p=!1,fullscreenOnMobile:f=!1}){return u.useEffect(()=>{if(!e)return;const m=document.body.style.overflow;document.body.style.overflow="hidden";const h=g=>{c&&g.key==="Escape"&&t()};return window.addEventListener("keydown",h),()=>{document.body.style.overflow=m,window.removeEventListener("keydown",h)}},[e,c,t]),!e||typeof document>"u"?null:ve.createPortal(i.jsx("div",{className:R.overlay,role:"presentation",onClick:()=>{a&&t()},children:i.jsxs("div",{role:"dialog","aria-modal":"true",className:b(R.dialog,Ir(o),p&&R.fullscreen,f&&R.fullscreenOnMobile,l),onClick:m=>m.stopPropagation(),children:[(n||!d)&&i.jsxs("header",{className:R.header,children:[i.jsx("h3",{className:R.title,children:n}),!d&&i.jsx("button",{type:"button",className:R.close,"aria-label":"Fechar",onClick:t,children:i.jsx(Lr,{})})]}),i.jsx("div",{className:R.body,children:r}),s&&i.jsx("footer",{className:R.footer,children:s})]})}),document.body)}function Ir(e){return e==="2xl"?R.size2xl:e==="3xl"?R.size3xl:R[e]}function Lr(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Rr({open:e,title:t,description:n,confirmLabel:r="Confirmar",cancelLabel:s="Cancelar",variant:o="primary",loading:a=!1,onConfirm:c,onCancel:l}){return i.jsx(Ae,{open:e,onClose:l,title:t,size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(ie,{variant:"secondary",onClick:l,disabled:a,children:s}),i.jsx(ie,{variant:o,loading:a,onClick:()=>{c()},children:r})]}),children:n})}const Pr="tempest_wrapper_iHNUs",Dr="tempest_label_-OEBL",Mr="tempest_required_CTss-",Ar="tempest_field_65yGJ",Fr="tempest_input_WjT81",Br="tempest_sizeSm_cgds6",Wr="tempest_sizeMd_EPFGy",Or="tempest_sizeLg_5Cq8k",zr="tempest_hasLeftIcon_xYO-v",qr="tempest_hasRightIcon_C7uyr",Ur="tempest_iconLeft_KrUhI",Gr="tempest_iconRight_Ssr47",Hr="tempest_error_VLISa",Jr="tempest_helper_7Vc-s",Kr="tempest_errorText_xz4xS",$={wrapper:Pr,label:Dr,required:Mr,field:Ar,input:Fr,sizeSm:Br,sizeMd:Wr,sizeLg:Or,hasLeftIcon:zr,hasRightIcon:qr,iconLeft:Ur,iconRight:Gr,error:Hr,helper:Jr,errorText:Kr},le=u.forwardRef(function({label:t,helperText:n,error:r,leftIcon:s,rightIcon:o,wrapperClassName:a,className:c,id:l,required:d,size:p="md",...f},m){const h=u.useId(),g=l??h,_=r?`${g}-error`:n?`${g}-helper`:void 0,w=p==="sm"?$.sizeSm:p==="lg"?$.sizeLg:$.sizeMd;return i.jsxs("div",{className:b($.wrapper,r&&$.error,a),children:[t&&i.jsxs("label",{htmlFor:g,className:$.label,children:[t,d&&i.jsx("span",{className:$.required,children:"*"})]}),i.jsxs("div",{className:$.field,children:[s&&i.jsx("span",{className:$.iconLeft,children:s}),i.jsx("input",{ref:m,id:g,"aria-invalid":!!r,"aria-describedby":_,required:d,className:b($.input,w,s&&$.hasLeftIcon,o&&$.hasRightIcon,c),...f}),o&&i.jsx("span",{className:$.iconRight,children:o})]}),r?i.jsx("span",{id:`${g}-error`,className:$.errorText,children:r}):n?i.jsx("span",{id:`${g}-helper`,className:$.helper,children:n}):null]})}),Vr=u.forwardRef(function({value:t,onChange:n,mode:r="date",...s},o){return i.jsx(le,{...s,ref:o,type:r,value:t,onChange:a=>n(a.target.value)})}),Qr="tempest_divider_KSGsi",Zr="tempest_horizontal_pZ05Y",Xr="tempest_bare_elDbS",Yr="tempest_vertical_p-jD4",es="tempest_dashed_JWxCU",ts="tempest_alignStart_QAIi1",ns="tempest_alignEnd_eZDwa",L={divider:Qr,horizontal:Zr,bare:Xr,vertical:Yr,dashed:es,alignStart:ts,alignEnd:ns};function rs({orientation:e="horizontal",variant:t="solid",label:n,align:r="center",className:s,...o}){return e==="vertical"?i.jsx("span",{role:"separator","aria-orientation":"vertical",className:b(L.divider,L.vertical,t==="dashed"&&L.dashed,s),...o}):n?i.jsx("div",{role:"separator","aria-orientation":"horizontal",className:b(L.divider,L.horizontal,t==="dashed"&&L.dashed,r==="start"&&L.alignStart,r==="end"&&L.alignEnd,s),...o,children:n}):i.jsx("hr",{className:b(L.divider,L.horizontal,L.bare,t==="dashed"&&L.dashed,s)})}const ae={xs:480,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},ss=["xs","sm","md","lg","xl","2xl"];function os(e){let t="xs";for(const n of ss)e>=ae[n]&&(t=n);return t}function X(){const[e,t]=u.useState(()=>typeof window>"u"?0:window.innerWidth);u.useEffect(()=>{if(typeof window>"u")return;const o=()=>t(window.innerWidth);return o(),window.addEventListener("resize",o,{passive:!0}),()=>window.removeEventListener("resize",o)},[]);const n=os(e),r=o=>e>=ae[o],s=o=>e<ae[o];return{current:n,width:e,above:r,below:s,isMobile:s("md"),isTablet:r("md")&&s("lg"),isDesktop:r("lg")}}const is="tempest_overlay_hcG1G",as="tempest_tempest-drawer-overlay_XFbxY",cs="tempest_panel_wUX0N",ls="tempest_right_-oX-6",us="tempest_tempest-drawer-in-right_pWYHv",ds="tempest_left_xi3nD",ps="tempest_tempest-drawer-in-left_o7JSb",fs="tempest_top_7rGCn",ms="tempest_tempest-drawer-in-top_kn6AF",hs="tempest_bottom_zd-25",_s="tempest_tempest-drawer-in-bottom_0x3u7",gs="tempest_handle_5B-TB",bs="tempest_handleTop_7aMf-",ys="tempest_header_sYoP1",ws="tempest_title_LqUOu",xs="tempest_close_tYPhU",vs="tempest_body_aV9FG",js="tempest_footer_AuvUP",F={overlay:is,tempestDrawerOverlay:as,panel:cs,right:ls,tempestDrawerInRight:us,left:ds,tempestDrawerInLeft:ps,top:fs,tempestDrawerInTop:ms,bottom:hs,tempestDrawerInBottom:_s,handle:gs,handleTop:bs,header:ys,title:ws,close:xs,body:vs,footer:js};function ks({open:e,onClose:t,placement:n="right",title:r,children:s,footer:o,closeOnBackdrop:a=!0,closeOnEsc:c=!0,hideCloseButton:l=!1,className:d,mobilePlacement:p,showHandle:f=!1}){const{isMobile:m}=X(),h=m&&p?p:n;return u.useEffect(()=>{if(!e)return;const g=document.body.style.overflow;document.body.style.overflow="hidden";const _=w=>{c&&w.key==="Escape"&&t()};return window.addEventListener("keydown",_),()=>{document.body.style.overflow=g,window.removeEventListener("keydown",_)}},[e,c,t]),!e||typeof document>"u"?null:ve.createPortal(i.jsxs(i.Fragment,{children:[i.jsx("div",{className:F.overlay,onClick:()=>{a&&t()}}),i.jsxs("aside",{role:"dialog","aria-modal":"true",className:b(F.panel,F[h],d),children:[f&&(h==="bottom"||h==="top")&&i.jsx("div",{className:b(F.handle,h==="top"&&F.handleTop),"aria-hidden":!0}),(r||!l)&&i.jsxs("header",{className:F.header,children:[i.jsx("h3",{className:F.title,children:r}),!l&&i.jsx("button",{type:"button","aria-label":"Fechar",className:F.close,onClick:t,children:i.jsx(Ss,{})})]}),i.jsx("div",{className:F.body,children:s}),o&&i.jsx("footer",{className:F.footer,children:o})]})]}),document.body)}function Ss(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const $s="tempest_wrapper_gzyTd",Ns="tempest_icon_qVCyh",Es="tempest_title_xPfUf",Cs="tempest_description_oWwH1",Ts="tempest_action_dqxw1",ee={wrapper:$s,icon:Ns,title:Es,description:Cs,action:Ts};function Is({icon:e,title:t,description:n,action:r,className:s}){return i.jsxs("div",{className:b(ee.wrapper,s),children:[e&&i.jsx("div",{className:ee.icon,children:e}),i.jsx("h4",{className:ee.title,children:t}),n&&i.jsx("p",{className:ee.description,children:n}),r&&i.jsx("div",{className:ee.action,children:r})]})}const Ls="tempest_wrapper_luRyF",Rs="tempest_icon_dEdBl",Ps="tempest_title_StutD",Ds="tempest_description_A2XCb",Ms="tempest_action_vm1LC",te={wrapper:Ls,icon:Rs,title:Ps,description:Ds,action:Ms};function As({title:e="Algo deu errado",description:t="Não foi possível carregar essas informações.",onRetry:n,retryLabel:r="Tentar novamente",icon:s,className:o}){return i.jsxs("div",{className:b(te.wrapper,o),children:[i.jsx("div",{className:te.icon,children:s??i.jsx(Fs,{})}),i.jsx("h4",{className:te.title,children:e}),t&&i.jsx("p",{className:te.description,children:t}),n&&i.jsx("div",{className:te.action,children:i.jsx(ie,{variant:"secondary",onClick:n,children:r})})]})}function Fs(){return i.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Bs="tempest_wrapper_E0qHs",Ws="tempest_label_lbMkx",Os="tempest_dropzone_jqua0",zs="tempest_active_CG9Uk",qs="tempest_disabled_WNUUl",Us="tempest_icon_i9fGH",Gs="tempest_title_bTVFl",Hs="tempest_subtitle_S54OV",Js="tempest_files_WljYm",Ks="tempest_file_Lp-dR",Vs="tempest_fileMeta_LTnN2",Qs="tempest_remove_jskra",Zs="tempest_hidden_ReEq6",T={wrapper:Bs,label:Ws,dropzone:Os,active:zs,disabled:qs,icon:Us,title:Gs,subtitle:Hs,files:Js,file:Ks,fileMeta:Vs,remove:Qs,hidden:Zs};function Xs(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ys(e,t){if(!t)return!0;const n=t.split(",").map(o=>o.trim().toLowerCase()),r=e.name.toLowerCase(),s=e.type.toLowerCase();return n.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?s.startsWith(o.replace("/*","/")):s===o)}function eo({value:e,onChange:t,label:n,accept:r,multiple:s=!1,maxSize:o,onReject:a,disabled:c,title:l="Arraste arquivos aqui ou clique para selecionar",subtitle:d,className:p}){const[f,m]=u.useState(!1),h=u.useRef(null);function g(y){const x=[],v=[];for(const C of Array.from(y)){if(!Ys(C,r)){v.push({file:C,reason:"type"});continue}if(o&&C.size>o){v.push({file:C,reason:"size"});continue}x.push(C)}if(v.length>0&&a?.(v),x.length===0)return;const N=s?[...e,...x]:x.slice(0,1);t(N)}function _(y){y.preventDefault(),m(!1),!c&&y.dataTransfer?.files&&g(y.dataTransfer.files)}function w(y){const x=e.slice();x.splice(y,1),t(x)}return i.jsxs("div",{className:b(T.wrapper,p),children:[n&&i.jsx("label",{className:T.label,children:n}),i.jsxs("div",{className:b(T.dropzone,f&&T.active,c&&T.disabled),role:"button",tabIndex:c?-1:0,onClick:()=>!c&&h.current?.click(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),h.current?.click())},onDragEnter:y=>{y.preventDefault(),c||m(!0)},onDragOver:y=>y.preventDefault(),onDragLeave:()=>m(!1),onDrop:_,children:[i.jsx("div",{className:T.icon,"aria-hidden":!0,children:i.jsx(to,{})}),i.jsx("p",{className:T.title,children:l}),d&&i.jsx("p",{className:T.subtitle,children:d}),i.jsx("input",{ref:h,type:"file",accept:r,multiple:s,disabled:c,className:T.hidden,onChange:y=>{y.target.files&&g(y.target.files),y.target.value=""}})]}),e.length>0&&i.jsx("ul",{className:T.files,children:e.map((y,x)=>i.jsxs("li",{className:T.file,children:[i.jsxs("div",{children:[i.jsx("div",{children:y.name}),i.jsx("div",{className:T.fileMeta,children:Xs(y.size)})]}),i.jsx("button",{type:"button","aria-label":`Remover ${y.name}`,className:T.remove,onClick:()=>w(x),children:"×"})]},`${y.name}-${x}`))})]})}function to(){return i.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const no="tempest_form_jNBDR",ro="tempest_stack_O1Hl-",so="tempest_inline_LBQAv",oo="tempest_grid_-B86T",io="tempest_section_HGqw3",ao="tempest_sectionHeader_ji9hQ",co="tempest_sectionTitle_GTPwe",lo="tempest_sectionDescription_KjW7k",uo="tempest_sectionBody_Vp2wz",po="tempest_row_1EkVR",fo="tempest_actions_hK95I",mo="tempest_start_gXnm3",ho="tempest_center_mKkz4",_o="tempest_end_O3yDQ",go="tempest_between_tte2z",A={form:no,stack:ro,inline:so,grid:oo,section:io,sectionHeader:ao,sectionTitle:co,sectionDescription:lo,sectionBody:uo,row:po,actions:fo,start:mo,center:ho,end:_o,between:go};function ue(e,t){return e===void 0?`${t*4}px`:typeof e=="number"?`${e*4}px`:e}function Fe(e){return e===void 0?"repeat(2, minmax(0, 1fr))":typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e}const bo=u.forwardRef(function({layout:t="stack",columns:n,gap:r,className:s,style:o,children:a,...c},l){const d={gap:ue(r,4),...t==="grid"?{gridTemplateColumns:Fe(n)}:null,...o};return i.jsx("form",{ref:l,className:b(A.form,A[t],s),style:d,...c,children:a})});function yo({title:e,description:t,layout:n="stack",columns:r,gap:s,className:o,style:a,children:c,...l}){const d={gap:ue(s,4),...n==="grid"?{gridTemplateColumns:Fe(r)}:null};return i.jsxs("section",{className:b(A.section,o),style:a,...l,children:[(e||t)&&i.jsxs("header",{className:A.sectionHeader,children:[e&&i.jsx("h3",{className:A.sectionTitle,children:e}),t&&i.jsx("p",{className:A.sectionDescription,children:t})]}),i.jsx("div",{className:b(A.sectionBody,A[n]),style:d,children:c})]})}function wo({gap:e,className:t,style:n,children:r,...s}){const o={gap:ue(e,3),...n};return i.jsx("div",{className:b(A.row,t),style:o,...s,children:r})}function xo({align:e="end",gap:t,className:n,style:r,children:s,...o}){const a={gap:ue(t,2),...r};return i.jsx("div",{className:b(A.actions,A[e],n),style:a,...o,children:s})}const vo="tempest_container_fJfOt",jo="tempest_sm_k8D4-",ko="tempest_md_EnpYy",So="tempest_lg_UU-Ig",$o="tempest_xl_2TEWj",No="tempest_full_l8bvG",Eo="tempest_stack_sxR8u",Co="tempest_vertical_2TMf5",To="tempest_horizontal_r7-c-",Io="tempest_center_EDSAh",Lo="tempest_start_ucQ-K",Ro="tempest_end_pnKlF",Po="tempest_stretch_pX6l7",Do="tempest_justifyStart_lHYsS",Mo="tempest_justifyCenter_JH2m6",Ao="tempest_justifyEnd_EBisT",Fo="tempest_justifyBetween_mAJwT",Bo="tempest_wrap_-xxOh",Wo="tempest_grid_o-JIX",P={container:vo,sm:jo,md:ko,lg:So,xl:$o,full:No,stack:Eo,vertical:Co,horizontal:To,center:Io,start:Lo,end:Ro,stretch:Po,justifyStart:Do,justifyCenter:Mo,justifyEnd:Ao,justifyBetween:Fo,wrap:Bo,grid:Wo};function Oo({size:e="lg",className:t,children:n,...r}){return i.jsx("div",{className:b(P.container,P[e],t),...r,children:n})}function zo(e){return typeof e=="object"&&e!==null&&("mobile"in e||"tablet"in e||"desktop"in e)}function ce(e,t){if(e!==void 0)return zo(e)?t==="desktop"?e.desktop??e.tablet??e.mobile:t==="tablet"?e.tablet??e.mobile??e.desktop:e.mobile??e.tablet??e.desktop:e}function Be(e){if(e!==void 0)return typeof e=="number"?`${e*4}px`:e}function We(e,t){return e?"mobile":t?"tablet":"desktop"}function qo({direction:e="vertical",gap:t=2,align:n,justify:r,wrap:s=!1,className:o,style:a,children:c,...l}){const{isMobile:d,isTablet:p}=X(),f=We(d,p),m=ce(e,f)??"vertical",g={gap:Be(ce(t,f)),...a},_=r==="between"?P.justifyBetween:r==="center"?P.justifyCenter:r==="end"?P.justifyEnd:r==="start"?P.justifyStart:void 0;return i.jsx("div",{className:b(P.stack,m==="vertical"?P.vertical:P.horizontal,n&&P[n],_,s&&P.wrap,o),style:g,...l,children:c})}function Uo(e){if(e!==void 0)return typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e}function Go({columns:e=2,gap:t=4,className:n,style:r,children:s,...o}){const{isMobile:a,isTablet:c}=X(),l=We(a,c),d=Uo(ce(e,l)),p=Be(ce(t,l));return i.jsx("div",{className:b(P.grid,n),style:{gridTemplateColumns:d,gap:p,...r},...o,children:s})}const Ho="tempest_kbd_jgbYx",Jo="tempest_sm_9WPWA",Ko="tempest_md_BePC0",Vo="tempest_lg_cBKum",Ee={kbd:Ho,sm:Jo,md:Ko,lg:Vo};function Qo({size:e="md",className:t,children:n,...r}){return i.jsx("kbd",{className:b(Ee.kbd,Ee[e],t),...r,children:n})}const Zo="tempest_wrapper_cRGQm",Xo="tempest_controls_fdL-y",Yo="tempest_page_WjG0l",ei="tempest_active_1kqsJ",ti="tempest_ellipsis_V294k",ni="tempest_sizeSelect_ZayTo",G={wrapper:Zo,controls:Xo,page:Yo,active:ei,ellipsis:ti,sizeSelect:ni};function ri(e,t,n){const r=n+4;if(t<=r)return Array.from({length:t},(c,l)=>l+1);const s=Math.max(2,e-Math.floor(n/2)),o=Math.min(t-1,s+n-1),a=[1];s>2&&a.push("...");for(let c=s;c<=o;c++)a.push(c);return o<t-1&&a.push("..."),a.push(t),a}function si({page:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:s,pageSizeOptions:o=[10,25,50,100],totalItems:a,siblingCount:c=3,className:l}){const d=u.useMemo(()=>ri(e,t,c),[e,t,c]);return t<=1&&!s?null:i.jsxs("div",{className:b(G.wrapper,l),children:[i.jsx("div",{children:typeof a=="number"?`${a} resultado${a===1?"":"s"}`:null}),i.jsxs("div",{className:G.controls,children:[i.jsx("button",{type:"button",className:G.page,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,"aria-label":"Página anterior",children:"‹"}),d.map((p,f)=>p==="..."?i.jsx("span",{className:G.ellipsis,children:"…"},`ellipsis-${f}`):i.jsx("button",{type:"button",className:b(G.page,p===e&&G.active),onClick:()=>n(p),"aria-current":p===e?"page":void 0,children:p},p)),i.jsx("button",{type:"button",className:G.page,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,"aria-label":"Próxima página",children:"›"}),s&&i.jsx("select",{className:G.sizeSelect,value:r,onChange:p=>s(Number(p.target.value)),"aria-label":"Itens por página",children:o.map(p=>i.jsxs("option",{value:p,children:[p," / página"]},p))})]})]})}const oi="tempest_wrapper_BQek1",ii="tempest_bar_uC-0x",ai="tempest_fill_vmg7x",ci="tempest_success_gWJ8U",li="tempest_warning_DGkPO",ui="tempest_danger_gfwHh",di="tempest_indeterminate_HojUj",pi="tempest_tempest-progress-loop_0nEdF",fi="tempest_label_qqHJM",Q={wrapper:oi,bar:ii,fill:ai,success:ci,warning:li,danger:ui,indeterminate:di,tempestProgressLoop:pi,label:fi};function mi({value:e=0,max:t=100,variant:n="primary",indeterminate:r=!1,showLabel:s=!1,label:o,className:a}){const c=r?0:Math.max(0,Math.min(100,e/t*100));return i.jsxs("div",{className:b(Q.wrapper,a),children:[(s||o)&&i.jsxs("div",{className:Q.label,children:[o&&i.jsx("span",{children:o}),s&&!r&&i.jsxs("span",{children:[Math.round(c),"%"]})]}),i.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":r?void 0:e,className:b(Q.bar,r&&Q.indeterminate),children:i.jsx("div",{className:b(Q.fill,n!=="primary"&&Q[n]),style:{width:r?void 0:`${c}%`}})})]})}const hi="tempest_wrapper_P-gFm",_i="tempest_disabled_0-cna",gi="tempest_input_7R8ZN",bi="tempest_dot_P7ejP",yi="tempest_labelWrap_iQ1HR",wi="tempest_label_vAFIP",xi="tempest_description_bEB8u",vi="tempest_group_oi329",ji="tempest_horizontal_1Ovgu",U={wrapper:hi,disabled:_i,input:gi,dot:bi,labelWrap:yi,label:wi,description:xi,group:vi,horizontal:ji},Oe=u.createContext(null),ki=u.forwardRef(function({label:t,description:n,value:r,disabled:s,name:o,checked:a,onChange:c,wrapperClassName:l,className:d,...p},f){const m=u.useContext(Oe),h=m?.name??o,g=m?.disabled??s,_=m?m.value===r:a;function w(y){m&&m.onChange?.(r),c?.(y)}return i.jsxs("label",{className:b(U.wrapper,g&&U.disabled,l),children:[i.jsx("input",{ref:f,type:"radio",name:h,value:r,checked:_,disabled:g,onChange:w,className:b(U.input,d),...p}),i.jsx("span",{className:U.dot,"aria-hidden":!0}),(t||n)&&i.jsxs("span",{className:U.labelWrap,children:[t&&i.jsx("span",{className:U.label,children:t}),n&&i.jsx("span",{className:U.description,children:n})]})]})});function Si({value:e,defaultValue:t,onChange:n,name:r,disabled:s,horizontal:o=!1,className:a,children:c}){const l=u.useId(),d=r??l,[p,f]=u.useState(t),m=e!==void 0,h=m?e:p;function g(_){m||f(_),n?.(_)}return i.jsx(Oe.Provider,{value:{name:d,value:h,onChange:g,disabled:s},children:i.jsx("div",{role:"radiogroup",className:b(U.group,o&&U.horizontal,a),children:c})})}function ze(e,t,n,r,s){return r?(Array.isArray(r)?r:[r]).includes(e):!(t&&!s.above(t)||n&&!s.below(n))}function $i({above:e,below:t,only:n,children:r}){const s=X();return ze(s.current,e,t,n,s)?r:null}function Ni({above:e,below:t,only:n,children:r}){const s=X();return ze(s.current,e,t,n,s)?null:r}const Ei="tempest_wrapper_dKXJJ",Ci="tempest_input_m0lPc",Ti="tempest_iconLeft_030-U",Ii="tempest_clear_nb6lG",oe={wrapper:Ei,input:Ci,iconLeft:Ti,clear:Ii},Li=u.forwardRef(function({value:t,onChange:n,onClear:r,wrapperClassName:s,placeholder:o="Buscar...",className:a,...c},l){function d(){n(""),r?.()}return i.jsxs("div",{className:b(oe.wrapper,s),children:[i.jsx("span",{className:oe.iconLeft,"aria-hidden":!0,children:i.jsx(Ri,{})}),i.jsx("input",{ref:l,type:"search",value:t,onChange:p=>n(p.target.value),placeholder:o,className:b(oe.input,a),...c}),t&&i.jsx("button",{type:"button",className:oe.clear,"aria-label":"Limpar busca",onClick:d,children:i.jsx(Pi,{})})]})});function Ri(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Pi(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Di="tempest_wrapper_KS2K3",Mi="tempest_label_Lmgos",Ai="tempest_required_PvDVJ",Fi="tempest_field_h-wBy",Bi="tempest_select_cjdcr",Wi="tempest_caret_MdCao",Oi="tempest_error_sw9MU",zi="tempest_helper_frosK",qi="tempest_errorText_-zd6i",z={wrapper:Di,label:Mi,required:Ai,field:Fi,select:Bi,caret:Wi,error:Oi,helper:zi,errorText:qi},Ui=u.forwardRef(function({label:t,helperText:n,error:r,options:s,placeholder:o,wrapperClassName:a,className:c,children:l,id:d,required:p,...f},m){const h=u.useId(),g=d??h;return i.jsxs("div",{className:b(z.wrapper,r&&z.error,a),children:[t&&i.jsxs("label",{htmlFor:g,className:z.label,children:[t,p&&i.jsx("span",{className:z.required,children:"*"})]}),i.jsxs("div",{className:z.field,children:[i.jsxs("select",{ref:m,id:g,"aria-invalid":!!r,required:p,className:b(z.select,c),...f,children:[o&&i.jsx("option",{value:"",disabled:!0,hidden:!0,children:o}),s?.map(_=>i.jsx("option",{value:_.value,disabled:_.disabled,children:_.label},_.value)),l]}),i.jsx("span",{className:z.caret,"aria-hidden":!0,children:i.jsx(Gi,{})})]}),r?i.jsx("span",{className:z.errorText,children:r}):n?i.jsx("span",{className:z.helper,children:n}):null]})});function Gi(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M6 9l6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Hi="tempest_skeleton_CB4uF",Ji="tempest_text_-A8IF",Ki="tempest_circle_DYcl8",he={skeleton:Hi,text:Ji,circle:Ki};function Vi({variant:e="rect",width:t,height:n,className:r,style:s}){return i.jsx("span",{"aria-hidden":!0,className:b(he.skeleton,e==="text"&&he.text,e==="circle"&&he.circle,r),style:{width:t,height:n,...s}})}const Qi="tempest_spinner_GpFZS",Zi="tempest_tempest-spinner_wKVCY",Xi="tempest_xs_p8BFI",Yi="tempest_sm_3sIoD",ea="tempest_md_M2sPj",ta="tempest_lg_IxTw2",na="tempest_xl_cgwqq",Ce={spinner:Qi,tempestSpinner:Zi,xs:Xi,sm:Yi,md:ea,lg:ta,xl:na};function ra({size:e="md",className:t,label:n="Carregando"}){return i.jsx("span",{role:"status","aria-label":n,className:b(Ce.spinner,Ce[e],t)})}const sa="tempest_stepper_w3qjQ",oa="tempest_vertical_d4mOs",ia="tempest_step_s2nqL",aa="tempest_dot_d1bSL",ca="tempest_completed_gcFHM",la="tempest_active_kL-CH",ua="tempest_label_8irAI",da="tempest_connector_lyeWp",q={stepper:sa,vertical:oa,step:ia,dot:aa,completed:ca,active:la,label:ua,connector:da};function pa({steps:e,current:t,orientation:n="horizontal",className:r}){return i.jsx("ol",{className:b(q.stepper,n==="vertical"&&q.vertical,r),children:e.map((s,o)=>{const a=o<t,c=o===t;return i.jsxs(u.Fragment,{children:[i.jsxs("li",{className:b(q.step,a&&q.completed,c&&q.active),"aria-current":c?"step":void 0,children:[i.jsx("span",{className:q.dot,children:a?"✓":o+1}),i.jsx("span",{className:q.label,children:s.label})]}),o<e.length-1&&i.jsx("span",{className:b(q.connector,a&&q.completed),"aria-hidden":!0})]},o)})})}const fa="tempest_wrapper_kudO9",ma="tempest_disabled_2aZ0V",ha="tempest_input_5BPNu",_a="tempest_track_7ObdZ",ga="tempest_thumb_-FTeK",ba="tempest_label_LrH7V",Z={wrapper:fa,disabled:ma,input:ha,track:_a,thumb:ga,label:ba},ya=u.forwardRef(function({label:t,disabled:n,wrapperClassName:r,className:s,...o},a){return i.jsxs("label",{className:b(Z.wrapper,n&&Z.disabled,r),children:[i.jsx("input",{ref:a,type:"checkbox",role:"switch",disabled:n,className:b(Z.input,s),...o}),i.jsx("span",{className:Z.track,"aria-hidden":!0,children:i.jsx("span",{className:Z.thumb})}),t&&i.jsx("span",{className:Z.label,children:t})]})}),wa="tempest_scroll_unrJp",xa="tempest_table_Dkosn",va="tempest_th_PNuEx",ja="tempest_td_jv9tA",ka="tempest_tr_7UG8J",Sa="tempest_clickable_B6Si-",$a="tempest_alignRight_9hY0G",Na="tempest_alignCenter_YiUQy",Ea="tempest_emptyRow_kdMiv",Ca="tempest_priorityTablet_3alUt",Ta="tempest_priorityDesktop_3f8Fq",Ia="tempest_stackable_heix7",La="tempest_stackableHead_mKGcA",Ra="tempest_stackableRow_qPNqc",k={scroll:wa,table:xa,th:va,td:ja,tr:ka,clickable:Sa,alignRight:$a,alignCenter:Na,emptyRow:Ea,priorityTablet:Ca,priorityDesktop:Ta,stackable:Ia,stackableHead:La,stackableRow:Ra};function Te(e){if(e==="tablet")return k.priorityTablet;if(e==="desktop")return k.priorityDesktop}function Pa({columns:e,data:t,rowKey:n,onRowClick:r,emptyMessage:s="Nenhum registro encontrado.",className:o,stackOnMobile:a=!1}){return i.jsx("div",{className:b(k.scroll,a&&k.stackable,o),children:i.jsxs("table",{className:k.table,children:[i.jsx("thead",{className:b(a&&k.stackableHead),children:i.jsx("tr",{children:e.map(c=>i.jsx("th",{className:b(k.th,c.align==="right"&&k.alignRight,c.align==="center"&&k.alignCenter,Te(c.priority)),style:{width:c.width},children:c.header},c.key))})}),i.jsx("tbody",{children:t.length===0?i.jsx("tr",{children:i.jsx("td",{className:k.emptyRow,colSpan:e.length,children:s})}):t.map((c,l)=>i.jsx("tr",{className:b(k.tr,r&&k.clickable,a&&k.stackableRow),onClick:r?()=>r(c):void 0,children:e.map(d=>{const p=d.render?d.render(c,l):c[d.key];return i.jsx("td",{className:b(k.td,d.align==="right"&&k.alignRight,d.align==="center"&&k.alignCenter,Te(d.priority),d.className),"data-label":typeof d.header=="string"?d.header:void 0,children:p},d.key)})},n(c,l)))})]})})}const Da="tempest_tablist_WR6ag",Ma="tempest_tab_IdDYc",Aa="tempest_active_PTNtG",Fa="tempest_panel_08i9c",Ba="tempest_pill_lGuqn",ne={tablist:Da,tab:Ma,active:Aa,panel:Fa,pill:Ba};function Wa({items:e,defaultId:t,activeId:n,onChange:r,variant:s="underline",className:o}){const a=e.find(h=>!h.disabled),[c,l]=u.useState(t??a?.id),d=n!==void 0,p=d?n:c,f=e.find(h=>h.id===p)??a;function m(h){d||l(h),r?.(h)}return i.jsxs("div",{className:o,children:[i.jsx("div",{role:"tablist",className:b(ne.tablist,s==="pill"&&ne.pill),children:e.map(h=>{const g=h.id===f?.id;return i.jsx("button",{type:"button",role:"tab","aria-selected":g,"aria-controls":`panel-${h.id}`,id:`tab-${h.id}`,disabled:h.disabled,className:b(ne.tab,g&&ne.active),onClick:()=>m(h.id),children:h.label},h.id)})}),f&&i.jsx("div",{role:"tabpanel",id:`panel-${f.id}`,"aria-labelledby":`tab-${f.id}`,className:ne.panel,children:f.content})]})}const Oa="tempest_wrapper_C0gfg",za="tempest_label_cWLXP",qa="tempest_required_rDZXE",Ua="tempest_textarea_Z-y6g",Ga="tempest_error_NWC9f",Ha="tempest_helper_gedut",Ja="tempest_errorText_ey07q",K={wrapper:Oa,label:za,required:qa,textarea:Ua,error:Ga,helper:Ha,errorText:Ja},Ka=u.forwardRef(function({label:t,helperText:n,error:r,wrapperClassName:s,className:o,id:a,required:c,...l},d){const p=u.useId(),f=a??p;return i.jsxs("div",{className:b(K.wrapper,r&&K.error,s),children:[t&&i.jsxs("label",{htmlFor:f,className:K.label,children:[t,c&&i.jsx("span",{className:K.required,children:"*"})]}),i.jsx("textarea",{ref:d,id:f,"aria-invalid":!!r,required:c,className:b(K.textarea,o),...l}),r?i.jsx("span",{className:K.errorText,children:r}):n?i.jsx("span",{className:K.helper,children:n}):null]})}),Va="tempest_trigger_Dmc5E",Qa="tempest_bubble_TPGHB",Za="tempest_tempest-tooltip-in_csYeZ",Xa="tempest_top_m2tnn",Ya="tempest_bottom_9Twz4",ec="tempest_left_UPdrG",tc="tempest_right_CV--T",_e={trigger:Va,bubble:Qa,tempestTooltipIn:Za,top:Xa,bottom:Ya,left:ec,right:tc};function nc({content:e,placement:t="top",children:n,disabled:r=!1,openDelay:s=150}){const[o,a]=u.useState(!1),c=u.useId();let l=null;function d(){r||(l&&clearTimeout(l),l=setTimeout(()=>a(!0),s))}function p(){l&&(clearTimeout(l),l=null),a(!1)}const f=u.cloneElement(n,{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p,"aria-describedby":o?c:void 0});return i.jsxs("span",{className:_e.trigger,children:[f,o&&i.jsx("span",{id:c,role:"tooltip",className:b(_e.bubble,_e[t]),children:e})]})}const rc="tempest_container_x4-Qm",sc="tempest_positionTopRight_gbUCQ",oc="tempest_positionTopLeft_Z-tMJ",ic="tempest_positionTopCenter_A4Ze4",ac="tempest_positionBottomRight_MGo19",cc="tempest_positionBottomLeft_DpiNe",lc="tempest_positionBottomCenter_XUdok",uc="tempest_toast_FLdHz",dc="tempest_tempest-toast-in_E2d-A",pc="tempest_success_Oy694",fc="tempest_warning_84GC8",mc="tempest_error_hrQAA",hc="tempest_info_eq5bQ",_c="tempest_title_-H6R2",gc="tempest_description_-QwfC",bc="tempest_close_i10-s",D={container:rc,positionTopRight:sc,positionTopLeft:oc,positionTopCenter:ic,positionBottomRight:ac,positionBottomLeft:cc,positionBottomCenter:lc,toast:uc,tempestToastIn:dc,success:pc,warning:fc,error:mc,info:hc,title:_c,description:gc,close:bc},qe=u.createContext(null);function yc(){const e=u.useContext(qe);if(!e)throw new Error("useToast must be used inside a <ToastProvider>");return e}function wc({children:e,defaultDuration:t=4e3,position:n="top-right"}){const[r,s]=u.useState([]),o=u.useRef(0),a=u.useCallback(d=>{s(p=>p.filter(f=>f.id!==d))},[]),c=u.useCallback(d=>{const p=d.id??`toast-${++o.current}`,f={id:p,title:d.title,description:d.description,variant:d.variant??"info",duration:d.duration??t};return s(m=>[...m,f]),p},[t]),l=u.useMemo(()=>({show:c,dismiss:a,success:(d,p)=>c({...p,description:d,variant:"success"}),error:(d,p)=>c({...p,description:d,variant:"error"}),warning:(d,p)=>c({...p,description:d,variant:"warning"}),info:(d,p)=>c({...p,description:d,variant:"info"})}),[c,a]);return i.jsxs(qe.Provider,{value:l,children:[e,i.jsx(vc,{toasts:r,onDismiss:a,position:n})]})}function xc(e){switch(e){case"top-left":return D.positionTopLeft;case"top-center":return D.positionTopCenter;case"bottom-right":return D.positionBottomRight;case"bottom-left":return D.positionBottomLeft;case"bottom-center":return D.positionBottomCenter;default:return D.positionTopRight}}function vc({toasts:e,onDismiss:t,position:n}){return typeof document>"u"?null:ve.createPortal(i.jsx("div",{className:b(D.container,xc(n)),"aria-live":"polite","aria-atomic":"true",children:e.map(r=>i.jsx(jc,{toast:r,onDismiss:t},r.id))}),document.body)}function jc({toast:e,onDismiss:t}){return u.useEffect(()=>{if(!e.duration)return;const n=setTimeout(()=>t(e.id),e.duration);return()=>clearTimeout(n)},[e.id,e.duration,t]),i.jsxs("div",{className:b(D.toast,D[e.variant]),role:"status",children:[i.jsxs("div",{children:[e.title&&i.jsx("p",{className:D.title,children:e.title}),e.description&&i.jsx("p",{className:D.description,children:e.description})]}),i.jsx("button",{type:"button",className:D.close,"aria-label":"Fechar notificação",onClick:()=>t(e.id),children:i.jsx(kc,{})})]})}function kc(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Sc="tempest_scroll_8Giwl",$c="tempest_spacer_P3Pvl",Nc="tempest_row_Ff0VU",ge={scroll:Sc,spacer:$c,row:Nc};function Ec({items:e,itemHeight:t,renderItem:n,height:r,overscan:s=4,getKey:o,className:a,style:c}){const l=u.useRef(null),[d,p]=u.useState(0),[f,m]=u.useState(0);u.useEffect(()=>{const y=l.current;if(!y||(m(y.clientHeight),typeof ResizeObserver>"u"))return;const x=new ResizeObserver(()=>m(y.clientHeight));return x.observe(y),()=>x.disconnect()},[]);const h=e.length*t,g=Math.max(0,Math.floor(d/t)-s),_=Math.ceil(f/t)+s*2,w=Math.min(e.length,g+_);return i.jsx("div",{ref:l,className:b(ge.scroll,a),style:{height:r,...c},onScroll:y=>p(y.target.scrollTop),role:"list",children:i.jsx("div",{className:ge.spacer,style:{height:h},children:e.slice(g,w).map((y,x)=>{const v=g+x,N=o?o(y,v):v;return i.jsx("div",{role:"listitem",className:ge.row,style:{top:v*t,height:t},children:n(y,v)},N)})})})}function Cc(e,t=300){const[n,r]=u.useState(e);return u.useEffect(()=>{const s=setTimeout(()=>r(e),t);return()=>clearTimeout(s)},[e,t]),n}function Tc(e=1,t=50){const[n,r]=u.useState(e),[s,o]=u.useState(t),a=u.useCallback(()=>r(1),[]);return{page:n,size:s,setPage:r,setSize:o,reset:a}}function Ic(e,t,n){return u.useMemo(()=>{const r=t.trim().toLowerCase();return r?typeof n=="function"?e.filter(s=>n(s,r)):e.filter(s=>n.some(o=>{const a=s[o];return a!=null&&String(a).toLowerCase().includes(r)})):e},[e,t,n])}function Lc(e){const[t,n]=u.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return u.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(e),s=o=>n(o.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function Rc(){const[e,t]=u.useState(()=>typeof navigator>"u"?!0:navigator.onLine);return u.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n),window.addEventListener("offline",r),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}},[]),e}function Pc(){const[e,t]=u.useState(()=>typeof document>"u"?"visible":document.visibilityState);return u.useEffect(()=>{if(typeof document>"u")return;const n=()=>t(document.visibilityState);return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e}function Dc(e,t={}){const[n,r]=u.useState(null),{once:s=!1,root:o,rootMargin:a,threshold:c}=t;return u.useEffect(()=>{const l=e.current;if(!l||typeof IntersectionObserver>"u")return;const d=new IntersectionObserver(([p])=>{p&&(r(p),s&&p.isIntersecting&&d.unobserve(l))},{root:o,rootMargin:a,threshold:c});return d.observe(l),()=>d.disconnect()},[e,s,o,a,c]),n}function Mc(e){const[t,n]=u.useState(null);return u.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=new ResizeObserver(o=>{const a=o[0];if(!a)return;const c=a.contentRect;n({width:c.width,height:c.height})});return s.observe(r),()=>s.disconnect()},[e]),t}function Ac(e={}){const{resetAfter:t=1500}=e,[n,r]=u.useState(!1),s=u.useRef(null),o=u.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r(!1)},[]);u.useEffect(()=>()=>o(),[o]);const a=u.useCallback(async c=>{try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)await navigator.clipboard.writeText(c);else if(typeof document<"u"){const l=document.createElement("textarea");l.value=c,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l)}else return!1;return r(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>r(!1),t),!0}catch{return!1}},[t]);return{copied:n,copy:a,reset:o}}function Fc(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;const n=!!t.ctrl,r=!!t.meta,s=!!t.shift,o=!!t.alt;if(t.mod){if(!e.ctrlKey&&!e.metaKey)return!1}else if(e.ctrlKey!==n||e.metaKey!==r)return!1;return!(e.shiftKey!==s||e.altKey!==o)}function Bc(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"?!0:e.isContentEditable}function Wc(e,t,n={}){const{disabled:r=!1,ignoreInput:s=!0}=n;u.useEffect(()=>{if(r||typeof window>"u")return;const o=a=>{s&&Bc(a.target)||Fc(a,e)&&t(a)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r,s,e.key,e.ctrl,e.meta,e.shift,e.alt,e.mod,t])}function Oc(){const[e,t]=u.useState(null),[n,r]=u.useState(!1);u.useEffect(()=>{if(typeof window>"u")return;const o=c=>{c.preventDefault(),t(c)},a=()=>{t(null),r(!0)};return window.addEventListener("beforeinstallprompt",o),window.addEventListener("appinstalled",a),()=>{window.removeEventListener("beforeinstallprompt",o),window.removeEventListener("appinstalled",a)}},[]);const s=u.useCallback(async()=>{if(!e)return"unsupported";await e.prompt();const o=await e.userChoice;return t(null),o.outcome==="accepted"&&r(!0),o.outcome},[e]);return{installable:!!e,installed:n,prompt:s}}const Ie=["mousemove","mousedown","keydown","touchstart","wheel","scroll"];function zc(e=6e4){const[t,n]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;let r=setTimeout(()=>n(!0),e);function s(){n(!1),clearTimeout(r),r=setTimeout(()=>n(!0),e)}for(const o of Ie)window.addEventListener(o,s,{passive:!0});return()=>{clearTimeout(r);for(const o of Ie)window.removeEventListener(o,s)}},[e]),t}function qc(e={}){const{watch:t=!1,disabled:n=!1,...r}=e,[s,o]=u.useState({loading:!n,error:null,coords:null,timestamp:null});return u.useEffect(()=>{if(n||typeof navigator>"u"||!navigator.geolocation){o(l=>({...l,loading:!1}));return}const a=l=>{o({loading:!1,error:null,coords:l.coords,timestamp:l.timestamp})},c=l=>{o(d=>({...d,loading:!1,error:l}))};if(t){const l=navigator.geolocation.watchPosition(a,c,r);return()=>navigator.geolocation.clearWatch(l)}navigator.geolocation.getCurrentPosition(a,c,r)},[n,t,r.enableHighAccuracy,r.maximumAge,r.timeout]),s}function Uc(e){u.useEffect(()=>{if(!e||typeof document>"u")return;const t=document.body,n=t.style.overflow;return t.style.overflow="hidden",()=>{t.style.overflow=n}},[e])}const Gc=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Hc(e,t){u.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement;function s(){return Array.from(n?.querySelectorAll(Gc)??[]).filter(c=>{if(c.hasAttribute("aria-hidden"))return!1;const l=typeof window<"u"?window.getComputedStyle(c):null;return!(l&&(l.display==="none"||l.visibility==="hidden"))})}function o(c){if(c.key!=="Tab")return;const l=s();if(l.length===0){c.preventDefault();return}const d=l[0],p=l[l.length-1],f=document.activeElement;c.shiftKey?(f===d||!f||!n?.contains(f))&&(c.preventDefault(),p.focus()):f===p&&(c.preventDefault(),d.focus())}return s()[0]?.focus(),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),r?.focus?.()}},[e,t])}function Jc(e){const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>t.current(...n),[])}function we(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>we(s,t[o]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>we(e[s],t[s]))}function Kc(e){const t=u.useRef(e);return we(t.current,e)||(t.current=e),t.current}function Vc(e,t,n){const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(n)for(const[s,o]of Object.entries(n))o!=null&&r.searchParams.set(s,String(o));return r.toString()}function Qc(e){return typeof FormData<"u"&&e instanceof FormData}async function Le(e){let t=null;try{t=await e.clone().json()}catch{try{t=await e.text()}catch{t=null}}const n=(typeof t=="object"&&t!==null?t.detail??t.message:void 0)??`Erro ${e.status}`;return{status:e.status,detail:String(n),body:t}}function Zc(e){const t=e.fetcher??globalThis.fetch.bind(globalThis);function n(){const a=e.getToken?.();return a?{Authorization:`Bearer ${a}`}:{}}async function r(a,c){const{body:l,params:d,headers:p,...f}=c,m=Qc(l),h={...m?{}:{"Content-Type":"application/json"},...e.headers,...n(),...p},g={...f,headers:h,credentials:e.withCredentials?"include":f.credentials,body:l==null?void 0:m?l:JSON.stringify(l)};return t(Vc(e.baseURL,a,d),g)}async function s(a,c={}){let l=await r(a,c);if(l.status===401)if(e.refresh)try{await e.refresh(),l=await r(a,c)}catch{throw await e.onUnauthorized?.(l),await Le(l)}else await e.onUnauthorized?.(l);if(!l.ok)throw await Le(l);return l.status===204?void 0:(l.headers.get("content-type")??"").includes("application/json")?await l.json():await l.text()}async function o(a,c,l="POST"){return s(a,{method:l,body:c})}return{request:s,get:(a,c)=>s(a,{...c,method:"GET"}),post:(a,c)=>s(a,{...c,method:"POST"}),put:(a,c)=>s(a,{...c,method:"PUT"}),patch:(a,c)=>s(a,{...c,method:"PATCH"}),delete:(a,c)=>s(a,{...c,method:"DELETE"}),upload:o}}function Xc(e,t,n){const r=e.safeParse(t);if(r.success)return r.data;if(typeof process<"u"&&(process.env?.NODE_ENV==="development"||process.env?.NODE_ENV==="test")){const o=r.error.issues.map(a=>` - ${a.path.join(".")||"<root>"}: ${a.message}`).join(`
2
2
  `);throw new Error(`[parseResponse] Contract drift on ${n}:
3
3
  ${o}
4
4
 
5
- Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida do servidor (${n}).`)}function xc(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function vc(e){const{url:t,body:n,method:r="POST",headers:s={},getToken:o,withCredentials:i=!1,onProgress:l,signal:c,parser:d=JSON.parse}=e;return new Promise((p,f)=>{if(c?.aborted){f(new DOMException("Aborted","AbortError"));return}const m=new XMLHttpRequest;m.open(r,t),m.withCredentials=i;const _=o?.(),g={...s};_&&!("Authorization"in g)&&(g.Authorization=`Bearer ${_}`);for(const[w,b]of Object.entries(g))m.setRequestHeader(w,b);l&&(m.upload.onprogress=w=>{l({loaded:w.loaded,total:w.total,fraction:w.lengthComputable?w.loaded/w.total:null,lengthComputable:w.lengthComputable})});function h(){m.abort()}c?.addEventListener("abort",h),m.onload=()=>{c?.removeEventListener("abort",h);const w=m.status>=200&&m.status<300,b=m.getResponseHeader("content-type")??"";if(!w){const x=xc(m.responseText),v=(typeof x=="object"&&x!==null?x.detail??x.message:void 0)??`Erro ${m.status}`,$={status:m.status,detail:String(v),body:x};f($);return}if(m.status===204||!m.responseText){p(void 0);return}if(b.includes("application/json"))try{p(d(m.responseText))}catch(x){f(x)}else p(m.responseText)},m.onerror=()=>{c?.removeEventListener("abort",h),f({status:0,detail:"Falha de rede no upload."})},m.onabort=()=>{c?.removeEventListener("abort",h),f(new DOMException("Aborted","AbortError"))},m.send(n)})}function jc(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException("Aborted","AbortError"));return}const s=setTimeout(n,e);t?.addEventListener("abort",()=>{clearTimeout(s),r(new DOMException("Aborted","AbortError"))},{once:!0})})}async function Sc(e,t={}){const{retries:n=3,initialDelay:r=300,maxDelay:s=1e4,shouldRetry:o=()=>!0,onRetry:i,signal:l}=t;let c=0,d;for(;c<n;){if(l?.aborted)throw new DOMException("Aborted","AbortError");try{return await e()}catch(p){if(d=p,c+=1,c>=n||!o(p,c))throw p;const f=Math.min(r*2**(c-1),s);i?.({attempt:c,delay:f,error:p}),await jc(f,l)}}throw d}function kc(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16;return(e==="x"?Math.floor(t):Math.floor(t)&3|8).toString(16)})}function $c(e,t){const{interval:n,disabled:r=!1,stopWhen:s,onError:o}=t,[i,l]=u.useState(null),[c,d]=u.useState(null),[p,f]=u.useState(!r),m=u.useRef(r),_=u.useRef(!1),g=u.useRef(null);async function h(){if(!(m.current||_.current)){_.current=!0;try{const w=await e();if(m.current)return;l(w),d(null),s?.(w)&&(m.current=!0)}catch(w){m.current||(d(w),o?.(w))}finally{_.current=!1,f(!1),m.current||(g.current=setTimeout(h,n))}}}return u.useEffect(()=>{if(m.current=r,r){g.current&&clearTimeout(g.current);return}return f(!0),h(),()=>{m.current=!0,g.current&&clearTimeout(g.current)}},[n,r]),{data:i,error:c,loading:p,stop:()=>{m.current=!0,g.current&&clearTimeout(g.current)},start:()=>{m.current&&(m.current=!1,h())}}}function Ec(e={}){const t=e.name??"tempest-auth",n=e.storage==="session"?()=>sessionStorage:()=>localStorage;return at.create()(Se.persist(r=>({user:e.initialUser??null,token:e.initialToken??null,isAuthenticated:!!e.initialToken,setSession:({user:s,token:o})=>r({user:s,token:o,isAuthenticated:!0}),setUser:s=>r({user:s}),setToken:s=>r({token:s,isAuthenticated:!!s}),logout:()=>r({user:null,token:null,isAuthenticated:!1})}),{name:t,storage:Se.createJSONStorage(n),partialize:r=>({user:r.user,token:r.token}),onRehydrateStorage:()=>r=>{r&&(r.isAuthenticated=!!r.token)}}))}function Nc({isAuthenticated:e,children:t,fallback:n}){return a.jsx(a.Fragment,{children:e?t:n})}function Ce(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);return typeof atob<"u"?atob(t+n):Buffer.from(t+n,"base64").toString("binary")}function Fe(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid JWT: must contain three segments.");const[n,r,s]=t;try{return{header:JSON.parse(Ce(n)),payload:JSON.parse(Ce(r)),signature:s}}catch{throw new Error("Invalid JWT: header or payload is not valid JSON.")}}function Cc(e,t=0){try{const{payload:n}=Fe(e);if(typeof n.exp!="number")return!0;const r=Math.floor(Date.now()/1e3);return n.exp<=r+t}catch{return!0}}function Tc(e,t={}){const{retries:n=3,initialDelay:r=400,reloadOnFinalFailure:s=!0}=t;async function o(i=1){try{return await e()}catch(l){if(i>=n)throw s&&typeof window<"u"&&window.location.reload(),l;return await new Promise(c=>setTimeout(c,r*2**(i-1))),o(i+1)}}return u.lazy(o)}function Ic(e){let t=null;return()=>t||(t=(async()=>{try{await e()}finally{t=null}})(),t)}const Ae={SHORT:30*1e3,DEFAULT:300*1e3,LONG:1800*1e3,INFINITE:1/0},We={SHORT:300*1e3,DEFAULT:1800*1e3,LONG:3600*1e3},Lc={REALTIME:5*1e3,FAST:30*1e3,DEFAULT:60*1e3,SLOW:300*1e3};function Pc(e,t){const n={all:[e]};for(const[r,s]of Object.entries(t))typeof s=="function"?n[r]=(...o)=>[e,...s(...o)]:n[r]=[e,...s];return n}function Rc({children:e,client:t,defaultOptions:n}){const[r]=u.useState(()=>t??new je.QueryClient({defaultOptions:{queries:{staleTime:Ae.DEFAULT,gcTime:We.DEFAULT,retry:1,refetchOnWindowFocus:!1,...n?.queries??{}},mutations:{retry:0,...n?.mutations??{}}}}));return a.jsx(je.QueryClientProvider,{client:r,children:e})}function Dc(e){try{return JSON.parse(e)}catch{return e}}function Oe(e,t={}){const{withCredentials:n=!1,namedEvents:r=[],heartbeatEvents:s=["ping"],maxRetries:o=10,initialBackoff:i=1e3,maxBackoff:l=3e4,parser:c=Dc,onOpen:d,onMessage:p,onError:f,onStatusChange:m}=t;let _=null,g=null,h=0,w="idle",b=!1;function x(j){w!==j&&(w=j,m?.(j))}function v(j,E){s.includes(j)||p?.({event:j,data:c(E.data),id:E.lastEventId||void 0,raw:E})}function $(){if(b)return;if(h>=o){x("error");return}const j=Math.min(i*2**h,l);h+=1,g=setTimeout(N,j)}function N(){if(b)return;_&&_.close(),x("connecting");const j=new EventSource(e,{withCredentials:n});_=j,j.onopen=()=>{h=0,x("open"),d?.()},j.onmessage=E=>v("message",E);for(const E of r)j.addEventListener(E,de=>v(E,de));for(const E of s)j.addEventListener(E,()=>{});j.onerror=E=>{f?.(E),j.close(),_=null,x("closed"),$()}}function le(){b=!0,g&&(clearTimeout(g),g=null),h=0,_&&(_.close(),_=null),x("closed")}function ue(){g&&(clearTimeout(g),g=null),h=0,b=!1,N()}return N(),{close:le,reconnect:ue,get status(){return w}}}function Mc(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);return p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const f=Oe(e,{...s,onStatusChange:i,onMessage:m=>{c(m),p.current?.(m)}});return d.current=f.reconnect,()=>{f.close(),d.current=null}},[e,n]),{status:o,lastMessage:l,reconnect:()=>d.current?.()}}function Be(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),o=new Uint8Array(s);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}function ne(){return typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}class ye extends Error{constructor(){super("Web Push não suportado neste navegador."),this.name="WebPushUnsupportedError"}}class ze extends Error{constructor(){super("Permissão de notificação negada pelo usuário."),this.name="WebPushPermissionDeniedError"}}class qe{config;constructor(t){this.config=t}static isSupported(){return ne()}async registration(){if(!ne())throw new ye;return this.config.getRegistration?await this.config.getRegistration():await navigator.serviceWorker.ready}permission(){return typeof Notification>"u"?"unsupported":Notification.permission}async requestPermission(){if(typeof Notification>"u")throw new ye;return Notification.requestPermission()}async getSubscription(){return(await this.registration()).pushManager.getSubscription()}async isSubscribed(){return ne()?await this.getSubscription()!==null:!1}async subscribe(){if(await this.requestPermission()!=="granted")throw new ze;const n=await this.registration(),r=await n.pushManager.getSubscription();if(r)return await this.config.onSubscribe(r.toJSON()),r;const s=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Be(this.config.vapidPublicKey)});return await this.config.onSubscribe(s.toJSON()),s}async unsubscribe(){const t=await this.getSubscription();return t?(this.config.onUnsubscribe&&await this.config.onUnsubscribe(t.toJSON()),t.unsubscribe()):!1}}function Fc(e){const t=u.useRef(e);t.current=e;const n=u.useMemo(()=>new qe({vapidPublicKey:e.vapidPublicKey,onSubscribe:h=>t.current.onSubscribe(h),onUnsubscribe:h=>t.current.onUnsubscribe?.(h),getRegistration:e.getRegistration}),[e.vapidPublicKey,e.getRegistration]),[r]=u.useState(()=>ne()),[s,o]=u.useState(()=>n.permission()),[i,l]=u.useState(!1),[c,d]=u.useState(!1),[p,f]=u.useState(null),m=u.useCallback(async()=>{if(r){o(n.permission());try{const h=await n.isSubscribed();l(h)}catch(h){f(h instanceof Error?h:new Error(String(h)))}}},[n,r]);u.useEffect(()=>{m()},[m]);const _=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.subscribe(),l(!0),o(n.permission())}catch(h){throw f(h instanceof Error?h:new Error(String(h))),h}finally{d(!1)}}},[n,r]),g=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.unsubscribe(),l(!1)}catch(h){throw f(h instanceof Error?h:new Error(String(h))),h}finally{d(!1)}}},[n,r]);return{supported:r,permission:s,subscribed:i,loading:c,error:p,subscribe:_,unsubscribe:g,refresh:m}}async function Ac(e){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const t=await navigator.serviceWorker.register(e.url,{scope:e.scope});return t.active&&e.onReady?.(t),t.addEventListener("updatefound",()=>{const n=t.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&e.onUpdate?.(n,t)})}),t}catch(t){return e.onError?.(t),null}}function Wc(e){e.postMessage({type:"SKIP_WAITING"})}async function Oc(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return 0;const e=await navigator.serviceWorker.getRegistrations();let t=0;for(const n of e)await n.unregister()&&(t+=1);return t}function we(){return globalThis}function Bc(e={}){const t=we(),{defaultTitle:n="Notificação",defaultIcon:r,defaultBadge:s,transform:o}=e;t.addEventListener("push",i=>{if(!i.data)return;let l;try{l=i.data.json()}catch{l={title:n,body:i.data.text()}}const c=o?o(l):l;if(!c)return;const d=c.title??n,p={body:c.body,icon:c.icon??r,badge:c.badge??s,image:c.image,tag:c.tag,data:{url:c.url??"/",...c.data??{}}};i.waitUntil(t.registration.showNotification(d,p))})}function zc(e={}){const t=we(),n=e.resolveUrl??(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"&&"url"in r){const s=r.url;return typeof s=="string"?s:"/"}return"/"});t.addEventListener("notificationclick",r=>{r.notification.close();const s=n(r.notification.data);r.waitUntil((async()=>{const o=await t.clients.matchAll({type:"window",includeUncontrolled:!0});for(const i of o)if(i.url.includes(s))return i.focus();return t.clients.openWindow(s)})())})}function qc(){const e=we();e.addEventListener("message",t=>{t.data?.type==="SKIP_WAITING"&&e.skipWaiting()})}function xe(){let e=null;async function t(r,{volume:s=1,loop:o=!1,autoplay:i=!0,stopPrevious:l=!1,onEnded:c,onError:d}={}){try{l&&e&&(e.pause(),e.currentTime=0);const p=new Audio(r);return p.volume=Math.max(0,Math.min(1,s)),p.loop=o,p.preload="auto",c&&(p.onended=c),d&&(p.onerror=f=>d(f)),e=p,i&&await p.play(),p}catch(p){return d?.(p),null}}function n(){e&&(e.pause(),e.currentTime=0)}return{play:t,stop:n,current:()=>e}}let he=null;function Ue(){return he||(he=xe()),he}async function Uc(e,t){return Ue().play(e,t)}function Jc(){Ue().stop()}function Gc(){const e=u.useRef(null),[t,n]=u.useState(!1);e.current||(e.current=xe()),u.useEffect(()=>()=>{e.current?.stop()},[]);const r=u.useCallback(async(o,i)=>{await e.current.play(o,i)&&n(!0)},[]),s=u.useCallback(()=>{e.current?.stop()},[]);return{play:r,stop:s,unlocked:t}}class Hc extends ct{store;constructor(t,n,r,s){super(t),this.version(n).stores({[r]:s}),this.store=this.table(r)}}function Kc(e){const{databaseName:t,version:n,tableName:r,indexes:s,keyPath:o="id",ownerField:i}=e,l=new Hc(t,n,r,s),c=l.store;function d(f,m){return!i||!m?f:{...f,[i]:m}}async function p(f,m={}){const{orderBy:_=o,reverse:g=!1,limit:h,offset:w,filter:b}=m;let x=i&&f?c.where(i).equals(f):c.toCollection();b&&(x=x.filter(b));let v=_===o?await x.toArray():await x.sortBy(_);return g&&(v=v.reverse()),w&&(v=v.slice(w)),typeof h=="number"&&(v=v.slice(0,h)),v}return{put:(f,m)=>c.put(d(f,m)),bulkPut:(f,m)=>c.bulkPut(f.map(_=>d(_,m))),get:f=>c.get(f),list:p,update:(f,m)=>c.update(f,m),updateMany:async(f,m)=>{const _=m;return i&&f?c.where(i).equals(f).modify(_):c.toCollection().modify(_)},delete:f=>c.delete(f),clear:async f=>{if(i&&f){await c.where(i).equals(f).delete();return}await c.clear()},count:f=>i&&f?c.where(i).equals(f).count():c.count(),raw:c,db:l}}function Vc(e=[],t=[]){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!0;return!1}class Qc extends u.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t){this.state.error&&Vc(t.resetKeys,this.props.resetKeys)&&this.reset()}reset=()=>{this.setState({error:null})};render(){const{error:t}=this.state;if(!t)return this.props.children;const{fallback:n}=this.props;return typeof n=="function"?n({error:t,reset:this.reset}):n}}function Zc(){const[,e]=u.useState(null);return u.useCallback(t=>{e(()=>{throw t instanceof Error?t:new Error(String(t))})},[])}function Yc(e,t){const n=e.safeParse(t);if(n.success)return{success:!0,data:n.data,errors:{}};const r={};for(const s of n.error.issues){const o=s.path.length===0?"_root":s.path.join(".");o in r||(r[o]=s.message)}return{success:!1,errors:r}}function Je(e){return async(t,n,r)=>{const s=e.safeParse(t);if(s.success)return{values:s.data,errors:{}};const o={},i=r.criteriaMode??"firstError";for(const l of s.error.issues){const c=l.path.length===0?"_root":l.path.join(".");i==="firstError"&&o[c]||(o[c]={type:l.code,message:l.message})}return{values:{},errors:o}}}function Xc(e,t={}){return lt.useForm({...t,resolver:Je(e)})}function re(e){return e.replace(/\D/g,"")}function el(e){const t=re(e);if(t.length!==11||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number);let r=0;for(let o=0;o<9;o++)r+=n[o]*(10-o);let s=r*10%11;if(s===10&&(s=0),s!==n[9])return!1;r=0;for(let o=0;o<10;o++)r+=n[o]*(11-o);return s=r*10%11,s===10&&(s=0),s===n[10]}function tl(e){const t=re(e);if(t.length!==14||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number),r=[5,4,3,2,9,8,7,6,5,4,3,2],s=[6,5,4,3,2,9,8,7,6,5,4,3,2];let o=0;for(let l=0;l<12;l++)o+=n[l]*r[l];let i=o%11;if(i=i<2?0:11-i,i!==n[12])return!1;o=0;for(let l=0;l<13;l++)o+=n[l]*s[l];return i=o%11,i=i<2?0:11-i,i===n[13]}function Ge(e){return re(e).slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")}function He(e){return re(e).slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2")}function nl(e){return re(e)}function rl(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)}function sl(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR").format(t)}function ol(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR",{dateStyle:"short",timeStyle:"short"}).format(t)}function Ke(e){const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")}function Ve(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}function il(e){return new Intl.NumberFormat("pt-BR",{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}function ce(e,t="numeric"){return u.forwardRef(function({value:r,onChange:s,...o},i){return a.jsx(ie,{...o,ref:i,value:e(r??""),inputMode:t,onChange:l=>s(e(l.target.value))})})}const al=ce(Ve),cl=ce(He),ll=ce(Ke,"tel"),ul=ce(Ge);function dl(e,t,n){return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e/100)}function pl(e){const t=e.replace(/\D/g,"");return t?Number.parseInt(t,10):0}const fl=u.forwardRef(function({value:t,onChange:n,currency:r="BRL",locale:s="pt-BR",...o},i){return a.jsx(ie,{...o,ref:i,type:"text",inputMode:"numeric",value:dl(t||0,s,r),onChange:l=>n(pl(l.target.value))})});function ml(){const[e,t]=u.useState(!1),[n,r]=u.useState(null),[s,o]=u.useState(null),i=u.useCallback(async c=>{const d=c.replace(/\D/g,"");if(d.length!==8)return r("CEP inválido."),null;t(!0),r(null);try{const f=await(await fetch(`https://viacep.com.br/ws/${d}/json/`)).json();return"erro"in f&&f.erro?(r("CEP não encontrado."),o(null),null):(o(f),f)}catch(p){return r(p instanceof Error?p.message:String(p)),null}finally{t(!1)}},[]),l=u.useCallback(()=>{t(!1),r(null),o(null)},[]);return{loading:e,error:n,data:s,lookup:i,reset:l}}function hl(e){try{return JSON.parse(e)}catch{return e}}function Qe(e,t={}){const{protocols:n,maxRetries:r=10,initialBackoff:s=1e3,maxBackoff:o=3e4,pingInterval:i=0,pingPayload:l=JSON.stringify({type:"ping"}),parser:c=hl,onOpen:d,onMessage:p,onClose:f,onError:m,onStatusChange:_}=t;let g=null,h=null,w=null,b=0,x="idle",v=!1;function $(S){x!==S&&(x=S,_?.(S))}function N(){w&&(clearInterval(w),w=null)}function le(){!i||i<=0||(N(),w=setInterval(()=>{g?.readyState===WebSocket.OPEN&&g.send(l)},i))}function ue(){if(v)return;if(b>=r){$("error");return}const S=Math.min(s*2**b,o);b+=1,h=setTimeout(j,S)}function j(){if(v)return;g&&(g.onopen=null,g.onmessage=null,g.onclose=null,g.onerror=null,g.close()),$("connecting");const S=new WebSocket(e,n);g=S,S.onopen=T=>{b=0,$("open"),le(),d?.(T)},S.onmessage=T=>{const it=typeof T.data=="string"?T.data:"";p?.({data:c(it),raw:T})},S.onerror=T=>{m?.(T)},S.onclose=T=>{N(),f?.(T),g=null,$("closed"),!v&&!T.wasClean&&ue()}}function E(S){return g?.readyState!==WebSocket.OPEN?!1:(g.send(S),!0)}function de(S,T){v=!0,h&&(clearTimeout(h),h=null),N(),b=0,g&&($("closing"),g.close(S,T),g=null),$("closed")}function ot(){h&&(clearTimeout(h),h=null),b=0,v=!1,j()}return j(),{send:E,close:de,reconnect:ot,get status(){return x}}}function _l(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const _=Qe(e,{...s,onStatusChange:i,onMessage:g=>{c(g),p.current?.(g)}});return d.current=_,()=>{_.close(),d.current=null}},[e,n]);const f=u.useCallback(_=>d.current?.send(_)??!1,[]),m=u.useCallback(()=>{d.current?.reconnect()},[]);return{status:o,lastMessage:l,send:f,reconnect:m}}const Ze=u.createContext(null);function Te(e){return e==="dark"||e==="light"?e:typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function gl(e){if(!e||typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function yl({children:e,defaultTheme:t="system",storageKey:n="tempest-theme",target:r,attribute:s="data-tempest-theme"}){const[o,i]=u.useState(()=>gl(n)??t),[l,c]=u.useState(()=>Te(o)),d=u.useRef(r);d.current=r,u.useEffect(()=>{const _=d.current?.()??document.documentElement;if(!_)return;const g=Te(o);_.setAttribute(s,g),c(g)},[o,s]),u.useEffect(()=>{if(o!=="system"||typeof window>"u")return;const _=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{const h=d.current?.()??document.documentElement,w=_.matches?"dark":"light";h?.setAttribute(s,w),c(w)};return _.addEventListener("change",g),()=>_.removeEventListener("change",g)},[o,s]);const p=u.useCallback(_=>{if(i(_),n&&typeof window<"u")try{window.localStorage.setItem(n,_)}catch{}},[n]),f=u.useCallback(()=>{p(l==="dark"?"light":"dark")},[l,p]),m=u.useMemo(()=>({theme:o,resolvedTheme:l,setTheme:p,toggle:f}),[o,l,p,f]);return a.jsx(Ze.Provider,{value:m,children:e})}function bl(){const e=u.useContext(Ze);if(!e)throw new Error("useTheme must be used inside a <ThemeProvider>");return e}function wl(e={}){const{storageKey:t="tempest-theme",defaultTheme:n="system"}=e;if(typeof window>"u")return n==="dark"?"dark":"light";let r=null;try{r=window.localStorage.getItem(t)}catch{r=null}const s=r??n;return s==="dark"||s==="light"?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xl(e={}){const t=e.storageKey??"tempest-theme",n=e.defaultTheme??"system";return`
5
+ Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida do servidor (${n}).`)}function Yc(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function el(e){const{url:t,body:n,method:r="POST",headers:s={},getToken:o,withCredentials:a=!1,onProgress:c,signal:l,parser:d=JSON.parse}=e;return new Promise((p,f)=>{if(l?.aborted){f(new DOMException("Aborted","AbortError"));return}const m=new XMLHttpRequest;m.open(r,t),m.withCredentials=a;const h=o?.(),g={...s};h&&!("Authorization"in g)&&(g.Authorization=`Bearer ${h}`);for(const[w,y]of Object.entries(g))m.setRequestHeader(w,y);c&&(m.upload.onprogress=w=>{c({loaded:w.loaded,total:w.total,fraction:w.lengthComputable?w.loaded/w.total:null,lengthComputable:w.lengthComputable})});function _(){m.abort()}l?.addEventListener("abort",_),m.onload=()=>{l?.removeEventListener("abort",_);const w=m.status>=200&&m.status<300,y=m.getResponseHeader("content-type")??"";if(!w){const x=Yc(m.responseText),v=(typeof x=="object"&&x!==null?x.detail??x.message:void 0)??`Erro ${m.status}`,N={status:m.status,detail:String(v),body:x};f(N);return}if(m.status===204||!m.responseText){p(void 0);return}if(y.includes("application/json"))try{p(d(m.responseText))}catch(x){f(x)}else p(m.responseText)},m.onerror=()=>{l?.removeEventListener("abort",_),f({status:0,detail:"Falha de rede no upload."})},m.onabort=()=>{l?.removeEventListener("abort",_),f(new DOMException("Aborted","AbortError"))},m.send(n)})}function tl(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException("Aborted","AbortError"));return}const s=setTimeout(n,e);t?.addEventListener("abort",()=>{clearTimeout(s),r(new DOMException("Aborted","AbortError"))},{once:!0})})}async function nl(e,t={}){const{retries:n=3,initialDelay:r=300,maxDelay:s=1e4,shouldRetry:o=()=>!0,onRetry:a,signal:c}=t;let l=0,d;for(;l<n;){if(c?.aborted)throw new DOMException("Aborted","AbortError");try{return await e()}catch(p){if(d=p,l+=1,l>=n||!o(p,l))throw p;const f=Math.min(r*2**(l-1),s);a?.({attempt:l,delay:f,error:p}),await tl(f,c)}}throw d}function rl(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16;return(e==="x"?Math.floor(t):Math.floor(t)&3|8).toString(16)})}function sl(e,t){const{interval:n,disabled:r=!1,stopWhen:s,onError:o}=t,[a,c]=u.useState(null),[l,d]=u.useState(null),[p,f]=u.useState(!r),m=u.useRef(r),h=u.useRef(!1),g=u.useRef(null);async function _(){if(!(m.current||h.current)){h.current=!0;try{const w=await e();if(m.current)return;c(w),d(null),s?.(w)&&(m.current=!0)}catch(w){m.current||(d(w),o?.(w))}finally{h.current=!1,f(!1),m.current||(g.current=setTimeout(_,n))}}}return u.useEffect(()=>{if(m.current=r,r){g.current&&clearTimeout(g.current);return}return f(!0),_(),()=>{m.current=!0,g.current&&clearTimeout(g.current)}},[n,r]),{data:a,error:l,loading:p,stop:()=>{m.current=!0,g.current&&clearTimeout(g.current)},start:()=>{m.current&&(m.current=!1,_())}}}function ol(e={}){const t=e.name??"tempest-auth",n=e.storage==="session"?()=>sessionStorage:()=>localStorage;return mt.create()(Ne.persist(r=>({user:e.initialUser??null,token:e.initialToken??null,isAuthenticated:!!e.initialToken,setSession:({user:s,token:o})=>r({user:s,token:o,isAuthenticated:!0}),setUser:s=>r({user:s}),setToken:s=>r({token:s,isAuthenticated:!!s}),logout:()=>r({user:null,token:null,isAuthenticated:!1})}),{name:t,storage:Ne.createJSONStorage(n),partialize:r=>({user:r.user,token:r.token}),onRehydrateStorage:()=>r=>{r&&(r.isAuthenticated=!!r.token)}}))}function il({isAuthenticated:e,children:t,fallback:n}){return i.jsx(i.Fragment,{children:e?t:n})}function Re(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);return typeof atob<"u"?atob(t+n):Buffer.from(t+n,"base64").toString("binary")}function Ue(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid JWT: must contain three segments.");const[n,r,s]=t;try{return{header:JSON.parse(Re(n)),payload:JSON.parse(Re(r)),signature:s}}catch{throw new Error("Invalid JWT: header or payload is not valid JSON.")}}function al(e,t=0){try{const{payload:n}=Ue(e);if(typeof n.exp!="number")return!0;const r=Math.floor(Date.now()/1e3);return n.exp<=r+t}catch{return!0}}function cl(e,t={}){const{retries:n=3,initialDelay:r=400,reloadOnFinalFailure:s=!0}=t;async function o(a=1){try{return await e()}catch(c){if(a>=n)throw s&&typeof window<"u"&&window.location.reload(),c;return await new Promise(l=>setTimeout(l,r*2**(a-1))),o(a+1)}}return u.lazy(o)}function ll(e){let t=null;return()=>t||(t=(async()=>{try{await e()}finally{t=null}})(),t)}const Ge={SHORT:30*1e3,DEFAULT:300*1e3,LONG:1800*1e3,INFINITE:1/0},He={SHORT:300*1e3,DEFAULT:1800*1e3,LONG:3600*1e3},ul={REALTIME:5*1e3,FAST:30*1e3,DEFAULT:60*1e3,SLOW:300*1e3};function dl(e,t){const n={all:[e]};for(const[r,s]of Object.entries(t))typeof s=="function"?n[r]=(...o)=>[e,...s(...o)]:n[r]=[e,...s];return n}function pl({children:e,client:t,defaultOptions:n}){const[r]=u.useState(()=>t??new $e.QueryClient({defaultOptions:{queries:{staleTime:Ge.DEFAULT,gcTime:He.DEFAULT,retry:1,refetchOnWindowFocus:!1,...n?.queries??{}},mutations:{retry:0,...n?.mutations??{}}}}));return i.jsx($e.QueryClientProvider,{client:r,children:e})}function fl(e){try{return JSON.parse(e)}catch{return e}}function Je(e,t={}){const{withCredentials:n=!1,namedEvents:r=[],heartbeatEvents:s=["ping"],maxRetries:o=10,initialBackoff:a=1e3,maxBackoff:c=3e4,parser:l=fl,onOpen:d,onMessage:p,onError:f,onStatusChange:m}=t;let h=null,g=null,_=0,w="idle",y=!1;function x(j){w!==j&&(w=j,m?.(j))}function v(j,E){s.includes(j)||p?.({event:j,data:l(E.data),id:E.lastEventId||void 0,raw:E})}function N(){if(y)return;if(_>=o){x("error");return}const j=Math.min(a*2**_,c);_+=1,g=setTimeout(C,j)}function C(){if(y)return;h&&h.close(),x("connecting");const j=new EventSource(e,{withCredentials:n});h=j,j.onopen=()=>{_=0,x("open"),d?.()},j.onmessage=E=>v("message",E);for(const E of r)j.addEventListener(E,me=>v(E,me));for(const E of s)j.addEventListener(E,()=>{});j.onerror=E=>{f?.(E),j.close(),h=null,x("closed"),N()}}function pe(){y=!0,g&&(clearTimeout(g),g=null),_=0,h&&(h.close(),h=null),x("closed")}function fe(){g&&(clearTimeout(g),g=null),_=0,y=!1,C()}return C(),{close:pe,reconnect:fe,get status(){return w}}}function ml(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,a]=u.useState("idle"),[c,l]=u.useState(null),d=u.useRef(null),p=u.useRef(r);return p.current=r,u.useEffect(()=>{if(!n||!e){a("idle");return}const f=Je(e,{...s,onStatusChange:a,onMessage:m=>{l(m),p.current?.(m)}});return d.current=f.reconnect,()=>{f.close(),d.current=null}},[e,n]),{status:o,lastMessage:c,reconnect:()=>d.current?.()}}function Ke(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),o=new Uint8Array(s);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a);return o}function re(){return typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}class xe extends Error{constructor(){super("Web Push não suportado neste navegador."),this.name="WebPushUnsupportedError"}}class Ve extends Error{constructor(){super("Permissão de notificação negada pelo usuário."),this.name="WebPushPermissionDeniedError"}}class Qe{config;constructor(t){this.config=t}static isSupported(){return re()}async registration(){if(!re())throw new xe;return this.config.getRegistration?await this.config.getRegistration():await navigator.serviceWorker.ready}permission(){return typeof Notification>"u"?"unsupported":Notification.permission}async requestPermission(){if(typeof Notification>"u")throw new xe;return Notification.requestPermission()}async getSubscription(){return(await this.registration()).pushManager.getSubscription()}async isSubscribed(){return re()?await this.getSubscription()!==null:!1}async subscribe(){if(await this.requestPermission()!=="granted")throw new Ve;const n=await this.registration(),r=await n.pushManager.getSubscription();if(r)return await this.config.onSubscribe(r.toJSON()),r;const s=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ke(this.config.vapidPublicKey)});return await this.config.onSubscribe(s.toJSON()),s}async unsubscribe(){const t=await this.getSubscription();return t?(this.config.onUnsubscribe&&await this.config.onUnsubscribe(t.toJSON()),t.unsubscribe()):!1}}function hl(e){const t=u.useRef(e);t.current=e;const n=u.useMemo(()=>new Qe({vapidPublicKey:e.vapidPublicKey,onSubscribe:_=>t.current.onSubscribe(_),onUnsubscribe:_=>t.current.onUnsubscribe?.(_),getRegistration:e.getRegistration}),[e.vapidPublicKey,e.getRegistration]),[r]=u.useState(()=>re()),[s,o]=u.useState(()=>n.permission()),[a,c]=u.useState(!1),[l,d]=u.useState(!1),[p,f]=u.useState(null),m=u.useCallback(async()=>{if(r){o(n.permission());try{const _=await n.isSubscribed();c(_)}catch(_){f(_ instanceof Error?_:new Error(String(_)))}}},[n,r]);u.useEffect(()=>{m()},[m]);const h=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.subscribe(),c(!0),o(n.permission())}catch(_){throw f(_ instanceof Error?_:new Error(String(_))),_}finally{d(!1)}}},[n,r]),g=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.unsubscribe(),c(!1)}catch(_){throw f(_ instanceof Error?_:new Error(String(_))),_}finally{d(!1)}}},[n,r]);return{supported:r,permission:s,subscribed:a,loading:l,error:p,subscribe:h,unsubscribe:g,refresh:m}}async function _l(e){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const t=await navigator.serviceWorker.register(e.url,{scope:e.scope});return t.active&&e.onReady?.(t),t.addEventListener("updatefound",()=>{const n=t.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&e.onUpdate?.(n,t)})}),t}catch(t){return e.onError?.(t),null}}function gl(e){e.postMessage({type:"SKIP_WAITING"})}async function bl(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return 0;const e=await navigator.serviceWorker.getRegistrations();let t=0;for(const n of e)await n.unregister()&&(t+=1);return t}function je(){return globalThis}function yl(e={}){const t=je(),{defaultTitle:n="Notificação",defaultIcon:r,defaultBadge:s,transform:o}=e;t.addEventListener("push",a=>{if(!a.data)return;let c;try{c=a.data.json()}catch{c={title:n,body:a.data.text()}}const l=o?o(c):c;if(!l)return;const d=l.title??n,p={body:l.body,icon:l.icon??r,badge:l.badge??s,image:l.image,tag:l.tag,data:{url:l.url??"/",...l.data??{}}};a.waitUntil(t.registration.showNotification(d,p))})}function wl(e={}){const t=je(),n=e.resolveUrl??(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"&&"url"in r){const s=r.url;return typeof s=="string"?s:"/"}return"/"});t.addEventListener("notificationclick",r=>{r.notification.close();const s=n(r.notification.data);r.waitUntil((async()=>{const o=await t.clients.matchAll({type:"window",includeUncontrolled:!0});for(const a of o)if(a.url.includes(s))return a.focus();return t.clients.openWindow(s)})())})}function xl(){const e=je();e.addEventListener("message",t=>{t.data?.type==="SKIP_WAITING"&&e.skipWaiting()})}function ke(){let e=null;async function t(r,{volume:s=1,loop:o=!1,autoplay:a=!0,stopPrevious:c=!1,onEnded:l,onError:d}={}){try{c&&e&&(e.pause(),e.currentTime=0);const p=new Audio(r);return p.volume=Math.max(0,Math.min(1,s)),p.loop=o,p.preload="auto",l&&(p.onended=l),d&&(p.onerror=f=>d(f)),e=p,a&&await p.play(),p}catch(p){return d?.(p),null}}function n(){e&&(e.pause(),e.currentTime=0)}return{play:t,stop:n,current:()=>e}}let be=null;function Ze(){return be||(be=ke()),be}async function vl(e,t){return Ze().play(e,t)}function jl(){Ze().stop()}function kl(){const e=u.useRef(null),[t,n]=u.useState(!1);e.current||(e.current=ke()),u.useEffect(()=>()=>{e.current?.stop()},[]);const r=u.useCallback(async(o,a)=>{await e.current.play(o,a)&&n(!0)},[]),s=u.useCallback(()=>{e.current?.stop()},[]);return{play:r,stop:s,unlocked:t}}class Sl extends ht{store;constructor(t,n,r,s){super(t),this.version(n).stores({[r]:s}),this.store=this.table(r)}}function $l(e){const{databaseName:t,version:n,tableName:r,indexes:s,keyPath:o="id",ownerField:a}=e,c=new Sl(t,n,r,s),l=c.store;function d(f,m){return!a||!m?f:{...f,[a]:m}}async function p(f,m={}){const{orderBy:h=o,reverse:g=!1,limit:_,offset:w,filter:y}=m;let x=a&&f?l.where(a).equals(f):l.toCollection();y&&(x=x.filter(y));let v=h===o?await x.toArray():await x.sortBy(h);return g&&(v=v.reverse()),w&&(v=v.slice(w)),typeof _=="number"&&(v=v.slice(0,_)),v}return{put:(f,m)=>l.put(d(f,m)),bulkPut:(f,m)=>l.bulkPut(f.map(h=>d(h,m))),get:f=>l.get(f),list:p,update:(f,m)=>l.update(f,m),updateMany:async(f,m)=>{const h=m;return a&&f?l.where(a).equals(f).modify(h):l.toCollection().modify(h)},delete:f=>l.delete(f),clear:async f=>{if(a&&f){await l.where(a).equals(f).delete();return}await l.clear()},count:f=>a&&f?l.where(a).equals(f).count():l.count(),raw:l,db:c}}function Nl(e=[],t=[]){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!0;return!1}class El extends u.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t){this.state.error&&Nl(t.resetKeys,this.props.resetKeys)&&this.reset()}reset=()=>{this.setState({error:null})};render(){const{error:t}=this.state;if(!t)return this.props.children;const{fallback:n}=this.props;return typeof n=="function"?n({error:t,reset:this.reset}):n}}function Cl(){const[,e]=u.useState(null);return u.useCallback(t=>{e(()=>{throw t instanceof Error?t:new Error(String(t))})},[])}function Tl(e,t){const n=e.safeParse(t);if(n.success)return{success:!0,data:n.data,errors:{}};const r={};for(const s of n.error.issues){const o=s.path.length===0?"_root":s.path.join(".");o in r||(r[o]=s.message)}return{success:!1,errors:r}}function Xe(e){return async(t,n,r)=>{const s=e.safeParse(t);if(s.success)return{values:s.data,errors:{}};const o={},a=r.criteriaMode??"firstError";for(const c of s.error.issues){const l=c.path.length===0?"_root":c.path.join(".");a==="firstError"&&o[l]||(o[l]={type:c.code,message:c.message})}return{values:{},errors:o}}}function Il(e,t={}){return _t.useForm({...t,resolver:Xe(e)})}function se(e){return e.replace(/\D/g,"")}function Ll(e){const t=se(e);if(t.length!==11||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number);let r=0;for(let o=0;o<9;o++)r+=n[o]*(10-o);let s=r*10%11;if(s===10&&(s=0),s!==n[9])return!1;r=0;for(let o=0;o<10;o++)r+=n[o]*(11-o);return s=r*10%11,s===10&&(s=0),s===n[10]}function Rl(e){const t=se(e);if(t.length!==14||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number),r=[5,4,3,2,9,8,7,6,5,4,3,2],s=[6,5,4,3,2,9,8,7,6,5,4,3,2];let o=0;for(let c=0;c<12;c++)o+=n[c]*r[c];let a=o%11;if(a=a<2?0:11-a,a!==n[12])return!1;o=0;for(let c=0;c<13;c++)o+=n[c]*s[c];return a=o%11,a=a<2?0:11-a,a===n[13]}function Ye(e){return se(e).slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")}function et(e){return se(e).slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2")}function Pl(e){return se(e)}function Dl(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)}function Ml(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR").format(t)}function Al(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR",{dateStyle:"short",timeStyle:"short"}).format(t)}function tt(e){const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")}function nt(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}function Fl(e){return new Intl.NumberFormat("pt-BR",{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}function de(e,t="numeric"){return u.forwardRef(function({value:r,onChange:s,...o},a){return i.jsx(le,{...o,ref:a,value:e(r??""),inputMode:t,onChange:c=>s(e(c.target.value))})})}const Bl=de(nt),Wl=de(et),Ol=de(tt,"tel"),zl=de(Ye);function ql(e,t,n){return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e/100)}function Ul(e){const t=e.replace(/\D/g,"");return t?Number.parseInt(t,10):0}const Gl=u.forwardRef(function({value:t,onChange:n,currency:r="BRL",locale:s="pt-BR",...o},a){return i.jsx(le,{...o,ref:a,type:"text",inputMode:"numeric",value:ql(t||0,s,r),onChange:c=>n(Ul(c.target.value))})});function Hl(){const[e,t]=u.useState(!1),[n,r]=u.useState(null),[s,o]=u.useState(null),a=u.useCallback(async l=>{const d=l.replace(/\D/g,"");if(d.length!==8)return r("CEP inválido."),null;t(!0),r(null);try{const f=await(await fetch(`https://viacep.com.br/ws/${d}/json/`)).json();return"erro"in f&&f.erro?(r("CEP não encontrado."),o(null),null):(o(f),f)}catch(p){return r(p instanceof Error?p.message:String(p)),null}finally{t(!1)}},[]),c=u.useCallback(()=>{t(!1),r(null),o(null)},[]);return{loading:e,error:n,data:s,lookup:a,reset:c}}function Jl(e){try{return JSON.parse(e)}catch{return e}}function rt(e,t={}){const{protocols:n,maxRetries:r=10,initialBackoff:s=1e3,maxBackoff:o=3e4,pingInterval:a=0,pingPayload:c=JSON.stringify({type:"ping"}),parser:l=Jl,onOpen:d,onMessage:p,onClose:f,onError:m,onStatusChange:h}=t;let g=null,_=null,w=null,y=0,x="idle",v=!1;function N(S){x!==S&&(x=S,h?.(S))}function C(){w&&(clearInterval(w),w=null)}function pe(){!a||a<=0||(C(),w=setInterval(()=>{g?.readyState===WebSocket.OPEN&&g.send(c)},a))}function fe(){if(v)return;if(y>=r){N("error");return}const S=Math.min(s*2**y,o);y+=1,_=setTimeout(j,S)}function j(){if(v)return;g&&(g.onopen=null,g.onmessage=null,g.onclose=null,g.onerror=null,g.close()),N("connecting");const S=new WebSocket(e,n);g=S,S.onopen=I=>{y=0,N("open"),pe(),d?.(I)},S.onmessage=I=>{const ft=typeof I.data=="string"?I.data:"";p?.({data:l(ft),raw:I})},S.onerror=I=>{m?.(I)},S.onclose=I=>{C(),f?.(I),g=null,N("closed"),!v&&!I.wasClean&&fe()}}function E(S){return g?.readyState!==WebSocket.OPEN?!1:(g.send(S),!0)}function me(S,I){v=!0,_&&(clearTimeout(_),_=null),C(),y=0,g&&(N("closing"),g.close(S,I),g=null),N("closed")}function pt(){_&&(clearTimeout(_),_=null),y=0,v=!1,j()}return j(),{send:E,close:me,reconnect:pt,get status(){return x}}}function Kl(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,a]=u.useState("idle"),[c,l]=u.useState(null),d=u.useRef(null),p=u.useRef(r);p.current=r,u.useEffect(()=>{if(!n||!e){a("idle");return}const h=rt(e,{...s,onStatusChange:a,onMessage:g=>{l(g),p.current?.(g)}});return d.current=h,()=>{h.close(),d.current=null}},[e,n]);const f=u.useCallback(h=>d.current?.send(h)??!1,[]),m=u.useCallback(()=>{d.current?.reconnect()},[]);return{status:o,lastMessage:c,send:f,reconnect:m}}const st=u.createContext(null);function Pe(e){return e==="dark"||e==="light"?e:typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Vl(e){if(!e||typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function Ql({children:e,defaultTheme:t="system",storageKey:n="tempest-theme",target:r,attribute:s="data-tempest-theme"}){const[o,a]=u.useState(()=>Vl(n)??t),[c,l]=u.useState(()=>Pe(o)),d=u.useRef(r);d.current=r,u.useEffect(()=>{const h=d.current?.()??document.documentElement;if(!h)return;const g=Pe(o);h.setAttribute(s,g),l(g)},[o,s]),u.useEffect(()=>{if(o!=="system"||typeof window>"u")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{const _=d.current?.()??document.documentElement,w=h.matches?"dark":"light";_?.setAttribute(s,w),l(w)};return h.addEventListener("change",g),()=>h.removeEventListener("change",g)},[o,s]);const p=u.useCallback(h=>{if(a(h),n&&typeof window<"u")try{window.localStorage.setItem(n,h)}catch{}},[n]),f=u.useCallback(()=>{p(c==="dark"?"light":"dark")},[c,p]),m=u.useMemo(()=>({theme:o,resolvedTheme:c,setTheme:p,toggle:f}),[o,c,p,f]);return i.jsx(st.Provider,{value:m,children:e})}function Zl(){const e=u.useContext(st);if(!e)throw new Error("useTheme must be used inside a <ThemeProvider>");return e}function Xl(e={}){const{storageKey:t="tempest-theme",defaultTheme:n="system"}=e;if(typeof window>"u")return n==="dark"?"dark":"light";let r=null;try{r=window.localStorage.getItem(t)}catch{r=null}const s=r??n;return s==="dark"||s==="light"?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Yl(e={}){const t=e.storageKey??"tempest-theme",n=e.defaultTheme??"system";return`
6
6
  (function(){try{
7
7
  var key=${JSON.stringify(t)};
8
8
  var def=${JSON.stringify(n)};
@@ -11,5 +11,5 @@ Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida d
11
11
  var resolved=mode==="dark"||mode==="light"?mode:(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");
12
12
  document.documentElement.setAttribute("data-tempest-theme",resolved);
13
13
  }catch(e){}})();
14
- `.trim()}function Ie(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s===void 0?`{${r}}`:String(s)}):e}function _e(e,t,n,r){const s=e[t]?.[r];if(s!==void 0)return s;if(n){const o=e[n]?.[r];if(o!==void 0)return o}return null}function ve(e){const{locale:t,fallbackLocale:n=null,messages:r}=e;function s(c,d){const p=_e(r,t,n,c);return p===null?c:Ie(p,d)}function o(c,d,p){const m=_e(r,t,n,`${c}${d===1?"_one":"_other"}`)??_e(r,t,n,c);return m===null?c:Ie(m,{count:d,...p??{}})}function i(c,d){return new Intl.NumberFormat(t,d).format(c)}function l(c,d){const p=typeof c=="string"?new Date(c):c;return Number.isNaN(p.getTime())?"":new Intl.DateTimeFormat(t,d).format(p)}return{locale:t,fallbackLocale:n,t:s,plural:o,formatNumber:i,formatDate:l,withLocale:c=>ve({locale:c,fallbackLocale:n??void 0,messages:r})}}const Ye=u.createContext(null);function vl(e,t){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);return n&&t.includes(n)?n:null}catch{return null}}function jl({children:e,locale:t,fallbackLocale:n,messages:r,storageKey:s="tempest-locale"}){const o=u.useMemo(()=>Object.keys(r),[r]),[i,l]=u.useState(()=>vl(s,o)??t);u.useEffect(()=>{typeof document<"u"&&document.documentElement.setAttribute("lang",i)},[i]);const c=u.useCallback(p=>{if(l(p),s&&typeof window<"u")try{window.localStorage.setItem(s,p)}catch{}},[s]),d=u.useMemo(()=>({...ve({locale:i,fallbackLocale:n,messages:r}),setLocale:c,availableLocales:o}),[i,n,r,c,o]);return a.jsx(Ye.Provider,{value:d,children:e})}function Xe(){const e=u.useContext(Ye);if(!e)throw new Error("useI18n must be used inside an <I18nProvider>");return e}function Sl(){return Xe().t}const Le=["debug","info","warn","error"];function kl(e,t){return Le.indexOf(t)>=Le.indexOf(e)}const et=({level:e,message:t,context:n})=>{const r=e==="debug"?"log":e;n?console[r](t,n):console[r](t)};function tt(e={}){const t=e.level??"info",n=e.sinks??[et],r=e.namespace??"";function s(o,i,l){if(!kl(t,o))return;const c={level:o,message:r?`[${r}] ${i}`:i,context:l,timestamp:Date.now()};for(const d of n)try{d(c)}catch{}}return{debug:(o,i)=>s("debug",o,i),info:(o,i)=>s("info",o,i),warn:(o,i)=>s("warn",o,i),error:(o,i)=>s("error",o,i),child:o=>tt({level:t,sinks:n,namespace:r?`${r}:${o}`:o})}}const nt=u.createContext(null);function $l({adapter:e,children:t}){u.useEffect(()=>(e.init?.(),()=>{e.flush?.()}),[e]);const n=u.useMemo(()=>e,[e]);return a.jsx(nt.Provider,{value:n,children:t})}function El(){return u.useContext(nt)}const Nl={identify(e){console.info("[telemetry] identify",e)},track(e){console.info("[telemetry] track",e.name,e.properties)},captureException(e,t){console.error("[telemetry] exception",e,t)}};function Cl(e){if(e===null)return null;const{id:t,email:n,name:r,traits:s}=e;return{...t!==void 0?{id:t}:null,...n!==void 0?{email:n}:null,...r!==void 0?{username:r}:null,...s??null}}function Tl(e){const{sentry:t,initOptions:n,flushTimeout:r=2e3,breadcrumbCategory:s="app"}=e;return{init(){n&&t.init&&t.init(n)},identify(o){t.setUser(Cl(o))},track(o){t.addBreadcrumb({category:s,message:o.name,level:"info",...o.properties?{data:o.properties}:null})},captureException(o,i){t.captureException(o,i?{extra:i}:void 0)},async flush(){t.flush&&await t.flush(r)}}}function Il(e){const{email:t,name:n,traits:r}=e;return{...t!==void 0?{email:t}:null,...n!==void 0?{name:n}:null,...r??null}}function Ll(e){const{posthog:t,init:n}=e;return{init(){n&&t.init&&t.init(n.apiKey,n.options)},identify(r){if(r===null){t.reset?.();return}r.id!==void 0&&t.identify(r.id,Il(r))},track(r){t.capture(r.name,r.properties)},captureException(r,s){if(t.captureException){t.captureException(r,s);return}const o=r instanceof Error?r:new Error(String(r));t.capture("$exception",{$exception_message:o.message,$exception_type:o.name,$exception_stack_trace_raw:o.stack,...s})}}}const rt=u.createContext(null);function Pl({adapter:e,children:t}){const n=u.useMemo(()=>e,[e]);return u.useEffect(()=>{},[n]),a.jsx(rt.Provider,{value:n,children:t})}function st(){const e=u.useContext(rt);if(!e)throw new Error("useFeatureFlag requires <FeatureFlagsProvider>");return e}function Rl(e,t=!1){const n=st(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.isEnabled(e,t);return u.useSyncExternalStore(r,s,s)}function Dl(e,t){const n=st(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.get(e,t);return u.useSyncExternalStore(r,s,s)}function Ml(e={}){const t={...e.initial??{}},n=new Set;function r(){for(const s of n)s()}return{isEnabled(s,o=!1){return s in t?!!t[s]:o},get(s,o){return s in t?t[s]:o},onChange(s){return n.add(s),()=>n.delete(s)},set(s,o){t[s]=o,r()}}}function Fl(e){const{growthbook:t}=e,n=new Set;let r=!1;function s(){r||!t.setRenderer||(r=!0,t.setRenderer(()=>{for(const o of n)o()}))}return{isEnabled(o,i=!1){const l=t.isOn(o);return typeof l=="boolean"?l:i},get(o,i){return t.getFeatureValue(o,i)},onChange(o){return s(),n.add(o),()=>{n.delete(o)}}}}function Al(e){const{client:t}=e;return{isEnabled(n,r=!1){return t.variation(n,r)===!0},get(n,r){return t.variation(n,r)},onChange(n){return!t.on||!t.off?()=>{}:(t.on("change",n),()=>{t.off("change",n)})}}}async function Wl(e){if(typeof navigator>"u"||!("share"in navigator))return{shared:!1,unsupported:!0,cancelled:!1};if(e.files&&!navigator.canShare?.({files:e.files}))return{shared:!1,unsupported:!0,cancelled:!1};try{return await navigator.share(e),{shared:!0,unsupported:!1,cancelled:!1}}catch(t){return t instanceof DOMException&&t.name==="AbortError"?{shared:!1,unsupported:!1,cancelled:!0}:{shared:!1,unsupported:!1,cancelled:!1,error:t}}}function Ol(){return typeof navigator<"u"&&"share"in navigator}const Bl={get(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}},set(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}};exports.Alert=jt;exports.AuthGuard=Nc;exports.Avatar=At;exports.Badge=Xt;exports.Breadcrumbs=on;exports.Button=oe;exports.CACHE_TIME=We;exports.CEPInput=ul;exports.CNPJInput=cl;exports.CPFInput=al;exports.Card=On;exports.Checkbox=Kn;exports.ChipInput=ir;exports.ConfirmDialog=xr;exports.Container=ko;exports.DatePicker=Fr;exports.Divider=Jr;exports.Drawer=cs;exports.EmptyState=hs;exports.ErrorBoundary=Qc;exports.ErrorState=xs;exports.FeatureFlagsProvider=Pl;exports.FileUpload=As;exports.Form=to;exports.FormActions=so;exports.FormRow=ro;exports.FormSection=no;exports.Grid=Eo;exports.I18nProvider=jl;exports.Input=ie;exports.Kbd=Lo;exports.Modal=Pe;exports.MoneyInput=fl;exports.Pagination=Oo;exports.PhoneInput=ll;exports.Progress=Qo;exports.QueryProvider=Rc;exports.REFETCH_TIME=Lc;exports.Radio=ii;exports.RadioGroup=ai;exports.STALE_TIME=Ae;exports.SearchBar=pi;exports.Select=Si;exports.Skeleton=Ci;exports.Spinner=Fi;exports.Stack=$o;exports.Stepper=Gi;exports.Switch=Xi;exports.Table=la;exports.Tabs=ha;exports.TelemetryProvider=$l;exports.Textarea=ja;exports.ThemeProvider=yl;exports.ToastProvider=qa;exports.Tooltip=Ia;exports.VirtualList=Qa;exports.WebPushClient=qe;exports.WebPushPermissionDeniedError=ze;exports.WebPushUnsupportedError=ye;exports.cn=y;exports.consoleSink=et;exports.consoleTelemetryAdapter=Nl;exports.createApiClient=bc;exports.createAudioPlayer=xe;exports.createAuthStore=Ec;exports.createEventStream=Oe;exports.createGrowthBookFeatureFlagsAdapter=Fl;exports.createI18n=ve;exports.createInMemoryFlags=Ml;exports.createLaunchDarklyFeatureFlagsAdapter=Al;exports.createLogger=tt;exports.createOfflineStore=Kc;exports.createPostHogTelemetryAdapter=Ll;exports.createQueryKeys=Pc;exports.createRefreshQueue=Ic;exports.createSentryTelemetryAdapter=Tl;exports.createWebSocket=Qe;exports.decodeJWT=Fe;exports.formatCEP=Ge;exports.formatCNPJ=He;exports.formatCPF=Ve;exports.formatCurrency=rl;exports.formatDate=sl;exports.formatDateTime=ol;exports.formatPercent=il;exports.formatPhone=Ke;exports.generateIdempotencyKey=kc;exports.getInitialTheme=wl;exports.installNotificationClickHandler=zc;exports.installPushHandler=Bc;exports.installSkipWaitingListener=qc;exports.isJWTExpired=Cc;exports.isPushSupported=ne;exports.isShareSupported=Ol;exports.lazyWithRetry=Tc;exports.parseResponse=wc;exports.playAudio=Uc;exports.registerServiceWorker=Ac;exports.retry=Sc;exports.share=Wl;exports.skipWaiting=Wc;exports.stopAudio=Jc;exports.storage=Bl;exports.themeInitScript=xl;exports.unmask=nl;exports.unregisterAllServiceWorkers=Oc;exports.uploadWithProgress=vc;exports.urlBase64ToUint8Array=Be;exports.useAudio=Gc;exports.useBeforeInstallPrompt=lc;exports.useClientFilter=Xa;exports.useClipboard=oc;exports.useDebounce=Za;exports.useDeepMemo=_c;exports.useDocumentVisibility=nc;exports.useErrorHandler=Zc;exports.useEventStream=Mc;exports.useFeatureFlag=Rl;exports.useFlagValue=Dl;exports.useFocusTrap=mc;exports.useGeolocation=dc;exports.useI18n=Xe;exports.useIdle=uc;exports.useIntersectionObserver=rc;exports.useKeyboardShortcut=cc;exports.useMediaQuery=ec;exports.useOnline=tc;exports.usePagination=Ya;exports.usePoll=$c;exports.usePushSubscription=Fc;exports.useResizeObserver=sc;exports.useScrollLock=pc;exports.useStableCallback=hc;exports.useTelemetry=El;exports.useTheme=bl;exports.useToast=za;exports.useTranslate=Sl;exports.useViaCEP=ml;exports.useWebSocket=_l;exports.useZodForm=Xc;exports.validateCNPJ=tl;exports.validateCPF=el;exports.validateForm=Yc;exports.zodResolver=Je;
14
+ `.trim()}function De(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s===void 0?`{${r}}`:String(s)}):e}function ye(e,t,n,r){const s=e[t]?.[r];if(s!==void 0)return s;if(n){const o=e[n]?.[r];if(o!==void 0)return o}return null}function Se(e){const{locale:t,fallbackLocale:n=null,messages:r}=e;function s(l,d){const p=ye(r,t,n,l);return p===null?l:De(p,d)}function o(l,d,p){const m=ye(r,t,n,`${l}${d===1?"_one":"_other"}`)??ye(r,t,n,l);return m===null?l:De(m,{count:d,...p??{}})}function a(l,d){return new Intl.NumberFormat(t,d).format(l)}function c(l,d){const p=typeof l=="string"?new Date(l):l;return Number.isNaN(p.getTime())?"":new Intl.DateTimeFormat(t,d).format(p)}return{locale:t,fallbackLocale:n,t:s,plural:o,formatNumber:a,formatDate:c,withLocale:l=>Se({locale:l,fallbackLocale:n??void 0,messages:r})}}const ot=u.createContext(null);function eu(e,t){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);return n&&t.includes(n)?n:null}catch{return null}}function tu({children:e,locale:t,fallbackLocale:n,messages:r,storageKey:s="tempest-locale"}){const o=u.useMemo(()=>Object.keys(r),[r]),[a,c]=u.useState(()=>eu(s,o)??t);u.useEffect(()=>{typeof document<"u"&&document.documentElement.setAttribute("lang",a)},[a]);const l=u.useCallback(p=>{if(c(p),s&&typeof window<"u")try{window.localStorage.setItem(s,p)}catch{}},[s]),d=u.useMemo(()=>({...Se({locale:a,fallbackLocale:n,messages:r}),setLocale:l,availableLocales:o}),[a,n,r,l,o]);return i.jsx(ot.Provider,{value:d,children:e})}function it(){const e=u.useContext(ot);if(!e)throw new Error("useI18n must be used inside an <I18nProvider>");return e}function nu(){return it().t}const Me=["debug","info","warn","error"];function ru(e,t){return Me.indexOf(t)>=Me.indexOf(e)}const at=({level:e,message:t,context:n})=>{const r=e==="debug"?"log":e;n?console[r](t,n):console[r](t)};function ct(e={}){const t=e.level??"info",n=e.sinks??[at],r=e.namespace??"";function s(o,a,c){if(!ru(t,o))return;const l={level:o,message:r?`[${r}] ${a}`:a,context:c,timestamp:Date.now()};for(const d of n)try{d(l)}catch{}}return{debug:(o,a)=>s("debug",o,a),info:(o,a)=>s("info",o,a),warn:(o,a)=>s("warn",o,a),error:(o,a)=>s("error",o,a),child:o=>ct({level:t,sinks:n,namespace:r?`${r}:${o}`:o})}}const lt=u.createContext(null);function su({adapter:e,children:t}){u.useEffect(()=>(e.init?.(),()=>{e.flush?.()}),[e]);const n=u.useMemo(()=>e,[e]);return i.jsx(lt.Provider,{value:n,children:t})}function ou(){return u.useContext(lt)}const iu={identify(e){console.info("[telemetry] identify",e)},track(e){console.info("[telemetry] track",e.name,e.properties)},captureException(e,t){console.error("[telemetry] exception",e,t)}};function au(e){if(e===null)return null;const{id:t,email:n,name:r,traits:s}=e;return{...t!==void 0?{id:t}:null,...n!==void 0?{email:n}:null,...r!==void 0?{username:r}:null,...s??null}}function cu(e){const{sentry:t,initOptions:n,flushTimeout:r=2e3,breadcrumbCategory:s="app"}=e;return{init(){n&&t.init&&t.init(n)},identify(o){t.setUser(au(o))},track(o){t.addBreadcrumb({category:s,message:o.name,level:"info",...o.properties?{data:o.properties}:null})},captureException(o,a){t.captureException(o,a?{extra:a}:void 0)},async flush(){t.flush&&await t.flush(r)}}}function lu(e){const{email:t,name:n,traits:r}=e;return{...t!==void 0?{email:t}:null,...n!==void 0?{name:n}:null,...r??null}}function uu(e){const{posthog:t,init:n}=e;return{init(){n&&t.init&&t.init(n.apiKey,n.options)},identify(r){if(r===null){t.reset?.();return}r.id!==void 0&&t.identify(r.id,lu(r))},track(r){t.capture(r.name,r.properties)},captureException(r,s){if(t.captureException){t.captureException(r,s);return}const o=r instanceof Error?r:new Error(String(r));t.capture("$exception",{$exception_message:o.message,$exception_type:o.name,$exception_stack_trace_raw:o.stack,...s})}}}const ut=u.createContext(null);function du({adapter:e,children:t}){const n=u.useMemo(()=>e,[e]);return u.useEffect(()=>{},[n]),i.jsx(ut.Provider,{value:n,children:t})}function dt(){const e=u.useContext(ut);if(!e)throw new Error("useFeatureFlag requires <FeatureFlagsProvider>");return e}function pu(e,t=!1){const n=dt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.isEnabled(e,t);return u.useSyncExternalStore(r,s,s)}function fu(e,t){const n=dt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.get(e,t);return u.useSyncExternalStore(r,s,s)}function mu(e={}){const t={...e.initial??{}},n=new Set;function r(){for(const s of n)s()}return{isEnabled(s,o=!1){return s in t?!!t[s]:o},get(s,o){return s in t?t[s]:o},onChange(s){return n.add(s),()=>n.delete(s)},set(s,o){t[s]=o,r()}}}function hu(e){const{growthbook:t}=e,n=new Set;let r=!1;function s(){r||!t.setRenderer||(r=!0,t.setRenderer(()=>{for(const o of n)o()}))}return{isEnabled(o,a=!1){const c=t.isOn(o);return typeof c=="boolean"?c:a},get(o,a){return t.getFeatureValue(o,a)},onChange(o){return s(),n.add(o),()=>{n.delete(o)}}}}function _u(e){const{client:t}=e;return{isEnabled(n,r=!1){return t.variation(n,r)===!0},get(n,r){return t.variation(n,r)},onChange(n){return!t.on||!t.off?()=>{}:(t.on("change",n),()=>{t.off("change",n)})}}}async function gu(e){if(typeof navigator>"u"||!("share"in navigator))return{shared:!1,unsupported:!0,cancelled:!1};if(e.files&&!navigator.canShare?.({files:e.files}))return{shared:!1,unsupported:!0,cancelled:!1};try{return await navigator.share(e),{shared:!0,unsupported:!1,cancelled:!1}}catch(t){return t instanceof DOMException&&t.name==="AbortError"?{shared:!1,unsupported:!1,cancelled:!0}:{shared:!1,unsupported:!1,cancelled:!1,error:t}}}function bu(){return typeof navigator<"u"&&"share"in navigator}const yu={get(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}},set(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}};exports.Alert=Tt;exports.AuthGuard=il;exports.Avatar=Gt;exports.BREAKPOINTS=ae;exports.Badge=an;exports.Breadcrumbs=fn;exports.Button=ie;exports.CACHE_TIME=He;exports.CEPInput=zl;exports.CNPJInput=Wl;exports.CPFInput=Bl;exports.Card=Jn;exports.Checkbox=tr;exports.ChipInput=fr;exports.ConfirmDialog=Rr;exports.Container=Oo;exports.DatePicker=Vr;exports.Divider=rs;exports.Drawer=ks;exports.EmptyState=Is;exports.ErrorBoundary=El;exports.ErrorState=As;exports.FeatureFlagsProvider=du;exports.FileUpload=eo;exports.Form=bo;exports.FormActions=xo;exports.FormRow=wo;exports.FormSection=yo;exports.Grid=Go;exports.Hide=Ni;exports.I18nProvider=tu;exports.Input=le;exports.Kbd=Qo;exports.Modal=Ae;exports.MoneyInput=Gl;exports.Pagination=si;exports.PhoneInput=Ol;exports.Progress=mi;exports.QueryProvider=pl;exports.REFETCH_TIME=ul;exports.Radio=ki;exports.RadioGroup=Si;exports.STALE_TIME=Ge;exports.SearchBar=Li;exports.Select=Ui;exports.Show=$i;exports.Skeleton=Vi;exports.Spinner=ra;exports.Stack=qo;exports.Stepper=pa;exports.Switch=ya;exports.Table=Pa;exports.Tabs=Wa;exports.TelemetryProvider=su;exports.Textarea=Ka;exports.ThemeProvider=Ql;exports.ToastProvider=wc;exports.Tooltip=nc;exports.VirtualList=Ec;exports.WebPushClient=Qe;exports.WebPushPermissionDeniedError=Ve;exports.WebPushUnsupportedError=xe;exports.cn=b;exports.consoleSink=at;exports.consoleTelemetryAdapter=iu;exports.createApiClient=Zc;exports.createAudioPlayer=ke;exports.createAuthStore=ol;exports.createEventStream=Je;exports.createGrowthBookFeatureFlagsAdapter=hu;exports.createI18n=Se;exports.createInMemoryFlags=mu;exports.createLaunchDarklyFeatureFlagsAdapter=_u;exports.createLogger=ct;exports.createOfflineStore=$l;exports.createPostHogTelemetryAdapter=uu;exports.createQueryKeys=dl;exports.createRefreshQueue=ll;exports.createSentryTelemetryAdapter=cu;exports.createWebSocket=rt;exports.decodeJWT=Ue;exports.formatCEP=Ye;exports.formatCNPJ=et;exports.formatCPF=nt;exports.formatCurrency=Dl;exports.formatDate=Ml;exports.formatDateTime=Al;exports.formatPercent=Fl;exports.formatPhone=tt;exports.generateIdempotencyKey=rl;exports.getInitialTheme=Xl;exports.installNotificationClickHandler=wl;exports.installPushHandler=yl;exports.installSkipWaitingListener=xl;exports.isJWTExpired=al;exports.isPushSupported=re;exports.isShareSupported=bu;exports.lazyWithRetry=cl;exports.parseResponse=Xc;exports.playAudio=vl;exports.registerServiceWorker=_l;exports.retry=nl;exports.share=gu;exports.skipWaiting=gl;exports.stopAudio=jl;exports.storage=yu;exports.themeInitScript=Yl;exports.unmask=Pl;exports.unregisterAllServiceWorkers=bl;exports.uploadWithProgress=el;exports.urlBase64ToUint8Array=Ke;exports.useAudio=kl;exports.useBeforeInstallPrompt=Oc;exports.useBreakpoint=X;exports.useClientFilter=Ic;exports.useClipboard=Ac;exports.useDebounce=Cc;exports.useDeepMemo=Kc;exports.useDocumentVisibility=Pc;exports.useErrorHandler=Cl;exports.useEventStream=ml;exports.useFeatureFlag=pu;exports.useFlagValue=fu;exports.useFocusTrap=Hc;exports.useGeolocation=qc;exports.useI18n=it;exports.useIdle=zc;exports.useIntersectionObserver=Dc;exports.useKeyboardShortcut=Wc;exports.useMediaQuery=Lc;exports.useOnline=Rc;exports.usePagination=Tc;exports.usePoll=sl;exports.usePushSubscription=hl;exports.useResizeObserver=Mc;exports.useScrollLock=Uc;exports.useStableCallback=Jc;exports.useTelemetry=ou;exports.useTheme=Zl;exports.useToast=yc;exports.useTranslate=nu;exports.useViaCEP=Hl;exports.useWebSocket=Kl;exports.useZodForm=Il;exports.validateCNPJ=Rl;exports.validateCPF=Ll;exports.validateForm=Tl;exports.zodResolver=Xe;
15
15
  //# sourceMappingURL=tempest-react-sdk.cjs.map