forlogic-core 2.4.8 → 2.4.9
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.
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("i18next"),t=require("react/jsx-runtime"),a=require("react"),r=require("@radix-ui/react-slot"),s=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),c=require("lucide-react"),d=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),v=require("@radix-ui/react-tooltip"),b=require("@radix-ui/react-popover"),y=require("react-i18next"),w=require("@supabase/supabase-js"),j=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),A=require("@radix-ui/react-switch"),T=require("@radix-ui/react-avatar"),D=require("@radix-ui/react-collapsible"),P=require("@radix-ui/react-tabs"),E=require("@radix-ui/react-accordion"),M=require("react-day-picker"),I=require("vaul"),R=require("@radix-ui/react-hover-card"),L=require("@radix-ui/react-navigation-menu"),F=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),U=require("react-resizable-panels"),O=require("@radix-ui/react-slider"),B=require("@radix-ui/react-menubar"),q=require("recharts"),V=require("@tiptap/react"),$=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable"),J=require("zod"),Z="undefined"!=typeof document?document.currentScript:null;function ee(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,Object.freeze(t)}var te=ee(a),ae=ee(c),re=ee(d),se=ee(u),ne=ee(m),oe=ee(p),ie=ee(x),le=ee(f),ce=ee(g),de=ee(v),ue=ee(b),me=ee(_),pe=ee(C),he=ee(k),xe=ee(S),fe=ee(A),ge=ee(T),ve=ee(D),be=ee(P),ye=ee(E),we=ee(R),je=ee(L),Ne=ee(F),_e=ee(z),Ce=ee(U),ke=ee(O),Se=ee(B),Ae=ee(q);const Te={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api.qualiex.com",appBasePath:""},De={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com",appBasePath:""};function Pe(){return"DEV"===(void 0).VITE_APP_ENV?"DEV":"PROD"}let Ee={};function Me(){const e="DEV"===Pe()?De:Te;return{...e,...Ee,oauth:{...e.oauth,...Ee.oauth}}}function Ie(){return"DEV"===Pe()}let Re="supabase";function Le(e){Re=e}function Fe(){return"supabase"===Re}const ze={get oauth(){const e=Me();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:e.oauth.responseType,scope:e.oauth.scope}}};function Ue(e){const t=Me().appBasePath||"";return`${window.location.origin}${t}${e}`}function Oe(){return Me().appBasePath||""}function Be(e){const t=Oe();return t&&e.startsWith(t)?e.slice(t.length)||"/":e}const qe={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Ve={debounceDelay:500},$e=()=>{const e=window.location.origin,t=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&t||(void 0).DEV},We=()=>$e()&&Fe(),He=$e,Ge=()=>Me().qualiexApiUrl,Ke={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},Ye={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},Qe={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},Xe="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",Je={qualiex:`${Xe}/logo-qualiex-white.svg`,qualitfy:`${Xe}/logo-qualitfy-white.svg`,metroex:`${Xe}/logo-metroex-white.svg`,qualiexSmall:`${Xe}/logo-forlogic-white.svg`,saber:`${Xe}/saber-gestao-white.png`,saberSmall:`${Xe}/small.svg`},Ze=`${Xe}/favicon.png`;let et={};function tt(e){return et.logos?.[e]??Je[e]}const at={get qualiex(){return tt("qualiex")},get qualitfy(){return tt("qualitfy")},get metroex(){return tt("metroex")},get saber(){return tt("saber")},get qualiexSmall(){return tt("qualiexSmall")},get saberSmall(){return tt("saberSmall")}};function rt(e){return tt(Ye.isQualiex?e?.isMetroex?"metroex":e?.isQualitfy?"qualitfy":"qualiex":"saber")}const st={get logo(){return rt()},get smallLogo(){return tt(Ye.isQualiex?"qualiexSmall":"saberSmall")},get favicon(){return et.favicon??Ze}},nt=st.logo,ot=st.smallLogo;function it(){if("undefined"==typeof document)return;document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=st.favicon,document.head.appendChild(e)}"function"==typeof queueMicrotask?queueMicrotask(it):Promise.resolve().then(it);const lt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function ct(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const dt={date:ct({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ct({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:ct({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function mt(e){return(t,a)=>{let r;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,s=a?.width?String(a.width):t;r=e.formattingValues[s]||e.formattingValues[t]}else{const t=e.defaultWidth,s=a?.width?String(a.width):e.defaultWidth;r=e.values[s]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const pt={ordinalNumber:(e,t)=>{const a=Number(e),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:mt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:mt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:mt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:mt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:mt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function ht(e){return(t,a={})=>{const r=a.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],n=t.match(s);if(!n)return null;const o=n[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a;return}(i,e=>e.test(o)):function(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=a.valueCallback?a.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}function xt(e){return(t,a={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],n=t.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=a.valueCallback?a.valueCallback(o):o;return{value:o,rest:t.slice(s.length)}}}const ft={ordinalNumber:xt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ht({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:ht({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ht({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:ht({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ht({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},gt={code:"en-US",formatDistance:(e,t,a)=>{let r;const s=lt[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},formatLong:dt,formatRelative:(e,t,a,r)=>ut[e],localize:pt,match:ft,options:{weekStartsOn:0,firstWeekContainsDate:1}};let vt={};function bt(){return vt}const yt=6048e5;function wt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function jt(e){const t=wt(e);return t.setHours(0,0,0,0),t}function Nt(e){const t=wt(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function _t(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Ct(e){const t=wt(e),a=function(e,t){const a=jt(e),r=jt(t),s=+a-Nt(a),n=+r-Nt(r);return Math.round((s-n)/864e5)}(t,function(e){const t=wt(e),a=_t(e,0);return a.setFullYear(t.getFullYear(),0,1),a.setHours(0,0,0,0),a}(t));return a+1}function kt(e,t){const a=bt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=wt(e),n=s.getDay(),o=(n<r?7:0)+n-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function St(e){return kt(e,{weekStartsOn:1})}function At(e){const t=wt(e),a=t.getFullYear(),r=_t(e,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const s=St(r),n=_t(e,0);n.setFullYear(a,0,4),n.setHours(0,0,0,0);const o=St(n);return t.getTime()>=s.getTime()?a+1:t.getTime()>=o.getTime()?a:a-1}function Tt(e){const t=wt(e),a=+St(t)-+function(e){const t=At(e),a=_t(e,0);return a.setFullYear(t,0,4),a.setHours(0,0,0,0),St(a)}(t);return Math.round(a/yt)+1}function Dt(e,t){const a=wt(e),r=a.getFullYear(),s=bt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=_t(e,0);o.setFullYear(r+1,0,n),o.setHours(0,0,0,0);const i=kt(o,t),l=_t(e,0);l.setFullYear(r,0,n),l.setHours(0,0,0,0);const c=kt(l,t);return a.getTime()>=i.getTime()?r+1:a.getTime()>=c.getTime()?r:r-1}function Pt(e,t){const a=wt(e),r=+kt(a,t)-+function(e,t){const a=bt(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Dt(e,t),n=_t(e,0);return n.setFullYear(s,0,r),n.setHours(0,0,0,0),kt(n,t)}(a,t);return Math.round(r/yt)+1}function Et(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const Mt={y(e,t){const a=e.getFullYear(),r=a>0?a:1-a;return Et("yy"===t?r%100:r,t.length)},M(e,t){const a=e.getMonth();return"M"===t?String(a+1):Et(a+1,2)},d:(e,t)=>Et(e.getDate(),t.length),a(e,t){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];default:return"am"===a?"a.m.":"p.m."}},h:(e,t)=>Et(e.getHours()%12||12,t.length),H:(e,t)=>Et(e.getHours(),t.length),m:(e,t)=>Et(e.getMinutes(),t.length),s:(e,t)=>Et(e.getSeconds(),t.length),S(e,t){const a=t.length,r=e.getMilliseconds();return Et(Math.trunc(r*Math.pow(10,a-3)),t.length)}},It="midnight",Rt="noon",Lt="morning",Ft="afternoon",zt="evening",Ut="night",Ot={G:function(e,t,a){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return a.era(r,{width:"abbreviated"});case"GGGGG":return a.era(r,{width:"narrow"});default:return a.era(r,{width:"wide"})}},y:function(e,t,a){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return a.ordinalNumber(r,{unit:"year"})}return Mt.y(e,t)},Y:function(e,t,a,r){const s=Dt(e,r),n=s>0?s:1-s;if("YY"===t){return Et(n%100,2)}return"Yo"===t?a.ordinalNumber(n,{unit:"year"}):Et(n,t.length)},R:function(e,t){return Et(At(e),t.length)},u:function(e,t){return Et(e.getFullYear(),t.length)},Q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Et(r,2);case"Qo":return a.ordinalNumber(r,{unit:"quarter"});case"QQQ":return a.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(r,{width:"narrow",context:"formatting"});default:return a.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Et(r,2);case"qo":return a.ordinalNumber(r,{unit:"quarter"});case"qqq":return a.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(r,{width:"narrow",context:"standalone"});default:return a.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,a){const r=e.getMonth();switch(t){case"M":case"MM":return Mt.M(e,t);case"Mo":return a.ordinalNumber(r+1,{unit:"month"});case"MMM":return a.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(r,{width:"narrow",context:"formatting"});default:return a.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,a){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Et(r+1,2);case"Lo":return a.ordinalNumber(r+1,{unit:"month"});case"LLL":return a.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(r,{width:"narrow",context:"standalone"});default:return a.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,a,r){const s=Pt(e,r);return"wo"===t?a.ordinalNumber(s,{unit:"week"}):Et(s,t.length)},I:function(e,t,a){const r=Tt(e);return"Io"===t?a.ordinalNumber(r,{unit:"week"}):Et(r,t.length)},d:function(e,t,a){return"do"===t?a.ordinalNumber(e.getDate(),{unit:"date"}):Mt.d(e,t)},D:function(e,t,a){const r=Ct(e);return"Do"===t?a.ordinalNumber(r,{unit:"dayOfYear"}):Et(r,t.length)},E:function(e,t,a){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return a.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return Et(n,2);case"eo":return a.ordinalNumber(n,{unit:"day"});case"eee":return a.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"});default:return a.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return Et(n,t.length);case"co":return a.ordinalNumber(n,{unit:"day"});case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"});default:return a.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,a){const r=e.getDay(),s=0===r?7:r;switch(t){case"i":return String(s);case"ii":return Et(s,t.length);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return a.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,a){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(r,{width:"narrow",context:"formatting"});default:return a.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,a){const r=e.getHours();let s;switch(s=12===r?Rt:0===r?It:r/12>=1?"pm":"am",t){case"b":case"bb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,a){const r=e.getHours();let s;switch(s=r>=17?zt:r>=12?Ft:r>=4?Lt:Ut,t){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,a){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),a.ordinalNumber(t,{unit:"hour"})}return Mt.h(e,t)},H:function(e,t,a){return"Ho"===t?a.ordinalNumber(e.getHours(),{unit:"hour"}):Mt.H(e,t)},K:function(e,t,a){const r=e.getHours()%12;return"Ko"===t?a.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},k:function(e,t,a){let r=e.getHours();return 0===r&&(r=24),"ko"===t?a.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},m:function(e,t,a){return"mo"===t?a.ordinalNumber(e.getMinutes(),{unit:"minute"}):Mt.m(e,t)},s:function(e,t,a){return"so"===t?a.ordinalNumber(e.getSeconds(),{unit:"second"}):Mt.s(e,t)},S:function(e,t){return Mt.S(e,t)},X:function(e,t,a){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return qt(r);case"XXXX":case"XX":return Vt(r);default:return Vt(r,":")}},x:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"x":return qt(r);case"xxxx":case"xx":return Vt(r);default:return Vt(r,":")}},O:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Bt(r,":");default:return"GMT"+Vt(r,":")}},z:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Bt(r,":");default:return"GMT"+Vt(r,":")}},t:function(e,t,a){return Et(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,a){return Et(e.getTime(),t.length)}};function Bt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),n=r%60;return 0===n?a+String(s):a+String(s)+t+Et(n,2)}function qt(e,t){if(e%60==0){return(e>0?"-":"+")+Et(Math.abs(e)/60,2)}return Vt(e,t)}function Vt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+Et(Math.trunc(r/60),2)+t+Et(r%60,2)}const $t=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Wt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ht={p:Wt,P:(e,t)=>{const a=e.match(/(P+)(p+)?/)||[],r=a[1],s=a[2];if(!s)return $t(e,t);let n;switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",$t(r,t)).replace("{{time}}",Wt(s,t))}},Gt=/^D+$/,Kt=/^Y+$/,Yt=["D","DD","YY","YYYY"];function Qt(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const a=wt(e);return!isNaN(Number(a))}const Xt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Jt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zt=/^'([^]*?)'?$/,ea=/''/g,ta=/[a-zA-Z]/;function aa(e,t,a){const r=bt(),s=a?.locale??r.locale??gt,n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=wt(e);if(!Qt(i))throw new RangeError("Invalid time value");let l=t.match(Jt).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ht[t])(e,s.formatLong)}return e}).join("").match(Xt).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:ra(e)};if(Ot[t])return{isToken:!0,value:e};if(t.match(ta))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});s.localize.preprocessor&&(l=s.localize.preprocessor(i,l));const c={firstWeekContainsDate:n,weekStartsOn:o,locale:s};return l.map(r=>{if(!r.isToken)return r.value;const n=r.value;(!a?.useAdditionalWeekYearTokens&&function(e){return Kt.test(e)}(n)||!a?.useAdditionalDayOfYearTokens&&function(e){return Gt.test(e)}(n))&&function(e,t,a){const r=function(e,t,a){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,a);if(Yt.includes(e))throw new RangeError(r)}(n,t,String(e));return(0,Ot[n[0]])(i,n,s.localize,c)}).join("")}function ra(e){const t=e.match(Zt);return t?t[1].replace(ea,"'"):e}function sa(e,t,a){const r=i.getDefaultOptions(),s=function(e,t,a){return new Intl.DateTimeFormat(a?[a.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,a.timeZone,a.locale??r.locale);return"formatToParts"in s?function(e,t){const a=e.formatToParts(t);for(let r=a.length-1;r>=0;--r)if("timeZoneName"===a[r].type)return a[r].value;return}(s,t):function(e,t){const a=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(a);return r?r[0].substr(1):""}(s,t)}function na(e,t){const a=function(e){ia[e]||(ia[e]=ca?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return ia[e]}(t);return"formatToParts"in a?function(e,t){try{const a=e.formatToParts(t),r=[];for(let e=0;e<a.length;e++){const t=oa[a[e].type];void 0!==t&&(r[t]=parseInt(a[e].value,10))}return r}catch(a){if(a instanceof RangeError)return[NaN];throw a}}(a,e):function(e,t){const a=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}(a,e)}const oa={year:0,month:1,day:2,hour:3,minute:4,second:5};const ia={},la=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),ca="06/25/2014, 00:00:00"===la||"06/25/2014 00:00:00"===la;function da(e,t,a,r,s,n,o){const i=new Date(0);return i.setUTCFullYear(e,t,a),i.setUTCHours(r,s,n,o),i}const ua=36e5,ma={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function pa(e,t,a){if(!e)return 0;let r,s,n=ma.timezoneZ.exec(e);if(n)return 0;if(n=ma.timezoneHH.exec(e),n)return r=parseInt(n[1],10),xa(r)?-r*ua:NaN;if(n=ma.timezoneHHMM.exec(e),n){r=parseInt(n[2],10);const e=parseInt(n[3],10);return xa(r,e)?(s=Math.abs(r)*ua+6e4*e,"+"===n[1]?-s:s):NaN}if(function(e){if(fa[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),fa[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());const r=a?t:function(e){return da(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),s=ha(r,e),n=a?s:function(e,t,a){const r=e.getTime();let s=r-t;const n=ha(new Date(s),a);if(t===n)return t;s-=n-t;const o=ha(new Date(s),a);if(n===o)return n;return Math.max(n,o)}(t,s,e);return-n}return NaN}function ha(e,t){const a=na(e,t),r=da(a[0],a[1]-1,a[2],a[3]%24,a[4],a[5],0).getTime();let s=e.getTime();const n=s%1e3;return s-=n>=0?n:1e3+n,r-s}function xa(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const fa={};const ga={X:function(e,t,a){const r=va(a.timeZone,e);if(0===r)return"Z";switch(t){case"X":return wa(r);case"XXXX":case"XX":return ya(r);default:return ya(r,":")}},x:function(e,t,a){const r=va(a.timeZone,e);switch(t){case"x":return wa(r);case"xxxx":case"xx":return ya(r);default:return ya(r,":")}},O:function(e,t,a){const r=va(a.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),n=r%60;if(0===n)return a+String(s);return a+String(s)+t+ba(n,2)}(r,":");default:return"GMT"+ya(r,":")}},z:function(e,t,a){switch(t){case"z":case"zz":case"zzz":return sa("short",e,a);default:return sa("long",e,a)}}};function va(e,t){const a=e?pa(e,t,!0)/6e4:t?.getTimezoneOffset()??0;if(Number.isNaN(a))throw new RangeError("Invalid time zone specified: "+e);return a}function ba(e,t){const a=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return a+r}function ya(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+ba(Math.floor(r/60),2)+t+ba(Math.floor(r%60),2)}function wa(e,t){if(e%60==0){return(e>0?"-":"+")+ba(Math.abs(e)/60,2)}return ya(e,t)}function ja(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Na=36e5,_a=6e4,Ca={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function ka(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const a=null==t.additionalDigits?2:Number(t.additionalDigits);if(2!==a&&1!==a&&0!==a)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const r=function(e){const t={};let a,r=Ca.dateTimePattern.exec(e);r?(t.date=r[1],a=r[3]):(r=Ca.datePattern.exec(e),r?(t.date=r[1],a=r[2]):(t.date=null,a=e));if(a){const e=Ca.timeZone.exec(a);e?(t.time=a.replace(e[1],""),t.timeZone=e[1].trim()):t.time=a}return t}(e),{year:s,restDateString:n}=function(e,t){if(e){const a=Ca.YYY[t],r=Ca.YYYYY[t];let s=Ca.YYYY.exec(e)||r.exec(e);if(s){const t=s[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(s=Ca.YY.exec(e)||a.exec(e),s){const t=s[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(r.date,a),o=function(e,t){if(null===t)return null;let a,r,s;if(!e||!e.length)return a=new Date(0),a.setUTCFullYear(t),a;let n=Ca.MM.exec(e);if(n)return a=new Date(0),r=parseInt(n[1],10)-1,Pa(t,r)?(a.setUTCFullYear(t,r),a):new Date(NaN);if(n=Ca.DDD.exec(e),n){a=new Date(0);const e=parseInt(n[1],10);return function(e,t){if(t<1)return!1;const a=Da(e);if(a&&t>366)return!1;if(!a&&t>365)return!1;return!0}(t,e)?(a.setUTCFullYear(t,0,e),a):new Date(NaN)}if(n=Ca.MMDD.exec(e),n){a=new Date(0),r=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return Pa(t,r,e)?(a.setUTCFullYear(t,r,e),a):new Date(NaN)}if(n=Ca.Www.exec(e),n)return s=parseInt(n[1],10)-1,Ea(s)?Sa(t,s):new Date(NaN);if(n=Ca.WwwD.exec(e),n){s=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return Ea(s,e)?Sa(t,s,e):new Date(NaN)}return null}(n,s);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let a,s=0;if(r.time&&(s=function(e){let t,a,r=Ca.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),Ma(t)?t%24*Na:NaN;if(r=Ca.HHMM.exec(e),r)return t=parseInt(r[1],10),a=parseFloat(r[2].replace(",",".")),Ma(t,a)?t%24*Na+a*_a:NaN;if(r=Ca.HHMMSS.exec(e),r){t=parseInt(r[1],10),a=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return Ma(t,a,e)?t%24*Na+a*_a+1e3*e:NaN}return null}(r.time),null===s||isNaN(s)))return new Date(NaN);if(r.timeZone||t.timeZone){if(a=pa(r.timeZone||t.timeZone,new Date(e+s)),isNaN(a))return new Date(NaN)}else a=ja(new Date(e+s)),a=ja(new Date(e+s+a));return new Date(e+s+a)}return new Date(NaN)}function Sa(e,t,a){t=t||0,a=a||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const s=7*t+a+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}const Aa=[31,28,31,30,31,30,31,31,30,31,30,31],Ta=[31,29,31,30,31,30,31,31,30,31,30,31];function Da(e){return e%400==0||e%4==0&&e%100!=0}function Pa(e,t,a){if(t<0||t>11)return!1;if(null!=a){if(a<1)return!1;const r=Da(e);if(r&&a>Ta[t])return!1;if(!r&&a>Aa[t])return!1}return!0}function Ea(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function Ma(e,t,a){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==a||!(a<0||a>=60)))}const Ia=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Ra(e,t,a,r){return function(e,t,a={}){const r=(t=String(t)).match(Ia);if(r){const s=ka(a.originalDate||e,a);t=r.reduce(function(e,t){if("'"===t[0])return e;const r=e.indexOf(t),n="'"===e[r-1],o=e.replace(t,"'"+ga[t[0]](s,t,a)+"'");return n?o.substring(0,r-1)+o.substring(r+1):o},t)}return aa(e,t,a)}(function(e,t,a){const r=pa(t,e=ka(e,a),!0),s=new Date(e.getTime()-r),n=new Date(0);return n.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),n.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),n}(e,t,{timeZone:(r={...r,timeZone:t,originalDate:e}).timeZone}),a,r)}const La={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Fa={date:ct({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:ct({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:ct({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},za={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Ua={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Oa={ordinalNumber:(e,t)=>Number(e)+"º",era:mt({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:mt({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:mt({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:mt({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:mt({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},Ba={ordinalNumber:xt({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ht({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:ht({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ht({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:ht({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ht({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},qa={code:"es",formatDistance:(e,t,a)=>{let r;const s=La[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},formatLong:Fa,formatRelative:(e,t,a,r)=>1!==t.getHours()?Ua[e]:za[e],localize:Oa,match:Ba,options:{weekStartsOn:1,firstWeekContainsDate:1}},Va={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},$a={date:ct({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:ct({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:ct({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Wa={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Ha={ordinalNumber:(e,t)=>{const a=Number(e);return"week"===t?.unit?a+"ª":a+"º"},era:mt({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:mt({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:mt({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:mt({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:mt({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},Ga={ordinalNumber:xt({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ht({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:ht({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ht({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:ht({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:ht({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},Ka={code:"pt-BR",formatDistance:(e,t,a)=>{let r;const s=Va[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",String(t)),a?.addSuffix?a.comparison&&a.comparison>0?"em "+r:"há "+r:r},formatLong:$a,formatRelative:(e,t,a,r)=>{const s=Wa[e];return"function"==typeof s?s(t):s},localize:Ha,match:Ga,options:{weekStartsOn:0,firstWeekContainsDate:1}},Ya=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],Qa=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],Xa=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],Ja="pt-BR",Za="dd/MM/yyyy HH:mm",er="America/Sao_Paulo",tr=e=>Ya.some(t=>t.value===e),ar=e=>Xa.some(t=>t.value===e),rr=()=>{if("undefined"==typeof navigator)return Ja;const e=navigator.language;if(tr(e))return e;const t=e.split("-")[0],a=Ya.find(e=>e.value.startsWith(t));return a?.value||Ja},sr=()=>{if("undefined"==typeof Intl)return er;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return ar(e)?e:er}catch{return er}},nr=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||Za),or={"pt-BR":Ka,"en-US":gt,"es-ES":qa},ir=(e,t=Za,a=er,r=Ja)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const n=or[r]||Ka;try{return Ra(s,a,t,{locale:n})}catch(o){return Ra(s,er,t,{locale:n})}},lr=(e,t=Ja,a=er)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const s=or[t]||Ka;try{return Ra(r,a,"PP",{locale:s})}catch(n){return Ra(r,er,"PP",{locale:s})}};function cr(e){const t=e.replace("#",""),a=3===t.length?t.split("").map(e=>e+e).join(""):t;return{r:parseInt(a.substring(0,2),16),g:parseInt(a.substring(2,4),16),b:parseInt(a.substring(4,6),16)}}function dr(e,t=.1){const{r:a,g:r,b:s}=cr(e);return`rgba(${a}, ${r}, ${s}, ${t})`}function ur(e){const{r:t,g:a,b:r}=cr(e),[s,n,o]=[t,a,r].map(e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)});return.2126*s+.7152*n+.0722*o}function mr(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function pr(e,t){return t?e.replace(/\{alias\}/g,t):e}function hr(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const a=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}const xr=["hint","details","code","where","schema","table","column"],fr="Ocorreu um erro ao processar sua solicitação.",gr=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function vr(e){const t=function(e){if(!e)return fr;if("string"==typeof e)return e;if(e instanceof Error)return e.message||fr;if("object"==typeof e&&"message"in e)return String(e.message);return fr}(e);return Ie()?t:gr.some(e=>e.test(t))?fr:t}function br(...e){return o.twMerge(n.clsx(e))}const yr=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(yr);if("object"==typeof e&&e.constructor===Object){const t={};for(const[a,r]of Object.entries(e))t[a]=yr(r);return t}return e},wr=s.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),jr=te.forwardRef(({className:e,variant:a,size:s,asChild:n=!1,...o},i)=>{const l=n?r.Slot:"button";return t.jsx(l,{className:br(wr({variant:a,size:s,className:e})),ref:i,...o})});jr.displayName="Button";const Nr=a.forwardRef(({className:e,children:a,variant:r="action",...s},n)=>t.jsx(jr,{ref:n,variant:r,size:"icon",className:br("h-8 w-8",e),...s,children:a||t.jsx(c.EllipsisVertical,{size:16})}));Nr.displayName="ActionButton";const _r=te.forwardRef(({className:e,type:a,showCharCount:r,maxLength:s,onChange:n,...o},i)=>{const[l,c]=te.useState(0);te.useEffect(()=>{"string"==typeof o.value?c(o.value.length):"string"==typeof o.defaultValue&&c(o.defaultValue.length)},[o.value,o.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("input",{type:a,className:br("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:s,onChange:e=>{c(e.target.value.length),n?.(e)},...o}),r&&s&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",s]})]})});_r.displayName="Input";const Cr=s.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),kr=te.forwardRef(({className:e,...a},r)=>t.jsx(re.Root,{ref:r,className:br(Cr(),e),...a}));kr.displayName=re.Root.displayName;const Sr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("rounded-lg border bg-card text-card-foreground shadow-sm",e),...a}));Sr.displayName="Card";const Ar=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("flex flex-col space-y-1.5 p-6",e),...a}));Ar.displayName="CardHeader";const Tr=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:br("text-2xl font-semibold leading-none tracking-tight",e),...a}));Tr.displayName="CardTitle";const Dr=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:br("text-sm text-muted-foreground",e),...a}));Dr.displayName="CardDescription";const Pr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("p-6 pt-0",e),...a}));Pr.displayName="CardContent";const Er=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("flex items-center p-6 pt-0",e),...a}));Er.displayName="CardFooter";const Mr=te.forwardRef(({className:e,orientation:a="horizontal",decorative:r=!0,...s},n)=>t.jsx(ne.Root,{ref:n,decorative:r,orientation:a,className:br("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Mr.displayName=ne.Root.displayName;const Ir=oe.Root,Rr=oe.Trigger,Lr=oe.Portal,Fr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Overlay,{className:br("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));Fr.displayName=oe.Overlay.displayName;const zr=te.forwardRef(({className:e,...a},r)=>t.jsxs(Lr,{children:[t.jsx(Fr,{}),t.jsx(oe.Content,{ref:r,className:br("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a})]}));zr.displayName=oe.Content.displayName;const Ur=({className:e,...a})=>t.jsx("div",{className:br("flex flex-col space-y-2 text-center sm:text-left",e),...a});Ur.displayName="AlertDialogHeader";const Or=({className:e,...a})=>t.jsx("div",{className:br("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});Or.displayName="AlertDialogFooter";const Br=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Title,{ref:r,className:br("text-lg font-semibold",e),...a}));Br.displayName=oe.Title.displayName;const qr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Description,{ref:r,className:br("text-sm text-muted-foreground",e),...a}));qr.displayName=oe.Description.displayName;const Vr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Action,{ref:r,className:br(wr(),e),...a}));Vr.displayName=oe.Action.displayName;const $r=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Cancel,{ref:r,className:br(wr({variant:"outline"}),"mt-2 sm:mt-0",e),...a}));$r.displayName=oe.Cancel.displayName;const Wr=se.Root,Hr=se.Trigger,Gr=se.Portal,Kr=se.Close,Yr=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{ref:r,className:br("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));Yr.displayName=se.Overlay.displayName;const Qr={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},Xr=te.forwardRef(({className:a,children:r,size:s,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:d,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:v,onInteractOutside:b,onEscapeKeyDown:y,...w},j)=>{const[N,_]=te.useState(!1),C=te.useRef(null),k=te.useRef(!1),S=s??(i||l||d||u||m||p?void 0:"md"),A=S?Qr[S]:{},T={...i??A.width?{width:i??A.width}:{},...l??A.minWidth?{minWidth:l??A.minWidth}:{},...d??A.maxWidth?{maxWidth:d??A.maxWidth}:{},...u??A.height?{height:u??A.height}:{},...m??A.minHeight?{minHeight:m??A.minHeight}:{},...p??A.maxHeight?{maxHeight:p??A.maxHeight}:{},...v},D=te.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),P=te.useRef(null),E="destructive"!==n;if("development"===process.env.NODE_ENV&&r){const e=te.Children.toArray(r);e.some(e=>te.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>te.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t.jsxs(Gr,{children:[t.jsx(Yr,{}),t.jsxs(se.Content,{ref:j,className:br("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",a),style:T,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?b?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void D(()=>{k.current=!0,P.current?.click()})):void y?.(e);e.preventDefault()},...w,children:[r,E&&t.jsxs(se.Close,{ref:P,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),D(()=>{k.current=!0,P.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]}),t.jsx(Ir,{open:N,onOpenChange:_,children:t.jsxs(zr,{children:[t.jsxs(Ur,{children:[t.jsx(Br,{children:h}),t.jsx(qr,{children:x})]}),t.jsxs(Or,{children:[t.jsx($r,{onClick:()=>{_(!1),C.current=null},children:f}),t.jsx(Vr,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});Xr.displayName=se.Content.displayName;const Jr=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:br("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Mr,{className:"mt-2"})]});Jr.displayName="DialogHeader";const Zr=({className:e,...a})=>t.jsx("div",{className:br("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...a});Zr.displayName="DialogBody";const es=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Mr,{className:"mb-4"}),t.jsx("div",{className:br("flex flex-row justify-end gap-2",e),...r,children:a})]});es.displayName="DialogFooter";const ts=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:br("text-xl font-semibold leading-none tracking-tight",e),...a}));ts.displayName=se.Title.displayName;const as=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:br("text-sm text-muted-foreground",e),...a}));as.displayName=se.Description.displayName;const rs=h.FormProvider,ss=te.createContext({}),ns=()=>{const e=te.useContext(ss),t=te.useContext(os),{getFieldState:a,formState:r}=h.useFormContext(),s=a(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=t;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...s}},os=te.createContext({}),is=te.forwardRef(({className:e,...a},r)=>{const s=te.useId();return t.jsx(os.Provider,{value:{id:s},children:t.jsx("div",{ref:r,className:br("space-y-1.5",e),...a})})});is.displayName="FormItem";const ls=te.forwardRef(({className:e,...a},r)=>{const{error:s,formItemId:n}=ns();return t.jsx(kr,{ref:r,className:br(s&&"text-destructive",e),htmlFor:n,...a})});ls.displayName="FormLabel";const cs=te.forwardRef(({...e},a)=>{const{error:s,formItemId:n,formDescriptionId:o,formMessageId:i}=ns();return t.jsx(r.Slot,{ref:a,id:n,"aria-describedby":s?`${o} ${i}`:`${o}`,"aria-invalid":!!s,...e})});cs.displayName="FormControl";const ds=te.forwardRef(({className:e,...a},r)=>{const{formDescriptionId:s}=ns();return t.jsx("p",{ref:r,id:s,className:br("text-sm text-muted-foreground",e),...a})});ds.displayName="FormDescription";const us=te.forwardRef(({className:e,children:a,...r},s)=>{const{error:n,formMessageId:o}=ns(),i=n?String(n?.message):a;return i?t.jsx("p",{ref:s,id:o,className:br("text-sm font-medium text-destructive",e),...r,children:i}):null});us.displayName="FormMessage";const ms=te.createContext({showCheck:!1}),ps=({showCheck:e=!1,...a})=>t.jsx(ms.Provider,{value:{showCheck:e},children:t.jsx(ie.Root,{...a})}),hs=ie.Group,xs=ie.Value,fs=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ie.Trigger,{ref:s,className:br("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...r,children:[a,t.jsx(ie.Icon,{asChild:!0,children:t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));fs.displayName=ie.Trigger.displayName;const gs=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollUpButton,{ref:r,className:br("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronUp,{className:"h-4 w-4"})}));gs.displayName=ie.ScrollUpButton.displayName;const vs=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollDownButton,{ref:r,className:br("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronDown,{className:"h-4 w-4"})}));vs.displayName=ie.ScrollDownButton.displayName;const bs=te.forwardRef(({className:e,children:a,position:r="popper",container:s,collisionBoundary:n,...o},i)=>t.jsx(ie.Portal,{container:s,children:t.jsxs(ie.Content,{ref:i,className:br("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,collisionBoundary:n,...o,children:[t.jsx(gs,{}),t.jsx(ie.Viewport,{className:br("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),t.jsx(vs,{})]})}));bs.displayName=ie.Content.displayName;const ys=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Label,{ref:r,className:br("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...a}));ys.displayName=ie.Label.displayName;const ws=te.forwardRef(({className:e,children:a,...r},s)=>{const{showCheck:n}=te.useContext(ms);return t.jsxs(ie.Item,{ref:s,className:br("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...r,children:[n&&t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ie.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),t.jsx(ie.ItemText,{children:a})]})});ws.displayName=ie.Item.displayName;const js=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Separator,{ref:r,className:br("-mx-1 my-1 h-px bg-muted",e),...a}));js.displayName=ie.Separator.displayName;const Ns=te.forwardRef(({className:e,...a},r)=>t.jsx(le.Root,{ref:r,className:br("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:t.jsx(le.Indicator,{className:br("flex items-center justify-center text-current"),children:t.jsx(c.Check,{className:"h-4 w-4"})})}));Ns.displayName=le.Root.displayName;const _s=te.forwardRef(({className:e,showCharCount:a,maxLength:r,onChange:s,...n},o)=>{const[i,l]=te.useState(0);te.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("textarea",{className:br("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:r,onChange:e=>{l(e.target.value.length),s?.(e)},...n}),a&&r&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",r]})]})});_s.displayName="Textarea";const Cs=s.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),ks=te.forwardRef(({className:e,variant:a,...r},s)=>t.jsx("div",{ref:s,className:br(Cs({variant:a}),e),...r}));ks.displayName="Badge";const Ss={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function As({size:e="md",className:a}){return t.jsx(c.Loader2,{className:br("animate-spin text-muted-foreground",Ss[e],a)})}function Ts({isLoading:e,children:a,className:r,type:s="spinner",size:n="md"}){return e?"overlay"===s?t.jsxs("div",{className:br("relative",r),children:[a,t.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:t.jsx(As,{size:n})})]}):"skeleton"===s?t.jsx("div",{className:br("animate-pulse",r),children:t.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):t.jsx("div",{className:br("flex items-center justify-center py-8",r),children:t.jsx(As,{size:n})}):t.jsx(t.Fragment,{children:a})}const Ds=({...e})=>t.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:t.jsx(c.CircleCheckIcon,{className:"h-4 w-4"}),info:t.jsx(c.InfoIcon,{className:"h-4 w-4"}),warning:t.jsx(c.TriangleAlertIcon,{className:"h-4 w-4"}),error:t.jsx(c.OctagonXIcon,{className:"h-4 w-4"}),loading:t.jsx(c.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),Ps=ce.Root,Es=ce.Trigger,Ms=ce.Group,Is=ce.Portal,Rs=ce.Sub,Ls=ce.RadioGroup,Fs=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(ce.SubTrigger,{ref:n,className:br("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Fs.displayName=ce.SubTrigger.displayName;const zs=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.SubContent,{ref:r,className:br("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));zs.displayName=ce.SubContent.displayName;const Us=te.forwardRef(({className:e,sideOffset:a=4,...r},s)=>t.jsx(ce.Portal,{children:t.jsx(ce.Content,{ref:s,sideOffset:a,className:br("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Us.displayName=ce.Content.displayName;const Os=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Item,{ref:s,className:br("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Os.displayName=ce.Item.displayName;const Bs=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(ce.CheckboxItem,{ref:n,className:br("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Bs.displayName=ce.CheckboxItem.displayName;const qs=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ce.RadioItem,{ref:s,className:br("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));qs.displayName=ce.RadioItem.displayName;const Vs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Label,{ref:s,className:br("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Vs.displayName=ce.Label.displayName;const $s=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.Separator,{ref:r,className:br("-mx-1 my-1 h-px bg-muted",e),...a}));$s.displayName=ce.Separator.displayName;const Ws=({className:e,...a})=>t.jsx("span",{className:br("ml-auto text-xs tracking-widest opacity-60",e),...a});Ws.displayName="DropdownMenuShortcut";const Hs=({delayDuration:e=300,...a})=>t.jsx(de.Provider,{delayDuration:e,...a}),Gs=de.Root,Ks=de.Trigger,Ys=te.forwardRef(({className:e,sideOffset:a=4,container:r,...s},n)=>t.jsx(de.Portal,{container:r,children:t.jsx(de.Content,{ref:n,sideOffset:a,className:br("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Ys.displayName=de.Content.displayName;const Qs=te.forwardRef(({children:e,disabledReason:a,className:r},s)=>{const n=t.jsx(Os,{ref:s,className:br("opacity-50 cursor-not-allowed pointer-events-auto",r),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return a?t.jsx(Hs,{delayDuration:100,children:t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("div",{className:"w-full",children:n})}),t.jsx(Ys,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:a})]})}):n});Qs.displayName="DisabledMenuItem";const Xs=ue.Root,Js=ue.Trigger,Zs=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,container:s,...n},o)=>t.jsx(ue.Portal,{container:s,children:t.jsx(ue.Content,{ref:o,align:a,sideOffset:r,className:br("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Zs.displayName=ue.Content.displayName;const en=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a}));en.displayName="Command";const tn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:t.jsx("input",{ref:r,className:br("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...a})}));tn.displayName="CommandInput";const an=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a}));an.displayName="CommandList";const rn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("py-6 text-center text-sm text-muted-foreground",e),...a}));rn.displayName="CommandEmpty";const sn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a}));sn.displayName="CommandGroup";const nn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("-mx-1 h-px bg-border",e),...a}));nn.displayName="CommandSeparator";const on=te.forwardRef(({className:e,disabled:a,onSelect:r,value:s,...n},o)=>t.jsx("div",{ref:o,className:br("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":a,onClick:()=>!a&&r?.(s||""),...n}));on.displayName="CommandItem";const ln=({className:e,...a})=>t.jsx("span",{className:br("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});function cn({className:e,...a}){return t.jsx("div",{className:br("animate-pulse rounded-md bg-muted",e),...a})}ln.displayName="CommandShortcut";const dn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function un({multiple:r,options:s,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f,required:g,className:v,sortOptions:b,maxDisplayedBadges:y,popoverContainer:w,onOpen:j,onClose:N,clearable:_,showCheck:C}){const[k,S]=a.useState(!1),[A,T]=a.useState(""),D=a.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),P=a.useMemo(()=>{if(!w)return;let e=w,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[w]),E=a.useMemo(()=>{const e=s.map(e=>({original:e,value:i(e),label:l(e)}));return b?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[s,i,l,b]),M=a.useMemo(()=>{if(!A)return E;const e=dn(A);return E.filter(t=>dn(t.label).includes(e))},[E,A]),I=a.useMemo(()=>E.filter(e=>D.includes(e.value)),[E,D]),R=e=>{S(e),e?j?.():(T(""),N?.())},L=(e,t)=>{t.preventDefault(),t.stopPropagation(),o&&o(r?D.filter(t=>t!==e):"")},F=y?I.slice(0,y):I,z=y&&I.length>y?I.length-y:0;return t.jsxs("div",{className:br("space-y-2",v),children:[m&&t.jsxs(kr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(Xs,{open:k,onOpenChange:R,modal:!1,children:[r?t.jsx(Js,{asChild:!0,children:t.jsxs("div",{role:"combobox","aria-expanded":k,"aria-disabled":f,tabIndex:f?-1:0,onKeyDown:e=>{f||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R(!k))},className:br("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",f&&"pointer-events-none opacity-50 cursor-not-allowed",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex items-center gap-2",children:[p&&t.jsx(p,{className:"h-4 w-4"}),u]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[F.map(e=>t.jsxs(ks,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&L(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>L(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),z>0&&t.jsxs(ks,{variant:"outline",className:"gap-1",children:["+",z]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t.jsxs("div",{className:"relative",children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{variant:"outline",role:"combobox","aria-expanded":k,disabled:f,className:br("relative w-full justify-start min-h-10 h-auto pr-10",_&&I.length>0&&"pr-16",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:u})]}):t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:I[0]?.label})]}),t.jsx(c.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),_&&I.length>0&&t.jsx("button",{type:"button",disabled:f,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>L("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(Zs,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:P,collisionBoundary:P,children:t.jsxs(en,{children:[t.jsxs("div",{className:"relative",children:[t.jsx(tn,{placeholder:x,value:A,onChange:e=>T(e.target.value)}),A&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(an,{children:0===s.length?t.jsx(rn,{children:h}):0===M.length?t.jsx(rn,{children:e.t("no_results")}):t.jsx(sn,{children:M.map(e=>{const a=D.includes(e.value);return t.jsxs(on,{value:e.value,onSelect:()=>(e=>{if(o)if(r){const t=D.includes(e)?D.filter(t=>t!==e):[...D,e];o(t)}else o(e),S(!1)})(e.value),className:br("cursor-pointer",a&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[C&&t.jsx(c.Check,{className:br("mr-2 h-4 w-4",a?"opacity-100":"opacity-0")}),d?d(e.original):e.label]},e.value)})})})]})})]})]})}function mn({multiple:e=!1,options:a,items:r,value:s,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f=!1,required:g=!1,isLoading:v=!1,error:b,className:w,sortOptions:j=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:T}=y.useTranslation(),D=a||r||[],P=o||n,E=u||T("select_placeholder","Selecione..."),M=h||T("no_results",T("no_results")),I=x||T("search_placeholder","Pesquisar...");if(v)return t.jsxs("div",{className:br("space-y-2",w),children:[m&&t.jsxs(kr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(cn,{className:"h-10 w-full"})]});const R="string"==typeof b?b:b instanceof Error?b.message:b?T("error_loading",T("error_loading")):void 0;return R?t.jsxs("div",{className:br("space-y-2",w),children:[m&&t.jsxs(kr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:R})]})]}):t.jsx(un,{multiple:e,options:D,value:s||(e?[]:""),onChange:P,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:E,label:m,icon:p,emptyMessage:M,searchPlaceholder:I,disabled:f,required:g,className:w,sortOptions:j,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const pn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function hn(e,t){if(!t)return null;const a=pn(t),r=[];for(const s of e){const e=pn(s.label).includes(a),n=s.children?hn(s.children,t):null,o=n&&n.length>0;(e||o)&&r.push({...s,children:e?s.children:o?n:s.children})}return r}function xn(e,t){for(const a of e){if(a.value===t)return a.label;if(a.children){const e=xn(a.children,t);if(e)return e}}}function fn({node:e,level:a,expanded:r,onToggleExpand:s,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,d=n.includes(e.value),u=8+20*a;return t.jsxs("div",{role:"treeitem","aria-expanded":l?r:void 0,"aria-selected":d,className:br("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(d?2:0)+"px"},children:[t.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:t=>{t.stopPropagation(),o(e.value)},children:[i&&t.jsx(c.Check,{className:br("h-4 w-4 shrink-0",d?"opacity-100":"opacity-0")}),(()=>{const a=d?e.iconSelected??(r?e.iconOpen:null)??e.icon:r?e.iconOpen??e.icon:e.icon;return a?t.jsx(a,{className:br("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),t.jsx("span",{className:"truncate",children:e.label})]}),l&&t.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:t=>{t.stopPropagation(),s(e.value)},tabIndex:-1,"aria-label":r?"Recolher":"Expandir",children:r?t.jsx(c.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function gn({nodes:e,level:r,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return t.jsx(t.Fragment,{children:e.map(e=>{const c=s.has(e.value);return t.jsxs(a.Fragment,{children:[t.jsx(fn,{node:e,level:r,expanded:c,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),c&&e.children&&e.children.length>0&&t.jsx(gn,{nodes:e.children,level:r+1,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function vn({multiple:e=!1,options:r,value:s,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:d,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:v,onOpen:b,onClose:w,defaultExpanded:j=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),[S,A]=a.useState(""),[T,D]=a.useState(()=>j?function(e){const t=new Set;return function e(a){for(const r of a)r.children&&r.children.length>0&&(t.add(r.value),e(r.children))}(e),t}(r):new Set),P=o||_("select_placeholder","Selecione..."),E=d||_("no_results",_("no_results")),M=u||_("search_placeholder","Pesquisar..."),I=a.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),R=a.useMemo(()=>{if(!v)return;let e=v,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[v]),L=a.useMemo(()=>hn(r,S),[r,S])??r,F=a.useMemo(()=>S?function(e,t){const a=new Set,r=pn(t);function s(e){if(!e.children||0===e.children.length)return pn(e.label).includes(r);let t=!1;for(const a of e.children)s(a)&&(t=!0);return t&&a.add(e.value),t||pn(e.label).includes(r)}for(const n of e)s(n);return a}(r,S):new Set,[r,S]),z=S?F:T,U=a.useCallback(e=>{S||D(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[S]),O=a.useMemo(()=>I.map(e=>({value:e,label:xn(r,e)||e})),[I,r]),B=e=>{k(e),e?b?.():(A(""),w?.())},q=a.useCallback(t=>{if(n)if(e){const e=I.includes(t)?I.filter(e=>e!==t):[...I,t];n(e)}else n(t),k(!1)},[n,e,I]),V=(t,a)=>{a.preventDefault(),a.stopPropagation(),n&&n(e?I.filter(e=>e!==t):"")},$=g?O.slice(0,g):O,W=g&&O.length>g?O.length-g:0;if(h)return t.jsxs("div",{className:br("space-y-2",f),children:[i&&t.jsxs(kr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(cn,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?t.jsxs("div",{className:br("space-y-2",f),children:[i&&t.jsxs(kr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:H})]})]}):t.jsxs("div",{className:br("space-y-2",f),children:[i&&t.jsxs(kr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(Xs,{open:C,onOpenChange:B,modal:!1,children:[t.jsx(Js,{asChild:!0,children:e?t.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(!C))},className:br("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),P]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>t.jsxs(ks,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&V(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>V(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&t.jsxs(ks,{variant:"outline",className:"gap-1",children:["+",W]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t.jsxs(jr,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:br("w-full justify-between min-h-10 h-auto font-normal",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),P]}):t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),O[0]?.label]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(Zs,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(c.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:M,value:S,onChange:e=>A(e.target.value)}),S&&t.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>A(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:t.jsx("div",{role:"tree",className:"p-1",children:0===L.length?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?E:_("no_search_results",_("no_results"))}):t.jsx(gn,{nodes:L,level:0,expandedIds:z,onToggleExpand:U,selectedValues:I,onSelect:q,showCheck:N})})})]})]})]})}const bn=void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:Z&&"SCRIPT"===Z.tagName.toUpperCase()&&Z.src||new URL("index.js",document.baseURI).href}&&!1,yn=new Map;function wn(e,t=1/0){if(!bn)return 0;const a=(yn.get(e)??0)+1;return yn.set(e,a),a}function jn(e){if(bn)try{performance.mark(`auth:${e}`)}catch{}}async function Nn(e,t){if(!bn)return t();const a=performance.now();try{return await t()}finally{performance.now()}}function _n(e){if(!bn)return;if(0===yn.size)return;const t={};for(const[a,r]of yn.entries())t[a]=r}let Cn=null;function kn(e,t,a){if(!bn||!t)return;if(a&&"object"==typeof a)for(const r in a)/^co\d+$/.test(r)&&0}const Sn=()=>bn;var An=Object.defineProperty;const Tn=class e{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const a=(4-t.length%4)%4;return t+="=".repeat(a),t}static parseJwtPayload(t){if(Sn()){return wn(`parseJwtPayload:${t.length}:${t.slice(-8)}`,4),wn("parseJwtPayload:total"),function(e,t){if(!bn)return t();performance.now();try{return t()}finally{performance.now()}}(t.length,()=>e._parseJwtPayloadImpl(t))}return e._parseJwtPayloadImpl(t)}static _parseJwtPayloadImpl(e){try{const s=e.split(".");if(3!==s.length)return null;const n=s[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),t=atob(e),a=new Uint8Array(t.length);for(let s=0;s<t.length;s++)a[s]=t.charCodeAt(s);const r=new TextDecoder("utf-8").decode(a);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(n),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(a){try{const e=this.normalizeBase64Url(n),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(s){return null}}static validateTokens(e,t){const a=[],r=[];try{t.split(".")[1],e.split(".")[1];const s=this.parseJwtPayload(t),n=this.parseJwtPayload(e);if(!s){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";a.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";a.push(e),o=!1}if(s.exp&&s.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:a,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:a,errors:r}}catch(s){const e=`Erro na validação de tokens: ${s}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}};((e,t,a)=>{t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(Tn,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let Dn=Tn;const Pn="qualiex_access_token",En="qualiex_id_token",Mn="supabase_token",In="oauth_state",Rn="oauth_nonce",Ln="selected_alias",Fn="manual_logout",zn="supabase_project_id",Un={setAccessToken:e=>localStorage.setItem(Pn,e),getAccessToken:()=>localStorage.getItem(Pn),setIdToken:e=>localStorage.setItem(En,e),getIdToken:()=>localStorage.getItem(En),getSupabaseToken:()=>localStorage.getItem(Mn),setOAuthState:e=>sessionStorage.setItem(In,e),getOAuthState:()=>sessionStorage.getItem(In),clearOAuthState:()=>sessionStorage.removeItem(In),setOAuthNonce:e=>sessionStorage.setItem(Rn,e),getOAuthNonce:()=>sessionStorage.getItem(Rn),clearOAuthNonce:()=>sessionStorage.removeItem(Rn),setSelectedAlias:e=>localStorage.setItem(Ln,e),getSelectedAlias:()=>localStorage.getItem(Ln),clearSelectedAlias:()=>localStorage.removeItem(Ln),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Un.getAccessToken()||!Un.getIdToken()),checkProjectMismatch:()=>{const e=Me().supabaseProjectId;if(!e)return!1;const t=localStorage.getItem(zn);return t&&t!==e?(Un.clearAll(),localStorage.setItem(zn,e),!0):(t||localStorage.setItem(zn,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Mn,e),Un._clearValidationCache()},areAllTokensValid:()=>{const e=Un.getAccessToken(),t=Un.getIdToken();if(!e||!t)return!1;try{const a=Dn.validateTokens(e,t);return!!a.idTokenValid&&a.idTokenValid}catch(a){return!1}},clearExpiredTokens:()=>{let e=!1;const t=Un.getAccessToken(),a=Un.getIdToken(),r=Un.getSupabaseToken();return t&&Un.isTokenExpired(t)&&(localStorage.removeItem(Pn),e=!0),a&&Un.isTokenExpired(a)&&(localStorage.removeItem(En),e=!0),r&&Un.isTokenExpired(r)&&(localStorage.removeItem(Mn),e=!0),e},clearAll:()=>{localStorage.removeItem(Pn),localStorage.removeItem(En),localStorage.removeItem(Mn),localStorage.removeItem(Ln),sessionStorage.removeItem(In),sessionStorage.removeItem(Rn),Un._clearValidationCache()},setManualLogout:()=>localStorage.setItem(Fn,"true"),isManualLogout:()=>"true"===localStorage.getItem(Fn),clearManualLogout:()=>localStorage.removeItem(Fn),isTokenExpired:e=>{try{return Dn.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Un._validationCache.isValid=!1,Un._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Un.getSupabaseToken();if(!e)return!1;if(Un.isTokenExpired(e))return Un._clearValidationCache(),Un._handleExpiredToken(),!1;const t=Date.now();return t-Un._validationCache.timestamp<Un._validationCache.cacheValidityMs?Un._validationCache.isValid:(Un._validationCache.isValid=!0,Un._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>Un.isSupabaseTokenValid()?Un.getSupabaseToken():null,_handleExpiredToken:()=>{Un.clearAll()},extractTokenData:()=>{if(wn("TokenManager.extractTokenData"),!Un.isSupabaseTokenValid())return null;const e=Un.getSupabaseToken();if(!e)return null;try{const t=Dn.parseJwtPayload(e);if(!t)return null;const a=t.alias||t.default||t.user_alias,r=t.place_id||null,s=t.place_name||null;let n=t.company_id;if(!n&&a)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===a){n=e[7];break}}}return{alias:a,companyId:n,placeId:r,placeName:s,payload:t}}catch(t){return Un._handleExpiredToken(),null}},getCompanyId:e=>{wn("TokenManager.getCompanyId");const t=Un.getAccessToken();if(t)try{const a=Dn.parseJwtPayload(t);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}const a=Un.extractTokenData();if(a?.companyId)return a.companyId;const r=Un.getIdToken();if(r)try{const t=Dn.parseJwtPayload(r);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}return null},getCompanyIdInt:e=>{wn("TokenManager.getCompanyIdInt");const t=[Un.getAccessToken(),Un.getIdToken()];for(const a of t)if(a)try{const t=Dn.parseJwtPayload(a);if(!t)continue;for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>1&&t[0]===e)return t[1];if(!e&&t.length>1)return t[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=Un.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{wn("TokenManager.getAllCompaniesData");const e=Un.getIdToken();if(!e)return[];try{const t=Dn.parseJwtPayload(e);if(!t)return[];const a=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&a.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return a}catch{return[]}}};var On=Object.defineProperty,Bn=(e,t,a)=>((e,t,a)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);const qn=new class{constructor(){Bn(this,"errors",[]),Bn(this,"toastCount",0),Bn(this,"lastToastTime",0)}handleError(e,t=!0){const a="string"==typeof e?e:e.message,r=vr(a);if(this.errors.push({id:hr("short"),message:a,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),t&&this.shouldShowToast()){const e=this.getErrorTitle(r);l.toast.error(e,{description:r})}}getErrorTitle(t){const a=t.toLowerCase();return a.includes("401")||a.includes("unauthorized")||a.includes("expirou")?e.t("error_session_expired"):a.includes("token")||a.includes("autenticação")?e.t("error_authentication"):a.includes("api")||a.includes("network")?e.t("error_connection"):"Erro"}success(e,t){l.toast.success(e,{description:t})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function Vn(e){return!!e&&e.startsWith("eyJ")}let $n=!1;var Wn=Object.defineProperty,Hn=(e,t,a)=>((e,t,a)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);function Gn(){if(Ie()){const e=Me();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}const e=(void 0).VITE_SUPABASE_URL,t=(void 0).VITE_SUPABASE_PK_OVERRIDE||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&t?{url:e,key:t}:null}const Kn=class e{constructor(e){Hn(this,"client"),Hn(this,"currentToken",null),Hn(this,"config"),this.config=e,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,t=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;$n?Vn(t):e&&Vn(t)?$n=!0:Vn(t)?$n=!0:$n=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:this.config.key};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return w.createClient(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>{const a="string"==typeof e?e:e.url;if(a.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(a.includes("apikey="))try{const e=new URL(a,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=a.startsWith("http")?e.toString():e.pathname+e.search+e.hash,s={...t,headers:{...t?.headers,apikey:this.config.key}};return fetch(r,s)}}catch{}return fetch(e,t)}}})}static getInstance(){if(!e.instance){const t=Gn();if(!t)throw new Error("[forlogic-core] Supabase não configurado. Defina VITE_SUPABASE_URL e VITE_SUPABASE_PUBLISHABLE_KEY no .env, ou não invoque getSupabaseClient() (use isSupabaseConfigured() para checar antes).");e.instance=new e(t)}return e.instance}getClient(){const e=Un.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Dn.isTokenExpired(e)}catch(t){return qn.handleError(t instanceof Error?t:"Supabase - Error validating token",!1),!1}}};Hn(Kn,"instance");let Yn=Kn;function Qn(){return Yn.getInstance().getClient()}class Xn{static async generateToken(e,t,a,r=!1){try{if(!r){const e=Un.getSupabaseToken();if(e&&Un.isSupabaseTokenValid())return e}const s=Qn();wn("SupabaseTokenService.generateToken:invoke");const{data:n,error:o}=await Nn(0,()=>s.functions.invoke("validate-token",{body:{access_token:e,alias:t}}));return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(a?.(),null):n?.access_token?(Un.setSupabaseToken(n.access_token),n.access_token):null}catch(s){return s instanceof Error&&(s.message.includes("401")||s.message.includes("Unauthorized"))&&a?.(),null}}}var Jn=Object.defineProperty,Zn=(e,t,a)=>((e,t,a)=>t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);class eo{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const t=Un.getAccessToken(),a=Un.getSelectedAlias();if(!t||!a)return null;const r=await Xn.generateToken(t,a,this.onLogoutCallback||void 0,e);return r||null}catch(t){return null}}}Zn(eo,"regenerationPromise",null),Zn(eo,"onLogoutCallback",null);class to{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(Un.clearAll(),window.location.href=Ue("/login"),!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const a=t.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>a.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var ao=Object.defineProperty;class ro{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,a=e.message||e.toString();if(401===t||a.includes("401")||a.includes("Unauthorized")){this.isRetrying=!0;try{return await eo.attemptRegeneration()?(this.isRetrying=!1,!0):(to.handleError(e),this.isRetrying=!1,!1)}catch(r){return to.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Un.getAccessToken();return e?Un.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,a)=>{((e,t,a)=>{t in e?ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,t+"",a)})(ro,"isRetrying",!1);const so=new class{get baseUrl(){return Ge()}async makeApiCall(e,t,a,r){const s=ro.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const n=Un.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!a||""===a.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":a}});if(!i.ok){const e=new Error(`API call failed: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}return await i.json()}mapToQualiexUser(e){let t;return t="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:t}}parseUsersResponse(e,t=""){let a=e;if(e.data)a=e.data;else{if(!Array.isArray(e))return qn.handleError(`[QualiexApi] Formato de resposta inesperado${t}`,!1),null;a=e}return Array.isArray(a)?a.map(e=>this.mapToQualiexUser(e)):(qn.handleError(`[QualiexApi] Resposta não é um array${t}`,!1),null)}async fetchUsers(e,t,a="active"){const r={companyId:t,search:"",filterStatus:a};try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t)??[]}catch(s){if(await ro.handleApiError(s))try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t," após retry")??[]}catch(n){return qn.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return qn.handleError(s instanceof Error?s.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,t,a){try{return(await this.fetchUsers(t,a)).find(t=>t.userId===e)||null}catch(r){return qn.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const a=await this.fetchUsers(e,t,"active"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async fetchAllUsersMap(e,t){const a=await this.fetchUsers(e,t,"all"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async getUsers(e,t="active"){const a=Un.extractTokenData();return a&&a.companyId?this.fetchUsers(e,a.companyId,t):[]}async fetchSoftwares(e){try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):(qn.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(t){if(await ro.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(a){return qn.handleError(a instanceof Error?a:"Erro ao buscar softwares após renovação de token",!0),[]}return qn.handleError(t instanceof Error?t.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,t,a){const r=!!a?.baseUrl,s=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,n=r?a.baseUrl:void 0,o=e=>e.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1}));try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):(qn.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(i){if(await ro.handleApiError(i))try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):[]}catch(l){return qn.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return qn.handleError(i instanceof Error?i.message:"Erro ao buscar associações do usuário",!0),[]}}};function no(e,t){const a=t||Ke.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function oo(e,t){const a=t||Ke.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function io(e,t){const a=t||Ke.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function lo(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||no(e.idField),emailField:e.emailField||oo(e.idField),usernameField:e.usernameField||io(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:no(e),emailField:oo(e),usernameField:io(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const co=new Map;class uo{static async fetchQualiexUsers(e,t){const a=`${t}_${e}_all`,r=co.get(a);if(r&&Date.now()-r.timestamp<3e5)return r.users;let s=await so.fetchUsers(e,t,"all");return 0===s.length&&(s=await so.fetchUsers(e,t,"active")),co.set(a,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const a=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&a.add(t)}return a}static indexUsers(e){const t=new Map;for(const a of e)a.id&&t.set(a.id,a),a.userId&&t.set(a.userId,a);return t}static enrichEntity(e,t,a){const r={...e};for(const s of t){const t=e[s.idField];if(!t)continue;const n=a.get(t);if(n){if(s.nameField){r[s.nameField]||(r[s.nameField]=n.userName||null)}if(s.emailField){r[s.emailField]||(r[s.emailField]=n.userEmail||null)}if(s.usernameField){r[s.usernameField]||(r[s.usernameField]=n.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{if(!Un.areAllTokensValid())return e;const a=Un.extractTokenData();if(!a)return e;const{alias:r,companyId:s}=a;if(!r||!s)return e;const n=lo(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(r,s),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(a){return qn.handleError(a instanceof Error?a:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}}const mo=["responsible_name"],po=e=>mo.includes(e);function ho(e,t,a){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:a||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:s,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,d=()=>{if(!Un.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Qn().schema(i).from(s)},u=(e,t,a,r)=>{let s=d().select(o||"*",{count:"exact"});s=s.eq("is_removed",!1),Object.entries(r).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?s=s.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?s=s.not(e,"is",null):"is_null"===t.operator&&(s=s.is(e,null)):null!==t&&(s=s.eq(e,t)))}),s=((e,t)=>{if(t&&n.length>0){const a=n.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(a)}return e})(s,e);const i=t.includes(".");return i||po(t)||(s=s.order(t,{ascending:"asc"===a})),{query:s,isForeignKey:i}},m=async(e,t,a,s,n)=>{const o=lo(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===t||e.emailField===t||e.usernameField===t),i=t.includes(".");if(po(t)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const c=await uo.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let d;d=i?c.sort((e,r)=>{const s=t.split(".").reduce((e,t)=>e?.[t],e)||"",n=t.split(".").reduce((e,t)=>e?.[t],r)||"",o=String(s).localeCompare(String(n),"pt-BR");return"asc"===a?o:-o}):((e,t,a)=>[...e].sort((e,r)=>{const s=e[t]||"",n=r[t]||"",o=s.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===a?o:-o}))(c,t,a);const u=((e,t=1,a=25)=>{const r=(t-1)*a,s=r+a;return{data:e.slice(r,s),pagination:{currentPage:t,totalPages:Math.ceil(e.length/a),totalItems:e.length,itemsPerPage:a,hasNextPage:s<e.length,hasPreviousPage:t>1}}})(d,s,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await uo.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:t,sortField:a,sortDirection:n,page:o,limit:i,additionalFilters:d}=(e=>{const{search:t="",sortField:a="updated_at",sortDirection:r="desc",page:s=1,limit:n=25,...o}=e;return{search:t,sortField:a,sortDirection:r,page:s,limit:n,additionalFilters:o}})(e),{query:p}=u(t,a,n,d),h=((e,t,a)=>{const r=(t-1)*a,s=r+a-1;return e.range(r,s)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${s}: ${f.message}`);let v=((e,t,a,r)=>{const s=Math.ceil((t||0)/r);return{data:e,currentPage:a,totalPages:s,totalItems:t||0,itemsPerPage:r,hasNextPage:a<s,hasPreviousPage:a>1}})(x||[],g,o,i);if((e=>{if(!c||!l||0===e.length)return!1;const t=lo(r.userIdFields,r.userFieldsMapping);return e.some(e=>t.some(t=>e[t.idField]))})(v.data)){const e=await m(v.data,a,n,o,i);if(!Array.isArray(e))return e;v={...v,data:e}}return v},async getById(e){const{data:t,error:a}=await d().select(o||"*").eq("id",e).maybeSingle();if(a)throw new Error(`Error fetching ${s}: ${a.message}`);return t},async create(e){const t=yr(e),a=Object.entries(t).reduce((e,[t,a])=>(void 0!==a&&(e[t]=a),e),{}),{data:r,error:n}=await d().insert(a).select().single();if(n)throw new Error(`Error creating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from create ${s} operation`);return r},async update(e,t){const a={...yr(t),updated_at:(new Date).toISOString()},{data:r,error:n}=await d().update(a).eq("id",e).select().single();if(n)throw new Error(`Error updating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from update ${s} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:a}=await d().update(t).eq("id",e);if(a)throw new Error(`Error soft deleting ${s}: ${a.message}`)}};return p}const xo={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},fo=class{static async initialize(){try{const e=Fe();if(e){if(Un.checkProjectMismatch())return{...xo}}if(!Un.hasAllTokens()||!Un.areAllTokensValid())return Un.clearExpiredTokens(),{...xo};const t=Un.getAccessToken(),a=Un.getIdToken();Un.clearManualLogout();const r=this.extractUserFromIdToken(a,t),s=this.extractCompaniesFromIdToken(a),n=e?Un.extractTokenData():null,o=this.resolveAliasFromContext(s,t,n?.alias??null);if(e&&(!Un.isSupabaseTokenValid()&&o&&await eo.attemptRegeneration(),!Un.isSupabaseTokenValid()))return{...xo};let i=null;if(o){const e=Un.getCompanyId(o),t=s.find(e=>e.alias===o);t&&(i={id:e||t.id,name:t.name,alias:t.alias})}const l=n?.placeId??null,c=n?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:o,companies:s,selectedUnit:i,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:c,activePlaceId:l,activePlaceName:c}}catch(e){return{...xo}}}static async loginDev(){if(!Fe())return this.loginProd(),!0;try{const e=Qn(),{data:t,error:a}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(a)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL(Ue("/callback"));return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";Un.setOAuthState(e);const t=Un.generateOAuthNonce();Un.setOAuthNonce(t);const a=Ue("/callback"),r=new URL(ze.oauth.authUrl);r.searchParams.set("client_id",ze.oauth.clientId),r.searchParams.set("response_type",ze.oauth.responseType),r.searchParams.set("scope",ze.oauth.scope),r.searchParams.set("redirect_uri",a),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),window.location.href=r.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),a=a=>e.get(a)||t.get(a),r=a("access_token"),s=a("id_token"),n=a("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(r&&s){const e=Un.getAccessToken();e!==r&&Un.clearAll()}const o=Fe();if(Un.hasAllTokens()){if(o){Un.getValidSupabaseToken()||await eo.attemptRegeneration(!0)}return!0}const i=r,l=s;if(!i||!l)throw new Error("Tokens não encontrados na URL de callback");Un.setAccessToken(i),Un.setIdToken(l),Un.clearManualLogout();const c=this.extractCompaniesFromIdToken(l),d=this.resolveAliasFromContext(c,i,null);if(!d)throw new Error("Nenhuma empresa encontrada nos tokens");if(Un.setSelectedAlias(d),o){if(!await eo.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return Un.clearOAuthState(),Un.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){const e=Un.getIdToken();Un.clearAll(),Un.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}const t=Ue("/login");if(e)try{const a=new URL(ze.oauth.logoutUrl);return a.searchParams.set("id_token_hint",e),a.searchParams.set("post_logout_redirect_uri",t),a.searchParams.set("client_id",ze.oauth.clientId),void(window.location.href=a.toString())}catch{}window.location.href=Ue("/login")}static decodeToken(e){return Dn.parseJwtPayload(e)}static extractUserFromIdToken(e,t){const a=this.decodeToken(e);if(!a)return null;const r=t?this.decodeToken(t):null;return{id:a.subNewId,email:a.email,name:a.name,identifier:a.identifier,isSysAdmin:"1"===r?.admin}}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const a=[];Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)a.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,s]=t[e].split("|");r&&s&&a.push({id:"",alias:r.trim(),name:s.trim()})}}});const r=new Map;for(const n of a){if(!n.alias)continue;const e=r.get(n.alias);(!e||!e.id&&n.id)&&r.set(n.alias,n)}const s=Array.from(r.values());a.length,s.length;return s.length,s}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const t=e.split(".");if(t.length<3)return null;const a=t[0];return"www"===a||"admin"===a?null:t.length>=4?t[1]:a}static resolveAliasFromContext(e,t,a){const r=t=>!!t&&e.some(e=>e.alias===t),s=this.getSubdomainAlias();if(r(s))return s;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(a))return a;const n=Un.getSelectedAlias();if(r(n))return n;const o=this.extractAliasFromAccessToken(t);return r(o)?o:e[0]?.alias||null}};eo.setLogoutCallback(()=>{fo.logout()});let go=fo;const vo=e=>e?.placeId||null,bo=e=>e?.placeName||null,yo=a.createContext(void 0),wo=({children:e})=>{const[r,s]=a.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=j.useQueryClient()}catch{}const[o,i]=a.useState(!1),l=a.useRef(0),c=a.useCallback(e=>{s(t=>({...t,...e}))},[]),d=a.useCallback(e=>{s(t=>({...t,isLoading:e}))},[]),u=a.useCallback(()=>{s({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=a.useCallback(async e=>{if(e.alias===r.alias)return;const t=++l.current;try{const s=Un.getAccessToken();if(!s)return;const o=Fe();let i=null;if(o){const a=await Xn.generateToken(s,e.alias,void 0,!0);if(l.current!==t)return;if(!a)return;Un.setSupabaseToken(a),i=Un.extractTokenData()}Un.setSelectedAlias(e.alias);const d=i?.alias||e.alias,u=i?.companyId||Un.getCompanyId(e.alias),m={id:u||e.id,name:e.name,alias:d};let p=null,h=null;if(r.user?.id&&d&&u)try{const e=await so.fetchActiveUsersMap(d,u);if(l.current!==t)return;const a=e.get(r.user.id);if(a){const e=(e=>({placeId:vo(e),placeName:bo(e)}))(a);p=e.placeId,h=e.placeName}}catch(a){}if(l.current!==t)return;c({alias:d,selectedUnit:m,placeId:p,placeName:h,activePlaceId:p,activePlaceName:h}),n&&await n.clear()}catch(a){}},[c,n,r.user,r.alias]),p=a.useCallback(async()=>{wn("AuthContext.processCallback");const e=await Nn(0,()=>go.processCallback());if(e){const e=await Nn(0,()=>go.initialize());e&&e.isAuthenticated&&(c({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[c,n]),h=a.useCallback(async()=>{await go.logout(),u(),n&&await n.clear()},[u,n]),x=a.useCallback(e=>{i(e)},[]),f=a.useCallback(()=>{},[]),g=a.useCallback(()=>{n&&n.invalidateQueries()},[n]);a.useEffect(()=>{if(!r.isAuthenticated)return;let e=!0;const t=setInterval(async()=>{if(e)if(Un.areAllTokensValid()){if(Fe()&&!Un.isSupabaseTokenValid())try{await eo.attemptRegeneration()||e&&h()}catch(t){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(t)}},[r.isAuthenticated,h]),a.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await go.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&d(!1)}catch(t){e&&(to.handleError(t),d(!1))}})(),()=>{e=!1}},[c,d,h]);const v=a.useMemo(()=>({...r,logout:h,processCallback:p,switchUnit:m,availableUnits:r.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[r.user,r.companies,r.alias,r.isAuthenticated,r.isLoading,r.selectedUnit,r.userId,r.userAlias,r.placeId,r.placeName,r.activePlaceId,r.activePlaceName,h,p,m,o,x,f,g]);return t.jsx(yo.Provider,{value:v,children:e})},jo=()=>{const e=a.useContext(yo);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function No({queryKey:e,service:t,entityName:r,searchFields:s,additionalFilters:n={},onSuccess:o}){const[i,c]=N.useSearchParams(),d=j.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=jo(),{t:h}=y.useTranslation(),x=a.useCallback(t=>{const a=`${e}_${t}`,r=i.get(a);return r||(i.get(t)||"")},[i,e]),f=x("search"),g=x("sortField")||qe.sorting.defaultField,v=x("sortDirection")||qe.sorting.defaultDirection,b=parseInt(x("page")||"1"),w=parseInt(x("limit")||String(qe.pagination.defaultPageSize)),_=f,C=a.useMemo(()=>({search:_,sortField:g,sortDirection:v,page:b,limit:w,...n}),[_,g,v,b,w,n]),k=a.useCallback(()=>t.getAll(C),[t,C]),S=j.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const A=j.useMutation({mutationFn:t.create,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Qe.success.created(r)),o?.()},onError:e=>{l.toast.error(`${Qe.error.create(r)}: ${e.message}`)}}),T=j.useMutation({mutationFn:({id:e,data:a})=>t.update(e,a),onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Qe.success.updated(r)),o?.()},onError:e=>{l.toast.error(`${Qe.error.update(r)}: ${e.message}`)}}),D=j.useMutation({mutationFn:t.delete,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Qe.success.deleted(r))},onError:e=>{l.toast.error(`${Qe.error.delete(r)}: ${e.message}`)}}),P=a.useCallback(t=>{const a={...Object.fromEntries(i)};Object.entries(t).forEach(([t,r])=>{const s=`${e}_${t}`;""===r||0===r?delete a[s]:a[s]=String(r)}),delete a.sortField,delete a.sortDirection,c(a)},[i,c,e]),E=a.useCallback(e=>{P({search:e,page:1})},[P]),M=a.useCallback(e=>{P({sortField:e,sortDirection:g===e&&"asc"===v?"desc":"asc",page:1})},[g,v,P]),I=a.useCallback(e=>{P({page:e})},[P]),R=a.useCallback(e=>{P({limit:e,page:1})},[P]),L=a.useCallback(()=>{const t=Object.fromEntries(i),a=`${e}_`,r=Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith(a)));c(r)},[c,i,e]),[F,z]=a.useState([]),U=a.useCallback(e=>{z(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),O=a.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(t=>t.length===e.length?[]:e)},[S?.data?.data]),B=a.useCallback(()=>{z([])},[]),q=a.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,S?.data?.data]),V=j.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>t.delete(e)))},onSuccess:(t,a)=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${a.length} ${r}(s) deletado(s) com sucesso`)),B()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=a.useCallback((e,t)=>{const a=t?t(e):e;e.id?T.mutate({id:e.id,data:a}):A.mutate({...a,alias:u})},[u,A,T]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||qe.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:T?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:v,currentPage:b,itemsPerPage:w,queryKey:e,createEntity:A.mutate,updateEntity:(e,t)=>T.mutate({id:e,data:t}),deleteEntity:D.mutate,save:$,handleSearch:E,handleSort:M,handlePageChange:I,handleItemsPerPageChange:R,clearFilters:L,refetch:S.refetch,selectedIds:F,selectItem:U,selectAll:O,clearSelection:B,isAllSelected:q,bulkDelete:e=>V.mutateAsync(e),isBulkDeleting:V.isPending}}function _o(e){const[t,r]=a.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return a.useEffect(()=>{const t=window.matchMedia(e);r(t.matches);const a=e=>{r(e.matches)};return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),t}function Co(e=768){return _o(`(max-width: ${e-1}px)`)}const ko=te.forwardRef(({className:e,...a},r)=>t.jsx("table",{ref:r,className:br("w-full caption-bottom text-[13px] table-fixed",e),...a}));ko.displayName="Table";const So=te.forwardRef(({className:e,...a},r)=>t.jsx("thead",{ref:r,className:br("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...a}));So.displayName="TableHeader";const Ao=te.forwardRef(({className:e,...a},r)=>t.jsx("tbody",{ref:r,className:br("[&_tr:last-child]:border-0",e),...a}));Ao.displayName="TableBody";const To=te.forwardRef(({className:e,...a},r)=>t.jsx("tfoot",{ref:r,className:br("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));To.displayName="TableFooter";const Do=te.forwardRef(({className:e,...a},r)=>t.jsx("tr",{ref:r,className:br("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...a}));Do.displayName="TableRow";const Po=te.forwardRef(({className:e,...a},r)=>t.jsx("th",{ref:r,className:br("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...a}));Po.displayName="TableHead";const Eo=te.forwardRef(({className:e,...a},r)=>t.jsx("td",{ref:r,className:br("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...a}));Eo.displayName="TableCell";const Mo=te.forwardRef(({className:e,...a},r)=>t.jsx("caption",{ref:r,className:br("mt-4 text-sm text-muted-foreground",e),...a}));function Io({rows:e=5,columns:a=4}){return t.jsx("div",{className:"w-full",children:t.jsxs("div",{className:"rounded-md border",children:[t.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(cn,{className:"h-4 w-24"},a))})}),t.jsx("div",{children:Array.from({length:e}).map((e,r)=>t.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(cn,{className:"h-4 w-20"},a))})},r))})]})})}function Ro({count:e=3}){return t.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,a)=>t.jsxs(Sr,{children:[t.jsxs(Ar,{children:[t.jsx(cn,{className:"h-4 w-3/4"}),t.jsx(cn,{className:"h-3 w-1/2"})]}),t.jsx(Pr,{children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(cn,{className:"h-3 w-full"}),t.jsx(cn,{className:"h-3 w-2/3"})]})})]},a))})}Mo.displayName="TableCaption";const Lo={default:c.FileX,search:c.Search,error:c.AlertCircle};function Fo({icon:e,title:a,description:r,action:s,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,c=Lo[o];return t.jsxs("div",{className:br("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[t.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:t.jsx(c,{className:"h-8 w-8 text-muted-foreground"})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:a}),r&&t.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),s&&t.jsx(jr,{onClick:s.onClick,variant:"outline",children:s.label})]})}function zo({children:e,className:a}){const r=te.useRef(null),[s,n]=te.useState(!1);te.useEffect(()=>{const e=()=>{const e=r.current;e&&n(e.scrollWidth>e.clientWidth)};e();const t=new ResizeObserver(e);return r.current&&t.observe(r.current),()=>t.disconnect()},[e]);const o=t.jsx("div",{ref:r,className:`truncate w-full max-w-full ${a||""}`,children:e});return s?t.jsx(Hs,{delayDuration:300,children:t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:o}),t.jsx(Ys,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const Uo=te.forwardRef(({direction:e,onMouseDown:a,isDragging:r,className:s},n)=>{const o="horizontal"===e;return t.jsx("div",{ref:n,onMouseDown:a,className:br("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],r&&"bg-primary/30",s),children:t.jsx("div",{className:br("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});Uo.displayName="TableResizeHandle";const Oo=me.Root,Bo=me.Trigger,qo=me.Group,Vo=me.Portal,$o=me.Sub,Wo=me.RadioGroup,Ho=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(me.SubTrigger,{ref:n,className:br("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Ho.displayName=me.SubTrigger.displayName;const Go=te.forwardRef(({className:e,...a},r)=>t.jsx(me.SubContent,{ref:r,className:br("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Go.displayName=me.SubContent.displayName;const Ko=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Portal,{children:t.jsx(me.Content,{ref:r,className:br("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Ko.displayName=me.Content.displayName;const Yo=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Item,{ref:s,className:br("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Yo.displayName=me.Item.displayName;const Qo=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(me.CheckboxItem,{ref:n,className:br("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Qo.displayName=me.CheckboxItem.displayName;const Xo=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(me.RadioItem,{ref:s,className:br("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Xo.displayName=me.RadioItem.displayName;const Jo=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Label,{ref:s,className:br("px-2 py-1.5 text-sm font-semibold text-foreground",a&&"pl-8",e),...r}));Jo.displayName=me.Label.displayName;const Zo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Separator,{ref:r,className:br("-mx-1 my-1 h-px bg-border",e),...a}));Zo.displayName=me.Separator.displayName;const ei=({className:e,...a})=>t.jsx("span",{className:br("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});ei.displayName="ContextMenuShortcut";const ti=({onEdit:e,onDelete:a,onToggleStatus:r,isActive:s=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),d=[];if(e){const t={icon:c.Edit,label:l("edit"),onClick:e};d.push(t)}if(o.forEach(e=>{d.push(e)}),r){const e={icon:s?c.PowerOff:c.Power,label:s?"Inativar":"Ativar",onClick:r};d.push(e)}if(n&&a){const e={icon:c.Trash2,label:l("ap_delete"),onClick:a,destructive:!0};d.push(e)}const u="dropdown"===i?Os:Yo;return t.jsx(t.Fragment,{children:d.map((e,a)=>t.jsxs(u,{onClick:e.onClick,className:br("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[t.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},a))})},ai=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsx(jr,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:t.jsx(c.EllipsisVertical,{size:12})})}),t.jsx(Us,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:t.jsx(ti,{onEdit:e?t=>{t?.stopPropagation(),e?.()}:void 0,onDelete:a?e=>{e?.stopPropagation(),a?.()}:void 0,onToggleStatus:s?e=>{e?.stopPropagation(),s?.()}:void 0,isActive:n,canDelete:r&&!!a,customActions:o,renderAs:"dropdown"})})]}),ri=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return t.jsx(Hs,{delayDuration:200,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e()},children:t.jsx(c.Pencil,{size:14})})}),t.jsx(Ys,{children:i("edit")})]}),o.map((e,a)=>{const r=e.icon;return t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e.onClick()},children:t.jsx(r,{size:14})})}),t.jsx(Ys,{children:e.label})]},a)}),s&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),s()},children:n?t.jsx(c.ToggleRight,{size:14}):t.jsx(c.ToggleLeft,{size:14})})}),t.jsx(Ys,{children:n?"Inativar":"Ativar"})]}),a&&r&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:br("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),a()},children:t.jsx(c.Trash2,{size:14})})}),t.jsx(Ys,{children:i("ap_delete")})]})]})})},si=150;function ni({columns:e,storageKey:t,onResize:r,enabled:s=!0}){const[n,o]=a.useState(()=>{if(!s||"undefined"==typeof window)return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??si,e),{});if(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??si,e),{})}),[i,l]=a.useState(!1),[c,d]=a.useState(null),u=a.useRef(0),m=a.useRef(0),p=a.useCallback((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),l(!0),d(e),u.current=t.clientX,m.current=n[e]??si)},[s,n]);a.useEffect(()=>{if(!i||!c)return;const a=e.find(e=>e.key===c),s=a?.minWidth??60,n=a?.maxWidth??500,p=e=>{const t=e.clientX-u.current,a=Math.max(s,Math.min(n,m.current+t));o(e=>{const t={...e,[c]:a};return r?.(t),t})},h=()=>{l(!1),d(null),t&&o(e=>(localStorage.setItem(t,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,c,e,t,r]),a.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=a.useCallback(()=>{const a=e.reduce((e,t)=>(e[t.key]=t.defaultWidth??si,e),{});o(a),t&&localStorage.removeItem(t),r?.(a)},[e,t,r]);return{columnWidths:n,isDragging:i,activeColumn:c,handleMouseDown:p,resetWidths:h}}const oi=s.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),ii=te.forwardRef(({className:e,variant:a,size:r,...s},n)=>t.jsx(he.Root,{ref:n,className:br(oi({variant:a,size:r,className:e})),...s}));ii.displayName=he.Root.displayName;const li=te.createContext({size:"default",variant:"default"}),ci=te.forwardRef(({className:e,variant:a,size:r,children:s,...n},o)=>t.jsx(pe.Root,{ref:o,className:br("flex items-center justify-center gap-1",e),...n,children:t.jsx(li.Provider,{value:{variant:a,size:r},children:s})}));ci.displayName=pe.Root.displayName;const di=te.forwardRef(({className:e,children:a,variant:r,size:s,...n},o)=>{const i=te.useContext(li);return t.jsx(pe.Item,{ref:o,className:br(oi({variant:i.variant||r,size:i.size||s}),e),...n,children:a})});di.displayName=pe.Item.displayName;const ui=a.memo(function({onNew:e,newButtonLabel:a,showNewButton:r=!0,showSearch:s=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:d=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:v=!1,availableViewModes:b=["table","list","grid"],rightSlot:w,className:j}){const{t:N}=y.useTranslation(),_=d>0,C=e&&r||h.length>0,k=x||v||w,S=s&&o;return C||S||k||l&&_?t.jsxs("div",{className:br("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",j),children:[t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&r&&t.jsxs(jr,{onClick:e,children:[t.jsx(c.Plus,{size:16,className:"mr-2"}),a||"Novo"]}),h.map((e,a)=>{const r=e.icon;return t.jsxs(jr,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[r&&t.jsx(r,{size:16,className:"mr-2"}),e.label]},a)})]}),l&&_&&t.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[t.jsx(ks,{variant:"secondary",className:"mr-1 tabular-nums",children:d}),t.jsxs(Hs,{delayDuration:200,children:[u.length>0?u.map((e,a)=>{const r=e.icon,s=e.disabled;return t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:br("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:s,onClick:()=>e.action([]),children:r?t.jsx(r,{size:16}):t.jsx("span",{className:"text-xs",children:e.label[0]})})}),t.jsx(Ys,{children:e.label})]},a)}):t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:t.jsx(c.Trash2,{size:16})})}),t.jsx(Ys,{children:N("ap_delete")})]}),t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:t.jsx(c.X,{size:16})})}),t.jsx(Ys,{children:N("clear_selection")})]})]})]}),S&&t.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t.jsxs("div",{className:"relative w-full",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(_r,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,v&&f&&g&&t.jsx(ci,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:b.map(e=>{const a=(e=>{switch(e){case"table":return c.Table2;case"list":return c.List;case"grid":return c.LayoutGrid}})(e);return t.jsx(di,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:t.jsx(a,{className:"h-4 w-4"})},e)})}),w]})]}):null}),mi=a.memo(({checked:e,onCheckedChange:a})=>t.jsx(Ns,{checked:e,onCheckedChange:a}),(e,t)=>e.checked===t.checked);function pi(e){try{const t=localStorage.getItem(e);if(!t)return null;const a=JSON.parse(t);let r=a.groupByColumns||[];return 0===r.length&&a.groupByColumn&&(r=[a.groupByColumn]),{hiddenColumns:new Set(a.hiddenColumns||[]),columnOrder:a.columnOrder||[],groupByColumns:r}}catch{return null}}function hi({columns:e,storageKey:t,enabled:r=!0,defaultHiddenColumns:s}){const n=a.useMemo(()=>e.map(e=>String(e.key)),[e]),o=a.useMemo(()=>new Set(s??[]),[s]),[i,l]=a.useState(()=>{if(!r)return o;if(!t)return o;const e=pi(t);return e?.hiddenColumns??o}),[c,d]=a.useState(()=>{if(!r||!t)return n;const e=pi(t)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=a.useState(()=>r&&t?pi(t)?.groupByColumns??[]:[]),[p,h]=a.useState(new Set);a.useEffect(()=>{r&&t&&function(e,t){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(t.hiddenColumns),columnOrder:t.columnOrder,groupByColumns:t.groupByColumns}))}catch{}}(t,{hiddenColumns:i,columnOrder:c,groupByColumns:u})},[i,c,u,t,r]),a.useEffect(()=>{const t=new Set(e.map(e=>String(e.key))),a=new Set(c),r=[...t].filter(e=>!a.has(e));r.length>0&&d(e=>[...e.filter(e=>t.has(e)),...r])},[e]);const x=a.useCallback(e=>i.has(e),[i]),f=a.useCallback(e=>{l(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),g=a.useCallback(()=>{l(new Set)},[]),v=a.useCallback(()=>{if(l(o),d(n),m([]),h(new Set),t)try{localStorage.removeItem(t)}catch{}},[n,o,t]),b=a.useCallback((e,t)=>{d(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r})},[]),y=a.useCallback(e=>{h(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),w=a.useCallback(e=>{m(e),h(new Set)},[]),j=a.useCallback(e=>{m(t=>t.includes(e)?t:[...t,e])},[]),N=a.useCallback(e=>{m(t=>t.filter(t=>t!==e)),h(t=>{const a=new Set;for(const r of t)r.includes(`${e}:`)||a.add(r);return a})},[]),_=a.useCallback((e,t)=>{m(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r}),h(new Set)},[]),C=u[0]??null,k=a.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=a.useMemo(()=>{if(!r)return e;const t=new Map(e.map(e=>[String(e.key),e]));return c.filter(e=>!i.has(e)&&t.has(e)).map(e=>t.get(e))},[e,c,i,r]),A=a.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(t,a,r,s){if(0===a.length)return[{groupKey:s||"__leaf__",groupValue:"",items:t,count:t.length,level:r}];const[n,...o]=a,i=new Map;for(const l of t){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([t,a])=>{const i=s?`${s}|${n}:${t}`:`${n}:${t}`,l=o.length>0?e(a,o,r+1,i):void 0;return{groupKey:i,groupValue:t,items:a,count:a.length,level:r,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:v,columnOrder:c,reorderColumns:b,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:w,addGroupByColumn:j,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:A,collapsedGroups:p,toggleGroupCollapse:y}}function xi({enabled:e=!1,onReorder:t}){const[r,s]=a.useState(null),[n,o]=a.useState(null),i=a.useCallback(()=>{s(null),o(null)},[]),l=a.useCallback((a,n)=>({draggable:e,onDragStart:t=>{e&&(s(a),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",String(a)),n&&t.dataTransfer.setData("application/column-key",n))},onDragOver:t=>{e&&null!==r&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},onDragEnter:t=>{e&&null!==r&&(t.preventDefault(),o(a))},onDrop:s=>{s.preventDefault(),e&&null!==r&&r!==a?(t(r,a),i()):i()},onDragEnd:()=>{i()}}),[e,r,t,i]);return a.useMemo(()=>({dragFromIndex:r,dragOverIndex:n,isDragging:null!==r,getDragProps:l}),[r,n,l])}function fi({columns:e,columnOrder:r,isColumnHidden:s,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:d,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=a.useState(null),[v,b]=a.useState(null),w=a.useRef(null),j=new Map(e.map(e=>[String(e.key),e])),N=r.filter(e=>j.has(e)).map(e=>j.get(e)),_=()=>{w.current=null,g(null),b(null)};N.some(e=>s(String(e.key)));const C=N.every(e=>!s(String(e.key)));return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(jr,{variant:"outline",size:"icon",className:"h-8 w-8",children:t.jsx(c.Columns3,{size:16})})}),t.jsxs(Zs,{className:"w-[260px] p-0",align:"end",children:[t.jsx("div",{className:"px-3 py-2 border-b",children:t.jsx("span",{className:"text-sm font-medium",children:"Colunas"})}),t.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:t.jsx(Hs,{delayDuration:300,children:N.map((e,a)=>{const r=String(e.key),o=s(r),h=!1!==e.hideable,y=!0===e.groupable,j=u.includes(r)||l===r;return t.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,g(e)})(a),onDragOver:e=>((e,t)=>{e.preventDefault(),b(t)})(e,a),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&i(w.current,e),w.current=null,g(null),b(null)})(a),onDragEnd:_,className:br("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===a&&"opacity-50",v===a&&"border-t-2 border-primary"),children:[t.jsx(c.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx(Ns,{checked:!o,onCheckedChange:()=>h&&n(r),disabled:!h,className:"shrink-0"}),t.jsx("span",{className:br("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:br("h-6 w-6 shrink-0",j&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),j?p?p(r):d?.(null):m?m(r):d?.(r)},children:t.jsx(c.Group,{size:14})})}),t.jsx(Ys,{children:x(j?"remove_grouping":"group_by_column")})]})]},r)})})}),t.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[t.jsx(jr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&t.jsx(jr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:"Redefinir padrão"})]})]})]})}function gi({columns:e,groupByColumns:r,addGroupByColumn:s,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=a.useState(!1),[d,u]=a.useState(null),[m,p]=a.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=r.length>0;return t.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const t=e.dataTransfer.getData("application/column-key");if(t&&!r.includes(t)){const e=h.get(t);e&&e.groupable&&s(t)}},className:br("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[t.jsx(c.Group,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?r.map((e,r)=>{const s=h.get(e);if(!s)return null;const i=d===r,l=m===r&&d!==r;return t.jsxs(a.Fragment,{children:[r>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),t.jsxs(ks,{variant:"secondary",className:br("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,t)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(t)),e.dataTransfer.effectAllowed="move",u(t)})(e,r),onDragOver:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),p(t)})(e,r),onDrop:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const a=e.dataTransfer.getData("application/group-chip-index");if(""!==a){const e=parseInt(a,10);isNaN(e)||e===t||o(e,t)}u(null),p(null)})(e,r),onDragEnd:x,children:[s.header,t.jsx("button",{onClick:t=>{t.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:t.jsx(c.X,{size:12})})]})]},e)}):t.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const vi=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:v,showActionBar:b=!0,showSearch:w=!1,searchValue:j,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D=!1,enableColumnResize:P=!0,resizeStorageKey:E,enableColumnManager:M=!0,columnManagerStorageKey:I,defaultHiddenColumns:R,enableGrouping:L=!1,enableExpandableRows:F=!1,renderExpandedContent:z,expandedRowIds:U,onToggleExpand:O,defaultExpandAll:B=!1,hideActionsColumn:q=!1})=>{const{t:V}=y.useTranslation(),{setSearchVisible:$}=jo(),W=Co(),[H,G]=a.useState(()=>B&&F?new Set(r.entities.map(e=>e.id)):new Set),K=void 0!==U,Y=K?new Set(U):H,Q=a.useCallback(e=>{K&&O?O(e):G(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[K,O]),X=void 0!==v?!v:b;a.useEffect(()=>{if(!w)return $(!0),()=>$(!1)},[$,w]);const J=hi({columns:s,storageKey:I,enabled:M,defaultHiddenColumns:R}),Z=xi({enabled:M,onReorder:J.reorderColumns}),ee=M?J.visibleColumns:s,{columnWidths:te,isDragging:ae,activeColumn:re,handleMouseDown:se}=ni({columns:ee.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:E?`${E}-columns`:void 0,enabled:P}),ne=a.useMemo(()=>(()=>{if(P){const e=ee.map(e=>te[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return ee.map((a,r)=>({...a,calculatedWidth:e[r],style:{width:e[r]/t*100+"%"}}))}let e=0;const t=ee.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const a=t.minWidth||120,r=t.weight||1;return e+=a,{...t,calculatedWidth:a,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[ee,P,te]),oe=h||g.length>0||w||m||S||D||M,ie=X&&oe,le=k||(()=>{r.bulkDelete?.(r.selectedIds)}),ce=e=>t.jsx(Eo,{className:"text-center",children:d?d(e):"inline"===p?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:t.jsx(ri,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):t.jsx(ai,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),de=e=>t.jsx(Ko,{className:"w-[160px]",children:t.jsx(ti,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),ue=M?t.jsx(fi,{columns:s,columnOrder:J.columnOrder,isColumnHidden:J.isColumnHidden,toggleColumn:J.toggleColumn,showAllColumns:J.showAllColumns,resetColumns:J.resetColumns,reorderColumns:J.reorderColumns,groupByColumn:L?J.groupByColumn:void 0,setGroupByColumn:L?J.setGroupByColumn:void 0,groupByColumns:L?J.groupByColumns:void 0,addGroupByColumn:L?J.addGroupByColumn:void 0,removeGroupByColumn:L?J.removeGroupByColumn:void 0}):void 0;if(W)return r.isLoading?t.jsx(Ro,{count:3}):0===r.entities.length?t.jsx(Fo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t.jsxs("div",{className:"flex flex-col h-full",children:[ie&&t.jsx(ui,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),t.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>t.jsxs(Oo,{children:[t.jsx(Bo,{asChild:!0,children:t.jsx(Sr,{className:br("overflow-hidden cursor-pointer hover:bg-muted/50",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:t.jsx(Pr,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[m&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(mi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1",children:[ee.map(a=>t.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||d)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):t.jsx(ai,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})})}),de(e)]},e.id))})]});const me=L&&J.groupByColumns.length>0?J.getGroupedData(r.entities):null,pe=null!==me,he=(F?1:0)+(m?1:0)+ee.length+(q?0:1),xe=e=>{const s=F&&Y.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(Oo,{children:[t.jsx(Bo,{asChild:!0,children:t.jsxs(Do,{className:br("cursor-pointer hover:bg-muted/50 relative",("inline"===p||q)&&"group",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:[F&&t.jsx(Eo,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),Q(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":V(s?"collapse_row":"expand_row"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&t.jsx(Eo,{onClick:e=>e.stopPropagation(),children:t.jsx(mi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),ee.map(a=>t.jsx(Eo,{className:a.className,children:t.jsx(zo,{children:a.render?a.render(e):String(e[a.key]??"")})},String(a.key))),!q&&ce(e)]})}),de(e)]}),s&&z&&t.jsx(Do,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Eo,{colSpan:he,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},fe=(e,r)=>{const{t:s}=y.useTranslation();return e.map(e=>{const s=J.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return t.jsxs(a.Fragment,{children:[t.jsx(Do,{className:br("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>J.toggleGroupCollapse(e.groupKey),children:t.jsx(Eo,{colSpan:r,className:"py-2 px-4",children:t.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[s?t.jsx(c.ChevronRight,{size:16}):t.jsx(c.ChevronDown,{size:16}),t.jsx("span",{children:e.groupValue}),t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!s&&(e.children?fe(e.children,r):e.items.map(xe))]},e.groupKey)})};return t.jsxs("div",{className:"flex flex-col h-full",children:[ie&&t.jsx(ui,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),r.isLoading?t.jsx(Io,{rows:5,columns:ee.length}):t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L&&t.jsx(gi,{columns:s,groupByColumns:J.groupByColumns,addGroupByColumn:J.addGroupByColumn,removeGroupByColumn:J.removeGroupByColumn,reorderGroupByColumns:J.reorderGroupByColumns}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(ko,{className:"table-fixed w-full",children:[t.jsxs("colgroup",{children:[F&&t.jsx("col",{style:{width:"40px"}}),m&&t.jsx("col",{style:{width:"50px"}}),ne.map((e,a)=>t.jsx("col",{style:e.style},a)),!q&&t.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),t.jsx(So,{children:t.jsxs(Do,{children:[F&&t.jsx(Po,{className:"w-[40px]"}),m&&t.jsx(Po,{className:"w-[50px]",children:t.jsx(mi,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),ee.map((e,a)=>{const s=P&&!1!==e.resizable,n=re===String(e.key),o=M?Z.getDragProps(a,String(e.key)):{},i=Z.dragFromIndex===a,l=Z.dragOverIndex===a&&Z.dragFromIndex!==a;return t.jsxs(Po,{className:br(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",M&&Z.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...o,children:[t.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(d=String(e.key),r.sortField!==d?null:"asc"===r.sortDirection?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}),s&&t.jsx(Uo,{direction:"horizontal",onMouseDown:t=>se(String(e.key),t),isDragging:n})]},String(e.key));var d}),!q&&t.jsx(Po,{className:"w-[50px] text-center",children:ue||e.t("actions")})]})}),t.jsx(Ao,{children:0===r.entities.length?t.jsx(Do,{children:t.jsx(Eo,{colSpan:he,className:"h-32",children:t.jsx(Fo,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):pe?fe(me,he):r.entities.map(xe)})]})})]})]})};function bi(e,t,r,s){const[n,o]=a.useState({}),[i,l]=a.useState({}),c=a.useMemo(()=>e,[e]),d=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(a){return u(e)}},p=(e,t,a)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let s;if("function"==typeof e.validation?s=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(s=e.validation.custom),s)try{const e=s(t,a);if(e)return e}catch(r){}}};a.useEffect(()=>{if(!s)return;const e=t=>{const a=[];return t.forEach(t=>{a.push(t),t.fields&&a.push(...e(t.fields))}),a},a=e(c),n={};a.forEach(e=>{let a;if(t&&void 0!==t[e.name]){if(a=t[e.name],null==a&&(a=""),"date"===e.type&&a)if("string"==typeof a){const e=new Date(a);d(e)&&(a=e.toISOString().split("T")[0])}else d(a)&&(a=a.toISOString().split("T")[0])}else a=u(e);n[e.name]=a}),a.forEach(e=>{const t=m(e,n);void 0!==t&&(n[e.name]=t)}),t&&Object.keys(t).forEach(e=>{a.find(t=>t.name===e)||void 0===t[e]||(n[e]=t[e])}),o(n),l({}),r&&r(n)},[c,t,r,s]);const h=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...h(e.fields))}),t},x=()=>{const e=h(c),t={};return e.forEach(e=>{const a=p(e,n[e.name],n);a&&(t[e.name]=a)}),l(t),0===Object.keys(t).length};return{formData:n,errors:i,updateField:(e,t)=>{o(a=>{const s={...a,[e]:t},n=((e,t)=>{let a={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=m(e,a);void 0!==t&&(a={...a,[e.name]:t})}),a})(e,s);return r&&r(n),n}),i[e]&&l(t=>{const a={...t};return delete a[e],a});const a=h(c).find(t=>t.name===e);if(a){const r=p(a,t,n);r&&l(t=>({...t,[e]:r}))}},validateForm:x,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),x()&&e(n)}}}const yi=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],wi=[10,22,35,45,55,68,78,87,94].flatMap(e=>yi.map(({hue:t,saturation:a})=>((e,t,a)=>{a/=100;const r=t=>(t+e/30)%12,s=(t/=100)*Math.min(a,1-a),n=e=>{const t=a-s*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return Math.round(255*t).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(t,a,e))),ji=({value:e="#3b82f6",onChange:r,label:s,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),d=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=a.useState(!1),h=a.useRef([]),x=yi.length,f=a.useMemo(()=>{const t=wi.findIndex(t=>t.toLowerCase()===e.toLowerCase());return t>=0?t:0},[e]),[g,v]=a.useState(f);a.useEffect(()=>{m&&(v(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const b=e=>{const t=Math.max(0,Math.min(wi.length-1,e));v(t),h.current[t]?.focus()},w=e=>{r?.(e),p(!1)};return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(kr,{children:s}),t.jsxs(Xs,{open:m,onOpenChange:p,children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[t.jsxs("span",{className:"flex items-center min-w-0",children:[t.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&t.jsx("span",{className:"truncate",children:e})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),t.jsx(Zs,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(kr,{children:u}),t.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${yi.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),b(g+1);break;case"ArrowLeft":e.preventDefault(),b(g-1);break;case"ArrowDown":e.preventDefault(),b(g+x);break;case"ArrowUp":e.preventDefault(),b(g-x);break;case"Home":e.preventDefault(),b(0);break;case"End":e.preventDefault(),b(wi.length-1);break;case"Enter":e.preventDefault(),w(wi[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:wi.map((a,r)=>{const s=a.toLowerCase()===e.toLowerCase();return t.jsx("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(s?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:a},onClick:()=>w(a),"aria-label":`Selecionar cor ${a}`},`${a}-${r}`)})})]}),t.jsxs("div",{children:[t.jsx(kr,{htmlFor:"color-input",children:d}),t.jsx(_r,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Ni=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(xe.Root,{ref:s,className:br("relative overflow-hidden",e),...r,children:[t.jsx(xe.Viewport,{className:"h-full w-full rounded-[inherit]",children:a}),t.jsx(_i,{}),t.jsx(xe.Corner,{})]}));Ni.displayName=xe.Root.displayName;const _i=te.forwardRef(({className:e,orientation:a="vertical",...r},s)=>t.jsx(xe.ScrollAreaScrollbar,{ref:s,orientation:a,className:br("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:t.jsx(xe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));_i.displayName=xe.ScrollAreaScrollbar.displayName;const Ci=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function ki({name:e,filled:a,className:r}){return t.jsx("span",{className:`material-symbols-outlined ${r??""}`,style:a?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Si=({value:e=null,onChange:r,label:s,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=a.useState(!1),d=a.useRef([]),u=e?(m=e,Ci.find(e=>e.name===m)):null;var m;const p=a.useMemo(()=>{if(!e)return 0;const t=Ci.findIndex(t=>t.name===e);return t>=0?t:0},[e]),[h,x]=a.useState(p);a.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{d.current[p]?.focus()}))},[i,p]);const f=a.useCallback(e=>{const t=Math.max(0,Math.min(Ci.length-1,e));x(t),d.current[t]?.focus()},[]),g=a.useCallback(e=>{r?.(e),l(!1)},[r]),v=a.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),b=a.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Ci.length-1);break;case"Enter":e.preventDefault(),g(Ci[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(kr,{children:s}),t.jsxs(Xs,{open:i,onOpenChange:l,children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:v,children:[u?t.jsx(ki,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):t.jsx("span",{className:"text-muted-foreground text-sm",children:n}),t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),t.jsx(Zs,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{d.current[p]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(Ni,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:t.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:b,role:"grid",children:Ci.map((a,r)=>t.jsx("button",{ref:e=>{d.current[r]=e},type:"button",tabIndex:r===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===a.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(a.name),title:a.name,children:t.jsx(ki,{name:a.name,filled:a.filled,className:"text-2xl"})},a.name))})}),t.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Ai=te.forwardRef(({className:e,...a},r)=>t.jsx(fe.Root,{className:br("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...a,ref:r,children:t.jsx(fe.Thumb,{className:br("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ai.displayName=fe.Root.displayName;const Ti=(e={})=>{const{user:t,alias:a}=jo(),{enabled:r=!0,status:s="active"}=e;return j.useQuery({queryKey:["qualiex-users",a,s],queryFn:()=>so.getUsers(a,s),enabled:r&&!!a&&!!t,staleTime:3e5,retry:2,retryDelay:1e3})},Di=({value:r,onChange:s,multiple:n=!1,label:o,required:i,placeholder:l,icon:c,maxDisplayedBadges:d,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:v,onOpen:b,onClose:w})=>{const{t:j}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Ti({enabled:p}),[k,S]=a.useState(new Map),A=a.useMemo(()=>r?Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean):[],[r]),T=a.useMemo(()=>{if(0===A.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return A.filter(t=>t&&!e.has(t)&&!k.has(t)).sort().join(",")},[A,N,k]);a.useEffect(()=>{if(!T)return;const e=T.split(",");let t=!1;const a=Un.extractTokenData();return a?.alias&&a?.companyId?(so.fetchUsers(a.alias,a.companyId,"all").then(a=>{t||S(t=>{const r=new Map(t);for(const s of e){const e=a.find(e=>e.userId===s||e.id===s);e&&r.set(s,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{t=!0}):void 0},[T]);const D=a.useMemo(()=>f?N.filter(f):N,[N,f]),P=a.useMemo(()=>{if(0===A.length)return D;const t=new Set(D.map(e=>e.userId||e.id||"")),a=A.filter(e=>e&&!t.has(e));if(0===a.length)return D;const r=a.map(t=>{const a=k.get(t);return a||{userId:t,id:t,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...D,...r]},[D,A,k]),E=a.useCallback(t=>{let a;if("custom"===h&&x)a=x(t);else{const e=t.userName||"";switch(h){case"name-email":a=t.userEmail?`${e} (${t.userEmail})`:e;break;case"name-role":a=t.roleName?`${e} - ${t.roleName}`:e;break;default:a=e}}return!1===t.isActive?`${a} (${e.t("inactive")})`:a},[h,x]);return t.jsx(mn,{multiple:n,value:r??(n?[]:""),onChange:s,options:P,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:E,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:j("no_results"),label:o,required:i,icon:c,maxDisplayedBadges:d,disabled:m,className:u,sortOptions:g,popoverContainer:v,onOpen:b,onClose:w})};function Pi({title:e,sections:r,initialData:s,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:c=!1,usersData:d}){const[u,m]=a.useState(r?.[0]?.id||""),p=a.useRef(null),[h,x]=a.useState(null),f=a.useCallback(e=>{p.current=e,x(e)},[]),g=a.useMemo(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:v,errors:b,updateField:y,handleSubmit:w}=bi(g,s,void 0,i),j=a.useMemo(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(v):e.disabled||!1})):[],[r,v]),N=a.useMemo(()=>{const e=j.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=j.find(e=>!e.disabled);return t?.id||u},[j,u]);a.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=j.find(e=>e.id===N),C=e=>{const a=(e.computedValue,v[e.name]),r=void 0!==a?a:"",s=b[e.name];switch(e.type){case"group":const a="horizontal"===e.layout,n=a?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=a?br("space-y-2 w-full",e.wrapperClassName):br("space-y-2",e.className,e.wrapperClassName);return t.jsxs("div",{className:o,children:[e.label,t.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Di,{value:r||"",onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:s?"border-destructive":""}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"textarea":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_s,{id:e.name,value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(ps,{value:String(r),onValueChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[t.jsx(fs,{className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:t.jsx(xs,{placeholder:e.placeholder})}),t.jsx(bs,{children:e.options?.map(e=>t.jsx(ws,{value:e.value,children:e.label},e.value))})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"multiselect":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(mn,{options:e.options||[],value:Array.isArray(r)?r:[],onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,error:s,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"date":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_r,{id:e.name,type:"date",value:String(r),onChange:t=>y(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:br("w-full",s?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"color":return t.jsxs("div",{children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_r,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>y(e.name,t.target.value),className:"h-10"}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"color-picker":return t.jsxs("div",{children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(ji,{value:r||e.defaultValue||"#3b82f6",onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"icon-picker":return t.jsxs("div",{children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Si,{value:r||e.defaultValue||null,onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(v):e.componentProps||{};return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(i,{value:r,onChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:s,popoverContainer:h,...l}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"number":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_r,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const a=t.target.value,r=""===a?null:Number(a);y(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"checkbox":return t.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[t.jsx(Ns,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),t.jsxs(kr,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"switch":return t.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ai,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive mt-2",children:s})]},e.name);default:return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(kr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_r,{id:e.name,type:"text",value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name)}},k=a.useCallback(()=>{if(!_)return null;if(_.disabled)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:t.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return t.jsx(e,{formData:v,updateField:y,errors:b,users:d,disabled:_.disabled})}return t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,v,y,b,d,C]),S=t.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[j.length>1&&t.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:t.jsx("div",{className:"flex space-x-2",children:j.map(e=>t.jsx(jr,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=j.find(t=>t.id===e);t&&!t.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:c?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):t.jsxs("form",{onSubmit:w(n),className:"space-y-3 md:space-y-4",children:[k(),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(jr,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(jr,{type:"submit",disabled:c,children:l||"Salvar"})]})]})})]});return t.jsx(Wr,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:t.jsxs(Xr,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t.jsxs(Jr,{showSeparator:!0,children:[t.jsx(ts,{children:e}),t.jsx(as,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function Ei({currentPage:e,totalPages:a,totalItems:r,itemsPerPage:s,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===r)return null;const d=(e-1)*s+1,u=Math.min(e*s,r);return t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[t.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),t.jsxs(ps,{value:String(s),onValueChange:e=>o(Number(e)),children:[t.jsx(fs,{className:"h-8 w-[70px]",children:t.jsx(xs,{})}),t.jsxs(bs,{children:[t.jsx(ws,{value:"10",children:"10"}),t.jsx(ws,{value:"25",children:"25"}),t.jsx(ws,{value:"50",children:"50"}),t.jsx(ws,{value:"100",children:"100"})]})]})]})}),t.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[d,"-",u," ",l("of","de")," ",r," ",l("items","itens")]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(jr,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsLeft,{size:16})}),t.jsx(jr,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronLeft,{size:16})}),t.jsxs("div",{className:"flex items-center gap-1 px-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e}),t.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),t.jsx("span",{className:"text-sm font-medium",children:a})]}),t.jsx(jr,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronRight,{size:16})}),t.jsx(jr,{variant:"outline",size:"sm",onClick:()=>n(a),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsRight,{size:16})})]})]})}function Mi({manager:e}){return t.jsx(Ei,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const Ii={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Ri={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Li={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Fi({children:e,direction:a="column",gap:r="md",align:s="stretch",justify:n="start",wrap:o=!1,className:i}){return t.jsx("div",{className:br("flex","column"===a?"flex-col":"flex-row",Ii[r],Ri[s],Li[n],o&&"flex-wrap",i),children:e})}function zi({manager:e,filters:a,inline:r=!1}){const{t:s}=y.useTranslation(),{isSearchVisible:n}=jo(),o=e.searchTerm,i=t.jsxs(t.Fragment,{children:[a.some(e=>"search"===e.type)&&!n&&t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(_r,{placeholder:"Pesquisar",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),a.filter(e=>"select"===e.type&&e.options).map((e,a)=>t.jsxs(ps,{value:e.value||"",onValueChange:t=>e.onChange?.(t),children:[t.jsx(fs,{className:"w-[180px]",children:t.jsx(xs,{placeholder:e.placeholder})}),t.jsx(bs,{children:e.options.map(e=>t.jsx(ws,{value:e.value,children:e.label},e.value))})]},`select-${a}`)),a.filter(e=>"custom"===e.type&&e.component).map((e,a)=>{const s=e.component;return t.jsx("div",{className:r?"":"w-full sm:w-auto",children:t.jsx(s,{...e.props})},`custom-${a}`)}),o&&t.jsxs(jr,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[t.jsx(c.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return r?t.jsx("div",{className:"flex items-center gap-2",children:i}):t.jsx(Fi,{direction:"column",gap:"md",className:"mb-6",children:t.jsx(Fi,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function Ui({manager:e,config:r,formSections:s,onSave:n,onToggleStatus:o,defaultSort:i}){e&&e.queryKey;const{setSearchVisible:l}=jo(),[c,d]=N.useSearchParams(),[u,m]=a.useState(!1),[p,h]=a.useState(null),[x,f]=a.useState({isOpen:!1,entityId:null,entityName:""}),[g,v]=a.useState({isOpen:!1,count:0});a.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),a.useEffect(()=>{if(i&&e){const t=`${e.queryKey}_sortField`,a=`${e.queryKey}_sortDirection`;if(!c.has(t)&&!c.has(a)){const e=Object.fromEntries(c);e[t]=i.column,e[a]=i.direction,d(e)}}},[]);const b=s.length>0?e=>{r.onEdit?r.onEdit(e):(h(e),m(!0))}:void 0,y="function"==typeof e?.deleteEntity?e=>{f({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,w=()=>{f({isOpen:!1,entityId:null,entityName:""})},j=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,_=(r.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return t.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&t.jsx(ui,{onNew:()=>{r.onNew?r.onNew():(h(null),m(!0))},newButtonLabel:r.newButtonLabel,showNewButton:j,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{v({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:_,filters:r.filters&&r.filters.length>0?t.jsx(zi,{manager:e,filters:r.filters,inline:!0}):void 0}),t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?t.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):t.jsx(vi,{manager:e,columns:r.columns,onEdit:b,onDelete:y,onToggleStatus:o,enableBulkActions:r.enableBulkActions,customRowActions:r.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:r.defaultHiddenColumns})}),t.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:t.jsx(Mi,{manager:e})}),!r.useCustomRouting&&!r.onNew&&s.length>0&&t.jsx(Pi,{open:u,title:p?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:s,initialData:p||void 0,onSubmit:e=>{n(e),m(!1),h(null)},onCancel:()=>{m(!1),h(null)},isLoading:e.isLoading,submitButtonText:p?"Atualizar":"Criar"}),t.jsx(Wr,{open:x.isOpen,onOpenChange:w,children:t.jsxs(Xr,{size:"sm",variant:"destructive",children:[t.jsx(Jr,{showSeparator:!0,children:t.jsx(ts,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:x.entityName}),". Esta ação não pode ser desfeita."]})}),t.jsxs(es,{children:[t.jsx(jr,{variant:"outline",onClick:w,children:"Cancelar"}),t.jsx(jr,{variant:"destructive",onClick:()=>{x.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(x.entityId),f({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),t.jsx(Wr,{open:g.isOpen,onOpenChange:()=>v({isOpen:!1,count:0}),children:t.jsxs(Xr,{size:"sm",variant:"destructive",children:[t.jsx(Jr,{showSeparator:!0,children:t.jsx(ts,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:g.count})," ",1===g.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t.jsxs(es,{children:[t.jsx(jr,{variant:"outline",onClick:()=>v({isOpen:!1,count:0}),children:"Cancelar"}),t.jsx(jr,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),v({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Oi(e,t){const a=e.toLowerCase();return a.includes("email")?{type:"email",required:!0}:a.includes("phone")||a.includes("tel")?{type:"tel"}:a.includes("description")||a.includes("content")||a.includes("notes")?{type:"textarea"}:a.includes("status")||a.includes("type")||a.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function Bi(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function qi(e={}){const{paramName:t="alias"}=e,r=N.useParams(),{alias:s,companies:n}=jo(),o=r[t]||null;return a.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,t=!!e;return{urlAlias:o,isAliasMismatch:t&&o!==s,isValidAlias:t,isMissing:!1,matchedCompany:e}},[o,s,n])}const Vi=s.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),$i={info:c.Info,warning:c.Info,danger:c.AlertTriangle,success:c.CheckCircle},Wi=te.forwardRef(({className:e,variant:a="info",showIcon:r=!0,children:s,...n},o)=>{const i=$i[a||"info"];return t.jsxs("div",{ref:o,role:"alert",className:br(Vi({variant:a}),e),...n,children:[r&&t.jsx(i,{className:"h-4 w-4"}),s]})});Wi.displayName="Alert";const Hi=te.forwardRef(({className:e,...a},r)=>t.jsx("h5",{ref:r,className:br("mb-1 font-medium leading-none tracking-tight",e),...a}));Hi.displayName="AlertTitle";const Gi=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("text-sm [&_p]:leading-relaxed",e),...a}));Gi.displayName="AlertDescription";const Ki=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Root,{ref:r,className:br("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...a}));Ki.displayName=ge.Root.displayName;const Yi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Image,{ref:r,className:br("aspect-square h-full w-full",e),...a}));Yi.displayName=ge.Image.displayName;const Qi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Fallback,{ref:r,className:br("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...a}));function Xi(){return Ge()||"https://common-v4-api.qualiex.com"}function Ji(){const e=Xi().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://login-api${e[1]||""}.${e[2]}`}return"https://login-api.qualiex.com"}function Zi(e){const t=Un.getAccessToken();if(!t)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function el(e,t,a){const r=async()=>{const r=await fetch(e,{...a,headers:{...Zi(t),...a?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(s){if(await ro.handleApiError(s))return await r();throw s}}async function tl(e){const t=Un.getAccessToken(),a=Un.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const t=Dn.parseJwtPayload(e),a="string"==typeof t?.subNewId?t.subNewId.trim():"";if(!a)throw new Error("NewId do usuário não encontrado no id-token.");return a}(a),s=Un.getSelectedAlias()?.trim()||Un.extractTokenData()?.alias||"",n=`${Ji()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,o=async()=>{const r=Un.getAccessToken()||t,o=Un.getIdToken()||a,i=new FormData;i.append(e.name,e,e.name);const l=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":o,Accept:"application/json, text/plain, */*",...s?{"un-alias":s}:{},AppGroupId:"1"},body:i});if(!l.ok){const e=new Error(`Upload falhou: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await o()}catch(i){if(await ro.handleApiError(i))try{return void await o()}catch(l){throw qn.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw i}}Qi.displayName=ge.Fallback.displayName;const al={"en-US":1,"pt-BR":2,"es-ES":3,"fr-FR":4};function rl(e,t){const a=e?.trim();if(a)return a;const r=Dn.parseJwtPayload(t),s="string"==typeof r?.subNewId?r.subNewId.trim():"";if(s)return s;throw new Error("Identificador do usuário não encontrado.")}function sl(e){const t=Un.getSelectedAlias()?.trim();if(t)return t;const a=Un.getSupabaseToken(),r=a?Dn.parseJwtPayload(a):null,s="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(s)return s;const n=Dn.parseJwtPayload(e),o="string"==typeof n?.default?n.default.trim():"string"==typeof n?.alias?n.alias.trim():"string"==typeof n?.user_alias?n.user_alias.trim():"";if(o)return o;for(const i in n||{}){if(!/^co\d+$/.test(i))continue;const e=n?.[i];if("string"!=typeof e)continue;const[t]=e.split(";");if(t?.trim())return t.trim()}}async function nl(e){const t=Un.getAccessToken(),a=Un.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=rl(e.newId,a),s=sl(a),n={};e.name&&e.name.trim()&&(n.Name=e.name.trim()),e.email&&e.email.trim()&&(n.Email=e.email.trim());const o=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e||4===e?e:null:al[e]??null}(e.language);void 0!==o&&(n.LanguageId=o);const i=`${Ji()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=Un.getAccessToken()||t,r=Un.getIdToken()||a,o=await fetch(i,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...s?{"un-alias":s}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok){const e=new Error(`Falha ao atualizar perfil: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}};try{await l()}catch(c){if(await ro.handleApiError(c))return void await l();throw c}}const ol={1:"en-US",2:"pt-BR",3:"es-ES",4:"fr-FR"};function il(e,...t){for(const a of t){const t=e[a];if("string"==typeof t&&t.trim())return t}return null}async function ll(e){const t=Un.getAccessToken(),a=Un.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=rl(e,a),s=sl(a),n=`${Ji()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,o=async()=>{const e=Un.getAccessToken()||t,o=Un.getIdToken()||a,i=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":o,...s?{"un-alias":s}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*"}});if(404===i.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!i.ok){const e=new Error(`Falha ao obter perfil: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}const l=await i.json(),c=function(e,...t){for(const a of t){const t=e[a];if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t&&t.trim()&&!Number.isNaN(Number(t)))return Number(t)}return null}(l,"languageId","LanguageId"),d=1===c||2===c||3===c||4===c?c:null,u=il(l,"photoUrl","PhotoUrl");let m=null;if(u)if(/^https?:\/\//i.test(u))m=u;else{const e=u.replace(/^\/+/,""),t=e.includes("?")?"&":"?";m=`${Ji()}/api/${e}${t}size=96`}return{newId:r,name:il(l,"name","Name"),email:il(l,"email","Email"),languageId:d,language:d?ol[d]:null,photoUrl:m}};try{return await o()}catch(i){if(await ro.handleApiError(i))return await o();throw i}}const cl=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],dl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ul=({open:e,onOpenChange:r,user:s,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:d}=y.useTranslation(),u=a.useRef(null),[m,p]=a.useState(null),[h,x]=a.useState(null),[f,g]=a.useState(d.language||"pt-BR"),[v,b]=a.useState(s.name||""),[w,j]=a.useState(s.email||""),[N,_]=a.useState(!1),[C,k]=a.useState(null);a.useEffect(()=>{if(!e)return;b(s.name||""),j(s.email||""),g(d.language||"pt-BR"),k(null);let t=!1;return(async()=>{try{const e=await ll(s.id||void 0);if(t)return;e.name&&b(e.name),e.email&&j(e.email),e.language&&g(e.language),k(e.photoUrl)}catch{}})(),()=>{t=!0}},[e,s.id,s.name,s.email,d.language]);const S=m||C||n,A=e=>{N||(e||(p(null),x(null),g(d.language||"pt-BR"),b(s.name||""),j(s.email||"")),r(e))};return t.jsx(Wr,{open:e,onOpenChange:A,children:t.jsxs(Xr,{className:"sm:max-w-md",children:[t.jsx(Jr,{children:t.jsx(ts,{children:i("edit_profile","Editar Perfil")})}),t.jsxs(Zr,{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(Ki,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[S&&t.jsx(Yi,{src:S,alt:s.name||""}),t.jsx(Qi,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]}),t.jsxs("div",{children:[t.jsxs(jr,{variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[t.jsx(c.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),t.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target.files?.[0];if(!t)return;const a=URL.createObjectURL(t);p(a),x(t)}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"profile-name",children:i("name","Nome")}),t.jsx(_r,{id:"profile-name",value:v,onChange:e=>b(e.target.value),maxLength:150,autoComplete:"name"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"profile-email",children:i("email","E-mail")}),t.jsx(_r,{id:"profile-email",type:"email",value:w,onChange:e=>j(e.target.value),maxLength:200,autoComplete:"email"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:i("language","Idioma")}),t.jsxs(ps,{value:f,onValueChange:g,children:[t.jsx(fs,{children:t.jsx(xs,{})}),t.jsx(bs,{children:cl.map(e=>t.jsx(ws,{value:e.value,children:e.label},e.value))})]})]})]}),t.jsxs(es,{children:[t.jsx(jr,{variant:"outline",onClick:()=>A(!1),disabled:N,children:i("cancel","Cancelar")}),t.jsxs(jr,{onClick:async()=>{if(v.trim())if(dl.test(w.trim())){_(!0);try{if(h)try{await tl(h),window.dispatchEvent(new Event("user-photo-updated")),l.toast.success("Foto atualizada com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error("Falha ao atualizar foto"+(t?`: ${t}`:""))}if(v.trim()!==(s.name||"")||w.trim()!==(s.email||"")||f!==d.language)try{await nl({newId:s.id||void 0,name:v.trim(),email:w.trim(),language:f}),l.toast.success("Perfil atualizado com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error(t||"Falha ao atualizar perfil")}f!==d.language&&d.changeLanguage(f),x(null),p(null),r(!1)}finally{_(!1)}}else l.toast.error("Informe um e-mail válido.");else l.toast.error("Informe o nome.")},disabled:N,children:[N&&t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),N?i("saving","Salvando..."):i("save","Salvar")]})]})]})})},ml=a.createContext(void 0);function pl({children:e,actions:r}){const{t:s}=y.useTranslation(),[n,o]=a.useState({}),[i,l]=a.useState(r);a.useEffect(()=>{l(r)},[r]);const c=a.useCallback(()=>o({}),[]),d=a.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:c,headerActions:i,setHeaderActions:l}),[n,c,i]);return t.jsx(ml.Provider,{value:d,children:e})}function hl(){const e=a.useContext(ml);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var xl={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",change_photo:"Trocar foto",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nome",electronic_signature:"Assinatura Eletrônica",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Imediato",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_team:"Remover da equipe",leadership_select_subordinates:"Selecione pelo menos um liderado",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",updates:"Atualizações",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_like:"Curtir",updates_dialog_do_not_show_again:"Não exibir novamente",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},fl={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",change_photo:"Change photo",cannot_be_own_leader:"A leader cannot be their own superior",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_profile:"Edit Profile",edit_name:"Edit Name",electronic_signature:"Electronic Signature",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_immediate_superior:"Immediate Superior",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_team:"Remove from team",leadership_select_subordinates:"Select at least one subordinate",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",updates:"Updates",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_like:"Like",updates_dialog_do_not_show_again:"Do not show again",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},gl={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",change_photo:"Cambiar foto",cannot_be_own_leader:"Un líder no puede ser su propio superior",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nombre",electronic_signature:"Firma Electrónica",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Inmediato",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_team:"Quitar del equipo",leadership_select_subordinates:"Seleccione al menos un subordinado",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",updates:"Actualizaciones",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_like:"Me gusta",updates_dialog_do_not_show_again:"No mostrar de nuevo",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const vl="true"===(void 0).VITE_I18N_DEBUG_MODE;function bl(t,a){e.addResourceBundle(t,"app",a,!0,!0)}vl&&e.use({type:"postProcessor",name:"debugKeys",process:(e,t)=>`🔑 ${Array.isArray(t)?t[0]:t}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:xl},"en-US":{core:fl},"es-ES":{core:gl}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:vl?["debugKeys"]:[]});const yl=a.createContext({moduleAlias:null,associationsBaseUrl:null,signDocumentsSchema:"common",signDocumentsTable:"sign_documents"});function wl({moduleAlias:e=null,associationsBaseUrl:a=null,signDocumentsSchema:r="common",signDocumentsTable:s="sign_documents",children:n}){return t.jsx(yl.Provider,{value:{moduleAlias:e,associationsBaseUrl:a,signDocumentsSchema:r,signDocumentsTable:s},children:n})}function jl(){return a.useContext(yl)}const Nl={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},_l=6e5;function Cl(e){const{moduleAlias:t,associationsBaseUrl:r}=jl(),{alias:s,user:n,isAuthenticated:o}=jo(),i=e??t,l=n?.id??null,c=o&&!!s&&!!l,{data:d=[],isLoading:u}=j.useQuery({queryKey:["qualiex-associations",l,s,r??null],queryFn:()=>so.fetchUserAssociations(l,s,r?{baseUrl:r}:void 0),enabled:c,staleTime:_l,gcTime:12e5}),m=a.useMemo(()=>s&&0!==d.length?d.find(e=>e.companyAlias===s)??null:null,[d,s]),p=a.useCallback(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const t=Nl[e];return void 0!==t&&m.softwares.includes(t)})},[m]);return{hasAccess:a.useMemo(()=>!i||p(i),[i,p]),isLoading:c&&u,role:a.useMemo(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}const kl={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES"};function Sl(){const{association:t}=Cl(),r=t?.language;return a.useEffect(()=>{if(!r)return;const t=kl[r];t&&e.language!==t&&e.changeLanguage(t)},[r]),null}const Al=a.createContext(void 0),Tl={locale:Ja,timezone:er,datetimeFormat:Za},Dl=async()=>{},Pl=({children:e})=>t.jsx(Al.Provider,{value:{...Tl,setLocale:Dl,setTimezone:Dl,setDatetimeFormat:Dl,isLoading:!1},children:e}),El=()=>{const e=a.useContext(Al);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Ml=ve.Root,Il=ve.CollapsibleTrigger,Rl=ve.CollapsibleContent;var Ll=Object.defineProperty,Fl=(e,t,a)=>((e,t,a)=>t in e?Ll(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,t+"",a);class zl extends a.Component{constructor(t){super(t),Fl(this,"copyErrorDetails",()=>{const t=qn.getErrors().slice(0,2),a=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${t.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(a),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,t){if((void 0).DEV)throw e;qn.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const a=qn.getErrors().slice(0,2);return t.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:t.jsxs(Sr,{className:"w-full max-w-2xl",children:[t.jsxs(Ar,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),t.jsx(Tr,{children:e.t("something_went_wrong")})]}),t.jsxs(Pr,{className:"space-y-4",children:[t.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t.jsxs(Ml,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[t.jsx(Il,{asChild:!0,children:t.jsxs(jr,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t.jsxs(Rl,{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t.jsxs("div",{className:"text-sm space-y-2",children:[t.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&t.jsx(Ni,{className:"h-32 w-full rounded border bg-muted p-2",children:t.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),a.length>0&&t.jsxs("div",{className:"pt-3 border-t",children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),t.jsx("div",{className:"space-y-2",children:a.map((e,a)=>t.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[a+1,"."]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),t.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t.jsxs(jr,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),t.jsx(jr,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const Ul=be.Root,Ol=te.forwardRef(({className:e,...a},r)=>t.jsx(be.List,{ref:r,className:br("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));Ol.displayName=be.List.displayName;const Bl=te.forwardRef(({className:e,...a},r)=>t.jsx(be.Trigger,{ref:r,className:br("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));Bl.displayName=be.Trigger.displayName;const ql=te.forwardRef(({className:e,...a},r)=>t.jsx(be.Content,{ref:r,className:br("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));function Vl({className:e}){return t.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),t.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),t.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function $l({className:e}){return t.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),t.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),t.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}ql.displayName=be.Content.displayName;const Wl={init(e){!function(e){try{return t=window,a=document,r="clarity",s="script",n=e,void(a.getElementById("clarity-script")||(t[r]=t[r]||function(){(t[r].q=t[r].q||[]).push(arguments)},(o=a.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+n+"?ref=npm",o.id="clarity-script",(i=a.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var t,a,r,s,n,o,i}(e)},setTag(e,t){window.clarity("set",e,t)},identify(e,t,a,r){window.clarity("identify",e,t,a,r)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Hl="forlogic_";function Gl(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Kl(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Yl(e){return Kl()?`${Hl}${e}`:e}function Ql(e){return Kl()?`${Hl}${e}`:e}function Xl(e){try{e()}catch(t){(void 0).DEV}}function Jl(e){for(const[t,a]of Object.entries(e))null!=a&&""!==a&&Wl.setTag(Ql(t),a)}function Zl({module:e,isContracted:t,sourceModule:a,alias:r}){Gl()&&Xl(()=>{Jl({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(t),source_module:a,alias:r}),Wl.event(Yl("module_menu_click"))})}function ec({module:e,sourceModule:t,alias:a}){Gl()&&Xl(()=>{Jl({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:t,alias:a}),Wl.event(Yl("module_interest_click"))})}function tc({resource:e,sourceModule:t,alias:a}){Gl()&&Xl(()=>{Jl({footer_resource:e,source_module:t,alias:a}),Wl.event(Yl("module_footer_click"))})}function ac({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:a="https://sabergestao.com.br/",wikiUrl:r,alias:s,sourceModule:n}){const{t:o}=y.useTranslation(),i=pr(e||r||"https://educacao.sabergestao.com.br/{alias}/fe",s),l=e=>{tc({resource:e,sourceModule:n,alias:s})};return t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Mr,{className:"mb-4"}),t.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Vl,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),t.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx($l,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t.jsxs("a",{href:r||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(c.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const rc=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]},{id:"admin",label:"Admin",modules:[{name:"Admin",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function sc({module:e,onClick:a}){return t.jsxs("button",{type:"button",onClick:a,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[t.jsx("div",{className:br("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function nc(e,t){if(0===e.length)return e;const a=Math.ceil(e.length/t),r=[];for(let s=0;s<a;s++)for(let n=0;n<t;n++){const t=n*a+s;t<e.length&&r.push(e[t])}return r}function oc({modules:e,onModuleClick:r,contractedModules:s,onModuleInterest:n}){const o=function(){const[e,t]=a.useState(4);return a.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?t(4):window.matchMedia("(min-width: 768px)").matches?t(3):window.matchMedia("(min-width: 640px)").matches?t(2):t(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,t)=>e.name.localeCompare(t.name)),l=void 0!==s,c=e=>!0===e.alwaysContracted||!l||s.includes(e.name),d=i.filter(c),u=l?i.filter(e=>!c(e)):[],m=nc(d,o),p=nc(u,o),h=(e,t)=>{t?r?.(e):n?.(e)};return t.jsxs("div",{className:"space-y-6",children:[m.length>0&&t.jsx("section",{children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>t.jsx(sc,{module:e,onClick:()=>h(e,!0)},e.name))})}),p.length>0&&t.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[t.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>t.jsx(sc,{module:e,onClick:()=>h(e,!1)},e.name))})]})]})}function ic({onModuleClick:e,contractedModules:r,onModuleInterest:s,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:c,sourceModule:d,showAdminGroup:u=!1}){const[m,p]=a.useState("qualiex"),h=u?rc.find(e=>"admin"===e.id)?.modules??[]:[],x=rc.filter(e=>"admin"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...h]}:e),f=e=>{ec({module:e,sourceModule:d,alias:c}),window.open(n,"_blank","noopener,noreferrer"),s?.(e)};return t.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t.jsxs(Ul,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[t.jsx(Ol,{className:"w-fit shrink-0",children:x.map(e=>t.jsxs(Bl,{value:e.id,children:[e.label,t.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),x.map(a=>t.jsx(ql,{value:a.id,className:"flex-1 mt-4 overflow-auto pr-2",children:t.jsx(oc,{modules:a.modules,onModuleClick:t=>{return s=t,n=a.id,Zl({module:s,isContracted:!!s.alwaysContracted||"qualiex"!==n||!r||r.includes(s.name),sourceModule:d,alias:c}),void e?.(s);var s,n},contractedModules:"qualiex"===a.id?r:void 0,onModuleInterest:f})},a.id))]}),t.jsx(ac,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c,sourceModule:d})]})}function lc(e){const{association:t}=Cl();return a.useMemo(()=>{if(e)return e;if(!t?.softwares)return;const a=t.softwares,r=rc.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const t=Nl[e.softwareAlias];return void 0!==t&&a.includes(t)}).map(e=>e.name):void 0},[e,t])}function cc({open:e,onOpenChange:a,onModuleClick:r,contractedModules:s,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:c,showAdminGroup:d}){const{alias:u,user:m}=jo(),p=lc(s),h=d??!!m?.isSysAdmin;return t.jsx(Wr,{open:e,onOpenChange:a,children:t.jsxs(Xr,{size:"lg",className:"overflow-hidden flex flex-col",children:[t.jsx(Jr,{className:"sr-only",children:t.jsx(ts,{children:"Módulos"})}),t.jsx(ic,{onModuleClick:e=>{r?r(e):e.url&&mr(pr(e.url,u||void 0))},contractedModules:p,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:u||void 0,sourceModule:c,showAdminGroup:h})]})})}function dc({open:r,onOpenChange:s,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:d,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:v=!0,size:b="lg",children:w,sourceModule:j}){const{t:N}=y.useTranslation(),_=a.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(t=>e.set(t.alias,t));const t=Array.from(e.values()),a=t.find(e=>e.alias===m),r=t.filter(e=>e.alias!==m).sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"}));return a?[a,...r]:r},[u,m]);return t.jsx(Wr,{open:r,onOpenChange:v?void 0:s,children:t.jsxs(Xr,{size:b,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:v?e=>e.preventDefault():void 0,onEscapeKeyDown:v?e=>e.preventDefault():void 0,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[t.jsx(ts,{children:N("no_access_page")}),t.jsx(as,{children:"Selecione um módulo para continuar navegando!"})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsxs(jr,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[t.jsx(c.Building2,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate text-xs",children:d||"Unidade"}),t.jsx(c.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),t.jsx(Us,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t.jsxs(Os,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&t.jsx(ks,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsxs(jr,{variant:"ghost",size:"sm",className:"gap-2",children:[t.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:t.jsx(c.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),t.jsx(c.ChevronDown,{className:"h-3 w-3"})]})}),t.jsxs(Us,{align:"end",children:[t.jsxs("div",{className:"px-2 py-1.5",children:[t.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:d})]}),t.jsx($s,{}),t.jsxs(Os,{onClick:h,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),w?t.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[t.jsx("div",{className:"flex-1",children:w}),t.jsx(ac,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]}):t.jsx(ic,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]})})}function uc(e,t){return t.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t)}function mc({children:e,contractedModules:r,onModuleClick:s,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:c,noAccessRedirectPath:d,noAccessRedirectMode:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=y.useTranslation(),{hasAccess:x,isLoading:f,association:g}=Cl(),{user:v,alias:b,companies:w,isAuthenticated:j,isLoading:N,logout:_,switchUnit:C}=jo(),k=lc(r),S=a.useMemo(()=>w?.length?b&&w.find(e=>e.alias===b)||w[0]:null,[w,b]),A=a.useMemo(()=>w?.length?w.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[w]),T=a.useCallback(e=>{const t=w?.find(t=>t.alias===e.alias);if(!t)return;const{pathname:a,search:r,hash:s}=window.location;if(b){const e=a.split("/"),n=e.indexOf(b);if(n>=0)return e[n]=t.alias,void(window.location.href=e.join("/")+r+s)}C(t)},[b,C,w]),D=a.useCallback(e=>{s?s(e):e.url&&mr(pr(e.url,b||void 0))},[s,b]),P=a.useMemo(()=>{if(!m)return;const e="undefined"!=typeof window?window.location.pathname:"",t=Object.keys(m).find(t=>uc(e,[t]));return t?m[t]:void 0},[m]),E="undefined"!=typeof window?window.location.pathname:"",M=!(!c?.length||!uc(E,c)),I=!N&&j&&!f&&!x&&!M&&!!d&&"always"===(u??"always")?function(e,t){return t&&e.startsWith("/")?e.split("/")[1]===t?e:`/${t}${e}`:e}(d,b):null;return a.useEffect(()=>{I&&I!==E&&window.location.replace(I)},[I,E]),N||!j||M?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(As,{size:"lg"})}):x?t.jsx(t.Fragment,{children:e}):I?I===E?t.jsx(t.Fragment,{children:e}):t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(As,{size:"lg"})}):t.jsx(dc,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:n,userName:v?.name,unitName:S?.name,units:A,currentAlias:b||void 0,onUnitChange:T,onLogout:_,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:p,blocking:!0,children:P})}let pc=!1;function hc(){if(pc||"undefined"==typeof document)return;pc=!0;for(const t of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=t,t.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const t of e)if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}}function xc({projectId:e,mode:t="auto"}){const{user:r,alias:s,isAuthenticated:n}=jo();a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&e&&!We()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Wl.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(a){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,t]),a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&n&&r&&"function"==typeof window.clarity)try{const e=r.email||r.identifier||"anonymous";Wl.identify(e,void 0,"modules-menu",r.name||void 0),s&&Wl.setTag("alias",s),"boolean"==typeof r.isSysAdmin&&Wl.setTag("isSysAdmin",String(r.isSysAdmin))}catch(e){(void 0).DEV}},[r,s,n,t])}let fc="legacy";function gc({projectId:e,mode:t}){return xc({projectId:e,mode:t}),null}function vc(){if(!Fe())return null;const e=Vn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),a=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||a||!(void 0).DEV)return null;const r={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[t.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",t.jsx("code",{style:r,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",t.jsx("code",{style:r,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const bc=ye.Root,yc=te.forwardRef(({className:e,...a},r)=>t.jsx(ye.Item,{ref:r,className:br("border-b",e),...a}));yc.displayName="AccordionItem";const wc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Header,{className:"flex",children:t.jsxs(ye.Trigger,{ref:s,className:br("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[a,t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));wc.displayName=ye.Trigger.displayName;const jc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:t.jsx("div",{className:br("pb-4 pt-0",e),children:a})}));jc.displayName=ye.Content.displayName;const Nc=te.forwardRef(({...e},a)=>t.jsx("nav",{ref:a,"aria-label":"breadcrumb",...e}));Nc.displayName="Breadcrumb";const _c=te.forwardRef(({className:e,...a},r)=>t.jsx("ol",{ref:r,className:br("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...a}));_c.displayName="BreadcrumbList";const Cc=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:br("inline-flex items-center gap-1.5",e),...a}));Cc.displayName="BreadcrumbItem";const kc=te.forwardRef(({asChild:e,className:a,...s},n)=>{const o=e?r.Slot:"a";return t.jsx(o,{ref:n,className:br("transition-colors hover:text-foreground",a),...s})});kc.displayName="BreadcrumbLink";const Sc=te.forwardRef(({className:e,...a},r)=>t.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:br("font-normal text-foreground",e),...a}));Sc.displayName="BreadcrumbPage";const Ac=({children:e,className:a,...r})=>t.jsx("li",{role:"presentation","aria-hidden":"true",className:br("[&>svg]:h-3.5 [&>svg]:w-3.5",a),...r,children:e??t.jsx(c.ChevronRight,{})});Ac.displayName="BreadcrumbSeparator";const Tc=({className:e,...a})=>t.jsxs("span",{role:"presentation","aria-hidden":"true",className:br("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Mais"})]});Tc.displayName="BreadcrumbEllipsis";const Dc=s.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),Pc=te.forwardRef(({className:e,orientation:a,...r},s)=>t.jsx("div",{ref:s,className:br(Dc({orientation:a}),e),...r}));function Ec({className:e,classNames:a,showOutsideDays:r=!0,...s}){return t.jsx(M.DayPicker,{showOutsideDays:r,className:br("p-3 pointer-events-auto",e),locale:Ka,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:"flex h-9 w-full items-center justify-center px-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1",button_previous:br(wr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:br(wr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:br(wr({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...a},components:{Chevron:({orientation:e})=>"left"===e?t.jsx(c.ChevronLeft,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})},...s})}Pc.displayName="ButtonGroup",Ec.displayName="Calendar";const Mc={Root:function({children:e,className:a}){return t.jsx("div",{className:br("space-y-4",a),children:e})},Item:function({children:e,onClick:a,className:r}){return t.jsx(Sr,{className:br("transition-colors",a&&"cursor-pointer hover:bg-muted/50",r),onClick:a,children:t.jsx(Pr,{className:"p-4",children:e})})},Field:function({label:e,value:a,className:r}){return t.jsxs("div",{className:br("flex justify-between items-center text-sm",r),children:[t.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),t.jsx("span",{className:"text-foreground",children:a})]})}};const Ic=({shouldScaleBackground:e=!0,...a})=>t.jsx(I.Drawer.Root,{shouldScaleBackground:e,...a});Ic.displayName="Drawer";const Rc=I.Drawer.Trigger,Lc=I.Drawer.Portal,Fc=I.Drawer.Close,zc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Overlay,{ref:r,className:br("fixed inset-0 z-50 bg-black/80",e),...a}));zc.displayName=I.Drawer.Overlay.displayName;const Uc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Lc,{children:[t.jsx(zc,{}),t.jsxs(I.Drawer.Content,{ref:s,className:br("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[t.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),a]})]}));Uc.displayName="DrawerContent";const Oc=({className:e,...a})=>t.jsx("div",{className:br("grid gap-1.5 p-4 text-center sm:text-left",e),...a});Oc.displayName="DrawerHeader";const Bc=({className:e,...a})=>t.jsx("div",{className:br("mt-auto flex flex-col gap-2 p-4",e),...a});Bc.displayName="DrawerFooter";const qc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Title,{ref:r,className:br("text-lg font-semibold leading-none tracking-tight",e),...a}));qc.displayName=I.Drawer.Title.displayName;const Vc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Description,{ref:r,className:br("text-sm text-muted-foreground",e),...a}));Vc.displayName=I.Drawer.Description.displayName;const $c={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},Wc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Hc=we.Root,Gc=we.Trigger,Kc=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,...s},n)=>t.jsx(we.Content,{ref:n,align:a,sideOffset:r,className:br("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));Kc.displayName=we.Content.displayName;const Yc=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-slot":"input-group",className:br("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...a}));Yc.displayName="InputGroup";const Qc=s.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),Xc=te.forwardRef(({className:e,align:a,...r},s)=>t.jsx("div",{ref:s,"data-slot":"input-group-addon",className:br(Qc({align:a}),e),...r}));Xc.displayName="InputGroupAddon";const Jc=s.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),Zc=te.forwardRef(({className:e,size:a,variant:r="ghost",...s},n)=>t.jsx(jr,{ref:n,"data-slot":"input-group-button",variant:r,className:br(Jc({size:a}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...s}));Zc.displayName="InputGroupButton";const ed=te.forwardRef(({className:e,...a},r)=>t.jsx(_r,{ref:r,"data-slot":"input-group-control",className:br("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));ed.displayName="InputGroupInput";const td=te.forwardRef(({className:e,...a},r)=>t.jsx(_s,{ref:r,"data-slot":"input-group-control",className:br("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));td.displayName="InputGroupTextarea";const ad=te.forwardRef(({className:e,...a},r)=>t.jsx("h1",{ref:r,className:br("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...a}));ad.displayName="H1";const rd=te.forwardRef(({className:e,...a},r)=>t.jsx("h2",{ref:r,className:br("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...a}));rd.displayName="H2";const sd=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:br("scroll-m-20 text-2xl font-semibold tracking-tight",e),...a}));sd.displayName="H3";const nd=te.forwardRef(({className:e,...a},r)=>t.jsx("h4",{ref:r,className:br("scroll-m-20 text-xl font-semibold tracking-tight",e),...a}));nd.displayName="H4";const od=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:br("leading-7 [&:not(:first-child)]:mt-6",e),...a}));od.displayName="P";const id=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:br("text-xl text-muted-foreground",e),...a}));id.displayName="Lead";const ld=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:br("text-lg font-semibold",e),...a}));ld.displayName="Large";const cd=te.forwardRef(({className:e,...a},r)=>t.jsx("small",{ref:r,className:br("text-sm font-medium leading-none",e),...a}));cd.displayName="Small";const dd=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:br("text-sm text-muted-foreground",e),...a}));dd.displayName="Muted";const ud=te.forwardRef(({className:e,...a},r)=>t.jsx("code",{ref:r,className:br("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...a}));ud.displayName="InlineCode";const md=te.forwardRef(({className:e,...a},r)=>t.jsx("blockquote",{ref:r,className:br("mt-6 border-l-2 pl-6 italic",e),...a}));md.displayName="Blockquote";const pd=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:br("my-6 ml-6 list-disc [&>li]:mt-2",e),...a}));pd.displayName="List";const hd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Root,{ref:s,className:br("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...r,children:[a,t.jsx(wd,{})]}));hd.displayName=je.Root.displayName;const xd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.List,{ref:r,className:br("group flex flex-1 list-none items-center justify-center space-x-1",e),...a}));xd.displayName=je.List.displayName;const fd=je.Item,gd=s.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),vd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Trigger,{ref:s,className:br(gd(),"group",e),...r,children:[a," ",t.jsx(c.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));vd.displayName=je.Trigger.displayName;const bd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Content,{ref:r,className:br("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...a}));bd.displayName=je.Content.displayName;const yd=je.Link,wd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:br("absolute left-0 top-full flex justify-center"),children:t.jsx(je.Viewport,{className:br("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:r,...a})}));wd.displayName=je.Viewport.displayName;const jd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Indicator,{ref:r,className:br("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...a,children:t.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));jd.displayName=je.Indicator.displayName;const Nd=({className:e,...a})=>t.jsx("nav",{role:"navigation","aria-label":"pagination",className:br("mx-auto flex w-full justify-center",e),...a});Nd.displayName="Pagination";const _d=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:br("flex flex-row items-center gap-1",e),...a}));_d.displayName="PaginationContent";const Cd=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:br("",e),...a}));Cd.displayName="PaginationItem";const kd=({className:e,isActive:a,size:r="icon",...s})=>t.jsx("a",{"aria-current":a?"page":void 0,className:br(wr({variant:a?"outline":"ghost",size:r}),e),...s});kd.displayName="PaginationLink";const Sd=({className:a,...r})=>t.jsxs(kd,{"aria-label":e.t("go_to_previous_page"),size:"default",className:br("gap-1 pl-2.5",a),...r,children:[t.jsx(c.ChevronLeft,{className:"h-4 w-4"}),t.jsx("span",{children:"Previous"})]});Sd.displayName="PaginationPrevious";const Ad=({className:a,...r})=>t.jsxs(kd,{"aria-label":e.t("go_to_next_page"),size:"default",className:br("gap-1 pr-2.5",a),...r,children:[t.jsx("span",{children:"Next"}),t.jsx(c.ChevronRight,{className:"h-4 w-4"})]});Ad.displayName="PaginationNext";const Td=({className:e,...a})=>t.jsxs("span",{"aria-hidden":!0,className:br("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"More pages"})]});Td.displayName="PaginationEllipsis";const Dd=te.forwardRef(({className:e,value:a,...r},s)=>t.jsx(Ne.Root,{ref:s,className:br("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:t.jsx(Ne.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));Dd.displayName=Ne.Root.displayName;const Pd=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Root,{className:br("grid gap-2",e),...a,ref:r}));Pd.displayName=_e.Root.displayName;const Ed=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Item,{ref:r,className:br("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:t.jsx(_e.Indicator,{className:"flex items-center justify-center",children:t.jsx(c.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ed.displayName=_e.Item.displayName;const Md=Ce.Panel,Id=se.Root,Rd=se.Trigger,Ld=se.Close,Fd=se.Portal,zd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{className:br("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));zd.displayName=se.Overlay.displayName;const Ud=s.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Od=te.forwardRef(({side:e="right",className:a,children:r,...s},n)=>t.jsxs(Fd,{children:[t.jsx(zd,{}),t.jsxs(se.Content,{ref:n,className:br(Ud({side:e}),a),...s,children:[r,t.jsxs(se.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Od.displayName=se.Content.displayName;const Bd=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:br("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Mr,{className:"mt-2"})]});Bd.displayName="SheetHeader";const qd=({className:e,...a})=>t.jsx("div",{className:br("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...a});qd.displayName="SheetBody";const Vd=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Mr,{className:"mb-4"}),t.jsx("div",{className:br("flex flex-row justify-end gap-2",e),...r,children:a})]});Vd.displayName="SheetFooter";const $d=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:br("text-lg font-semibold text-foreground",e),...a}));$d.displayName=se.Title.displayName;const Wd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:br("text-sm text-muted-foreground",e),...a}));Wd.displayName=se.Description.displayName;const Hd="sidebar:state",Gd=te.createContext(null);function Kd(){const e=te.useContext(Gd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Yd=te.forwardRef(({defaultOpen:e=!0,open:a,onOpenChange:r,className:s,style:n,children:o,...i},l)=>{const c=Co(),[d,u]=te.useState(!1),[m,p]=te.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(Hd);return null!==t?"true"===t:e}return e}),h=a??m,x=te.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):p(t),"undefined"!=typeof window&&localStorage.setItem(Hd,String(t))},[r,h]),f=te.useCallback(()=>c?u(e=>!e):x(e=>!e),[c,x,u]);te.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",v=te.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:f}),[g,h,x,c,d,u,f]);return t.jsx(Gd.Provider,{value:v,children:t.jsx(Hs,{delayDuration:0,children:t.jsx("div",{className:br("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",s),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});Yd.displayName="SidebarProvider";const Qd=te.forwardRef(({side:e="left",variant:a="sidebar",collapsible:r="offcanvas",className:s,children:n,...o},i)=>{const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Kd();return"none"===r?t.jsx("div",{className:br("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:i,...o,children:n}):l?t.jsx(Id,{open:d,onOpenChange:u,...o,children:t.jsxs(Od,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[t.jsx($d,{className:"sr-only",children:"Menu de Navegação"}),t.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):t.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?r:"","data-variant":a,"data-side":e,children:[t.jsx("div",{className:br("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:br("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});Qd.displayName="Sidebar";const Xd=te.forwardRef(({className:e,onClick:a,...r},s)=>{const{toggleSidebar:n}=Kd();return t.jsxs(jr,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:br("h-7 w-7",e),onClick:e=>{a?.(e),n()},...r,children:[t.jsx(c.PanelLeft,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Xd.displayName="SidebarTrigger";const Jd=te.forwardRef(({className:e,...a},r)=>{const{toggleSidebar:s}=Kd();return t.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:br("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...a})});Jd.displayName="SidebarRail";const Zd=te.forwardRef(({className:e,...a},r)=>t.jsx("main",{ref:r,className:br("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...a}));Zd.displayName="SidebarInset";const eu=te.forwardRef(({className:e,...a},r)=>t.jsx(_r,{ref:r,"data-sidebar":"input",className:br("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...a}));eu.displayName="SidebarInput";const tu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"header",className:br("flex flex-col gap-2 p-2",e),...a}));tu.displayName="SidebarHeader";const au=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"footer",className:br("flex flex-col gap-2 p-2",e),...a}));au.displayName="SidebarFooter";const ru=te.forwardRef(({className:e,...a},r)=>t.jsx(Mr,{ref:r,"data-sidebar":"separator",className:br("mx-2 w-auto bg-sidebar-border",e),...a}));ru.displayName="SidebarSeparator";const su=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"content",className:br("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...a}));su.displayName="SidebarContent";const nu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group",className:br("relative flex w-full min-w-0 flex-col p-2",e),...a}));nu.displayName="SidebarGroup";const ou=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"div";return t.jsx(o,{ref:n,"data-sidebar":"group-label",className:br("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})});ou.displayName="SidebarGroupLabel";const iu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"button";return t.jsx(o,{ref:n,"data-sidebar":"group-action",className:br("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...s})});iu.displayName="SidebarGroupAction";const lu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group-content",className:br("w-full text-sm",e),...a}));lu.displayName="SidebarGroupContent";const cu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu",className:br("flex w-full min-w-0 flex-col gap-1",e),...a}));cu.displayName="SidebarMenu";const du=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,"data-sidebar":"menu-item",className:br("group/menu-item relative",e),...a}));du.displayName="SidebarMenuItem";const uu=s.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),mu=te.forwardRef(({asChild:e=!1,isActive:a=!1,variant:s="default",size:n="default",tooltip:o,className:i,...l},c)=>{const d=e?r.Slot:"button",{isMobile:u,state:m}=Kd(),p=t.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":n,"data-active":a,className:br(uu({variant:s,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:p}),t.jsx(Ys,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});mu.displayName="SidebarMenuButton";const pu=te.forwardRef(({className:e,asChild:a=!1,showOnHover:s=!1,...n},o)=>{const i=a?r.Slot:"button";return t.jsx(i,{ref:o,"data-sidebar":"menu-action",className:br("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});pu.displayName="SidebarMenuAction";const hu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:br("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...a}));hu.displayName="SidebarMenuBadge";const xu=te.forwardRef(({className:e,showIcon:a=!1,...r},s)=>{const n=te.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:br("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[a&&t.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});xu.displayName="SidebarMenuSkeleton";const fu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:br("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...a}));fu.displayName="SidebarMenuSub";const gu=te.forwardRef(({...e},a)=>t.jsx("li",{ref:a,...e}));gu.displayName="SidebarMenuSubItem";const vu=te.forwardRef(({asChild:e=!1,size:a="md",isActive:s,className:n,...o},i)=>{const l=e?r.Slot:"a";return t.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":a,"data-active":s,className:br("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});vu.displayName="SidebarMenuSubButton";const bu=te.forwardRef(({className:e,value:a,defaultValue:r,...s},n)=>{const o=a||r||[0];return t.jsxs(ke.Root,{ref:n,value:a,defaultValue:r,className:br("relative flex w-full touch-none select-none items-center",e),...s,children:[t.jsx(ke.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:t.jsx(ke.Range,{className:"absolute h-full bg-primary"})}),o.map((e,a)=>t.jsx(ke.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},a))]})});bu.displayName=ke.Root.displayName;const yu=Se.Menu,wu=Se.Group,ju=Se.Portal,Nu=Se.Sub,_u=Se.RadioGroup,Cu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Root,{ref:r,className:br("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...a}));Cu.displayName=Se.Root.displayName;const ku=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Trigger,{ref:r,className:br("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...a}));ku.displayName=Se.Trigger.displayName;const Su=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(Se.SubTrigger,{ref:n,className:br("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Su.displayName=Se.SubTrigger.displayName;const Au=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.SubContent,{ref:r,className:br("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Au.displayName=Se.SubContent.displayName;const Tu=te.forwardRef(({className:e,align:a="start",alignOffset:r=-4,sideOffset:s=8,...n},o)=>t.jsx(Se.Portal,{children:t.jsx(Se.Content,{ref:o,align:a,alignOffset:r,sideOffset:s,className:br("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Tu.displayName=Se.Content.displayName;const Du=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Item,{ref:s,className:br("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Du.displayName=Se.Item.displayName;const Pu=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(Se.CheckboxItem,{ref:n,className:br("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Pu.displayName=Se.CheckboxItem.displayName;const Eu=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Se.RadioItem,{ref:s,className:br("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Eu.displayName=Se.RadioItem.displayName;const Mu=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Label,{ref:s,className:br("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Mu.displayName=Se.Label.displayName;const Iu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Separator,{ref:r,className:br("-mx-1 my-1 h-px bg-muted",e),...a}));Iu.displayName=Se.Separator.displayName;const Ru=({className:e,...a})=>t.jsx("span",{className:br("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});Ru.displayname="MenubarShortcut";const Lu={light:"",dark:".dark"},Fu=te.createContext(null);function zu(){const e=te.useContext(Fu);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Uu=te.forwardRef(({id:e,className:a,children:r,config:s,...n},o)=>{const i=te.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return t.jsx(Fu.Provider,{value:{config:s},children:t.jsxs("div",{"data-chart":l,ref:o,className:br("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...n,children:[t.jsx(Ou,{id:l,config:s}),t.jsx(Ae.ResponsiveContainer,{children:r})]})})});Uu.displayName="Chart";const Ou=({id:e,config:a})=>{const r=Object.entries(a).filter(([,e])=>e.theme||e.color);return r.length?t.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Lu).map(([t,a])=>`\n${a} [data-chart=${e}] {\n${r.map(([e,a])=>{const r=a.theme?.[t]||a.color;return r?` --color-${e}: ${r};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Bu=Ae.Tooltip,qu=te.forwardRef(({active:e,payload:a,className:r,indicator:s="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:c,formatter:d,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=zu(),f=te.useMemo(()=>{if(n||!a?.length)return null;const[e]=a,r=Wu(x,e,`${p||e?.dataKey||e?.name||"value"}`),s=p||"string"!=typeof i?r?.label:x[i]?.label||i;return l?t.jsx("div",{className:br("font-medium",c),children:l(s,a)}):s?t.jsx("div",{className:br("font-medium",c),children:s}):null},[i,l,a,n,c,x,p]);if(!e||!a?.length)return null;const g=1===a.length&&"dot"!==s;return t.jsxs("div",{ref:h,className:br("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:f,t.jsx("div",{className:"grid gap-1.5",children:a.map((e,a)=>{const r=`${m||e.name||e.dataKey||"value"}`,n=Wu(x,e,r),i=u||e.payload?.fill||e.color;return t.jsx("div",{className:br("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===s&&"items-center"),children:d&&void 0!==e?.value&&e.name?d(e.value,e.name,e,a,e.payload):t.jsxs(t.Fragment,{children:[n?.icon?t.jsx(n.icon,{}):!o&&t.jsx("div",{className:br("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===s,"w-1":"line"===s,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===s,"my-0.5":g&&"dashed"===s}),style:{"--color-bg":i,"--color-border":i}}),t.jsxs("div",{className:br("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[t.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,t.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&t.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||a)})})]})});qu.displayName="ChartTooltip";const Vu=Ae.Legend,$u=te.forwardRef(({className:e,hideIcon:a=!1,payload:r,verticalAlign:s="bottom",nameKey:n},o)=>{const{config:i}=zu();return r?.length?t.jsx("div",{ref:o,className:br("flex items-center justify-center gap-4","top"===s?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${n||e.dataKey||"value"}`,s=Wu(i,e,r);return t.jsxs("div",{className:br("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[s?.icon&&!a?t.jsx(s.icon,{}):t.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),s?.label]},e.value)})}):null});function Wu(e,t,a){if("object"!=typeof t||null===t)return;const r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let s=a;return a in t&&"string"==typeof t[a]?s=t[a]:r&&a in r&&"string"==typeof r[a]&&(s=r[a]),s in e?e[s]:e[a]}$u.displayName="ChartLegend";const Hu=({onClick:e,isActive:a,disabled:r,children:s,title:n})=>t.jsx("button",{type:"button",onClick:e,disabled:r,title:n,className:br("p-1.5 rounded hover:bg-muted transition-colors",a?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:s}),Gu=()=>t.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Ku({image:e,title:a,className:r}){return t.jsx("div",{className:br("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?t.jsx("img",{src:e,alt:a,className:"w-full h-full object-cover"}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(c.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function Yu({steps:e,currentStepIndex:a,onStepSelect:r,stepLabel:s,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(a+1)/i*100;return t.jsxs("div",{className:br("flex items-center gap-3",n),children:[t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsxs(jr,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[s," ",a+1,"/",i,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(Us,{align:"start",children:e.map((e,s)=>t.jsxs(Os,{onClick:()=>r(s),className:br(s===a&&"bg-accent"),children:[s+1,". ",e.title]},e.id))})]}),t.jsx(Dd,{value:l,className:"w-32 h-2"})]})}function Qu({currentStepIndex:e,totalSteps:a,onBack:r,onNext:s,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:d}){const{t:u}=y.useTranslation(),m=0===e,p=e===a-1;return t.jsxs("div",{className:br("flex items-center gap-2",d),children:[!m&&t.jsxs(jr,{variant:"outline",onClick:r,size:"sm",children:[t.jsx(c.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),t.jsxs(jr,{onClick:p?n:s,size:"sm",children:[p?l:i,!p&&t.jsx(c.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const Xu=te.forwardRef(({open:a,onOpenChange:r,steps:s,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:d="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[v,b]=te.useState(0),y=void 0!==h,w=y?h:v,j=te.useCallback(e=>{y?x?.(e):b(e),o?.(e)},[y,x,o]);te.useEffect(()=>{a||y||b(0)},[a,y]);const N=s[w],_=s.length;return N?t.jsx(Wr,{open:a,onOpenChange:r,children:t.jsxs(Xr,{ref:g,size:m,variant:"informative",className:br("p-0 gap-0 overflow-hidden",f),children:[t.jsxs(Kr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Fechar"})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(Ku,{image:N.image,title:N.title}),t.jsx(ts,{className:"text-xl font-semibold",children:N.title}),t.jsx(as,{className:"text-muted-foreground",children:N.description})]})}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx(Mr,{}),t.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?t.jsx(Yu,{steps:s,currentStepIndex:w,onStepSelect:e=>{j(e)},stepLabel:u}):t.jsx("div",{}),t.jsx(Qu,{currentStepIndex:w,totalSteps:_,onBack:()=>{w>0&&j(w-1)},onNext:()=>{w<_-1&&j(w+1)},onComplete:()=>{n?.(),r(!1)},backButtonText:l,continueButtonText:i,finishButtonText:d})]})]})]})}):null});function Ju({label:e,onClick:a,icon:r,actions:s=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:d="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(s.length>0))return t.jsxs(jr,{variant:n,size:o,disabled:p,onClick:a,className:u,children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]});return t.jsxs("div",{className:br("inline-flex rounded-md shadow-sm",u),children:[t.jsxs(jr,{variant:n,size:o,disabled:p,onClick:a,className:"rounded-r-none border-r-0 focus:z-10",children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]}),t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsx(jr,{variant:n,size:o,disabled:p,className:br("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:t.jsx(c.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),t.jsx(Us,{align:d,className:"min-w-[160px]",children:s.map(e=>{const a=e.icon;return t.jsxs(Os,{onClick:e.onClick,disabled:e.disabled,className:br("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}Xu.displayName="OnboardingDialog";var Zu=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(Zu||{});const em=[{value:"csv",label:"CSV",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:t.jsx(c.FileSpreadsheet,{className:"h-5 w-5"})}],tm=[{value:"png",label:"PNG",icon:t.jsx(c.Image,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})}];const am=a.forwardRef(({value:e,onChange:r,onTimeChange:s,label:n,error:o,format:i="24h",className:l,id:d,...u},m)=>{const p=d??te.useId(),h=a.useCallback(e=>{const t=e.target.value;r?.(t),s?.(t)},[r,s]),x=a.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t.jsxs("div",{className:br("grid gap-1.5",l),children:[n&&t.jsx(kr,{htmlFor:p,children:n}),t.jsxs("div",{className:"relative",children:[t.jsx(_r,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:br("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),t.jsx(c.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&t.jsx("p",{className:"text-sm text-destructive",children:o})]})});function rm({currentStep:e,totalSteps:a,onStepChange:r,stepLabels:s,canGoToStep:n,className:o,progressWidth:i="w-32"}){te.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:a},(e,t)=>t+1),d=t=>!(t<=e)&&(!!n&&!n(t));return t.jsxs("div",{className:br("flex items-center gap-3",o),children:[t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsxs(jr,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",a,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(Us,{align:"start",children:l.map(a=>t.jsxs(Os,{onClick:()=>{var t;(t=a)<e?r(t):n&&!n(t)||r(t)},disabled:d(a),className:br("cursor-pointer",a===e&&"bg-muted font-medium",d(a)&&"opacity-50 cursor-not-allowed"),children:[t.jsxs("span",{className:"mr-2 text-muted-foreground",children:[a,"."]}),s?.[a-1]||`Etapa ${a}`,a===e&&t.jsx(c.Check,{className:"h-4 w-4 ml-auto"})]},a))})]}),t.jsx(Dd,{value:e/a*100,className:br("h-2",i)})]})}function sm(e){const t=Un.getAccessToken(),a={"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},"un-alias":e};if(t)try{const e=JSON.parse(atob(t.split(".")[1]));e.sub&&(a["x-waf-rate"]=btoa(e.sub))}catch{}return a}async function nm(e,t,a){let r=await fetch(e,t);if(401===r.status){if(await ro.handleApiError({status:401})){const s={...t,headers:sm(a)};r=await fetch(e,s)}}return r}function om(e){const[t,r]=a.useState([]),[s,n]=a.useState(0),[o,i]=a.useState(!1);a.useEffect(()=>{if(!e)return;let t=!1;const a=`${Ge().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const s=sm(e),o=await nm(a,{method:"GET",headers:s},e);if(!o.ok)return;const i=await o.json();!t&&i.data?.[0]&&(r(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(s){}finally{t||i(!1)}}(),()=>{t=!0}},[e]);const l=a.useCallback(async()=>{if(!e||s<=0||0===t.length)return;const a=t[0].id,r=`${Ge().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const t=sm(e),s=JSON.stringify({id:a,idUpdateType:3});await nm(r,{method:"POST",headers:t,body:s},e)}catch(o){}},[e,s,t]);return{updates:t,badgeCount:s,loading:o,markAsVisualized:l}}am.displayName="Timepicker";const im=a.forwardRef(({updates:a,badgeCount:r,onOpen:s,onViewAll:n},o)=>{const i=void 0===a,l=jo(),d=l?.alias??null,u=om(i?d:null),m=N.useNavigate(),p=i?u.updates??[]:a,h=i?u.badgeCount??0:r??0,x=s??(i?u.markAsVisualized:void 0),f=n??(i&&d?()=>{m(`/${d}/up/view`)}:void 0);return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:x,title:e.t("updates"),children:[t.jsx(c.Coffee,{className:"h-7 w-7"}),h>0&&t.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:h>99?"99+":h})]})}),t.jsxs(Zs,{align:"end",className:"w-80 p-0",children:[t.jsx("div",{className:"border-b border-border px-4 py-3",children:t.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),t.jsx("div",{className:"max-h-72 overflow-y-auto",children:p.length>0?t.jsx("ul",{className:"divide-y divide-border",children:p.map(e=>t.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:f,children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[t.jsx(c.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.jsxs(jr,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:f,children:["Ver todas as atualizações",t.jsx(c.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});im.displayName="UpdatesNotification";var lm=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(lm||{}),cm=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(cm||{});const dm={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function um(e){const{t:t}=y.useTranslation();return e?dm[e.toLowerCase()]??0:0}const mm={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function pm(e){const{t:t}=y.useTranslation();return mm[e?.toLowerCase()]||""}function hm(e){const{t:t}=y.useTranslation(),a=e%60;return`${Math.floor(e/60)}min ${a<10?"0":""}${a}`}function xm({open:e,onOpenChange:r,url:s,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),d=a.useCallback(()=>{r(!1)},[r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&d()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,d]),t.jsx(Wr,{open:e,onOpenChange:r,children:t.jsxs(Xr,{className:br("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[t.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&t.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Ys,{children:"Fechar"})]})]}),t.jsx("iframe",{src:s,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function fm({term:r,open:s,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:d=e.t("terms_read_agree")}){const u=a.useMemo(()=>r.file?function(e,t=""){const{t:a}=y.useTranslation(),r=atob(e),s=[];for(let o=0;o<r.length;o+=512){const e=r.slice(o,o+512),t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);s.push(new Uint8Array(t))}const n=new Blob(s,{type:t});return URL.createObjectURL(n)}(r.file,r.type):null,[r.file,r.type]),m=a.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=a.useCallback(()=>{r.hasUserSignature?m():o?.(r.id)},[r,o,m]),h=!i&&!r.hasUserSignature&&o;return t.jsx(Wr,{open:s,onOpenChange:e=>!e&&m(),children:t.jsxs(Xr,{className:br("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[t.jsx(c.FileText,{className:"h-5 w-5 text-primary"}),l]}),t.jsxs("div",{className:"flex items-center gap-2",children:[h&&t.jsx(jr,{size:"sm",onClick:p,children:d}),t.jsx(jr,{variant:"ghost",size:"icon",onClick:m,children:t.jsx(c.X,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"flex-1 min-h-0",children:r.file&&u?t.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function gm(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function vm(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function bm(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.allowedIds?.forEach(e=>a.add(e)),r.inheritedIds?.forEach(e=>a.add(e));return a}var ym=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))(ym||{});const wm={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function jm(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Nm(e){const{t:t}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const _m={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};var Cm=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Cm||{}),km=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(km||{}),Sm=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Sm||{}),Am=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(Am||{}),Tm=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(Tm||{}),Dm=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(Dm||{}),Pm=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(Pm||{}),Em=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(Em||{}),Mm=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(Mm||{}),Im=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(Im||{}),Rm=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(Rm||{}),Lm=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(Lm||{}),Fm=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(Fm||{}),zm=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(zm||{}),Um=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(Um||{}),Om=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))(Om||{}),Bm=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(Bm||{}),qm=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))(qm||{}),Vm=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(Vm||{}),$m=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))($m||{}),Wm=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(Wm||{}),Hm=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(Hm||{}),Gm=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(Gm||{}),Km=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(Km||{}),Ym=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(Ym||{}),Qm=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(Qm||{});const Xm={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Jm=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],Zm=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function ep(e){if(!e)return 0;const[t,a]=e.split("/"),r=Xm[t?.toLowerCase()]??0;return 12*(parseInt(a)||0)+r}function tp(e){const t=e.split("/"),a=t[t.length-1];return`${t.slice(0,-1).join("/")}/${encodeURIComponent(a.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function ap(e){for(const t of Zm)if(e[t])return e[t];return null}function rp(e){const t=[];for(const a of Object.keys(e)){const r=e[a];null!=r&&(r instanceof Date?t.push(`${a}=${r.toISOString()}`):Array.isArray(r)?r.forEach(e=>{t.push(...rp({[a]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||t.push(`${a}=${r}`))}return t}const sp=/^-?\d+(,\d{3})*(\.\d+)?$/;const np=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const op=new Set([Im.Text]),ip=new Set([Im.Text,Im.Numeric,Im.RiskMatrix,Im.Burndown,Im.PerformanceColumns]),lp=new Set([Im.Text,Im.RiskMatrix,Im.Burndown,Im.PerformanceColumns]);function cp({config:e,viewOnly:r=!1,complement:s,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:d,className:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(e.onlyMine??!1),x=op.has(e.typeId),f=!ip.has(e.typeId),g=!lp.has(e.typeId),v=a.useMemo(()=>{if(!e.jsonRules||e.typeId===Im.PerformanceColumns)return!1;try{const t=JSON.parse(e.jsonRules);return t?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),b=a.useMemo(()=>o?.(e)??"#",[o,e]),w=a.useCallback(()=>{const e=!p;h(e),d?.(e)},[p,d]),j=[];return p&&j.push(m("dashboard_only_mine")),e.onlyLate&&j.push(m("dashboard_only_overdue")),v&&j.push(m("dashboard_advanced_filter")),t.jsxs("div",{className:br("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&s,t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("span",{className:"block truncate",children:e.title})}),t.jsx(Ys,{children:e.title})]}),j.length>0&&t.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:j.join(" | ")})]}),"after-title"===n&&s]}),!r&&t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&s,t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-6 w-6",children:t.jsx(c.MoreVertical,{className:"h-3.5 w-3.5"})})}),t.jsxs(Us,{align:"end",className:"w-48",children:[e.canUpdate&&t.jsxs(Os,{onClick:()=>e.onEdit?.(e.id),children:[t.jsx(c.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&t.jsxs(Os,{onClick:i,children:[t.jsx(c.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&t.jsxs(Os,{disabled:e.noData,onClick:l,children:[t.jsx(c.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&t.jsxs(Os,{disabled:!e.openQueryEnabled,onClick:()=>window.open(b,"_blank"),children:[t.jsx(c.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&t.jsxs(t.Fragment,{children:[t.jsx($s,{}),t.jsxs(Os,{onClick:w,children:[p&&t.jsx(c.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&t.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t.jsxs(t.Fragment,{children:[t.jsx($s,{}),t.jsxs(Os,{onClick:()=>e.onDuplicate?.(e.id),children:[t.jsx(c.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t.jsxs(Os,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[t.jsx(c.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&s]})]})}function dp({config:e,queryUrl:a,className:r}){return t.jsxs("div",{className:br("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t.jsxs("p",{className:"mt-2 text-xs",children:[a&&t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),a&&e.canUpdate&&t.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function up({panelType:e,className:a}){const r=e===Im.Burndown;return t.jsxs("div",{className:br("flex flex-1 flex-col items-center justify-center gap-2 p-4",a),children:[t.jsx(As,{className:"h-10 w-10 text-muted-foreground/40"}),r&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function mp({hasRemovedColumn:a=!1,className:r}){return t.jsxs("div",{className:br("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),t.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function pp({onRemove:e,className:a}){return t.jsxs("div",{className:br("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",a),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&t.jsx("p",{className:"mt-2 text-xs",children:t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const hp={[Cm.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Cm.Sum]:"Sum",[Cm.Average]:e.t("dashboard_average"),[Cm.DistinctCount]:e.t("dashboard_distinct_count"),[Cm.Max]:e.t("dashboard_max_value"),[Cm.Min]:e.t("dashboard_min_value")};function xp({config:e,state:a,value:r,label:s,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:c,className:d}){const{t:u}=y.useTranslation(),m=s??hp[e.aggregationType??""]??"",p=function(e,t){if(null==e)return"—";const a=Jm.includes(t.field),r=t.aggregationType===Cm.Count||t.aggregationType===Cm.DistinctCount;return a&&!r?np.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(r,e);return t.jsxs("div",{className:br("flex h-full flex-col",d),children:[t.jsx(cp,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:c}),a===Vm.Loading&&t.jsx(up,{}),a===Vm.Loaded&&t.jsxs("div",{className:br("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[t.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),a===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),a===Vm.Error&&t.jsx(dp,{config:e,queryUrl:l}),a===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function fp({config:e,state:a,htmlContent:r,viewOnly:s=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const c=r??e.textTypeString??"";return t.jsxs("div",{className:br("flex h-full flex-col",l),children:[t.jsx(cp,{config:e,viewOnly:s,onRefresh:n,queryUrlBuilder:i}),a===Vm.Loading&&t.jsx(up,{}),a===Vm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),a===Vm.Error&&t.jsx(dp,{config:e,queryUrl:o})]})}function gp({config:e,state:r,data:s=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=a.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=a.useCallback(e=>{if(i)i(e);else if(m){const t=ap(e);t&&window.open(tp(t),"_blank")}},[i,m]);return t.jsxs("div",{className:br("flex h-full flex-col",p),children:[t.jsx(cp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Vm.Loading&&t.jsx(up,{}),r===Vm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:t.jsx("tr",{children:h.map(e=>t.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),t.jsx("tbody",{children:s.map((e,a)=>{const r=m&&!!ap(e);return t.jsx("tr",{className:br("border-b border-border/50 transition-colors hover:bg-muted/30",(r||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(a=>t.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:a.render?a.render(e[a.columnName],e):vp(e[a.columnName],a)},a.columnName))},a)})})]})}),r===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),r===Vm.Error&&t.jsx(dp,{config:e,queryUrl:d}),r===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function vp(e,t){return null==e?"":e instanceof Date?"datetime"===t.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const bp=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function yp({config:e,variant:r,state:s,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:c,viewOnly:d=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:bp,v=a.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),b="bar"===r,y="stacked-column"===r,w=a.useMemo(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t.jsxs("div",{className:br("flex h-full flex-col",f),children:[t.jsx(cp,{config:e,viewOnly:d,onRefresh:m,onExport:p,queryUrlBuilder:x}),s===Vm.Loading&&t.jsx(up,{}),s===Vm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:wp({variant:r,data:n,series:v,colors:g,categoryKey:l,isHorizontalBar:b,isStacked:y,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),s===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),s===Vm.Error&&t.jsx(dp,{config:e,queryUrl:h}),s===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function wp({variant:e,data:a,series:r,colors:s,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:c,onPointClick:d}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=t.jsx(q.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=t.jsx(q.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=t.jsx(q.Tooltip,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=r.length>1?t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=d?(e,t)=>d(a[t],t):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t.jsxs(q.BarChart,{data:a,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||s[a%s.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:d?"pointer":void 0},e.dataKey))]}):"area"===e?t.jsxs(q.AreaChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>{const r=e.color||s[a%s.length];return t.jsx(q.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:d?"pointer":void 0}},e.dataKey)})]}):t.jsxs(q.LineChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||s[a%s.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:d?"pointer":void 0}},e.dataKey))]})}const jp=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function Np({config:e,state:r,data:s=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:jp,h=a.useMemo(()=>s.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[s]),x=a.useMemo(()=>h.reduce((e,t)=>e+(t.value??0),0),[h]);return t.jsxs("div",{className:br("flex h-full flex-col",m),children:[t.jsx(cp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Vm.Loading&&t.jsx(up,{}),r===Vm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.PieChart,{children:[t.jsx(q.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:t})=>`${e??""}: ${(100*(t??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,t)=>i(s[t],t):void 0,cursor:i?"pointer":void 0,children:h.map((e,a)=>t.jsx(q.Cell,{fill:p[a%p.length]},a))}),t.jsx(q.Tooltip,{formatter:e=>{const t="number"==typeof e?e:0,a=x>0?(t/x*100).toFixed(1):"0";return`${t.toLocaleString("pt-BR")} (${a}%)`}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),r===Vm.Error&&t.jsx(dp,{config:e,queryUrl:d}),r===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function _p({config:e,state:r,data:s=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:c,onExport:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=a.useMemo(()=>{const e=[...s].sort((e,t)=>(t.value??0)-(e.value??0)),t=e.reduce((e,t)=>e+(t.value??0),0);let a=0;return e.map(e=>(a+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:t>0?Math.round(a/t*100):0}))},[s]);return t.jsxs("div",{className:br("flex h-full flex-col",p),children:[t.jsx(cp,{config:e,viewOnly:i,onRefresh:c,onExport:d,queryUrlBuilder:m}),r===Vm.Loading&&t.jsx(up,{}),r===Vm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),t.jsx(q.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:(e,t)=>"% Acumulado"===t?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,t)=>l(s[t],t):void 0,cursor:l?"pointer":void 0}),t.jsx(q.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),r===Vm.Error&&t.jsx(dp,{config:e,queryUrl:u}),r===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Cp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:c,queryUrl:d,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=s??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return t.jsxs("div",{className:br("flex h-full flex-col",m),children:[t.jsx(cp,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:u}),a===Vm.Loading&&t.jsx(up,{panelType:Im.Burndown}),a===Vm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.AreaChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),t.jsx(q.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),a===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),a===Vm.Error&&t.jsx(dp,{config:e,queryUrl:d}),a===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function kp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=s??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return t.jsxs("div",{className:br("flex h-full flex-col",p),children:[t.jsx(cp,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:m}),a===Vm.Loading&&t.jsx(up,{}),a===Vm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.BarChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),t.jsx(q.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:c?(e,t)=>c(r[t],t):void 0,cursor:c?"pointer":void 0}),t.jsx(q.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),a===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),a===Vm.Error&&t.jsx(dp,{config:e,queryUrl:u}),a===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Sp({config:e,state:r,rule:s,risks:n=[],matrixViewType:o=Om.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=a.useMemo(()=>[...s?.parametersY??[]].sort((e,t)=>t.position-e.position),[s?.parametersY]),x=s?.parametersX??[],f=a.useMemo(()=>{const e={};return n.forEach(t=>{const a=`${t.parameterYPosition}-${t.parameterXPosition}`;e[a]||(e[a]=[]),e[a].push(t)}),e},[n]);return t.jsxs("div",{className:br("flex h-full flex-col",p),children:[t.jsx(cp,{config:e,viewOnly:i,onRefresh:d,queryUrlBuilder:m}),r===Vm.Loading&&t.jsx(up,{}),r===Vm.Loaded&&s&&t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:s.name_y})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex mb-1",children:[t.jsx("div",{className:"w-16 shrink-0"}),t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.threat_strategy_type_name}),!s.disable_opportunities&&t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.opportunity_strategy_type_name})]}),h.map((e,a)=>t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((r,n)=>{const i=((e,t)=>f[`${t.position}-${e.position}`]??[])(r,e),d=((e,t)=>s?.colorMatrix?.[t]?.[e]??"hsl(var(--muted))")(n,a);return t.jsxs("div",{className:br("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||c)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:d},onClick:()=>i.length>0&&l?.(r,e,i),children:[o===Om.Quantity&&i.length>0&&t.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===Om.AllRisksList&&i.map(e=>t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:t=>{t.stopPropagation(),c?.(e)},children:e.code})}),t.jsxs(Ys,{className:"max-w-[250px]",children:[t.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",t.jsx("strong",{children:e.analysisDate})]}),e.strategy&&t.jsxs("p",{className:"text-xs",children:["Estratégia: ",t.jsx("strong",{children:e.strategy})]}),e.resultName&&t.jsxs("p",{className:"text-xs",children:["Criticidade: ",t.jsx("strong",{style:{backgroundColor:d},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},r.position)})]},e.position)),t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>t.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),t.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:s.name_x})]})]})}),r===Vm.NoData&&t.jsx(mp,{hasRemovedColumn:e.hasRemovedColumn}),r===Vm.Error&&t.jsx(dp,{config:e,queryUrl:u}),r===Vm.Unavailable&&t.jsx(pp,{onRemove:()=>e.onRemove?.(e.id)})]})}const Ap=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Ap.Translate.toString(e),Ap.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function Tp(e){switch(Number(e)){case Im.Area:case Im.Bar:case Im.Column:case Im.Line:case Im.Numeric:case Im.Pie:case Im.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Dp({panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=a.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*s+(e.sizeY-1)*n+"px",transform:Ap.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,r,s,n,u,m,p]);return t.jsxs("div",{ref:d,style:h,className:br("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[t.jsx("div",{className:br("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?c:{}}),t.jsx("div",{className:"h-full",children:i})]})}function Pp({panels:e,columns:r=8,cellHeight:s=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:c,className:d}){const[u,m]=a.useState(e);a.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=a.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=a.useMemo(()=>u.map(e=>e.id),[u]),f=a.useCallback(e=>{const{active:t,over:a}=e;if(!a||t.id===a.id)return;const r=u.findIndex(e=>e.id===t.id),s=u.findIndex(e=>e.id===a.id);if(-1===r||-1===s)return;const n=[...u],o={...n[r]},i={...n[s]},l=o.col,d=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=d,n[r]=o,n[s]=i,m(n),c?.(n)},[u,c]),g=a.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${h}, ${s}px)`,gap:`${n}px`}),[r,h,s,n]);return 0===u.length?t.jsxs("div",{className:br("flex flex-col items-center justify-center py-16 text-center",d),children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):t.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:t.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:t.jsx("div",{style:g,className:br("relative w-full",i&&"bg-muted/30",d),children:u.map(e=>t.jsx(Dp,{panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const Ep={[Im.Bar]:"bar",[Im.Column]:"column",[Im.StackedColumn]:"stacked-column",[Im.Area]:"area",[Im.Line]:"line",[Im.EvolutionLine]:"evolution-line"};function Mp({config:e,state:a,data:r,numericValue:s,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:c,matrixRule:d,matrixRisks:u,onPanelClick:m}){const p=Ep[e.typeId];if(p)return t.jsx(yp,{config:e,variant:p,state:a,data:o,series:i});switch(e.typeId){case Im.Numeric:return t.jsx(xp,{config:e,state:a,value:s});case Im.Text:return t.jsx(fp,{config:e,state:a});case Im.List:return t.jsx(gp,{config:e,state:a,data:r,columns:n??[]});case Im.Pie:return t.jsx(Np,{config:e,state:a,data:r});case Im.Pareto:return t.jsx(_p,{config:e,state:a,data:r});case Im.Burndown:return t.jsx(Cp,{config:e,state:a,data:l});case Im.PerformanceColumns:return t.jsx(kp,{config:e,state:a,data:c});case Im.RiskMatrix:return t.jsx(Sp,{config:e,state:a,rule:d,risks:u??[]});default:return t.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function Ip({dashboard:e,panels:r,pages:s,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:c,onRefresh:d,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:v,onLayoutChange:b,onPageChange:w,toolbarActions:j,className:N}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),S=e.idViewType===Lm.Carousel,A=a.useMemo(()=>r,[r,S,n]),T=a.useMemo(()=>A.map(e=>{const t=Tp(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:t.x,minSizeY:t.y}}),[A]),D=a.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:v}),[o,f,g,v]),P=a.useCallback(()=>{C||l||(k(!0),d?.(),setTimeout(()=>k(!1),3e4))},[C,l,d]),E=a.useCallback(e=>{const a=A.find(t=>t.id===e);if(!a)return null;const r=D(a),s=c?.(e)??{state:Vm.Loaded};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx(cp,{config:r,onRefresh:()=>{}}),t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(Mp,{config:r,...s})})]})},[A,D,c,o,f,g,v]);return t.jsxs("div",{className:br("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[j,d&&t.jsx("button",{onClick:P,disabled:C||l,className:br("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&t.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?t.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):t.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&t.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&t.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:t.jsx("svg",{className:br("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&s&&s.length>1&&t.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:s.map(e=>t.jsx("button",{onClick:()=>w?.(e.id),className:br("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&t.jsx("div",{className:"flex justify-center py-3",children:t.jsxs("button",{onClick:x,className:br("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&t.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:t.jsx(Pp,{panels:T,allowDragging:o,showGridLines:o,renderPanel:E,onLayoutChange:b})})]})}function Rp(e,t=Um.PtBr){const{t:a}=y.useTranslation();switch(t){case Um.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case Um.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function Lp(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Fp=[{value:Km.All,label:"Todos"},{value:Km.OnlyMine,label:e.t("dashboard_my")},{value:Km.Favorites,label:"Favoritos"}];function zp({dashboards:e,limit:r,isLoading:s=!1,language:n=Um.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:c,onEdit:d,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:v,toolbarExtra:b,className:w}){const{t:j}=y.useTranslation(),[N,_]=a.useState(""),[C,k]=a.useState(Km.All),[S,A]=a.useState(null),T=a.useCallback(e=>{_(e),g?.(e)},[g]),D=a.useCallback(e=>{k(e),v?.(e)},[v]),P=a.useMemo(()=>{let t=e;if(N){const e=N.toLowerCase();t=t.filter(t=>t.code?.toLowerCase().includes(e)||Rp(t,n).toLowerCase().includes(e)||t.responsibleName?.toLowerCase().includes(e))}switch(C){case Km.OnlyMine:break;case Km.Favorites:t=t.filter(e=>e.isFavorite)}return t},[e,N,C,n]);return t.jsxs("div",{className:br("flex flex-col h-full",w),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),r&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.countDashboards,"/",r.maxDashboards,")"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative",children:[t.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"m21 21-4.3-4.3"})]}),t.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>T(e.target.value),className:br("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),b,o&&h&&t.jsxs("button",{onClick:h,className:br("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),t.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Fp.map(e=>t.jsx("button",{onClick:()=>D(e.value),disabled:s,className:br("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),s&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!s&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t.jsxs("tr",{children:[t.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:t.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),t.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),t.jsx("th",{className:"w-12 px-3 py-2"})]})}),t.jsxs("tbody",{children:[0===P.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),P.map(e=>t.jsxs("tr",{onClick:()=>c?.(e),className:br("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[t.jsx("td",{className:"px-3 py-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsx("svg",{className:br("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),t.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),t.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Rp(e,n)}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),t.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:Lp(e.lastModified)}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:br("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),t.jsx("td",{className:"px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(null)}),t.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-1 border-t border-border"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Up=[{value:Rm.NotUpdate,label:e.t("dashboard_no_refresh")},{value:Rm.FiveMinutes,label:"5 minutos"},{value:Rm.TenMinutes,label:"10 minutos"},{value:Rm.FifteenMinutes,label:"15 minutos"},{value:Rm.ThirtyMinutes,label:"30 minutos"},{value:Rm.OneHour,label:"1 hora"}],Op=[{value:Lm.NormalPage,label:e.t("dashboard_normal_page")},{value:Lm.Carousel,label:"Carrossel"}],Bp=[{value:Tm.FiveSeconds,label:"5 segundos"},{value:Tm.TenSeconds,label:"10 segundos"},{value:Tm.FifteenSeconds,label:"15 segundos"},{value:Tm.ThirtySeconds,label:"30 segundos"},{value:Tm.OneMinute,label:"1 minuto"},{value:Tm.ThreeMinutes,label:"3 minutos"},{value:Tm.FiveMinutes,label:"5 minutos"},{value:Tm.TenMinutes,label:"10 minutos"}],qp=[{value:zm.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:zm.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:zm.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Vp=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function $p({dashboard:e,initialTab:r=Fm.General,isSaving:s=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:c=[],onSave:d,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=a.useState(r),[g,v]=a.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[b,w]=a.useState(e?.titlePtBr??""),[j,N]=a.useState(e?.titleEnUs??""),[_,C]=a.useState(e?.titleEsEs??""),[k,S]=a.useState(e?.responsibleId??""),[A,T]=a.useState(e?.isActive??!0),[D,P]=a.useState(e?.idUpdateTime??Rm.NotUpdate),[E,M]=a.useState(e?.idViewType??Lm.NormalPage),[I,R]=a.useState(e?.idPageTime??Tm.FifteenSeconds),[L,F]=a.useState(e?.idShare??zm.NotShared),[z,U]=a.useState(e?.groups??[]),[O,B]=a.useState(e?.places??[]),[q,V]=a.useState(e?.collaborators??[]),$=E===Lm.Carousel,W=g["pt-br"]||g.en||g.es,H=a.useMemo(()=>!!W&&(!(g["pt-br"]&&!b.trim())&&(!(g.en&&!j.trim())&&!(g.es&&!_.trim()))),[W,g,b,j,_]),G=a.useCallback(e=>{v(t=>({...t,[e]:!t[e]}))},[]),K=a.useCallback(()=>{H&&!s&&d?.({titlePtBr:g["pt-br"]?b:"",titleEnUs:g.en?j:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:A,idUpdateTime:D,idViewType:E,idPageTime:$?I:null,idShare:L,groups:L===zm.SharedWithUsersGroupsPlacesCollaborators?z:[],places:L===zm.SharedWithUsersGroupsPlacesCollaborators?O:[],collaborators:L===zm.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[H,s,d,g,b,j,_,k,A,D,E,I,$,L,z,O,q]);return t.jsxs("div",{className:br("flex flex-col h-full bg-background",m),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&t.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t.jsxs("button",{onClick:K,disabled:!H||s,className:br("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[s?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t.jsxs("div",{className:"flex border-b border-border bg-card",children:[t.jsx("button",{onClick:()=>f(Fm.General),className:br("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Fm.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),t.jsx("button",{onClick:()=>f(Fm.Share),className:br("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Fm.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===Fm.General&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),t.jsx("div",{className:"flex gap-2",children:Vp.map(e=>t.jsx("button",{onClick:()=>G(e.key),className:br("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&t.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),t.jsx("input",{value:b,onChange:e=>w(e.target.value),maxLength:200,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[b.length,"/200"]})]}),g.en&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),t.jsx("input",{value:j,onChange:e=>N(e.target.value),maxLength:200,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[j.length,"/200"]})]}),g.es&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),t.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[t.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),t.jsx("select",{value:D,onChange:e=>P(Number(e.target.value)),disabled:n,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Up.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t.jsxs("div",{className:"flex items-center gap-3 h-10",children:[t.jsx("button",{onClick:()=>T(!A),disabled:e?.isGeneralViewUse,className:br("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",A?"bg-primary":"bg-muted","disabled:opacity-50"),children:t.jsx("span",{className:br("inline-block h-4 w-4 rounded-full bg-white transition-transform",A?"translate-x-6":"translate-x-1")})}),t.jsx("span",{className:"text-sm text-foreground",children:A?"Ativo":"Inativo"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),t.jsx("select",{value:E,onChange:e=>M(Number(e.target.value)),disabled:n||$,className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Op.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),$&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),t.jsx("select",{value:I??"",onChange:e=>R(Number(e.target.value)),className:br("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Bp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===Fm.Share&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M12 16v-4"}),t.jsx("path",{d:"M12 8h.01"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),t.jsx("div",{className:"space-y-3",children:qp.map(a=>t.jsxs("label",{className:br("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",L===a.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"shareType",value:a.value,checked:L===a.value,onChange:()=>F(a.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:a.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})]},a.value))}),L===zm.SharedWithUsersGroupsPlacesCollaborators&&t.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),t.jsx("select",{multiple:!0,value:z,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);U(t)},className:br("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",O.length,")"]}),t.jsx("select",{multiple:!0,value:O,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);B(t)},className:br("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),t.jsx("select",{multiple:!0,value:q,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);V(t)},className:br("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:c.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Wp(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Hp(e,t){return{id:t?.id??Wp(),text:e,children:t?.children,collapsed:t?.collapsed,color:t?.color,icon:t?.icon,note:t?.note,side:t?.side}}function Gp(e,t){if(e.id===t)return{node:e,parent:null};const a=[];for(const r of e.children??[])a.push({node:r,parent:e});for(;a.length;){const e=a.pop();if(e.node.id===t)return{node:e.node,parent:e.parent};for(const t of e.node.children??[])a.push({node:t,parent:e.node})}return null}function Kp(e,t){const a=t(e);return a.children?.length?{...a,children:a.children.map(e=>Kp(e,t))}:a}function Yp(e,t,a){return Kp(e,e=>e.id===t?a(e):e)}function Qp(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Xp(e,t,a){const r=Hp(a||"");let s=r.id;return{root:Kp(e,a=>{if(a.id!==t)return a;let n=r;if(a.id===e.id){const t=Qp(e);n={...n,side:t.left<=t.right?"left":"right"}}else n={...n,side:a.side};return s=n.id,{...a,collapsed:!1,children:[...a.children??[],n]}}),newId:s}}function Jp(e,t,a){if(e.id===t)return Xp(e,t,a);const r=Gp(e,t);if(!r||!r.parent)return{root:e,newId:t};const s=r.parent,n=Hp(a||"",{side:r.node.side}),o=n.id;return{root:Kp(e,e=>{if(e.id!==s.id)return e;const a=(e.children??[]).findIndex(e=>e.id===t),r=[...e.children??[]];return r.splice(a+1,0,n),{...e,children:r}}),newId:o}}function Zp(e,t){if(e.id===t)return{root:e,nextSelectedId:t};const a=Gp(e,t);if(!a||!a.parent)return{root:e,nextSelectedId:null};const r=a.parent,s=r.children??[],n=s.findIndex(e=>e.id===t),o=s[n+1]?.id??s[n-1]?.id??r.id;return{root:Kp(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==t)}),nextSelectedId:o}}function eh(e,t,a){if(t===a)return e;if(t===e.id)return e;if(function(e,t,a){const r=Gp(e,t);return!!r&&!!Gp(r.node,a)}(e,t,a))return e;const r=Gp(e,t);if(!r)return e;const s=(()=>{if(a===e.id){const t=Qp(e);return{...r.node,side:t.left<=t.right?"left":"right"}}const t=Gp(e,a)?.node;return{...r.node,side:t?.side}})(),n=Kp(e,e=>e.children?.length&&e.children.some(e=>e.id===t)?{...e,children:e.children.filter(e=>e.id!==t)}:e);return Kp(n,e=>e.id!==a?e:{...e,collapsed:!1,children:[...e.children??[],s]})}function th(e,t){return Yp(e,t,e=>({...e,collapsed:!e.collapsed}))}function ah(e,t){return Kp(e,a=>a.children?.length?a.id===e.id&&t?a:{...a,collapsed:t}:a)}function rh(e){const{value:t,defaultValue:r,onChange:s,readOnly:n}=e,o=void 0!==t,[i,l]=a.useState(()=>r??t??Hp("Mapa Mental",{id:"root"})),c=o?t:i,[d,u]=a.useState(c.id),m=a.useRef([]),p=a.useRef([]),h=a.useCallback((e,t)=>{n||(m.current.push(t),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),s?.(e))},[o,s,n]),x=a.useCallback((e,t)=>{const a=Yp(c,e,e=>({...e,text:t}));h(a,c)},[c,h]),f=a.useCallback((e,t)=>{const a=Yp(c,e,e=>({...e,...t}));h(a,c)},[c,h]),g=a.useCallback((e,t="")=>{const{root:a,newId:r}=Xp(c,e,t);return h(a,c),u(r),r},[c,h]),v=a.useCallback((e,t="")=>{const{root:a,newId:r}=Jp(c,e,t);return h(a,c),u(r),r},[c,h]),b=a.useCallback(e=>{const{root:t,nextSelectedId:a}=Zp(c,e);t!==c&&(h(t,c),u(a))},[c,h]),y=a.useCallback((e,t)=>{const a=eh(c,e,t);a!==c&&h(a,c)},[c,h]),w=a.useCallback(e=>{const t=Gp(c,e);if(!t||!t.node.children?.length)return;const a=th(c,e);h(a,c)},[c,h]),j=a.useCallback(()=>{h(ah(c,!1),c)},[c,h]),N=a.useCallback(()=>{h(ah(c,!0),c)},[c,h]),_=a.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(c),o||l(e),s?.(e))},[c,o,s]),C=a.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(c),o||l(e),s?.(e))},[c,o,s]),k=m.current.length>0,S=p.current.length>0,A=a.useMemo(()=>d?Gp(c,d)?.node??null:null,[c,d]),T=a.useCallback(e=>{h(e,c)},[c,h]);return{root:c,setRoot:T,selectedId:d,selectedNode:A,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:v,removeNode:b,moveNode:y,toggleNode:w,expandAll:j,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const sh=180,nh=80,oh=16,ih=60;function lh(e){const t=(e.collapsed?[]:e.children??[]).map(lh);if(!t.length)return{node:e,visibleChildren:t,height:44};const a=t.reduce((e,t)=>e+t.height,0)+oh*(t.length-1);return{node:e,visibleChildren:t,height:Math.max(44,a)}}function ch(e,t,a,r,s,n,o){const i=[],l={node:e.node,parent:t,x:a,y:r,width:180,height:44,side:s,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let c=r+22-(e.visibleChildren.reduce((e,t)=>e+t.height,0)+oh*(e.visibleChildren.length-1))/2;for(const d of e.visibleChildren){const t="right"===s?a+180+nh:a-nh-sh,r=c+d.height/2-22,l=ch(d,e.node,t,r,s,n+1,o);i.push(l),c+=d.height+oh}return l}function dh(e){return a.useMemo(()=>function(e){const t=e.collapsed?[]:e.children??[],a=t.filter(e=>"left"!==e.side).map(lh),r=t.filter(e=>"left"===e.side).map(lh),s=a.reduce((e,t)=>e+t.height,0)+oh*Math.max(0,a.length-1),n=r.reduce((e,t)=>e+t.height,0)+oh*Math.max(0,r.length-1),o=Math.max(s,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=a.length?Math.max(...a.map(i))+1:0,c=260*(r.length?Math.max(...r.map(i))+1:0),d=220+260*l+c+120,u=o+120,m=ih+c,p=[],h={node:e,parent:null,x:m,y:ih+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=ih+o/2-s/2;for(const v of a){const t=x+v.height/2-22,a=ch(v,e,m+220+nh,t,"right",1,p);h.visibleChildren.push(a),x+=v.height+oh}let f=ih+o/2-n/2;for(const v of r){const t=f+v.height/2-22,a=ch(v,e,m-nh-sh,t,"left",1,p);h.visibleChildren.push(a),f+=v.height+oh}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:d,height:u}}(e),[e])}function uh(e,t){const{layout:a,selectedId:r,setSelectedId:s}=t;if(!r)return void s(a.nodes[0]?.node.id??null);const n=a.byId.get(r);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const t=n.visibleChildren.find(t=>t.side===e);return void(t&&s(t.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&s(e.node.id)}else n.parent&&s(n.parent.id);return}if(!n.parent)return;const o=a.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===r),c="up"===e?i[l-1]:i[l+1];c&&s(c.node.id)}const mh=({layout:e,selected:a,editing:r,readOnly:s,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,v=(b=f.icon)?ae[b]??null:null;var b;const y=!!f.children?.length,w=te.useRef(null),[j,N]=te.useState(f.text);te.useEffect(()=>{if(r){N(f.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[r,f.text]);const _=()=>{i(j.trim()||f.text)},C=f.color;return t.jsxs("div",{role:"treeitem","aria-selected":a,"aria-expanded":y?!f.collapsed:void 0,tabIndex:a?0:-1,"data-node-id":f.id,draggable:!s&&!g&&!r,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),s||o()},className:br("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",a&&!g&&"ring-2 ring-primary ring-offset-1",a&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[v&&t.jsx(v,{className:br("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),t.jsx("div",{className:"flex-1 min-w-0",children:r?t.jsx("input",{ref:w,value:j,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:br("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?t.jsx("div",{className:"text-sm truncate",children:x(f)}):t.jsx("div",{className:"text-sm truncate",children:f.text||t.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!r&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:br("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:t.jsx(c.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),t.jsx(Ys,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&t.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:br("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?t.jsx(c.Plus,{className:"h-3 w-3"}):"left"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3"}):t.jsx(c.Minus,{className:"h-3 w-3"})})]})},ph=({parent:e,child:a})=>{const r=a.x+a.width/2<e.x+e.width/2,s=r?e.x:e.x+e.width,n=e.y+e.height/2,o=r?a.x+a.width:a.x,i=a.y+a.height/2,l=(s+o)/2,c=`M ${s} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return t.jsx("path",{d:c,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},hh=({label:e,icon:a,onClick:r,disabled:s})=>t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:s,"aria-label":e,className:"h-8 w-8",children:a})}),t.jsx(Ys,{children:e})]}),xh=e=>{const{t:a}=y.useTranslation();return t.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[t.jsx(hh,{label:a("mind_map_add_child"),icon:t.jsx(c.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),t.jsx(hh,{label:a("mind_map_add_sibling"),icon:t.jsx(c.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),t.jsx(hh,{label:a("mind_map_delete_node"),icon:t.jsx(c.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),t.jsx(Mr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(hh,{label:a("mind_map_expand_all"),icon:t.jsx(c.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),t.jsx(hh,{label:a("mind_map_collapse_all"),icon:t.jsx(c.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),t.jsx(Mr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(hh,{label:a("mind_map_zoom_out"),icon:t.jsx(c.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),t.jsx(hh,{label:a("mind_map_zoom_in"),icon:t.jsx(c.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),t.jsx(hh,{label:a("mind_map_fit_to_screen"),icon:t.jsx(c.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),t.jsx(Mr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(hh,{label:a("mind_map_undo"),icon:t.jsx(c.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),t.jsx(hh,{label:a("mind_map_redo"),icon:t.jsx(c.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),t.jsx("div",{className:"flex-1"}),t.jsx(hh,{label:a("mind_map_export_json"),icon:t.jsx(c.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),t.jsx(hh,{label:a("mind_map_export_image"),icon:t.jsx(c.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function fh(e){return JSON.stringify(e,null,2)}function gh(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const t=e;if("string"!=typeof t.text)throw new Error('Invalid mind map node: missing "text"');const a=Array.isArray(t.children)?t.children.map(e=>gh(e)):void 0;return Hp(t.text,{id:"string"==typeof t.id?t.id:void 0,collapsed:"boolean"==typeof t.collapsed?t.collapsed:void 0,color:"string"==typeof t.color?t.color:void 0,icon:"string"==typeof t.icon?t.icon:void 0,note:"string"==typeof t.note?t.note:void 0,side:"left"===t.side||"right"===t.side?t.side:void 0,children:a})}function vh({data:e,columns:r,sortField:s,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:d=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:v=!0,onColumnResize:b,enableColumnReorder:w=!1,onReorderColumns:j,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:A=!1,rowActionsVariant:T="default",hideActionsColumn:D=!1,actionsHeaderContent:P}){const{t:E}=y.useTranslation(),M=u||E("no_items_found",E("no_items_found_empty")),[I,R]=a.useState(()=>A?new Set(e.map(e=>e.id)):new Set),L=void 0!==k,F=L?new Set(k):I,z=a.useCallback(e=>{L&&S?S(e):R(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[L,S]),{columnWidths:U,isDragging:O,activeColumn:B,handleMouseDown:q}=ni({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:b,enabled:v}),V=xi({enabled:w&&!!j,onReorder:j??(()=>{})}),$=a.useMemo(()=>{if(v){const e=r.map(e=>U[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return e.map(e=>e/t*100+"%")}const e=r.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return r.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const a=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${a}%)`:`${a}%`})},[r,v,U]);if(d)return t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,a)=>t.jsx(cn,{className:"h-12 w-full"},a))})});if(0===e.length)return t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-center text-muted-foreground",children:t.jsx("p",{children:M})})});const W=l&&!D,H=(p?1:0)+(_?1:0)+r.length+(W?1:0);return t.jsx("div",{className:"flex-1 overflow-auto "+(O?"select-none":""),children:t.jsxs(ko,{className:br("table-fixed w-full",m),children:[t.jsx(So,{className:"sticky top-0 bg-background z-10",children:t.jsxs(Do,{children:[_&&t.jsx(Po,{className:"w-[40px]"}),p&&t.jsx(Po,{className:"w-[40px]",children:t.jsx(Ns,{checked:g,onCheckedChange:f,"aria-label":E("select_all","Selecionar todos")})}),r.map((e,a)=>{const r=v&&!1!==e.resizable,i=B===String(e.key),l=w&&!!j,d=l?V.getDragProps(a):{},u=V.dragFromIndex===a,m=V.dragOverIndex===a&&V.dragFromIndex!==a;return t.jsxs(Po,{className:br(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&V.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:$[a]},...d,children:[!1!==e.sortable&&o?t.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),s!==p?null:"asc"===n?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}):t.jsx("span",{className:"font-medium",children:e.header}),r&&t.jsx(Uo,{direction:"horizontal",onMouseDown:t=>q(String(e.key),t),isDragging:i})]},String(e.key));var p}),W&&t.jsx(Po,{className:"w-[80px] text-right",children:P??E("actions","Ações")})]})}),t.jsx(Ao,{children:e.map(e=>{const s=_&&F.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(Do,{onClick:()=>i?.(e),className:br(i?"cursor-pointer":"","relative","inline"===T&&"group"),children:[_&&t.jsx(Eo,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":s?E("collapse_row","Recolher linha"):E("expand_row","Expandir linha"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&t.jsx(Eo,{children:t.jsx(Ns,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${E("select_all","Selecionar todos")} ${e.id}`})}),r.map(a=>t.jsx(Eo,{className:a.className,children:t.jsx(zo,{children:a.render?a.render(e):String(e[a.key]??"-")})},String(a.key))),W&&t.jsx(Eo,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===T?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),s&&C&&t.jsx(Do,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Eo,{colSpan:H,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function bh({searchValue:e="",onSearchChange:a,customFilters:r=[],onClearFilters:s,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||r.length>0;return t.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[a&&t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(_r,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>a(e.target.value),className:"pl-9 h-9"})]}),r.map((e,a)=>t.jsx("div",{className:"vertical"===o?"w-full":"",children:e},a)),n&&l&&s&&t.jsxs(jr,{variant:"ghost",size:"sm",onClick:s,className:"h-9 px-3 whitespace-nowrap",children:[t.jsx(c.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function yh(e,t){const a=new Set;function r(e){if(e)for(const t of e)a.add(t.id),r(t.children)}return function e(a){for(const s of a){if(s.id===t)return r(s.children),!0;if(s.children&&e(s.children))return!0}return!1}(e),a}function wh({children:e,itemId:a,enableDrag:r,onDragStartCell:s,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return t.jsx(Eo,{draggable:r,onDragStart:r?e=>s(a,e):void 0,onDragEnd:r?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(a,e)},className:l,children:e})}function jh({item:e,level:a,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w,dragCount:j}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*a,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),A=g===e.id&&f!==e.id,T=p?.has(e.id)??!1,D={itemId:e.id,enableDrag:x,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w};return t.jsxs(t.Fragment,{children:[t.jsxs(Do,{className:br(l&&"cursor-pointer",k&&"group",S&&"opacity-40",A&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[t.jsx(wh,{...D,children:t.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&t.jsx(Ns,{checked:T,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&t.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?t.jsx(c.ChevronDown,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})}):t.jsx("div",{className:"w-6 shrink-0"}),n??t.jsx(c.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate",children:String(e[s]??e.id)}),f===e.id&&j&&j>1&&t.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:j})]})}),r.map(r=>{const s=e[r.key],n=r.render?r.render(e,a):null!=s?String(s):"—";return t.jsx(wh,{...D,className:br("text-center",r.className),children:r.hoverContent?t.jsxs(Hc,{openDelay:200,children:[t.jsx(Gc,{asChild:!0,children:t.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),t.jsx(Kc,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):n},String(r.key))}),d&&t.jsx(wh,{...D,className:"text-right",children:t.jsx("div",{onClick:e=>e.stopPropagation(),className:br("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:d(e)})})]}),_&&N&&e.children.map(e=>t.jsx(jh,{item:e,level:a+1,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w,dragCount:j},e.id))]})}function Nh({onDrop:a,isDragOver:r,onDragOver:s,onDragLeave:n,label:o}){return t.jsxs("div",{className:br("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:s,onDragEnter:s,onDragLeave:n,onDrop:a,children:[t.jsx(c.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function _h(e){const t=N.useNavigate();return{onNew:()=>{const a=e.newPath||`${e.basePath}/new`;t(a)},onEdit:a=>{const r=e.editPath?e.editPath.replace(":id",a.id):`${e.basePath}/${a.id}/edit`;t(r)}}}const Ch="true"===(void 0).VITE_SHOW_EDIT_PROFILE,kh=a.memo(({variant:e="card",className:r="",selectedUnit:s,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:d,isAuthenticated:u,logout:m,switchUnit:p}=jo(),{role:h}=Cl(),x=h?.name||null,f=l?.[0]||null,g=d?l?.find(e=>e.alias===d):f,v=l||[],b=s||g||f||f,[w,j]=a.useState(0);a.useEffect(()=>{const e=()=>j(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const N=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48&v=${w}`},[i?.id,w]),_=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=96&v=${w}`},[i?.id,w]),C=a.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),k=a.useCallback(e=>{n?n(e):p(e)},[n,p]),S=a.useMemo(()=>{if(!v?.length)return[];const e=new Map;v.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),a=t.find(e=>e.alias===b?.alias),r=t.filter(e=>e.alias!==b?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),a?[a,...r]:r},[v,b?.alias]),[A,T]=a.useState(!1);if(!u||!i)return null;const D=()=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsxs(Ki,{className:"w-10 h-10",children:[N&&t.jsx(Yi,{src:N,alt:i.name||o("user_photo")}),t.jsx(Qi,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||t.jsx(c.User,{className:"h-5 w-5"})})]})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",b?.name||"N/A"]})]})]}),b&&t.jsx("div",{className:"mt-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(c.Building2,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:b.name})]})}),S.length>1&&t.jsxs("div",{className:"mt-2",children:[t.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>t.jsx(ks,{variant:e.alias===b?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t.jsxs(ks,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]});return"dropdown"===e?t.jsxs(t.Fragment,{children:[t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsx(jr,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${r}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"hidden md:block text-right",children:[t.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),t.jsx("p",{className:"text-xs text-primary-foreground/70",children:b?.name||"N/A"})]}),t.jsxs(Ki,{className:"w-8 h-8 border border-primary-foreground/30",children:[N&&t.jsx(Yi,{src:N,alt:i.name||o("user_photo")}),t.jsx(Qi,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||t.jsx(c.User,{className:"h-4 w-4"})})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4"})]})})}),t.jsxs(Us,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t.jsxs(Rs,{children:[t.jsxs(Fs,{children:[t.jsx(c.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),t.jsx(zs,{children:S.map(e=>t.jsxs(Os,{onClick:()=>k(e),className:e.alias===b?.alias?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===b?.alias&&t.jsx(ks,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Ch&&t.jsxs(t.Fragment,{children:[t.jsx($s,{}),t.jsxs(Os,{onClick:()=>T(!0),children:[t.jsx(c.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),t.jsx($s,{}),t.jsxs(Os,{onClick:m,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),Ch&&t.jsx(ul,{open:A,onOpenChange:T,user:i,userPhotoUrl:_,userInitials:C})]}):t.jsxs(Sr,{className:r,children:[t.jsx(Ar,{children:t.jsx(Tr,{className:"text-lg",children:o("user_info")})}),t.jsxs(Pr,{className:"space-y-4",children:[t.jsx(D,{}),t.jsx(Mr,{}),t.jsxs(jr,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),Sh=a.createContext({});function Ah({children:e,config:r}){const s=a.useMemo(()=>{const e=Ie(),t=r?.appName?e?`${r.appName} (Dev)`:r.appName:void 0;return{navigation:r?.navigation,appName:t}},[r?.navigation,r?.appName]);return t.jsx(Sh.Provider,{value:s,children:e})}function Th(){return a.useContext(Sh)}function Dh(e,t){if(!e)return"";const a=e.find(e=>e.path===t);if(a)return a.label;const r=e.find(e=>t.startsWith(e.path+"/"));return r?.label||""}function Ph(e,t){const[r,s]=a.useState(e),n=a.useRef(),o=a.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return a.useEffect(()=>(o(),n.current=setTimeout(()=>{s(e)},t),o),[e,t,o]),[r,o]}function Eh({appName:e}){const[r,s]=a.useState(!1),{association:n}=Cl(),o=rt({isQualitfy:n?.isQualitfy,isMetroex:n?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between w-[258px]",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:t.jsx("img",{src:o,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&t.jsx("button",{className:"min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground/80 hover:text-primary-foreground/60 transition-colors leading-tight py-1",onClick:()=>s(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),t.jsx(cc,{open:r,onOpenChange:s})]})}const Mh=a.memo(function({actions:r}){const s=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=Th(),l=Dh(o,s.pathname),{metadata:d,headerActions:u}=hl(),{setOpenMobile:m}=Kd(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:v}=jo(),b=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,w]=N.useSearchParams(),j=a.useCallback(e=>{const{pathname:t,search:a,hash:r}=s;if(h){const s=t.split("/"),o=s.indexOf(h);if(o>=0)return s[o]=e.alias,void n(s.join("/")+a+r)}v(e)},[h,s,n,v]),[_,C]=a.useState(()=>y.get("search")||""),[k,S]=Ph(_,Ve.debounceDelay);a.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),w(e)},[k,w,x]);const A=o?.find(e=>e.path===s.pathname)||o?.find(e=>s.pathname.startsWith(e.path+"/")),T=d.title||l,D=d.subtitle||A?.complementaryText||"";return t.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(jr,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:t.jsx(c.Menu,{size:20})}),t.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:t.jsx(Eh,{appName:i})}),t.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t.jsxs("div",{className:"flex-shrink-0",children:[d.breadcrumbs&&d.breadcrumbs.length>0&&t.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:d.breadcrumbs.map((e,a)=>t.jsxs("span",{className:"flex items-center gap-1",children:[a>0&&t.jsx(c.ChevronRight,{className:"h-3 w-3"}),e.href?t.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):t.jsx("span",{children:e.label})]},a))}),t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:T})}),D&&t.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:D})]}),x&&t.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(_r,{placeholder:"Pesquisar",value:_,onChange:e=>(e=>{C(e)})(e.target.value),className:"w-full pl-10 pr-8"}),_&&t.jsx(jr,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),w(e)},title:e.t("clear_search"),children:t.jsx(c.X,{size:14})})]}),t.jsx(jr,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:t.jsx(c.RefreshCw,{size:14})})]}),t.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||r)&&t.jsx("div",{className:"flex items-center gap-2",children:u||r}),(void 0).VITE_WIKI_URL&&t.jsx(jr,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>mr((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),t.jsx(im,{}),t.jsx("div",{className:"text-sm",children:t.jsx(kh,{variant:"dropdown",selectedUnit:b,onUnitChange:j})})]})]})})}),Ih=({key:e,enabled:t,checkFn:a,staleTime:r=3e5,gcTime:s=6e5})=>j.useQuery({queryKey:["permission",e],queryFn:a,enabled:t,staleTime:r,gcTime:s,retry:0,refetchOnWindowFocus:!1});function Rh({config:e,isCollapsed:a=!1,isDisabled:r=!1,className:s}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=c.Plus,variant:d="button"}=e;if(!o||0===o.length)return null;if("split-button"===d){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(a){const a=t.jsx(jr,{onClick:e.onClick,disabled:r||e.disabled,className:br("justify-center px-2 w-full",s),variant:"outline",size:"default",children:t.jsx(n,{className:"h-4 w-4 shrink-0"})});return t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:a}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:e.label})})]})}return t.jsx(Ju,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:r||e.disabled,className:br("w-full",s),menuAlign:"start"})}const u=(e,r,s=!1)=>t.jsxs(t.Fragment,{children:[e,!a&&r&&t.jsx("span",{className:"truncate",children:r}),!a&&s&&t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=r||e.disabled,c=t.jsx(jr,{onClick:e.onClick,disabled:i,className:br("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return a?t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:c}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:e.label})})]}):c}const m=t.jsx(jr,{disabled:r,className:br("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:a?t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:m}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:i})})]}):m}),t.jsx(Us,{align:"start",side:a?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const a=e.icon;return t.jsxs(Os,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Lh="forlogic-sidebar-pinned",Fh=()=>{try{const e=localStorage.getItem(Lh);return!!e&&JSON.parse(e)}catch{return!1}};function zh({direction:e="right",minWidth:t=224,maxWidth:r=384,defaultWidth:s=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,c]=a.useState(()=>{if("undefined"==typeof window)return s;const e=localStorage.getItem(n);return e?parseInt(e):s}),[d,u]=a.useState(!1),m=a.useRef(null);a.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=a.useCallback(e=>{e.preventDefault(),u(!0)},[]);return a.useEffect(()=>{if(!d)return;const a=a=>{let s;s="left"===e?window.innerWidth-a.clientX:a.clientX,s=Math.max(t,Math.min(r,s)),c(s),o?.(s)},s=()=>{u(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s)}},[d,e,t,r,l,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d,e]),{width:l,isDragging:d,dragRef:m,handleMouseDown:p}}const Uh=a.createContext(void 0);function Oh(){const e=a.useContext(Uh);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}const Bh="2.4.8";function qh({config:e,customContent:r,resizable:s=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:d,setOpenMobile:u}=Kd(),m=N.useLocation(),{alias:p,user:h}=jo(),{appName:x}=Th(),{hasOpenModal:f}=Oh(),[g,v]=a.useState(Fh),b=Co(),w=!!b||l,j=a.useCallback(()=>{b&&u(!1)},[b,u]),_=s?zh({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;a.useEffect(()=>{d(!!g)},[g,d]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return t.jsxs(Qd,{collapsible:"icon",className:br("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:_&&w?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&t.jsx("div",{className:"py-3",children:t.jsx(Hs,{children:t.jsx(Rh,{config:e.moduleActions,isCollapsed:!w,isDisabled:f})})}),t.jsx(su,{className:br(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||t.jsx(nu,{className:"p-0",children:t.jsx(lu,{children:t.jsx(cu,{className:"gap-1",children:t.jsx(Hs,{children:e?.navigation?.map((e,a)=>{if("separator"===e.type)return t.jsx(ru,{className:"my-2"},`sep-${a}`);const r=({item:e,index:a})=>{const s=`${e.path}-${a}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=Ih({key:s,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,d=o?c.Loader2:l?c.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?t.jsx(Ml,{defaultOpen:!0,className:"group/collapsible",children:t.jsxs(du,{children:[t.jsx(Il,{asChild:!0,children:t.jsx(mu,{size:"default",children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label}),t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),t.jsx(Rl,{children:t.jsx(fu,{children:e.children.map((e,a)=>t.jsx(r,{item:e,index:a},e.path))})})]})},e.path):t.jsx(du,{children:t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("div",{className:br("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path):t.jsx(du,{children:l||o?t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:w?t.jsx(mu,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):w?t.jsx(mu,{asChild:!0,isActive:C(e.path),size:"default",children:t.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:j,children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(N.Link,{to:e.path,onClick:j,className:br("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path)};return t.jsx(r,{item:e,index:a},e.path)})})})})})}),!b&&t.jsxs("div",{className:br("mt-auto pb-4 pt-2 flex items-center gap-2",w?"justify-between px-1":"justify-center flex-col"),children:[w&&t.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/70 select-text truncate",title:`forlogic-core v${Bh}`,children:["v",Bh]}),!w&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground/60 select-text",children:["v",Bh.split(".").slice(0,2).join(".")]})}),t.jsx(Ys,{side:"right",children:t.jsxs("p",{children:["forlogic-core v",Bh]})})]}),t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;v(e),(e=>{try{localStorage.setItem(Lh,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?t.jsx(c.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),t.jsx(Ys,{side:"right",children:t.jsx("p",{children:l?"Recolher":"Expandir"})})]})]}),s&&_&&w&&t.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:br("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}function Vh(e){if("string"!=typeof e)return;return e.trim()||void 0}function $h(){const{alias:e,isAuthenticated:t,isLoading:r,selectedUnit:s}=jo(),n=s?.id??null,o=!!Un.getAccessToken(),i=function(e,t){const a=Vh(t);if(a)return a;const r=Un,s=Vh(r.getCurrentCompanyId?.());if(s)return s;const n=Un.extractTokenData(),o=Vh(n?.companyId)??Vh(n?.company_id);if(o)return o;if(e){const t=Vh(Un.getCompanyId(e));if(t)return t}}(e,n),l=!!e&&!!t&&o,c=l&&!!i,[,d]=a.useReducer(e=>e+1,0);a.useEffect(()=>{if(!t||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[t,o,i]);let u=null;return r?u="Carregando autenticação...":t?e?o?i||(u="Aguardando unidade ativa..."):u="Aguardando token de acesso Qualiex...":u="Aguardando alias...":u="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!r,isAuthenticated:!!t,isReadyForQualiex:l,isReadyForQualiexWithCompany:c,isWaitingCompanyId:!!t&&o&&!i,waitingReason:u}}async function Wh(e,t){const a=await el(`${Xi()}/api/common/v1/updates/userView/${t}`,e),r=await a.json(),s=r?.data??r;return Array.isArray(s)?s:[]}async function Hh(e,t,a,r){const s=void 0===r?"undefined":String(r),n={id:t,idUpdateType:a};void 0!==r&&(n.liked=r),await el(`${Xi()}/api/common/v1/Updates/userVisualized/${a}/${s}`,e,{method:"POST",body:JSON.stringify(n)})}const Gh=3e5;function Kh(){const{alias:e,isReadyForQualiex:t}=$h();return j.useQuery({queryKey:["user-updates","bar",e],queryFn:()=>Wh(e,1),enabled:t,staleTime:Gh})}function Yh(){const{alias:e,isReadyForQualiex:t}=$h();return j.useQuery({queryKey:["user-updates","dialog",e],queryFn:()=>Wh(e,2),enabled:t,staleTime:Gh})}function Qh({item:e,onDismiss:a}){const{t:r}=y.useTranslation(),s=e.text||e.title,n=e.color||"hsl(var(--primary))";return t.jsxs("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:n},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[s,t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]}):t.jsx("span",{children:s}),t.jsx("button",{type:"button",onClick:()=>a(e.id),"aria-label":r("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:t.jsx(c.X,{className:"h-4 w-4"})})]})}function Xh(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const a of t){const t=e.match(a);if(t)return t[1]}return null}function Jh(e,t){const a=Xh(e);if(!a)return e;return`https://www.youtube.com/embed/${a}${t?"?autoplay=1&mute=1":""}`}function Zh(e){const t=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return t?t[1]:null}function ex(e,t){const a=Zh(e);if(!a)return e;return`https://player.vimeo.com/video/${a}${t?"?autoplay=1&muted=1":""}`}function tx(e){if(!e)return;const t=e.match(/src="([^"]+)"/);return t?t[1]:void 0}function ax(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function rx({item:e,open:r,onClose:s}){const{t:n}=y.useTranslation(),[o,i]=a.useState(!1),[l,d]=a.useState(!1);a.useEffect(()=>{i(!1),d(!1)},[e.id]);const u=e.countLiked+(o?1:0);return t.jsx(Wr,{open:r,onOpenChange:e=>{e||s({liked:o,doNotShowAgain:l})},children:t.jsxs(Xr,{size:"md",children:[t.jsx(Jr,{showSeparator:!0,children:t.jsx(ts,{style:e.color?{color:e.color}:void 0,children:e.title})}),t.jsxs(Zr,{children:[(()=>{const a=e.urlVideo??e.videoUrl??e.url??"",r=a?Xh(a):null;return r?t.jsx("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),t.jsx("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t.jsxs(es,{className:"!justify-between items-center",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>i(e=>!e),"aria-pressed":o,"aria-label":n("updates_dialog_like","Curtir"),className:br("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",o?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:t.jsx(c.Heart,{className:br("h-4 w-4",o&&"fill-current")})}),t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[t.jsx(Ns,{checked:l,onCheckedChange:e=>d(!0===e)}),n("updates_dialog_do_not_show_again","Não exibir novamente")]}),t.jsx(jr,{variant:"ghost",onClick:()=>s({liked:o,doNotShowAgain:l}),children:n("updates_dialog_close","Fechar")})]})]})]})})}function sx(e){return e&&e.trim()?e.trim():"anon"}function nx(e){try{const t=localStorage.getItem(e);if(!t)return new Set;const a=JSON.parse(t);return new Set(Array.isArray(a)?a.map(String):[])}catch{return new Set}}function ox(e,t){try{localStorage.setItem(e,JSON.stringify(Array.from(t)))}catch{}}function ix(){const{alias:e}=$h(),{data:r=[]}=Kh(),{data:s=[]}=Yh(),n=a.useMemo(()=>function(e){return`updates.bar.dismissed.${sx(e)}`}(e),[e]),o=a.useMemo(()=>function(e){return`updates.dialog.seen.${sx(e)}`}(e),[e]),[i,l]=a.useState(()=>nx(n)),[c,d]=a.useState(()=>nx(o)),[u,m]=a.useState(new Set),[p,h]=a.useState(0);if(a.useEffect(()=>{l(nx(n)),d(nx(o)),m(new Set),h(0)},[n,o]),!e)return null;const x=r.find(e=>!i.has(e.id)),f=s.filter(e=>!c.has(e.id)&&!u.has(e.id))[p];return t.jsxs(t.Fragment,{children:[x&&t.jsx(Qh,{item:x,onDismiss:async t=>{const a=new Set(i);a.add(t),l(a),ox(n,a);try{await Hh(e,t,1)}catch{}}}),f&&t.jsx(rx,{item:f,open:!0,onClose:async({liked:t,doNotShowAgain:a})=>{if(!f)return;const r=f.id;if(!a)return m(e=>{const t=new Set(e);return t.add(r),t}),void h(0);const s=new Set(c);s.add(r),d(s),ox(o,s),h(0);try{await Hh(e,r,2,t)}catch{}}})]})}const lx=a.memo(function({children:e,sidebar:r,sidebarConfig:s,showHeader:n=!0,showSidebar:o=!0}){const i=a.useMemo(()=>o?r||t.jsx(qh,{config:s}):null,[r,s,o]),l=a.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=a.useRef(null),d=a.useRef(null),u=a.useCallback(()=>{if(c.current&&d.current){const e=c.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return a.useEffect(()=>{u();const e=new ResizeObserver(u);return c.current&&e.observe(c.current),()=>e.disconnect()},[u]),t.jsx(Ah,{config:s,children:t.jsx(pl,{children:t.jsx(Yd,{defaultOpen:!1,style:l,children:t.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&t.jsxs("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[t.jsx(Mh,{}),t.jsx(ix,{})]}),t.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[i,t.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class cx{static async sendEmail(e){const t=Qn(),{data:a,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return a}}const dx=cx,ux=J.z.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),mx=J.z.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),px=J.z.string().uuid("UUID inválido"),hx=J.z.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),xx=J.z.object({page:J.z.coerce.number().int().min(1).default(1),pageSize:J.z.coerce.number().int().min(1).max(500).default(50)});function fx(e){const[t,r]=a.useState(!1),{uploadFunction:s,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:c}=e||{};return{upload:async(e,t)=>{if(!s){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}r(!0);try{const a={...o,...t};if(a.maxSize&&e.size>a.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(a.maxSize/1024/1024)}MB`);if(a.allowedTypes){if(!a.allowedTypes.some(t=>t.endsWith("/*")?e.type.startsWith(t.replace("/*","")):e.type===t))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${a.allowedTypes.join(", ")}`)}const r=await s(e,a);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(r),r}catch(a){const e=a instanceof Error?a:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),c?.(e),e}finally{r(!1)}},deleteMedia:async(e,t)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,t),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(a){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),a}},uploading:t}}function gx(e,t){return e/t}const vx=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function bx(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const t=e/1024;if(t<1024)return`${Math.round(t)} KB`;const a=t/1024;if(a<1024)return`${Math.round(a)} MB`;const r=a/1024;return Math.round(100*r)/100+" GB"}function yx(e){const t=e.lastIndexOf(".");return-1===t?"":e.substring(t+1).toLowerCase()}var wx=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(wx||{}),jx=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(jx||{}),Nx=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Nx||{});function _x(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function Cx(e,t){if(!t)return!0;const a=null!=_x(e)&&""!==_x(e)&&!(Array.isArray(_x(e))&&0===_x(e).length);return!1!==e.isActive||a}function kx({field:e}){return t.jsxs("div",{className:"space-y-1",children:[e.name&&t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&t.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Sx({field:e,readOnly:a,onChange:r}){const s=e.config,n=s?.multiline??!1,o=a||e.readOnly,i=t=>{r?.({...e,textValue:t})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?t.jsx(_s,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):t.jsx(_r,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function Ax({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(_r,{type:"date",value:n,onChange:t=>{return a=t.target.value,void r?.({...e,dateValue:a||void 0});var a},placeholder:e.placeholder,disabled:s})]})}function Tx({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e=>{if(!e)return;const[t,a]=e.split(":").map(Number);return 60*t+a};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(_r,{type:"time",value:(e=>{if(null==e)return"";const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`})(e.timeValue),onChange:t=>r?.({...e,timeValue:n(t.target.value)}),placeholder:e.placeholder,disabled:s})]})}function Dx({field:e,readOnly:r,onChange:s}){const n=e.config,o=n?.multiple??!1,i=r||e.readOnly,[l,d]=a.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const t={value:crypto.randomUUID(),text:l.trim()};s?.({...e,itemsValue:[...u,t]}),d("")};if(!o){const a=u[0]?.text||"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_r,{type:"url",value:a,onChange:t=>(t=>{const a={value:t,text:t};s?.({...e,itemsValue:t?[a]:[]})})(t.target.value),placeholder:e.placeholder||"https://",disabled:i}),a&&t.jsx(jr,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:t.jsx(c.ExternalLink,{className:"h-4 w-4"})})})]})]})}return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_r,{type:"url",value:l,onChange:e=>d(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),t.jsx(jr,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:t.jsx(c.Plus,{className:"h-4 w-4"})})]}),u.length>0&&t.jsx("div",{className:"space-y-1",children:u.map((a,r)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("a",{href:a.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:a.text}),!i&&t.jsx(jr,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(t=>{const a=u.filter((e,a)=>a!==t);s?.({...e,itemsValue:a})})(r),children:t.jsx(c.Trash2,{className:"h-3 w-3"})})]},a.value))})]})}function Px({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=null!=s?.decimals&&s.decimals>0?(1/Math.pow(10,s.decimals)).toString():"1";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(_r,{type:"number",value:e.numberValue??"",onChange:t=>(t=>{if(""===t)return void r?.({...e,numberValue:void 0});const a=parseFloat(t);isNaN(a)||r?.({...e,numberValue:a})})(t.target.value),placeholder:e.placeholder,disabled:n,min:s?.min,max:s?.max,step:o}),null!=s?.min&&null!=s?.max&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",s.min," | Max: ",s.max]})]})}function Ex({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??jx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=e.itemsValue?.[0]?.value||"",c=t=>{const a=i.find(e=>e.value===t);if(!a)return;const s={value:a.value,text:a.text,isActive:a.isActive};r?.({...e,itemsValue:[s]})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===jx.dropdown&&t.jsxs(ps,{value:l,onValueChange:c,disabled:n,children:[t.jsx(fs,{children:t.jsx(xs,{placeholder:e.placeholder||"Selecione..."})}),t.jsx(bs,{children:i.map(e=>t.jsxs(ws,{value:e.value,children:[e.text,!1===e.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===jx.radio||o===jx.buttons)&&t.jsx(Pd,{value:l,onValueChange:c,disabled:n,className:br(o===jx.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ed,{value:a.value,id:`${e.id}-${a.value}`}),t.jsxs(kr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))}),!n&&l&&!e.required&&t.jsx("button",{type:"button",onClick:()=>{r?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Mx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??jx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(a=>t.jsxs(ks,{variant:"secondary",className:"gap-1 pr-1",children:[t.jsx("span",{className:"text-xs",children:a.text}),!n&&t.jsx("button",{type:"button",onClick:()=>(t=>{const a=(e.itemsValue||[]).filter(e=>e.value!==t);r?.({...e,itemsValue:a})})(a.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:t.jsx(c.X,{className:"h-3 w-3"})})]},a.value))}),!n&&t.jsx("div",{className:br(o===jx.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ns,{id:`${e.id}-${a.value}`,checked:l.has(a.value),onCheckedChange:()=>(t=>{const a=e.itemsValue||[],s=a.some(e=>e.value===t.value)?a.filter(e=>e.value!==t.value):[...a,{value:t.value,text:t.text,isActive:t.isActive}];r?.({...e,itemsValue:s})})(a),disabled:n}),t.jsxs(kr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))})]})}function Ix({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.questions||[],i=s?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{children:e.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{className:br(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx("div",{className:"border rounded-md overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b bg-muted/50",children:[t.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>t.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),t.jsx("tbody",{children:o.map((a,s)=>t.jsxs("tr",{className:br(s<o.length-1&&"border-b"),children:[t.jsx("td",{className:"p-2 text-muted-foreground",children:a.text}),i.map(s=>{return t.jsx("td",{className:"text-center p-2",children:t.jsx(Pd,{value:(o=a.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:t=>((t,a,s,n)=>{const o={questionValue:t,questionText:a,optionValue:s,optionText:n},i=l.filter(e=>e.questionValue!==t);i.push(o),r?.({...e,questionsValue:i})})(a.value,a.text,t,s.text),disabled:n,className:"flex justify-center",children:t.jsx(Ed,{value:s.value,id:`${e.id}-${a.value}-${s.value}`})})},s.value);var o})]},a.value))})]})})]})}function Rx({field:e,readOnly:a,onChange:r}){const s={field:e,readOnly:a,onChange:r};switch(e.type){case wx.readOnlyText:return t.jsx(kx,{...s});case wx.text:return t.jsx(Sx,{...s});case wx.date:return t.jsx(Ax,{...s});case wx.time:return t.jsx(Tx,{...s});case wx.url:return t.jsx(Dx,{...s});case wx.number:return t.jsx(Px,{...s});case wx.singleSelection:return t.jsx(Ex,{...s});case wx.multiSelection:return t.jsx(Mx,{...s});case wx.questions:return t.jsx(Ix,{...s});default:return null}}function Lx({open:r,onOpenChange:s,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:c=[],setDefaultApproverOnInit:d=!0,onSubmit:u}){const[m,p]=a.useState(!0),[h,x]=a.useState(d&&n.length>0?n[0].id:null),[f,g]=a.useState(o),v=e=>{p(e),e&&!d?x(null):!e&&!d&&n.length>0&&x(n[0].id)},b=f!==o||!m;return t.jsx(Wr,{open:r,onOpenChange:s,children:t.jsxs(Xr,{className:"sm:max-w-[480px]",variant:"form",isDirty:b,children:[t.jsx(Jr,{children:t.jsx(ts,{children:i})}),t.jsxs("div",{className:"space-y-4",children:[c.length>0&&t.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:c.map((e,a)=>t.jsx("p",{dangerouslySetInnerHTML:{__html:e}},a))}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>v(!0),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>v(!1),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{children:"Etapa"}),t.jsxs(ps,{value:h??void 0,onValueChange:x,disabled:m,children:[t.jsx(fs,{children:t.jsx(xs,{placeholder:e.t("approval_select_step")})}),t.jsx(bs,{children:n.map(e=>t.jsx(ws,{value:e.id,children:e.name},e.id))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(kr,{children:e.t("approval_opinion")}),t.jsx(_s,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),t.jsxs(es,{children:[t.jsx(jr,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),t.jsx(jr,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!b,children:"Concluir"})]})]})})}function Fx({open:e,onOpenChange:r,approvers:s,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[c,d]=a.useState(null),u=a.useMemo(()=>{const e=new Set(o);return s.filter(t=>!e.has(t.id))},[s,o]),m=a.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return t.jsx(Wr,{open:e,onOpenChange:r,children:t.jsxs(Xr,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!c,children:[t.jsx(Jr,{children:t.jsx(ts,{children:l("approval_select_approver")})}),t.jsx(Ts,{isLoading:n,type:"spinner",children:t.jsx("div",{className:"space-y-4",children:t.jsx(mn,{options:m,value:c??void 0,onValueChange:e=>d("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),t.jsxs(es,{children:[t.jsx(jr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),t.jsx(jr,{onClick:()=>{if(!c)return;const e=u.find(e=>e.id===c);e&&i(e)},disabled:!c||n,children:"Concluir"})]})]})})}function zx(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Ux({text:e,maxLength:r=130}){const{t:s}=y.useTranslation(),[n,o]=a.useState(!1);return e.length<=r?t.jsx("span",{children:e}):t.jsxs("span",{children:[n?e:`${e.substring(0,r)}... `,t.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:s(n?"approval_read_less":"approval_read_more")})]})}function Ox({approver:e}){if(1===e.type&&e.approverId)return t.jsxs(Ki,{className:"h-9 w-9 shrink-0",children:[t.jsx(Yi,{src:e.photoUrl,alt:e.name}),t.jsx(Qi,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const a=2===e.type?c.Users:3===e.type?c.MapPin:c.User;return t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:t.jsx(a,{className:"h-4 w-4 text-background"})})}function Bx({approver:e}){return e.date?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[t.jsx(c.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:zx(e.date)}),1!==e.type&&e.approvedUsername&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[t.jsx(c.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:zx(e.returnDate)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function qx({approver:e}){const{t:a}=y.useTranslation(),r=1!==e.type||e.approverId?e.name:"A definir";return t.jsxs("div",{children:[2===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:a("approval_user_group")}),3===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),t.jsx("p",{className:"text-sm font-medium break-words",children:r}),t.jsx(Bx,{approver:e})]})}var Vx=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(Vx||{});exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),exports.DialogPrimitive=se,Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AccordionPrimitive=ye,exports.AUTH_CONFIG=ze,exports.AccessDeniedDialog=dc,exports.Accordion=bc,exports.AccordionContent=jc,exports.AccordionItem=yc,exports.AccordionTrigger=wc,exports.ActionButton=Nr,exports.ActionMenu=Nr,exports.ActionMenuItems=ti,exports.AggregationType=Cm,exports.Alert=Wi,exports.AlertDescription=Gi,exports.AlertDialog=Ir,exports.AlertDialogAction=Vr,exports.AlertDialogCancel=$r,exports.AlertDialogContent=zr,exports.AlertDialogDescription=qr,exports.AlertDialogFooter=Or,exports.AlertDialogHeader=Ur,exports.AlertDialogOverlay=Fr,exports.AlertDialogPortal=Lr,exports.AlertDialogTitle=Br,exports.AlertDialogTrigger=Rr,exports.AlertTitle=Hi,exports.AliasRedirect=function(){const{alias:e}=jo(),{pathname:a,search:r,hash:s}=N.useLocation();return e?t.jsx(N.Navigate,{to:`/${e}${a}${r}${s}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:r="alias"}){const s=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:c,switchUnit:d}=jo(),{urlAlias:u,isAliasMismatch:m,isValidAlias:p,isMissing:h,matchedCompany:x}=qi({paramName:r}),[f,g]=a.useState(!1),v=a.useRef(!1),b=r in o,y=a.useCallback(e=>{const t=o[r],{pathname:a,search:s,hash:i}=n;if(t){const r=a.split("/"),n=r.findIndex(e=>e===t);if(n>=0)return r[n]=e,r.join("/")+s+i}return`/${e}${"/"===a?"":a}${s}${i}`},[o,r,n]);return a.useEffect(()=>{if(b&&!c&&l&&i&&!v.current)if(h)s(y(i),{replace:!0});else if(!u||p){if(m&&x&&!v.current){(async()=>{v.current=!0,g(!0);try{await d(x)}catch(e){i&&s(y(i),{replace:!0})}finally{v.current=!1,g(!1)}})()}}else s(y(i),{replace:!0})},[b,c,l,i,h,u,p,m,x,d,y,s]),c||!l?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(As,{size:"lg"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):t.jsx(t.Fragment,{children:e})},exports.AnalysisFunctionality=km,exports.AppHeader=Mh,exports.AppLayout=lx,exports.AppSidebar=qh,exports.ApprovalFlowReturnStep=Vx,exports.ApprovalSidenav=function({config:e,isLoading:r=!1,onClose:s,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:d=!1}){const{t:u}=y.useTranslation(),[m,p]=a.useState(!1),[h,x]=a.useState(!1),[f,g]=a.useState(""),[v,b]=a.useState(""),[w,j]=a.useState(!1),[N,_]=a.useState(""),C=r||m,k=a.useCallback((e,t)=>{g(e),b(t??""),x(!0)},[]),S=a.useCallback(async t=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...t}))return k(f,t.observation),void p(!1);s(),p(!1)},[e.associationId,f,n,s,k]),A=a.useCallback(e=>{_(e),j(!0)},[]),T=a.useCallback(async t=>{j(!1),p(!0),await o(e.associationId,N,t),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),D=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],P=(t,a)=>e.canApprove&&t.isCurrentStep&&a.approverId&&!a.date&&a.canApprove,E=(t,a)=>!e.flowReproved&&t.isCurrentStep&&1===a.type&&a.canApprove&&(!a.approverId||a.isToBeDefined);return t.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[t.jsx(jr,{variant:"ghost",size:"icon",onClick:s,className:"shrink-0",children:t.jsx(c.X,{className:"h-5 w-5"})}),t.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?t.jsx(Ts,{isLoading:!0,type:"spinner",className:"flex-1",children:t.jsx("div",{})}):t.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&t.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,a)=>t.jsx("div",{className:br("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},a))}),t.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(a=>t.jsxs("div",{className:br("space-y-2",(!a.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t.jsxs("p",{className:"font-semibold text-sm",children:[a.index,". Etapa: ",a.name]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground break-words",children:t.jsx(Ux,{text:a.description})}),a.returnDate&&t.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.returnUserName," em ",zx(a.returnDate)]})]}),a.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:t.jsx(Ux,{text:a.returnObservation})})]}),a.approvers.map(e=>t.jsxs("div",{className:"p-2 space-y-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx(Ox,{approver:e}),t.jsx(qx,{approver:e})]}),P(a,e)&&t.jsx(jr,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),E(a,e)&&t.jsx(jr,{size:"sm",variant:"outline",onClick:()=>A(e.id),children:"Selecionar"})]}),e.observation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Ux,{text:e.observation})}),e.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Ux,{text:e.returnObservation})})]},e.id))]},a.id))]}),t.jsx(Lx,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:v,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),t.jsx(Fx,{open:w,onOpenChange:j,approvers:l,isLoading:d,ignoreUserIds:D,onSubmit:T})]})},exports.ApproveDialog=Lx,exports.AuthErrorInterceptor=to,exports.AuthProvider=wo,exports.AuthService=go,exports.AutoComplete=mn,exports.Avatar=Ki,exports.AvatarFallback=Qi,exports.AvatarImage=Yi,exports.Badge=ks,exports.BaseForm=Pi,exports.Blockquote=md,exports.BodyContent=function({breadcrumbs:e,children:a,className:r}){return t.jsxs("div",{className:br("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",r),children:[e&&e.length>0&&t.jsx(Nc,{className:"mb-4",children:t.jsx(_c,{children:e.map((a,r)=>{const s=r===e.length-1;return t.jsxs(te.Fragment,{children:[r>0&&t.jsx(Ac,{}),t.jsx(Cc,{children:s||!a.href?t.jsx(Sc,{children:a.label}):a.asChild&&a.children?t.jsx(kc,{asChild:!0,children:a.children}):t.jsx(kc,{asChild:!0,children:t.jsx(N.Link,{to:a.href||"/",children:a.label})})})]},`${a.label}-${r}`)})})}),t.jsx("div",{className:"space-y-6",children:a})]})},exports.Breadcrumb=Nc,exports.BreadcrumbEllipsis=Tc,exports.BreadcrumbItem=Cc,exports.BreadcrumbLink=kc,exports.BreadcrumbList=_c,exports.BreadcrumbPage=Sc,exports.BreadcrumbSeparator=Ac,exports.BurndownPanel=Cp,exports.Button=jr,exports.ButtonGroup=Pc,exports.CRUD_CONFIG=qe,exports.CURRENCY_FIELDS=Jm,exports.Calendar=Ec,exports.CallbackPage=()=>{const{processCallback:e}=jo(),r=N.useNavigate(),[s,n]=a.useState(null),[o,i]=a.useState(!1);a.useEffect(()=>{let t=!1;if(Sn()){yn.clear(),function(){if(bn&&"undefined"!=typeof PerformanceObserver&&!Cn)try{Cn=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration}),Cn.observe({type:"longtask",buffered:!0})}catch{}}(),jn("callback:start");try{const e=Un.getAccessToken(),t=Un.getIdToken();if(e){kn(0,e,Dn.parseJwtPayload(e))}if(t){kn(0,t,Dn.parseJwtPayload(t))}}catch{}}const a=Sn()?window.setTimeout(()=>{t||_n()},15e3):0;return(async()=>{try{const a=await e();if(t=!0,Sn()&&(jn("callback:processCallback:end"),function(e,t,a){if(!bn)return null;try{return performance.measure(`auth:${e}`,`auth:${t}`,`auth:${a}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),_n()),a){window.history.replaceState({},document.title,Ue("/"));const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),r(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){t=!0,Sn()&&_n(),localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{a&&window.clearTimeout(a),function(){if(Cn){try{Cn.disconnect()}catch{}Cn=null}}()}},[e,r]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(t){n(t?.message||"Erro ao tentar novamente.")}finally{i(!1)}},d=()=>{window.location.href=Ue("/")};return s?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsxs(Tr,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[t.jsx(c.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t.jsxs(Pr,{className:"space-y-4",children:[t.jsx(Wi,{variant:"danger",children:t.jsx(Gi,{children:s})}),t.jsx("div",{className:"text-sm text-muted-foreground",children:t.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(jr,{onClick:l,disabled:o,className:"flex-1",children:o?t.jsxs(t.Fragment,{children:[t.jsx(As,{size:"sm",className:"mr-2"}),"Tentando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),t.jsx(jr,{onClick:d,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsx(Tr,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t.jsxs(Pr,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(As,{size:"lg"})}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=Sr,exports.CardContent=Pr,exports.CardDescription=Dr,exports.CardFooter=Er,exports.CardHeader=Ar,exports.CardSkeleton=Ro,exports.CardTitle=Tr,exports.CartesianPanel=yp,exports.ChartContainer=Uu,exports.ChartLegend=Vu,exports.ChartLegendContent=$u,exports.ChartStyle=Ou,exports.ChartTooltip=Bu,exports.ChartTooltipContent=qu,exports.Checkbox=Ns,exports.Collapsible=Ml,exports.CollapsibleContent=Rl,exports.CollapsibleTrigger=Il,exports.ColorPicker=ji,exports.ColumnSettingsPopover=fi,exports.ComboTree=vn,exports.Combobox=mn,exports.Command=en,exports.CommandDialog=({children:e,...a})=>t.jsx("div",{...a,children:t.jsx(en,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=rn,exports.CommandGroup=sn,exports.CommandInput=tn,exports.CommandItem=on,exports.CommandList=an,exports.CommandSeparator=nn,exports.CommandShortcut=ln,exports.ContentContainer=function({title:e,subtitle:a,children:r,className:s,hasHeader:n=!0}){const o=e||a;return t.jsxs("div",{className:br("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",s),children:[n&&o&&t.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&t.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),a&&t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:a})]}),r&&t.jsx("div",{className:br("p-6",!n&&o&&"pt-4"),children:r})]})},exports.ContextMenu=Oo,exports.ContextMenuCheckboxItem=Qo,exports.ContextMenuContent=Ko,exports.ContextMenuGroup=qo,exports.ContextMenuItem=Yo,exports.ContextMenuLabel=Jo,exports.ContextMenuPortal=Vo,exports.ContextMenuRadioGroup=Wo,exports.ContextMenuRadioItem=Xo,exports.ContextMenuSeparator=Zo,exports.ContextMenuShortcut=ei,exports.ContextMenuSub=$o,exports.ContextMenuSubContent=Go,exports.ContextMenuSubTrigger=Ho,exports.ContextMenuTrigger=Bo,exports.CoreProviders=function({children:r,queryClient:s,moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i="common",signDocumentsTable:l="sign_documents",moduleAccessGuardProps:c,appTranslations:d,clarityProjectId:u,clarityMode:m="auto",backend:p="supabase",securityMode:h="legacy"}){Le(p),fc=h,hc();const[x]=a.useState(()=>new j.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=s??x;a.useEffect(()=>{if(d)for(const[e,t]of Object.entries(d))bl(e,t)},[d]);const g={sourceModule:n,...c};return t.jsxs(zl,{children:[t.jsx(vc,{}),t.jsx(y.I18nextProvider,{i18n:e,children:t.jsx(j.QueryClientProvider,{client:f,children:t.jsxs(wo,{children:[t.jsx(gc,{projectId:u,mode:m}),t.jsx(Pl,{children:t.jsxs(wl,{moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i,signDocumentsTable:l,children:[t.jsx(Sl,{}),t.jsx(mc,{...g,children:r})]})})]})})})]})},exports.CrudActionBar=ui,exports.CrudActionMenu=function({onEdit:e,onDelete:r,onToggleStatus:s,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:d="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=a.useMemo(()=>{const t=[];return e&&o&&t.push({key:"edit",icon:c.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),s&&t.push({key:"toggle-status",icon:n?c.PowerOff:c.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:s,variant:"default"}),l.forEach(e=>{!1!==e.show&&t.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),r&&i&&t.push({key:"delete",icon:c.Trash2,label:m("remove","Remover"),onClick:r,variant:"destructive"}),t},[e,r,s,n,o,i,l,m]);return 0===p.length?null:"dropdown"===d?t.jsx(Hs,{delayDuration:200,children:t.jsxs(Ps,{children:[t.jsx(Es,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:t.jsx(c.EllipsisVertical,{size:"compact"===u?14:16})})}),t.jsx(Us,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t.jsxs(Qs,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t.jsxs(Os,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):t.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>t.jsxs(jr,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&t.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&t.jsx("span",{className:"ml-1",children:e.label})]},e.key))})},exports.CrudGrid=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:d,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:v=!1,searchValue:b,onSearchChange:w,searchPlaceholder:j,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:A,onViewModeChange:T,listCardRenderer:D,gridCardRenderer:P,showViewToggle:E=!1})=>{const{setSearchVisible:M}=jo(),I=void 0!==f?!f:g;a.useEffect(()=>{if(!v)return M(!0),()=>M(!1)},[M,v]);const R=m||x.length>0||v||u||C||E,L=_||(()=>{r.bulkDelete?.(r.selectedIds)}),F=A||"grid",z="list"===F,U={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],O=I&&R?t.jsx(ui,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:v,searchValue:b,onSearchChange:w,searchPlaceholder:j,showBulkActions:u,selectedCount:r.selectedIds.length,bulkActions:N,onBulkDelete:L,onClearSelection:r.clearSelection,customActions:x,filters:C,viewMode:F,onViewModeChange:T,showViewToggle:E,availableViewModes:["list","grid"]}):null;return r.isLoading?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx(Ro,{count:6})})]}):0===r.entities.length?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Fo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx("div",{className:br("grid gap-4",U),children:r.entities.map(e=>{const a=(e=>{const{t:t}=y.useTranslation();return z&&D?D(e):!z&&P?P(e):S?S(e):null})(e);return t.jsxs(Oo,{children:[t.jsx(Bo,{asChild:!0,children:a?t.jsx("div",{className:"cursor-pointer",onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:a}):t.jsx(Sr,{className:br("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&r.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:t.jsxs(Pr,{className:br("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&t.jsx("div",{className:br(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:t.jsx(mi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),z?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:s.map(a=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key)))}),(n||o||c)&&t.jsx("div",{onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(ai,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]}):t.jsxs("div",{className:"flex items-start gap-3",children:[u&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(mi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[s.map((a,r)=>t.jsxs("div",{className:br("flex justify-between items-start gap-2",r!==s.length-1&&"mb-2"),children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||c)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(ai,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]})]})]})})}),t.jsx(Ko,{className:"w-[160px]",children:t.jsx(ti,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:d?d(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=Ui,exports.CrudPagination=Mi,exports.CrudPrimitiveFilterBar=bh,exports.CrudPrimitivePagination=Ei,exports.CrudPrimitiveTable=vh,exports.CrudTable=vi,exports.CustomFormFields=function({fields:e,readOnly:r=!1,hideInactiveWithoutValue:s=!1,onChange:n,onFieldChange:o}){const i=a.useCallback(t=>{if(o?.(t),n){const a=e.map(e=>e.id===t.id?t:e);n(a)}},[e,n,o]),l=e.filter(e=>Cx(e,s));return 0===l.length?null:t.jsx("div",{className:"space-y-4",children:l.map(e=>t.jsx(Rx,{field:e,readOnly:r,onChange:i},e.id))})},exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=Qa,exports.DEFAULT_DATETIME_FORMAT=Za,exports.DEFAULT_LOCALE=Ja,exports.DEFAULT_TIMEZONE=er,exports.DashboardForm=$p,exports.DashboardFormTab=Fm,exports.DashboardFunctionality=Sm,exports.DashboardGeneralView=function({dashboards:e,limit:r,generalView:s,language:n=Um.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:c=!1,canEditStandard:d=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:v=!1,onOpen:b,onBackToList:y,onRefresh:w,onRefreshList:j,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:A,onAddPanel:T,onEditPanel:D,onRemovePanel:P,onDuplicatePanel:E,onLayoutChange:M,onSearch:I,onQuickFilterChange:R,onSetGeneralView:L,viewState:F,onViewStateChange:z,listToolbarExtra:U,viewToolbarActions:O,className:B}){const[q,V]=a.useState({mode:"list"}),$=F??q,W=a.useCallback(e=>{z?z(e):V(e)},[z]),H=a.useMemo(()=>"view"===$.mode||"edit"===$.mode||"share"===$.mode?e.find(e=>e.id===$.dashboardId)??null:null,[e,$]),[G,K]=a.useState(!1),[Y,Q]=a.useState(m[0]?.id);a.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),a.useEffect(()=>{if("view"!==$.mode||!H||H.idViewType!==Lm.Carousel||m.length<=1)return;const e=function(e){switch(e){case Tm.FiveSeconds:return 5e3;case Tm.TenSeconds:return 1e4;case Tm.FifteenSeconds:return 15e3;case Tm.ThirtySeconds:return 3e4;case Tm.OneMinute:return 6e4;case Tm.ThreeMinutes:return 18e4;case Tm.FiveMinutes:return 3e5;case Tm.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),t=setInterval(()=>{Q(e=>{const t=(m.findIndex(t=>t.id===e)+1)%m.length;return m[t]?.id})},e);return()=>clearInterval(t)},[$,H,m]);const X=a.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),b?.(e)},[W,b]),J=a.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=a.useCallback(()=>{W({mode:"create"})},[W]),ee=a.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),te=a.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),ae=a.useCallback(e=>{"edit"===$.mode||"share"===$.mode?C?.($.dashboardId,e):_?.(e)},[$,_,C]),re=a.useCallback(()=>{"edit"===$.mode||"share"===$.mode?W({mode:"view",dashboardId:$.dashboardId}):W({mode:"list"})},[$,W]),se=a.useCallback(()=>{H&&N?.(H)},[H,N]),ne=a.useCallback(()=>{H&&ee(H)},[H,ee]),oe=a.useCallback(()=>{H&&te(H)},[H,te]);return t.jsxs("div",{className:br("flex flex-col h-full",B),children:["list"===$.mode&&t.jsx(zp,{dashboards:e,limit:r,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:c,onOpen:X,onEdit:ee,onShare:te,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:j,onSearch:I,onQuickFilterChange:R,toolbarExtra:U,className:"flex-1"}),"view"===$.mode&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[!G&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),s?.dashboardId===H.id&&t.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[t.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&L&&s?.dashboardId!==H.id&&t.jsx("button",{onClick:()=>L(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),t.jsx(Ip,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||d&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:w,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:se,onEdit:ne,onShare:oe,onAddPanel:T,onEditPanel:D,onRemovePanel:P,onDuplicatePanel:E,onLayoutChange:M,onPageChange:Q,toolbarActions:O,className:"flex-1"})]}),"create"===$.mode&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),t.jsx($p,{users:h,groups:x,places:f,collaborators:g,isSaving:v,onSave:ae,onCancel:re,className:"flex-1"})]}),("edit"===$.mode||"share"===$.mode)&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:re,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),t.jsx($p,{dashboard:H,initialTab:"share"===$.mode?Fm.Share:Fm.General,users:h,groups:x,places:f,collaborators:g,isSaving:v,isQualitfy:!!H.isStandard&&!d,onSave:ae,onCancel:re,className:"flex-1"})]})]})},exports.DashboardGrid=Pp,exports.DashboardLanguage=Um,exports.DashboardList=zp,exports.DashboardListType=Am,exports.DashboardPageTime=Tm,exports.DashboardPanelDimension=Dm,exports.DashboardPanelOrderBy=Em,exports.DashboardPanelOrderByType=Pm,exports.DashboardPanelPeriod=Mm,exports.DashboardPanelRenderer=Mp,exports.DashboardPanelType=Im,exports.DashboardShareType=zm,exports.DashboardUpdateTime=Rm,exports.DashboardView=Ip,exports.DashboardViewType=Lm,exports.DataFilterBar=bh,exports.DataList=Mc,exports.DataPagination=Ei,exports.DataTable=vh,exports.DatePicker=function({date:e,onDateChange:a,placeholder:r,disabled:s=!1,className:n,disabledDates:o}){const{t:l}=y.useTranslation(),d=r??l("select_date");return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{variant:"outline",disabled:s,className:br("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[t.jsx(c.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Ka}):t.jsx("span",{children:d})]})}),t.jsx(Zs,{className:"w-auto p-0",align:"start",children:t.jsx(Ec,{mode:"single",selected:e,onSelect:a,disabled:o,initialFocus:!0,className:"pointer-events-auto"})})]})},exports.Dialog=Wr,exports.DialogBody=Zr,exports.DialogClose=Kr,exports.DialogContent=Xr,exports.DialogDescription=as,exports.DialogFooter=es,exports.DialogHeader=Jr,exports.DialogOverlay=Yr,exports.DialogPortal=Gr,exports.DialogTitle=ts,exports.DialogTrigger=Hr,exports.DialogWizard=function({open:a,onOpenChange:r,currentStep:s,onStepChange:n,steps:o,canGoToStep:i,children:l,title:d,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:v="lg",unsavedChangesTitle:b,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=y.useTranslation(),T=o.length,D=s>=T,P=s<=1;return t.jsx(Wr,{open:a,onOpenChange:r,children:t.jsxs(Xr,{size:v,variant:f,isDirty:g,unsavedChangesTitle:b,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:br("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[t.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),t.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,a)=>{const r=a+1,o=r===s,l=(e=>e<s)(r),d=(u=r)<=s||!i||i(u);var u;return t.jsxs("button",{type:"button",onClick:()=>(e=>{e!==s&&(e<s?n(e):i&&!i(e)||n(e))})(r),disabled:!d,className:br("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&d&&"hover:bg-primary-foreground/10 cursor-pointer",!d&&"opacity-40 cursor-not-allowed"),children:[t.jsx("span",{className:br("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?t.jsx(c.Check,{className:"h-3.5 w-3.5"}):r}),t.jsx("span",{className:br("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},r)})})]}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsxs(Jr,{className:"p-6 pb-0",children:[t.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",s," de ",T]}),t.jsx(ts,{children:d}),u&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),t.jsx(Zr,{className:"px-6",children:l}),!k&&t.jsx(es,{className:"px-6 pb-6",children:t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("div",{className:"flex items-center gap-2",children:S}),t.jsxs("div",{className:"flex items-center gap-2",children:[!P&&t.jsx(jr,{variant:"outline",onClick:()=>n(s-1),children:x}),D?t.jsx(jr,{onClick:m,disabled:C,children:p}):t.jsx(jr,{onClick:()=>n(s+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=Qs,exports.Drawer=Ic,exports.DrawerClose=Fc,exports.DrawerContent=Uc,exports.DrawerDescription=Vc,exports.DrawerFooter=Bc,exports.DrawerHeader=Oc,exports.DrawerOverlay=zc,exports.DrawerPortal=Lc,exports.DrawerTitle=qc,exports.DrawerTrigger=Rc,exports.DropdownMenu=Ps,exports.DropdownMenuCheckboxItem=Bs,exports.DropdownMenuContent=Us,exports.DropdownMenuGroup=Ms,exports.DropdownMenuItem=Os,exports.DropdownMenuLabel=Vs,exports.DropdownMenuPortal=Is,exports.DropdownMenuRadioGroup=Ls,exports.DropdownMenuRadioItem=qs,exports.DropdownMenuSeparator=$s,exports.DropdownMenuShortcut=Ws,exports.DropdownMenuSub=Rs,exports.DropdownMenuSubContent=zs,exports.DropdownMenuSubTrigger=Fs,exports.DropdownMenuTrigger=Es,exports.ECustomFormFieldType=wx,exports.EFieldViewMode=jx,exports.ESelectionFieldDataSource=Nx,exports.EditProfileDialog=ul,exports.ElectronicSignatureDialog=function({open:r,onOpenChange:s,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:d=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,v=g?e.t("esign_password_description"):e.t("esign_code_description"),b=m??v,[y,w]=a.useState(""),[j,N]=a.useState(!1),[_,C]=a.useState(!1),[k,S]=a.useState(null),A=a.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(w(""),s(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,s,f,g]),T=a.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),D=e=>{e||(w(""),S(null)),s(e)},P=g?c.Lock:c.ShieldCheck,E=g?"Senha":e.t("verification_code"),M=g?e.t("enter_password"):e.t("enter_code");return t.jsx(Wr,{open:r,onOpenChange:D,children:t.jsxs(Xr,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[t.jsx(Jr,{children:t.jsxs(ts,{className:"flex items-center gap-2",children:[t.jsx(P,{className:"h-5 w-5 text-primary"}),u]})}),t.jsxs("div",{className:"py-4 space-y-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:b}),!g&&l&&t.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[t.jsx(c.Mail,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),t.jsx("span",{className:"font-medium",children:l})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"signature-input",children:E}),t.jsx(_r,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),A())},maxLength:g?void 0:d,placeholder:M,autoFocus:!0,className:br(k&&"border-destructive focus-visible:ring-destructive")}),k&&t.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&t.jsxs(jr,{variant:"ghost",size:"sm",onClick:T,disabled:_,className:"text-primary",children:[t.jsx(c.RefreshCw,{className:br("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),t.jsxs(es,{children:[t.jsx(jr,{variant:"outline",onClick:()=>D(!1),disabled:j,children:h}),t.jsx(jr,{onClick:A,disabled:!y.trim()||j,children:j?"Validando...":p})]})]})})},exports.EllipsisText=zo,exports.EmailService=cx,exports.EmptyState=Fo,exports.EntitySelect=mn,exports.ErrorBoundary=zl,exports.ExportDialog=function({open:e,onOpenChange:r,onExport:s,mode:n="table",options:o,title:i,description:l,cancelLabel:c="Cancelar",exportLabel:d="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=a.useState(""),h=o??("chart"===n?tm:em),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),r(e)};return t.jsx(Wr,{open:e,onOpenChange:g,children:t.jsxs(Xr,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[t.jsx(Jr,{children:t.jsx(ts,{children:x})}),t.jsxs("div",{className:"py-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),t.jsx(Pd,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ed,{value:e.value,id:`export-${e.value}`}),t.jsxs(kr,{htmlFor:`export-${e.value}`,className:br("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t.jsxs(es,{children:[t.jsx(jr,{variant:"outline",onClick:()=>g(!1),children:c}),t.jsx(jr,{onClick:()=>{m&&(s(m),r(!1),p(""))},disabled:!m,children:d})]})]})})},exports.ExportFormat=Zu,exports.FORBIDDEN_FILE_TYPES=vx,exports.FilePrintType=cm,exports.FileViewerType=lm,exports.FilterBar=zi,exports.Form=rs,exports.FormControl=cs,exports.FormDateField=Ax,exports.FormDescription=ds,exports.FormField=({...e})=>t.jsx(ss.Provider,{value:{name:e.name},children:t.jsx(h.Controller,{...e})}),exports.FormItem=is,exports.FormLabel=ls,exports.FormMessage=us,exports.FormMultiSelectionField=Mx,exports.FormNumericField=Px,exports.FormQuestionsField=Ix,exports.FormSingleSelectionField=Ex,exports.FormSkeleton=function({fields:e=4}){return t.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,a)=>t.jsxs("div",{className:"space-y-2",children:[t.jsx(cn,{className:"h-4 w-24"}),t.jsx(cn,{className:"h-10 w-full"})]},a)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(cn,{className:"h-10 w-20"}),t.jsx(cn,{className:"h-10 w-20"})]})]})},exports.FormTextField=Sx,exports.FormTimeField=Tx,exports.FormUrlField=Dx,exports.Grid=function({children:e,cols:a="auto-fit",gap:r="md",className:s}){return t.jsx("div",{className:br("grid",$c[a],Wc[r],s),children:e})},exports.H1=ad,exports.H2=rd,exports.H3=sd,exports.H4=nd,exports.HeaderSkeleton=function(){return t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(cn,{className:"h-8 w-8 rounded-full"}),t.jsx(cn,{className:"h-6 w-32"})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(cn,{className:"h-8 w-8"}),t.jsx(cn,{className:"h-8 w-24"})]})]})},exports.HoverCard=Hc,exports.HoverCardContent=Kc,exports.HoverCardTrigger=Gc,exports.IconPicker=Si,exports.IframeDialog=xm,exports.ImageEditor=function({value:e,onChange:r,onSubmit:s,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:d}){const{t:u}=y.useTranslation(),[m,p]=a.useState(e||{alignment:"center",allowDownload:!1}),h=a.useRef(null),{upload:x,uploading:f}=fx({uploadFunction:o,deleteFunction:i,defaultOptions:{...d,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,t)=>{const a={...m,[e]:t};p(a),r(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"URL"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(_r,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await x(t),a={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(a),r(a)}catch(a){}finally{h.current&&(h.current.value="")}},className:"hidden"}),t.jsx(jr,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:t.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:t.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"caption",children:"Legenda"}),t.jsx(_s,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"alt",children:u("alt_text")}),t.jsx(_r,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"Alinhamento"}),t.jsxs(ps,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[t.jsx(fs,{children:t.jsx(xs,{})}),t.jsxs(bs,{children:[t.jsx(ws,{value:"left",children:"Esquerda"}),t.jsx(ws,{value:"center",children:"Centro"}),t.jsx(ws,{value:"right",children:"Direita"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"width",children:"Largura"}),t.jsx(_r,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"height",children:"Altura"}),t.jsx(_r,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ns,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),t.jsx(kr,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(jr,{variant:"outline",onClick:n,children:"Cancelar"}),t.jsx(jr,{onClick:()=>{m.imageUrl?s(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:a="",style:r}){const{t:s}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return t.jsx("div",{className:`flex ${n} my-4 ${a}`,style:r,children:t.jsxs("div",{className:"space-y-2 max-w-full",children:[t.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&t.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[t.jsx(c.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=ud,exports.Input=_r,exports.InputGroup=Yc,exports.InputGroupAddon=Xc,exports.InputGroupButton=Zc,exports.InputGroupInput=ed,exports.InputGroupTextarea=td,exports.LINK_PROPERTIES=Zm,exports.LOGO_CONFIG=Ye,exports.Label=kr,exports.LanguageBootstrap=Sl,exports.Large=ld,exports.Lead=id,exports.List=pd,exports.ListPanel=gp,exports.LoadingState=Ts,exports.LocaleProvider=Pl,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsx(Tr,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t.jsxs(Pr,{className:"text-center space-y-4",children:[t.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),t.jsx(jr,{onClick:async()=>{We()?await go.loginDev():go.loginProd()},className:"w-full",size:"lg",children:We()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=Qe,exports.MODULES_DATA=rc,exports.MONTHS_MAP=Xm,exports.MatrixRiskPanel=Sp,exports.MatrixViewType=Om,exports.Menubar=Cu,exports.MenubarCheckboxItem=Pu,exports.MenubarContent=Tu,exports.MenubarGroup=wu,exports.MenubarItem=Du,exports.MenubarLabel=Mu,exports.MenubarMenu=yu,exports.MenubarPortal=ju,exports.MenubarRadioGroup=_u,exports.MenubarRadioItem=Eu,exports.MenubarSeparator=Iu,exports.MenubarShortcut=Ru,exports.MenubarSub=Nu,exports.MenubarSubContent=Au,exports.MenubarSubTrigger=Su,exports.MenubarTrigger=ku,exports.MindMap=({value:e,defaultValue:r,onChange:s,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:c,className:d,height:u=600})=>{const{t:m}=y.useTranslation(),p=rh({value:e,defaultValue:r,onChange:s,readOnly:o}),h=dh(p.root),x=function(){const[e,t]=a.useState({x:0,y:0,scale:1}),r=a.useRef(!1),s=a.useRef({x:0,y:0,tx:0,ty:0}),n=a.useCallback(t=>{0!==t.button&&1!==t.button||(r.current=!0,s.current={x:t.clientX,y:t.clientY,tx:e.x,ty:e.y},t.currentTarget.setPointerCapture(t.pointerId))},[e.x,e.y]),o=a.useCallback(e=>{r.current&&t(t=>({...t,x:s.current.tx+(e.clientX-s.current.x),y:s.current.ty+(e.clientY-s.current.y)}))},[]),i=a.useCallback(e=>{if(r.current){r.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=a.useCallback((e,a,r)=>{t(t=>{const s=Math.min(2.5,Math.max(.3,t.scale+e));if(s===t.scale)return t;if(void 0===a||void 0===r)return{...t,scale:s};const n=s/t.scale;return{scale:s,x:a-(a-t.x)*n,y:r-(r-t.y)*n}})},[]),c=a.useCallback(()=>l(.15),[l]),d=a.useCallback(()=>l(-.15),[l]),u=a.useCallback(()=>t({x:0,y:0,scale:1}),[]),m=a.useCallback((e,a,r,s)=>{const n=Math.min((r-64)/e,(s-64)/a,1.5),o=Math.max(.3,n);t({scale:o,x:(r-e*o)/2,y:(s-a*o)/2})},[]),p=a.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),a=e.clientX-t.left,r=e.clientY-t.top;l(e.deltaY>0?-.1:.1,a,r)},[l]);return a.useEffect(()=>{const e=()=>r.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:t,zoomIn:c,zoomOut:d,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=te.useRef(null),g=te.useRef(null),v=te.useRef(null),[b,w]=te.useState(null),[j,N]=te.useState(null);te.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:t,containerRef:r,onStartEditing:s,readOnly:n,extraShortcuts:o}){a.useEffect(()=>{const a=a=>{const i=r.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=a.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const c={layout:t,selectedId:e.selectedId,setSelectedId:e.setSelectedId},d=e.selectedId;for(const t of o??[])if(t.key.toLowerCase()===a.key.toLowerCase()&&!!t.ctrl===(a.ctrlKey||a.metaKey)&&!!t.shift===a.shiftKey&&!!t.alt===a.altKey)return a.preventDefault(),void t.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((a.ctrlKey||a.metaKey)&&"z"===a.key.toLowerCase())return a.preventDefault(),void(a.shiftKey?e.redo():e.undo());if("ArrowUp"===a.key)return a.preventDefault(),void uh("up",c);if("ArrowDown"===a.key)return a.preventDefault(),void uh("down",c);if("ArrowLeft"===a.key)return a.preventDefault(),void uh("left",c);if("ArrowRight"===a.key)return a.preventDefault(),void uh("right",c);if(d){if(" "===a.key)return a.preventDefault(),void e.toggleNode(d);if("F2"===a.key){if(n)return;return a.preventDefault(),void s(d)}if(!n){if("Enter"===a.key&&!a.shiftKey)return a.preventDefault(),d===e.root.id?e.addChild(d,""):e.addSibling(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Insert"===a.key||"Tab"===a.key)return a.preventDefault(),e.addChild(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Delete"===a.key||"Backspace"===a.key){if(d===e.root.id)return;return a.preventDefault(),void e.removeNode(d)}}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,r,s,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||w(e)},readOnly:o,extraShortcuts:l});const _=te.useRef(!1);te.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:t,clientHeight:a}=e;t>0&&a>0&&h.width>0&&(x.fitTo(h.width,h.height,t,a),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,A=te.useRef(null),T=e=>t=>{if(o)return;const a=A.current;if(!a||a===e)return;const r=Gp(p.root,a);r&&Gp(r.node,e)||(t.preventDefault(),t.dataTransfer.dropEffect="move",N(e))},D=()=>N(null),P=e=>t=>{t.preventDefault();const a=A.current;N(null),A.current=null,a&&a!==e&&p.moveNode(a,e)};return t.jsx(Hs,{children:t.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:br("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",d),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&t.jsx(xh,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");w(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void w(e)}const e=p.addSibling(C,"");w(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,t,a="application/json"){const r=new Blob([e],{type:a}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(fh(p.root),"mind-map.json")},onExportImage:async()=>{if(v.current)try{await async function(e,t="mind-map.png"){const a=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(a),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,n=new Image;await new Promise((e,t)=>{n.onload=()=>e(),n.onerror=()=>t(new Error("Failed to load SVG snapshot")),n.src=s});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const c=l.getContext("2d");if(!c)throw new Error("Canvas 2D context unavailable");c.fillStyle="#ffffff",c.fillRect(0,0,l.width,l.height),c.drawImage(n,0,0,l.width,l.height);const d=await new Promise(e=>l.toBlob(e,"image/png"));if(!d)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(d),m=document.createElement("a");m.href=u,m.download=t,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(v.current,"mind-map.png")}catch(e){}}}),t.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:t.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[t.jsx("svg",{ref:v,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(a=>t.jsx(ph,{parent:e,child:a},`${e.node.id}-${a.node.id}`)))}),h.nodes.map(e=>{return t.jsx(mh,{layout:e,selected:C===e.node.id,editing:b===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>w(e.node.id),onFinishEditing:t=>{null!==t&&p.renameNode(e.node.id,t),w(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(a=e.node.id,e=>{o||a===p.root.id||(A.current=a,e.dataTransfer.setData("text/plain",a),e.dataTransfer.effectAllowed="move")}),onDragOver:T(e.node.id),onDragLeave:D,onDrop:P(e.node.id),isDropTarget:j===e.node.id,renderNodeContent:c},e.node.id);var a})]})})]})})},exports.ModalStateProvider=function({children:e}){const[r,s]=a.useState(new Set),[n,o]=a.useState(!1),i=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.add(e),a})},[]),l=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.delete(e),a})},[]),c=a.useCallback(e=>{o(e)},[]),d=a.useMemo(()=>r.size>0||n,[r,n]),u=a.useMemo(()=>({openModals:r,hasOpenModal:d,registerModal:i,unregisterModal:l,setHasOpenModal:c}),[r,d,i,l,c]);return t.jsx(Uh.Provider,{value:u,children:e})},exports.ModuleAccessGuard=mc,exports.ModuleGrid=oc,exports.ModuleOfferContent=function({title:e,description:a,image:r,icon:s,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),d=n??l("want_to_know_more");return t.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(r||s)&&t.jsx("div",{className:"flex items-center justify-center",children:r?t.jsx("img",{src:r,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):s?t.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:t.jsx(s,{className:"h-12 w-12 text-primary"})}):null}),t.jsxs("div",{className:"space-y-3 max-w-lg",children:[t.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a})]}),i?t.jsx("div",{className:"w-full",children:i}):o?t.jsxs(jr,{onClick:o,size:"lg",className:"gap-2",children:[t.jsx(c.Sparkles,{className:"h-4 w-4"}),d]}):null]})},exports.ModuleProvider=wl,exports.ModulesContent=ic,exports.ModulesDialog=cc,exports.ModulesFooterCards=ac,exports.MultiSelect=mn,exports.MultiselectPermissions=function({items:r,categories:s,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:d=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:v,onDisclaimerClick:b,className:w}){const[j,N]=a.useState(s[0]?.id??""),[_,C]=a.useState(""),[k,S]=a.useState([]),[A,T]=a.useState(!1),D=a.useMemo(()=>bm(n[j]),[n,j]),P=a.useMemo(()=>function(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.inheritedIds?.forEach(e=>a.add(e));return a}(n[j]),[n,j]),E=a.useMemo(()=>r.filter(e=>D.has(e.id)),[r,D]),M=a.useMemo(()=>{const e=vm(_);return r.filter(t=>!D.has(t.id)&&!(e&&!vm(t.name).includes(e)))},[r,D,_]),I=a.useMemo(()=>{const e={};for(const t of s)e[t.id]=bm(n[t.id]).size;return e},[s,n]),R=a.useCallback(e=>{N(e),S([]),C("")},[]),L=a.useCallback(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),F=a.useCallback(()=>{if(0===k.length)return;const e=[...n[j]??[]];for(const t of k){const a=r.find(e=>e.id===t),s=a?.group??"default",n=e.find(e=>e.context===s);n?n.allowedIds.includes(t)||(n.allowedIds=[...n.allowedIds,t]):e.push({context:s,allowedIds:[t],inheritedIds:[]})}o({...n,[j]:e}),S([]),C(""),T(!1)},[k,n,j,r,o]),z=a.useCallback(e=>{if(P.has(e))return;const t=(n[j]??[]).map(t=>({...t,allowedIds:t.allowedIds.filter(t=>t!==e)}));o({...n,[j]:t})},[n,j,P,o]);return l?t.jsxs("div",{className:br("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[t.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),t.jsx("div",{className:"h-9 w-full bg-muted rounded"}),t.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):t.jsx("div",{className:br("rounded-md border bg-muted/30",w),children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:d}),t.jsxs(ps,{value:j,onValueChange:R,children:[t.jsx(fs,{className:"h-9 text-sm",children:t.jsx(xs,{})}),t.jsx(bs,{children:s.map(e=>t.jsx(ws,{value:e.id,children:t.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,I[e.id]>0&&t.jsx(ks,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:I[e.id]})]})},e.id))})]})]}),!i&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(Xs,{open:A,onOpenChange:T,children:[t.jsx(Js,{asChild:!0,children:t.jsxs(jr,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,t.jsx(c.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(Zs,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[t.jsx("div",{className:"p-2 border-b",children:t.jsxs("div",{className:"relative",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(_r,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),t.jsx(Ni,{className:"max-h-[220px]",children:0===M.length?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):t.jsx("div",{className:"p-1",children:M.map(e=>{const a=k.includes(e.id);return t.jsxs("div",{className:br("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",a&&"bg-accent/50"),onClick:()=>L(e.id),children:[t.jsx("div",{className:br("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",a&&"bg-primary text-primary-foreground"),children:a&&t.jsx(c.Check,{className:"h-3 w-3"})}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&t.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),t.jsxs(jr,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:F,children:[t.jsx(c.Plus,{className:"h-4 w-4"}),u]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:m}),t.jsx("div",{className:br("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===E.length?t.jsx("span",{className:"text-sm text-muted-foreground",children:p}):t.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(e=>{const a=P.has(e.id);return t.jsxs(ks,{variant:a?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!a&&t.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:t.jsx(c.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",v&&b&&t.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:b,children:v})]})]})]})})},exports.Muted=dd,exports.NavigationMenu=hd,exports.NavigationMenuContent=bd,exports.NavigationMenuIndicator=jd,exports.NavigationMenuItem=fd,exports.NavigationMenuLink=yd,exports.NavigationMenuList=xd,exports.NavigationMenuTrigger=vd,exports.NavigationMenuViewport=wd,exports.NavigationProvider=Ah,exports.NumericPanel=xp,exports.OnboardingDialog=Xu,exports.OnlineEditorDialog=function({open:e,onOpenChange:r,identifier:s,fileName:n,mode:o="edit",type:i="document",onClose:l,className:d}){const[u,m]=a.useState(!0),p=function(e,t="edit",a="document"){return`https://docs.google.com/${a}/d/${e}/${t}?usp=drivesdk?embedded=true&rm=demo`}(s,o,i);a.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=a.useCallback(()=>{l?.(),r(!1)},[l,r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,h]),t.jsx(Wr,{open:e,onOpenChange:r,children:t.jsxs(Xr,{className:br("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",d),children:[t.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),t.jsx("div",{className:"flex items-center ml-4 z-20",children:t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Ys,{children:"Fechar"})]})})]}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?t.jsx(As,{className:"h-14 w-14"}):t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(As,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=od,exports.PageBreadcrumb=function({items:e,maxItems:a=3,className:r}){const s=e.length>a?[e[0],...e.slice(-(a-1))]:e,n=e.length>a;return t.jsx(Nc,{className:r,children:t.jsx(_c,{children:s.map((e,a)=>{const r=0===a,s=n&&1===a;return t.jsxs(Cc,{children:[!r&&t.jsx(Ac,{}),s&&t.jsxs(t.Fragment,{children:[t.jsx(Tc,{}),t.jsx(Ac,{})]}),e.isCurrentPage?t.jsx(Sc,{children:e.label}):t.jsx(kc,{asChild:!0,children:t.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=pl,exports.Pagination=Nd,exports.PaginationContent=_d,exports.PaginationEllipsis=Td,exports.PaginationItem=Cd,exports.PaginationLink=kd,exports.PaginationNext=Ad,exports.PaginationPrevious=Sd,exports.PaletteType=Qm,exports.PanelError=dp,exports.PanelHeader=cp,exports.PanelItemsPerPanel=Bm,exports.PanelLoader=up,exports.PanelNoData=mp,exports.PanelSortType=qm,exports.PanelState=Vm,exports.PanelUnavailable=pp,exports.ParetoPanel=_p,exports.PerformancePanel=kp,exports.PiePanel=Np,exports.PlanType=Wm,exports.Popover=Xs,exports.PopoverContent=Zs,exports.PopoverTrigger=Js,exports.Progress=Dd,exports.ProtectedRoute=({children:r})=>{const{isAuthenticated:s,isLoading:n}=jo();if(a.useEffect(()=>{if(n)return;if(s)return;if(Un.isManualLogout())return void(window.location.pathname.endsWith("/login")||(window.location.href=Ue("/login")));const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const r=We(),o=Be(window.location.pathname),i=o+window.location.search+window.location.hash;["/","/login","/callback"].includes(o)||localStorage.setItem("auth_return_url",i);(async()=>{r?await go.loginDev():go.loginProd()})()},[s,n]),n&&!s)return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsx(Tr,{className:"text-xl font-semibold",children:"Carregando..."})}),t.jsxs(Pr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!s){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsx(Tr,{className:"text-xl font-semibold",children:"Processando..."})}),t.jsxs(Pr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Sr,{className:"w-full max-w-md",children:[t.jsx(Ar,{className:"text-center",children:t.jsx(Tr,{className:"text-xl font-semibold",children:"Iniciando..."})}),t.jsxs(Pr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:We()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return t.jsx(t.Fragment,{children:r})},exports.QUALIEX_CONFIG=Ke,exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=uo,exports.QualiexErrorInterceptor=ro,exports.QualiexUserField=Di,exports.QueriesContextType=Hm,exports.QueriesShareType=Gm,exports.QuickFilterDashboard=Km,exports.RadioGroup=Pd,exports.RadioGroupItem=Ed,exports.ReadOnlyTextField=kx,exports.ReportRequestList=function({requests:e,isLoading:r=!1,onGetReportUrl:s,formatDate:n=Nm,labels:o,className:i}){const{t:l}=y.useTranslation(),d={...wm,...o},[u,m]=a.useState(""),[p,h]=a.useState(!1),[x,f]=a.useState(""),[g,v]=a.useState(""),[b,w]=a.useState(null),j=a.useMemo(()=>{if(!u)return e;const t=jm(u);return e.filter(e=>jm(e.reportName).includes(t))},[e,u]),N=a.useCallback(async e=>{if(!b){w(e.id);try{const t=await s(e.id);t&&(f(t),v(e.reportName),h(!0))}finally{w(null)}}},[s,b]);return r?t.jsx("div",{className:br("space-y-3",i),children:Array.from({length:5}).map((e,a)=>t.jsx(cn,{className:"h-12 w-full"},a))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:br("space-y-3",i),children:[t.jsxs("div",{className:"relative max-w-sm",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(_r,{className:"pl-8 h-9 text-sm",placeholder:d.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),t.jsx(Ni,{className:"rounded-md border",children:t.jsxs(ko,{children:[t.jsx(So,{children:t.jsxs(Do,{children:[t.jsx(Po,{className:"min-w-[140px]",children:d.report}),t.jsx(Po,{className:"min-w-[150px]",children:d.status}),t.jsx(Po,{className:"min-w-[160px]",children:d.requestDate}),t.jsx(Po,{className:"min-w-[160px]",children:d.lastUpdate}),t.jsx(Po,{className:"min-w-[160px]",children:d.expirationDate}),t.jsx(Po,{className:"min-w-[140px]"})]})}),t.jsx(Ao,{children:0===j.length?t.jsx(Do,{children:t.jsx(Eo,{colSpan:6,className:"text-center text-muted-foreground py-8",children:d.noResults})}):j.map(e=>{const a=function(e){const{t:t}=y.useTranslation();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),r=function(e,a){const{t:r}=y.useTranslation();switch(e){case 1:return{label:a.statusWaiting,icon:t.jsx(c.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:a.statusProcessing,icon:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:a.statusCompleted,icon:t.jsx(c.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:a.statusError,icon:t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:a.statusExpired,icon:t.jsx(c.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(a,d),s=3===a,o=5===a;return t.jsxs(Do,{children:[t.jsx(Eo,{className:"font-medium",children:e.reportName}),t.jsx(Eo,{children:t.jsxs(ks,{variant:r.variant,className:br("gap-1",r.className),children:[r.icon,r.label]})}),t.jsx(Eo,{className:"text-sm",children:n(new Date(e.requestDate))}),t.jsx(Eo,{className:"text-sm",children:n(new Date(e.lastUpdate))}),t.jsx(Eo,{className:br("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),t.jsx(Eo,{children:t.jsxs(jr,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!s||b===e.id,onClick:()=>N(e),children:[b===e.id?t.jsx(c.Loader2,{className:"h-4 w-4 animate-spin"}):t.jsx(c.Eye,{className:"h-4 w-4"}),d.viewReport]})})]},e.id)})})]})})]}),t.jsx(xm,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ReportRequestStatus=ym,exports.ResizableHandle=({withHandle:e,className:a,...r})=>t.jsx(Ce.PanelResizeHandle,{className:br("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(c.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=Md,exports.ResizablePanelGroup=({className:e,...a})=>t.jsx(Ce.PanelGroup,{className:br("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),exports.RichTextEditor=({value:r,onChange:s,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:d=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=a.useState("visual"),x=V.useEditor({extensions:[$.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:r||"",editable:!n,onUpdate:({editor:e})=>{s(e.getHTML())}});te.useEffect(()=>{x&&r!==x.getHTML()&&x.commands.setContent(r||"")},[r,x]);const f=a.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""!==t?x.chain().focus().extendMarkRange("link").setLink({href:t}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?t.jsxs("div",{className:br("space-y-2",u),children:[l&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1",children:[t.jsxs(jr,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[t.jsx(c.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t.jsxs(jr,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[t.jsx(c.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t.jsxs(jr,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[t.jsx(c.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),d&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",t.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&t.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[t.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[t.jsx(Hu,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:t.jsx(c.Heading1,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:t.jsx(c.Heading2,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:t.jsx(c.Heading3,{className:"h-4 w-4"})}),t.jsx(Gu,{}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:t.jsx(c.Bold,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:t.jsx(c.Italic,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:t.jsx(c.Underline,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:t.jsx(c.Strikethrough,{className:"h-4 w-4"})}),t.jsx(Gu,{}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:t.jsx(c.List,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:t.jsx(c.ListOrdered,{className:"h-4 w-4"})}),t.jsx(Gu,{}),t.jsx(Hu,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:t.jsx(c.Highlighter,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:t.jsx(c.Link,{className:"h-4 w-4"})}),t.jsx(Gu,{}),t.jsx(Hu,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:t.jsx(c.RemoveFormatting,{className:"h-4 w-4"})}),t.jsx(Gu,{}),t.jsx(Hu,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:t.jsx(c.Undo,{className:"h-4 w-4"})}),t.jsx(Hu,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:t.jsx(c.Redo,{className:"h-4 w-4"})})]}),t.jsx(V.EditorContent,{editor:x,className:br("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&t.jsx("textarea",{value:r||"",onChange:e=>s(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&t.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:t.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:t.jsx("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.RiskCriticality=Ym,exports.SEARCH_CONFIG=Ve,exports.SUPPORTED_LOCALES=Ya,exports.ScrollArea=Ni,exports.ScrollBar=_i,exports.Select=ps,exports.SelectApproverDialog=Fx,exports.SelectContent=bs,exports.SelectGroup=hs,exports.SelectItem=ws,exports.SelectLabel=ys,exports.SelectScrollDownButton=vs,exports.SelectScrollUpButton=gs,exports.SelectSearch=mn,exports.SelectSeparator=js,exports.SelectTrigger=fs,exports.SelectValue=xs,exports.Separator=Mr,exports.Sheet=Id,exports.SheetBody=qd,exports.SheetClose=Ld,exports.SheetContent=Od,exports.SheetDescription=Wd,exports.SheetFooter=Vd,exports.SheetHeader=Bd,exports.SheetOverlay=zd,exports.SheetPortal=Fd,exports.SheetTitle=$d,exports.SheetTrigger=Rd,exports.Sidebar=Qd,exports.SidebarActionTrigger=Rh,exports.SidebarContent=su,exports.SidebarFooter=au,exports.SidebarGroup=nu,exports.SidebarGroupAction=iu,exports.SidebarGroupContent=lu,exports.SidebarGroupLabel=ou,exports.SidebarHeader=function({open:e,appName:r}){const[s,n]=a.useState(!1),{association:o}=Cl(),i=rt({isQualitfy:o?.isQualitfy,isMetroex:o?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsx(tu,{className:"p-0 gap-0",children:e?t.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:i,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),r&&t.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(r)})})]}):t.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:t.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:st.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),t.jsx(cc,{open:s,onOpenChange:n})]})},exports.SidebarInput=eu,exports.SidebarInset=Zd,exports.SidebarLogo=Eh,exports.SidebarMenu=cu,exports.SidebarMenuAction=pu,exports.SidebarMenuBadge=hu,exports.SidebarMenuButton=mu,exports.SidebarMenuItem=du,exports.SidebarMenuSkeleton=xu,exports.SidebarMenuSub=fu,exports.SidebarMenuSubButton=vu,exports.SidebarMenuSubItem=gu,exports.SidebarProvider=Yd,exports.SidebarRail=Jd,exports.SidebarSeparator=ru,exports.SidebarSkeleton=function(){return t.jsx("div",{className:"w-64 border-r bg-muted/10",children:t.jsxs("div",{className:"p-4",children:[t.jsx(cn,{className:"h-8 w-32 mb-6"}),t.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,a)=>t.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[t.jsx(cn,{className:"h-4 w-4"}),t.jsx(cn,{className:"h-4 w-20"})]},a))})]})})},exports.SidebarTrigger=Xd,exports.SingleFileUpload=function({storedFile:e,customFileName:r,allowedExtensions:s,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:d=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:v,onFileReplace:b,onDownload:w,onView:j,className:N}){const{t:_}=y.useTranslation(),C=a.useRef(null),[k,S]=a.useState(null),[A,T]=a.useState(null),[D,P]=a.useState(!1),E=k||e,M=k?.name||e?.name||"",I=k?.size||e?.size;M&&yx(M);const R=r||M,L=l&&!k&&!!e,F=d&&!k&&!!e,z=!!A||!!f||p&&h&&!E,U=!!E,O=a.useCallback(e=>{if(vx.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(s?.length){const t=yx(e.name);if(!s.includes(t))return{type:"extension",message:n}}return null},[o,i,s,n]),B=a.useCallback(e=>{const t=e.target.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),S(null),void(C.current&&(C.current.value=""));T(null),S(t),g?.(t),C.current&&(C.current.value="")},[O,g]),q=a.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const t=e.dataTransfer.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),void S(null);T(null),S(t),g?.(t)},[x,O,g]),V=a.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),$=a.useCallback(()=>{b?.(),C.current?.click()},[b]),W=a.useCallback(()=>{S(null),T(null),v?.(),C.current&&(C.current.value="")},[v]),H=a.useCallback(async()=>{if(!D&&e&&w){P(!0);try{await w(e)}finally{P(!1)}}},[D,e,w]),G=a.useCallback(()=>{e&&j&&j(e)},[e,j]),K=a.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!A)return p&&h&&!E?_("required_field"):null;switch(A.type){case"extension":return A.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${bx(o)}`;case"max-size":return`Tamanho máximo: ${bx(i)}`;default:return _("file_error")}})();return t.jsxs("div",{className:br("space-y-1",N),children:[t.jsx("div",{className:br("rounded-md border border-dashed transition-colors",U&&"border-solid border-border",!U&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:U?t.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(c.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("p",{className:"text-xs truncate",children:R})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=I&&t.jsx("span",{className:"text-xs text-muted-foreground",children:bx(I)}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[L&&w&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:D,onClick:H,children:t.jsx(c.Download,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Ys,{children:"Download"})]}),F&&j&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:t.jsx(c.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Ys,{children:"Visualizar"})]}),u&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:$,children:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Ys,{children:"Substituir"})]}),m&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground"})})}),t.jsx(Ys,{children:_("remove")})]})]})]})]}):t.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:q,onDragOver:V,children:[t.jsx(c.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),t.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",t.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&t.jsx("p",{className:"text-xs text-destructive",children:Y}),t.jsx("input",{ref:C,type:"file",className:"hidden",accept:s?.map(e=>`.${e}`).join(","),onChange:B,disabled:x})]})},exports.Skeleton=cn,exports.Slider=bu,exports.Small=cd,exports.SonnerToaster=Ds,exports.Spinner=As,exports.SplitButton=Ju,exports.Stack=Fi,exports.StatusBadge=function({label:e,color:a,icon:r,showIcon:s,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const c=_m[n],d=s??!!r;return t.jsxs("span",{className:br("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",c.badge,l),style:(()=>{switch(o){case"outline":return{color:a,borderColor:dr(a,.3),backgroundColor:"transparent"};case"ghost":return{color:a,backgroundColor:"transparent"};default:return{color:a,backgroundColor:i||dr(a,.1)}}})(),children:[d&&r&&t.jsx(r,{size:c.icon,strokeWidth:2}),e]})},exports.StepSelector=rm,exports.Stepper=rm,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:r={},minHeight:s="80vh",...n}){const o=a.useMemo(()=>{const t=`${e}/api/reports/v1/Viewer/InitViewer`,a=new URLSearchParams(r).toString();return a?`${t}?${a}`:t},[e,r]);return t.jsx(xm,{...n,url:o,minHeight:s})},exports.Switch=Ai,exports.TIMEZONES=Xa,exports.TabPageContent=function({children:e,className:a}){return t.jsx("div",{className:br("space-y-6",a),children:e})},exports.TabPageHeader=function({title:e,description:a,actions:r,className:s}){return t.jsxs("div",{className:br("space-y-4",s),children:[t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),a&&t.jsx("p",{className:"text-muted-foreground text-sm",children:a})]}),r&&t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),t.jsx(Mr,{})]})},exports.TabPageLayout=function({children:e,className:a}){return t.jsx("div",{className:br("flex flex-col h-full",a),children:t.jsx(Ni,{className:"flex-1",children:t.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=ko,exports.TableBody=Ao,exports.TableCaption=Mo,exports.TableCell=Eo,exports.TableFooter=To,exports.TableHead=Po,exports.TableHeader=So,exports.TableResizeHandle=Uo,exports.TableRow=Do,exports.TableRowActions=ai,exports.TableSkeleton=Io,exports.Tabs=Ul,exports.TabsContent=ql,exports.TabsList=Ol,exports.TabsTrigger=Bl,exports.TeamSelector=function({users:e,value:r,onChange:s,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:d="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=a.useState(""),[v,b]=a.useState(!1),[w,j]=a.useState(null),N=a.useMemo(()=>new Set(r),[r]),_=a.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=a.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=a.useCallback(e=>{e&&!N.has(e)&&(s([...r,e]),g(""))},[r,s,N]),S=a.useCallback(e=>{i?(j(e),b(!0)):s(r.filter(t=>t!==e))},[r,s,i]),A=a.useCallback(()=>{w&&s(r.filter(e=>e!==w)),b(!1),j(null)},[w,r,s]);return t.jsxs("div",{className:br("space-y-3",m),children:[t.jsx("div",{className:"flex items-start gap-3",children:t.jsx("div",{className:"flex-1",children:t.jsx(mn,{options:C,value:f,onValueChange:e=>{const t="string"==typeof e?e:e?.[0]??"";g(t),t&&k(t)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),t.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?t.jsx("div",{className:"space-y-2",children:_.map(e=>t.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t.jsxs(Ki,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Yi,{src:e.avatar,alt:e.name}),t.jsx(Qi,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.Shield,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.MapPin,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),t.jsx("button",{type:"button",className:br("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:t.jsx(c.X,{className:"h-4 w-4"})})]})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[t.jsx(c.User,{className:"h-12 w-12 mb-2 opacity-30"}),t.jsx("p",{className:"text-sm",children:x})]}),t.jsx(Wr,{open:v,onOpenChange:b,children:t.jsxs(Xr,{className:"sm:max-w-[400px]",children:[t.jsx(Jr,{children:t.jsx(ts,{children:h})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:d}),t.jsxs(es,{children:[t.jsx(jr,{variant:"ghost",onClick:()=>b(!1),children:"Cancelar"}),t.jsx(jr,{variant:"destructive",onClick:A,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:r,open:s,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:d=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=a.useState(!1),h=a.useCallback(()=>{o(r.id)},[o,r.id]);return t.jsxs(t.Fragment,{children:[t.jsx(Wr,{open:s&&!m,onOpenChange:e=>!e&&n(),children:t.jsxs(Xr,{className:"sm:max-w-md",children:[t.jsx(Jr,{children:t.jsxs(ts,{className:"flex items-center gap-2",children:[t.jsx(c.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),t.jsxs("div",{className:"space-y-4",children:[r.description&&t.jsx(Ni,{className:"max-h-48",children:t.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r.description}})}),r.file&&t.jsxs(jr,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[t.jsx(c.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),t.jsxs(es,{className:"gap-2 sm:gap-0",children:[t.jsx(jr,{variant:"ghost",onClick:n,children:l}),t.jsx(jr,{onClick:h,children:d})]})]})}),m&&t.jsx(fm,{term:r,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=fm,exports.TextPanel=fp,exports.Textarea=_s,exports.Timepicker=am,exports.Toaster=Ds,exports.Toggle=ii,exports.ToggleGroup=ci,exports.ToggleGroupItem=di,exports.TokenManager=Un,exports.TokenService=Dn,exports.Tooltip=Gs,exports.TooltipContent=Ys,exports.TooltipProvider=Hs,exports.TooltipTrigger=Ks,exports.TreeSelect=vn,exports.TreeTable=function({data:r,columns:s,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:v,selectedIds:b,onSelectItem:y,onSelectAll:w,isAllSelected:j,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:A=200}){const[T,D]=a.useState(null),[P,E]=a.useState(null),[M,I]=a.useState(!1),[R,L]=a.useState(1),F=a.useRef(null),z=a.useRef([]),U=a.useRef(null),O=a.useMemo(()=>new Set(b??[]),[b]),B=a.useMemo(()=>{if(!T||!r)return new Set;const e=z.current.length>0?z.current:[T],t=function(e,t){const a=new Set;for(const r of t)yh(e,r).forEach(e=>a.add(e));return a}(r,e);return e.forEach(e=>t.add(e)),t},[T,r]),q=a.useRef(B);q.current=B;const V=a.useCallback(()=>{F.current=null,z.current=[],U.current=null,D(null),E(null),I(!1),L(1)},[]),$=a.useCallback((e,t)=>{e.length>1&&C?C(e,t):1===e.length&&_?.(e[0],t)},[_,C]),W=a.useCallback((e,t)=>{const a=O.has(e)&&O.size>1?Array.from(O):[e];F.current=e,z.current=a,U.current=null,D(e),L(a.length),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e),t.dataTransfer.setData("application/x-tree-ids",JSON.stringify(a))},[O]),H=a.useCallback((e,t)=>{t.preventDefault(),t.dataTransfer.dropEffect="move",q.current.has(e)?E(null):(U.current=e,E(e))},[]),G=a.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const a=q.current.has(e)?U.current:e;if(!a)return void V();let r=z.current;if(0===r.length){try{const e=t.dataTransfer.getData("application/x-tree-ids");if(e){const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(r=t)}}catch{}if(0===r.length){const e=t.dataTransfer.getData("text/plain");e&&(r=[e])}}0===r.length||r.includes(a)||$(r,a),V()},[$,V]),K=a.useCallback(e=>{e.preventDefault(),e.stopPropagation();let t=z.current;if(0===t.length){try{const a=e.dataTransfer.getData("application/x-tree-ids");if(a){const e=JSON.parse(a);Array.isArray(e)&&e.length>0&&(t=e)}}catch{}if(0===t.length){const a=e.dataTransfer.getData("text/plain");a&&(t=[a])}}0!==t.length?($(t,null),V()):V()},[$,V]),Y=a.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",I(!0)},[]),Q=a.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=a.useCallback(e=>{if(!N)return;const t=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),a=t?.dataset?.treeRowId??U.current;a&&G(a,e)},[N,G]);if(x)return t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[t.jsx(c.User,{className:"h-10 w-10 text-muted-foreground/50"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==T;return t.jsxs("div",{className:br("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(E(null),I(!1))}:void 0,children:[N&&J&&t.jsx(Nh,{onDrop:K,isDragOver:M,onDragOver:Y,onDragLeave:()=>I(!1),label:k}),t.jsxs(ko,{children:[t.jsx(So,{children:t.jsxs(Do,{children:[t.jsx(Po,{className:"text-left",style:{minWidth:A},children:t.jsxs("div",{className:"flex items-center gap-2",children:[v&&t.jsx(Ns,{checked:j??!1,onCheckedChange:()=>w?.()}),o]})}),s.map(e=>t.jsx(Po,{className:br("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&t.jsx(Po,{className:"text-right",style:{width:S},children:p})]})}),t.jsx(Ao,{children:r.map(e=>t.jsx(jh,{item:e,level:0,columns:s,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:v,selectedIds:O,onSelectItem:y,enableRowDrag:N,draggedId:T,dragOverId:P,onDragStartCell:W,onDragEndCell:V,onDragOverCell:H,onDropCell:G,dragCount:R},e.id))})]})]})},exports.TruncatedCell=zo,exports.UpdatesBar=Qh,exports.UpdatesDialog=rx,exports.UpdatesNotification=im,exports.UserUpdatesViewer=ix,exports.UsersGroupsSelector=function({users:r,groups:s=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:d=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:v}){const[b,y]=a.useState(!1),[w,j]=a.useState(""),[N,_]=a.useState(void 0),C=a.useMemo(()=>new Set(n),[n]),k=a.useMemo(()=>{let e=r;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),w){const t=gm(w);e=e.filter(e=>gm(e.name).includes(t)||gm(e.email??"").includes(t))}return e},[r,N,w]),S=a.useMemo(()=>b?k:r.filter(e=>C.has(e.id)),[b,k,r,C]),A=n.length,T=a.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),D=a.useCallback(e=>{if(i)return;const t=C.has(e)?n.filter(t=>t!==e):[...n,e];o(t)},[n,C,o,i]),P=a.useCallback(e=>{if(i)return;const t=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...t]);o(Array.from(e))}else o(n.filter(e=>!t.has(e)))},[n,k,o,i]),E=a.useCallback(()=>{y(e=>!e),j(""),_(void 0)},[]);return t.jsxs("div",{className:br("rounded-md border bg-muted/30",v),children:[(!i||A>0)&&t.jsxs("div",{className:br("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:E,children:[t.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(b?p:m)}),t.jsx("span",{className:"text-xs text-muted-foreground",children:A>0&&`${A} ${1===A?f:g}`})]}),t.jsxs("div",{className:"px-4 pb-3",children:[b&&t.jsxs("div",{className:"flex gap-3 mb-3",children:[!d&&s.length>0&&t.jsxs(ps,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[t.jsx(fs,{className:"w-[200px] h-9 text-sm",children:t.jsx(xs,{placeholder:e.t("approval_user_group")})}),t.jsxs(bs,{children:[t.jsx(ws,{value:"__all__",children:e.t("team_all_groups")}),s.map(e=>t.jsx(ws,{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(_r,{className:"pl-8 h-9 text-sm",placeholder:u,value:w,onChange:e=>j(e.target.value)})]})]}),!b&&0===A&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[t.jsx(c.Users,{className:"h-4 w-4 mr-2"}),x]}),b&&k.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(Ns,{checked:T,onCheckedChange:e=>P(!!e)}),t.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&t.jsx(Ni,{style:{maxHeight:l},className:"pr-2",children:t.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return t.jsxs("div",{className:br("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",b&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:b?()=>D(e.id):void 0,children:[b&&t.jsx(Ns,{checked:C.has(e.id),onCheckedChange:()=>D(e.id),onClick:e=>e.stopPropagation()}),t.jsxs(Ki,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Yi,{src:e.avatar,alt:e.name}),t.jsx(Qi,{className:"text-xs",children:(a=e.name,a.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var a})})}),b&&0===k.length&&t.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:r,onChange:s,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:d,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(r||{inputType:"url",controls:!0}),x=a.useRef(null),f=a.useRef(null),{upload:g,uploading:v}=fx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:b,uploading:w}=fx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),j=a.useMemo(()=>ax(p.videoUrl||tx(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,t)=>{const a={...p,[e]:t};h(a),s(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:m("input_type")}),t.jsxs(ps,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[t.jsx(fs,{children:t.jsx(xs,{})}),t.jsxs(bs,{children:[t.jsx(ws,{value:"url",children:"URL"}),t.jsx(ws,{value:"upload",children:m("file_upload")}),t.jsx(ws,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"Arquivo"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await g(t),a={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||t.name.replace(/\.[^/.]+$/,"")};h(a),s(a)}catch(a){}finally{x.current&&(x.current.value="")}},className:"hidden"}),t.jsx(jr,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:v,children:v?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:m("embed_code")}),t.jsx(_s,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"Thumbnail"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(_r,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),t.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await b(t),a={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(a),s(a)}catch(a){}finally{f.current&&(f.current.value="")}},className:"hidden"}),t.jsx(jr,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:w,children:w?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{htmlFor:"title",children:"Título"}),t.jsx(_r,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),t.jsxs("div",{className:"flex gap-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ns,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),t.jsx(kr,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ns,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),t.jsx(kr,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(kr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const a=p.videoUrl||tx(p.embedCode)||"";if(!a)return t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===j)return t.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[t.jsx("source",{src:a}),"Seu navegador não suporta este vídeo."]});const r="youtube"===j?Jh(a,p.autoplay):ex(a,p.autoplay);return t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:p.title||e.t("video"),src:r,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(jr,{variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(jr,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:a,className:r="",style:s}){const n=a.videoUrl||tx(a.embedCode)||"";if(!n)return null;const o=ax(n);return t.jsx(Sr,{className:`overflow-hidden my-4 ${r}`,style:s,children:t.jsxs(Pr,{className:"p-0",children:["file"===o?t.jsxs("video",{controls:!1!==a.controls,autoPlay:a.autoplay,poster:a.thumbnail,className:"w-full h-auto",playsInline:!0,muted:a.autoplay,children:[t.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:a.title||e.t("video"),src:"youtube"===o?Jh(n,a.autoplay):ex(n,a.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),a.title&&t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm font-medium",children:a.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:r,template:s,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:d=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:v=!1,readingConfirmationTimeRemaining:b,onIframeLoad:w,className:j}){const{t:N}=y.useTranslation(),_=a.useRef(null),C=n??um(s.extension),k=d||v||h,S=s.code?`${s.code} – ${s.name}`:s.name,A=a.useCallback(()=>{_.current&&w&&w(_.current)},[w]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,r]),t.jsx(Wr,{open:e,onOpenChange:r,children:t.jsxs(Xr,{className:br("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===C||6===C)&&"w-[90vw]",j),children:[t.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),t.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&t.jsxs(t.Fragment,{children:[(x||f)&&t.jsx(t.Fragment,{children:f?t.jsxs("div",{className:"flex flex-col mr-2.5",children:[t.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[t.jsx(c.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),t.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=b&&b>0?t.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[t.jsx("span",{children:N("terms_confirmation_available")}),t.jsx("span",{className:"font-medium min-w-[72px]",children:hm(b)}),t.jsx("span",{children:"segundos"})]}):t.jsxs(jr,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[t.jsx(c.ShieldCheck,{className:"h-4 w-4 mr-1"}),v?"Confirmando...":N("terms_confirm_reading")]})}),0!==C&&u&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:t.jsx(c.Star,{className:br("h-4 w-4",m&&"fill-accent text-accent")})})}),t.jsx(Ys,{children:m?"Desfavoritar":"Favoritar"})]}),0!==C&&i&&t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:t.jsx(c.Download,{className:"h-4 w-4"})})}),t.jsx(Ys,{children:"Download"})]})]}),t.jsxs(Gs,{children:[t.jsx(Ks,{asChild:!0,children:t.jsx(jr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>r(!1),children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Ys,{children:"Fechar"})]})]})]}),t.jsx("div",{className:br("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",0===C&&"min-h-[124px]",1===C&&"max-h-[85vh]",(4===C||6===C)&&"min-w-[77vw] min-h-[80vh]"),children:o?t.jsx(As,{className:"h-14 w-14"}):t.jsxs(t.Fragment,{children:[(0===C||!s.url)&&t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),t.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),1===C&&t.jsx("img",{loading:"eager",src:s.url,alt:s.name,className:"max-w-full max-h-[85vh] object-contain"}),2===C&&t.jsx("video",{controls:!0,autoPlay:!0,src:s.url,className:"w-full h-full"}),3===C&&t.jsx("audio",{controls:!0,autoPlay:!0,src:s.url}),(4===C||6===C)&&t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(As,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{ref:_,src:s.url,onLoad:A,className:"border-none w-full h-full z-[1] relative",title:s.name})]})]})}),!o&&0===C&&t.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[t.jsx(jr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),i&&t.jsx(jr,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.VisualizationType=$m,exports.addAppTranslations=bl,exports.addChild=Xp,exports.addSibling=Jp,exports.aliasSchema=mx,exports.appRedirectUrl=Ue,exports.applyFavicon=it,exports.assets=st,exports.badgeVariants=Cs,exports.brandLogos=at,exports.buildModuleUrl=pr,exports.buildPlacesTree=function(e){e.forEach(t=>{t.children=e.filter(e=>e.parentId===t.id)});const t=e.filter(e=>!e.parentId);return function e(t,a){t?.forEach(t=>{a(t),t.children&&e(t.children,a)})}(t,t=>{t.children=e.filter(e=>e.parentId===t.id)}),t},exports.buildQualiexHeaders=Zi,exports.buildWopiUrl=function(e){const{t:t}=y.useTranslation(),{viewerUrl:a,wopiUrl:r,fileId:s,token:n,extension:o,language:i="pt-br"}=e,l=pm(o);return l?`${a}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${r}${s}`)}`:null},exports.buttonGroupVariants=Dc,exports.buttonVariants=wr,exports.calculateAspectRatio=gx,exports.cn=br,exports.configureBrandAssets=function(e){et={...et,...e,logos:{...et.logos,...e.logos}}},exports.configureEnvironment=function(e){Ee={...Ee,...e,oauth:{...Ee.oauth,...e.oauth}}},exports.createCrudPage=function(e){return({manager:a})=>{const{manager:r,config:s,onSave:n,onEdit:o,onToggleStatus:i}=e,l=a??r,c={entityName:s.entityName,entityNamePlural:s.entityNamePlural,filters:s.filters||[],columns:s.columns,cardFields:s.cardFields||[],enableBulkActions:s.enableBulkActions??!1,bulkActions:s.bulkActions||[],customActions:s.customActions,customRowActions:s.customRowActions,customListView:s.customListView,onEdit:o||s.onEdit,onNew:s.onNew,useCustomRouting:s.useCustomRouting,hideNewButton:s.hideNewButton,showNewButton:s.showNewButton,newButtonLabel:s.newButtonLabel,showSearch:s.showSearch,searchPlaceholder:s.searchPlaceholder,showActionBar:s.showActionBar};return t.jsx(Ui,{manager:l,config:c,formSections:s.formSections,onSave:n,onToggleStatus:i,defaultSort:s.defaultSort})}},exports.createCrudRoutingConfig=function(e,t){const a=_h({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:a.onNew,onEdit:a.onEdit}},exports.createMindMapNode=Hp,exports.createRoutingHandlers=_h,exports.createService=ho,exports.createSimpleSaveHandler=function(e,t,a){return r=>{if(r.id){const t=a(r);e.updateEntity(r.id,t)}else{const a=t(r);e.createEntity(a)}}},exports.createSimpleService=function(e){const t=ho({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(a,r)=>No({queryKey:e.tableName,service:t,entityName:e.entityName,additionalFilters:a,onSuccess:r})}},exports.createStatusConfig=function(e){return t=>e[t]},exports.createTranslatedMessages=t=>({success:{created:t=>e.t("msg_created_success",`${t} criado com sucesso`).replace("{{entity}}",t),updated:t=>e.t("msg_updated_success",`${t} atualizado com sucesso`).replace("{{entity}}",t),deleted:t=>e.t("msg_deleted_success",`${t} removido com sucesso`).replace("{{entity}}",t)},error:{create:t=>e.t("msg_create_error",`Erro ao criar ${t}`).replace("{{entity}}",t),update:t=>e.t("msg_update_error",`Erro ao atualizar ${t}`).replace("{{entity}}",t),delete:t=>e.t("msg_delete_error",`Erro ao remover ${t}`).replace("{{entity}}",t),load:t=>e.t("msg_load_error",`Erro ao carregar ${t}`).replace("{{entity}}",t)}}),exports.currencyFormatter=np,exports.debounce=(e,t)=>{let a;return(...r)=>{clearTimeout(a),a=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=oo,exports.deriveNameField=no,exports.deriveUsernameField=io,exports.detectBrowserLocale=rr,exports.detectBrowserPreferences=()=>{const e=rr();return{locale:e,timezone:sr(),datetimeFormat:nr(e)}},exports.detectBrowserTimezone=sr,exports.detectVideoProvider=ax,exports.emailSchema=ux,exports.emailService=dx,exports.errorService=qn,exports.exportMindMap=fh,exports.extractImageFileName=function(e){try{const t=new URL(e),a=t.pathname.split("/");return a[a.length-1]||"image"}catch{const t=e.split("/");return t[t.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const t=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(t)},exports.extractVimeoId=Zh,exports.extractYouTubeId=Xh,exports.findDatetimeFormat=e=>Qa.find(t=>t.value===e),exports.findLocale=e=>Ya.find(t=>t.value===e),exports.findNode=Gp,exports.findTimezone=e=>Xa.find(t=>t.value===e),exports.formatBytes=bx,exports.formatCurrency=(e,t="BRL",a="pt-BR")=>null==e?"":new Intl.NumberFormat(a,{style:"currency",currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=lr,exports.formatDatetime=ir,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.generateCrudConfig=function(e,t,a={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const a=t[e],s={key:e,header:Bi(e),label:Bi(e),...Oi(e,a),sortable:!0,searchable:"string"==typeof a};r.push(s)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...a}},exports.generateId=hr,exports.generateNodeId=Wp,exports.generatePastelBg=dr,exports.getAppBasePath=Oe,exports.getAppEnv=Pe,exports.getBackendMode=function(){return Re},exports.getCommonBaseUrl=Xi,exports.getContrastRatio=function(e,t){const a=ur(e),r=ur(t);return(Math.max(a,r)+.05)/(Math.min(a,r)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case Im.Bar:case Im.Column:case Im.Pie:case Im.List:case Im.Line:case Im.Area:case Im.Text:case Im.StackedColumn:return{x:4,y:2};case Im.Pareto:case Im.RiskMatrix:case Im.Burndown:case Im.PerformanceColumns:return{x:8,y:2};case Im.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getEnvironmentConfig=Me,exports.getFieldValue=_x,exports.getFileExtension=yx,exports.getFormFieldValues=function(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))},exports.getIdentBaseUrl=function(){const e=Xi().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://ident-api${e[1]||""}.${e[2]}`}return"https://ident-api.qualiex.com"},exports.getLinkFromRow=ap,exports.getLuminance=ur,exports.getMinPanelSize=Tp,exports.getOnlineViewerType=function(e){const{t:t}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getQualiexApiUrl=Ge,exports.getSecurityMode=function(){return fc},exports.getSupabaseClient=Qn,exports.getUserProfile=ll,exports.getViewerType=um,exports.getWopiViewer=pm,exports.handleExternalLink=mr,exports.importMindMap=function(e){return gh(JSON.parse(e))},exports.inferDatetimeFormat=nr,exports.inputGroupAddonVariants=Qc,exports.inputGroupButtonVariants=Jc,exports.isCurrency=function(e){return!!sp.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnv=Ie,exports.isDevEnvironment=He,exports.isImageUrl=function(e){const t=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const a=new URL(e);return t.some(e=>a.pathname.toLowerCase().endsWith(e))}catch{const a=e.toLowerCase();return t.some(e=>a.endsWith(e))}},exports.isLovablePreview=$e,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isSupabaseBackend=Fe,exports.isSupabaseConfigured=function(){return null!==Gn()},exports.isValidDatetimeFormat=e=>Qa.some(t=>t.value===e),exports.isValidLocale=tr,exports.isValidTimezone=ar,exports.loadForlogicFonts=hc,exports.logoSrc=nt,exports.markUpdateVisualized=Hh,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=eh,exports.navigationMenuTriggerStyle=gd,exports.normalizeVideoUrl=function(e,t,a){switch(t||ax(e)){case"youtube":return Jh(e,a);case"vimeo":return ex(e,a);default:return e}},exports.normalizeVimeoUrl=ex,exports.normalizeYouTubeUrl=Jh,exports.paginationSchema=xx,exports.parseIframeSrc=tx,exports.processUrl=tp,exports.qualiexApi=so,exports.qualiexFetch=el,exports.removeNode=Zp,exports.resizeKeepingAspect=function(e,t,a,r){const s=gx(e,t);return a&&!r?{width:a,height:Math.round(a/s)}:r&&!a?{width:Math.round(r*s),height:r}:{width:e,height:t}},exports.resolveBrandLogo=rt,exports.resolveFieldMappings=lo,exports.resolvePageTitle=Dh,exports.safeStringSchema=(e=1e3)=>J.z.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),exports.sanitizeErrorMessage=vr,exports.setBackendMode=Le,exports.setCollapsedAll=ah,exports.setFormFieldValues=function(e,t){return t?.length?e.map(e=>{const a=t.find(t=>t.formFieldAssociationId===e.id);if(!a)return e;const r={...e};switch(e.type){case 2:r.textValue=a.textValue;break;case 6:r.numberValue=a.numberValue;break;case 3:r.dateValue=a.dateValue;break;case 4:r.timeValue=a.timeValue;break;case 5:case 7:case 8:r.itemsValue=a.itemsValue||[];break;case 9:r.questionsValue=a.questionsValue||[]}return r}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new j.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=Cx,exports.shouldUseDevTokens=We,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=ot,exports.sortByMonthYear=function(e){return e?.sort((e,t)=>{if(!e?.items?.length||!t?.items?.length)return 0;return ep(e.items[0]?.keyDate)-ep(t.items[0]?.keyDate)})},exports.stripTechHeaders=function(e){if(!e||"object"!=typeof e)return e;const t={...e};for(const a of xr)delete t[a];return t},exports.timestampId=()=>Date.now().toString(),exports.toQueryString=function(e){return e?rp(e).join("&"):null},exports.toRouterPath=Be,exports.toggleCollapsed=th,exports.toggleVariants=oi,exports.trackFooterClick=tc,exports.trackInterestClick=ec,exports.trackModuleClick=Zl,exports.trimTextFields=yr,exports.updateUserProfile=nl,exports.uploadUserPhoto=tl,exports.useActiveModules=(e={})=>{const{enabled:t=!0}=e,{alias:a}=jo();return j.useQuery({queryKey:["active-modules",a],queryFn:async()=>{if(!a)return[];const e=Qn(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",a).eq("status","active").order("name");if(r){if(!to.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!a})},exports.useAliasFromUrl=qi,exports.useAuth=jo,exports.useBaseForm=bi,exports.useClarity=xc,exports.useColumnManager=hi,exports.useColumnResize=ni,exports.useCrud=No,exports.useDebounce=Ph,exports.useDerivedContractedModules=lc,exports.useFormField=ns,exports.useHasOpenModal=function(){const{hasOpenModal:e}=Oh();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:t}=El(),a=Za;return{formatDatetime:r=>ir(r,a,t,e),formatDate:a=>lr(a,e,t),locale:e,timezone:t,datetimeFormat:a}},exports.useIsMobile=Co,exports.useLocale=El,exports.useMediaQuery=_o,exports.useMediaUpload=fx,exports.useModalState=Oh,exports.useModuleAccess=Cl,exports.useModuleConfig=jl,exports.useNavigation=Th,exports.usePageMetadata=function(e){const{setMetadata:t,clearMetadata:r}=hl(),s=a.useRef({});a.useEffect(()=>{const a=JSON.stringify(s.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(s.current.title!==e.title||s.current.subtitle!==e.subtitle||a)&&(s.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},t(e)),()=>r()},[e.title,e.subtitle,e.breadcrumbs,t,r])},exports.usePageMetadataContext=hl,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:t}=Th();return Dh(t,e.pathname)},exports.usePermissionQuery=Ih,exports.useQualiexReady=$h,exports.useQualiexUsers=Ti,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),a=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,s)=>{r+=`/${e}`;const n=s===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");a.push({label:o,href:n?void 0:r,isCurrentPage:n})}),a})()},exports.useRowResize=function({rowIds:e,defaultHeight:t=48,minHeight:r=32,maxHeight:s=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,c]=a.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[d,u]=a.useState(!1),[m,p]=a.useState(null),h=a.useRef(0),x=a.useRef(0),f=a.useCallback(e=>l[e]??t,[l,t]),g=a.useCallback((e,a)=>{i&&(a.preventDefault(),a.stopPropagation(),u(!0),p(e),h.current=a.clientY,x.current=l[e]??t)},[i,l,t]);a.useEffect(()=>{if(!d||!m)return;const e=e=>{const t=e.clientY-h.current,a=Math.max(r,Math.min(s,x.current+t));c(e=>{const t={...e,[m]:a};return o?.(t),t})},t=()=>{u(!1),p(null),n&&c(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[d,m,r,s,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d]);const v=a.useCallback(()=>{c({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:d,activeRow:m,handleMouseDown:g,resetHeights:v,getRowHeight:f}},exports.useSidebar=Kd,exports.useSidebarResize=zh,exports.useUpdatesNotification=om,exports.useUserUpdatesBar=Kh,exports.useUserUpdatesDialog=Yh,exports.useWizard=function(e){const{steps:t,initialStep:r=0,initialData:s={},onComplete:n,onCancel:o}=e,[i,l]=a.useState(r),[c,d]=a.useState(s),[u,m]=a.useState(!1),[p,h]=a.useState(!1),x=t.length,f=0===i,g=i===x-1,v=t[i],b=x>1?(i+1)/x*100:100,y=a.useCallback(()=>!v?.canProceed||v.canProceed(),[v]),w=a.useMemo(()=>y(),[y,c]),j=a.useMemo(()=>!f&&!v?.disableBack,[f,v]),N=a.useCallback(e=>{d(t=>({...t,...e}))},[]),_=a.useCallback((e,t)=>{d(a=>({...a,[e]:t}))},[]),C=a.useCallback(()=>{l(r),d(s),m(!1),h(!1),o?.()},[r,s,o]),k=a.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(c))}finally{h(!1)}}},[y,p,c,n]),S=a.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),A=a.useCallback(()=>{j&&!u&&l(e=>Math.max(e-1,0))},[j,u]),T=a.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),D=a.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:v,data:c,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:A,goTo:T,canProceed:w,canGoBack:j,setData:N,updateField:_,reset:C,complete:k,setLoading:D,progress:b,stepIndex:i,totalSteps:x}},exports.userIdSchema=hx,exports.uuidSchema=px,exports.validateFields=function(e){const t=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const a=_x(e);if((null==a||""===a||Array.isArray(a)&&0===a.length)&&t.push(e.id),6===e.type&&null!=a){const r=e.config;null!=r?.min&&a<r.min&&t.push(e.id),null!=r?.max&&a>r.max&&t.push(e.id)}}),{valid:0===t.length,invalidFields:[...new Set(t)]}};
|
|
1
|
+
"use strict";var e=require("i18next"),t=require("react/jsx-runtime"),a=require("react"),r=require("@radix-ui/react-slot"),s=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),c=require("lucide-react"),d=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),v=require("@radix-ui/react-tooltip"),b=require("@radix-ui/react-popover"),y=require("react-i18next"),w=require("@supabase/supabase-js"),j=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),A=require("@radix-ui/react-switch"),T=require("@radix-ui/react-avatar"),D=require("@radix-ui/react-collapsible"),P=require("@radix-ui/react-tabs"),E=require("@radix-ui/react-accordion"),M=require("react-day-picker"),I=require("vaul"),R=require("@radix-ui/react-hover-card"),L=require("@radix-ui/react-navigation-menu"),F=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),U=require("react-resizable-panels"),O=require("@radix-ui/react-slider"),B=require("@radix-ui/react-menubar"),q=require("recharts"),V=require("@tiptap/react"),$=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable"),J=require("zod"),Z="undefined"!=typeof document?document.currentScript:null;function ee(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,Object.freeze(t)}var te=ee(a),ae=ee(c),re=ee(d),se=ee(u),ne=ee(m),oe=ee(p),ie=ee(x),le=ee(f),ce=ee(g),de=ee(v),ue=ee(b),me=ee(_),pe=ee(C),he=ee(k),xe=ee(S),fe=ee(A),ge=ee(T),ve=ee(D),be=ee(P),ye=ee(E),we=ee(R),je=ee(L),Ne=ee(F),_e=ee(z),Ce=ee(U),ke=ee(O),Se=ee(B),Ae=ee(q);const Te={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:""},De={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:""};function Pe(){return"DEV"===(void 0).VITE_APP_ENV?"DEV":"PROD"}let Ee={};function Me(){const e="DEV"===Pe()?De:Te;return{...e,...Ee,oauth:{...e.oauth,...Ee.oauth}}}function Ie(){return"DEV"===Pe()}let Re="supabase";function Le(e){Re=e}function Fe(){return"supabase"===Re}const ze={get oauth(){const e=Me();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:e.oauth.responseType,scope:e.oauth.scope}}};function Ue(e){const t=Me().appBasePath||"";return`${window.location.origin}${t}${e}`}function Oe(){return Me().appBasePath||""}function Be(e){const t=Oe();return t&&e.startsWith(t)?e.slice(t.length)||"/":e}const qe={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Ve={debounceDelay:500},$e=()=>{const e=window.location.origin,t=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&t||(void 0).DEV},We=()=>$e()&&Fe(),He=$e,Ge=()=>Me().qualiexApiUrl,Ke=()=>Me().identApiUrl,Ye=()=>Me().loginApiUrl,Qe={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},Xe={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},Je={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},Ze="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",et={qualiex:`${Ze}/logo-qualiex-white.svg`,qualitfy:`${Ze}/logo-qualitfy-white.svg`,metroex:`${Ze}/logo-metroex-white.svg`,qualiexSmall:`${Ze}/logo-forlogic-white.svg`,saber:`${Ze}/saber-gestao-white.png`,saberSmall:`${Ze}/small.svg`},tt=`${Ze}/favicon.png`;let at={};function rt(e){return at.logos?.[e]??et[e]}const st={get qualiex(){return rt("qualiex")},get qualitfy(){return rt("qualitfy")},get metroex(){return rt("metroex")},get saber(){return rt("saber")},get qualiexSmall(){return rt("qualiexSmall")},get saberSmall(){return rt("saberSmall")}};function nt(e){return rt(Xe.isQualiex?e?.isMetroex?"metroex":e?.isQualitfy?"qualitfy":"qualiex":"saber")}const ot={get logo(){return nt()},get smallLogo(){return rt(Xe.isQualiex?"qualiexSmall":"saberSmall")},get favicon(){return at.favicon??tt}},it=ot.logo,lt=ot.smallLogo;function ct(){if("undefined"==typeof document)return;document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=ot.favicon,document.head.appendChild(e)}"function"==typeof queueMicrotask?queueMicrotask(ct):Promise.resolve().then(ct);const dt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function ut(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const mt={date:ut({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ut({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:ut({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},pt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ht(e){return(t,a)=>{let r;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,s=a?.width?String(a.width):t;r=e.formattingValues[s]||e.formattingValues[t]}else{const t=e.defaultWidth,s=a?.width?String(a.width):e.defaultWidth;r=e.values[s]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const xt={ordinalNumber:(e,t)=>{const a=Number(e),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:ht({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ht({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ht({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:ht({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:ht({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function ft(e){return(t,a={})=>{const r=a.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],n=t.match(s);if(!n)return null;const o=n[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a;return}(i,e=>e.test(o)):function(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=a.valueCallback?a.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}function gt(e){return(t,a={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],n=t.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=a.valueCallback?a.valueCallback(o):o;return{value:o,rest:t.slice(s.length)}}}const vt={ordinalNumber:gt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ft({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:ft({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ft({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:ft({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ft({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},bt={code:"en-US",formatDistance:(e,t,a)=>{let r;const s=dt[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},formatLong:mt,formatRelative:(e,t,a,r)=>pt[e],localize:xt,match:vt,options:{weekStartsOn:0,firstWeekContainsDate:1}};let yt={};function wt(){return yt}const jt=6048e5;function Nt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function _t(e){const t=Nt(e);return t.setHours(0,0,0,0),t}function Ct(e){const t=Nt(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function kt(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function St(e){const t=Nt(e),a=function(e,t){const a=_t(e),r=_t(t),s=+a-Ct(a),n=+r-Ct(r);return Math.round((s-n)/864e5)}(t,function(e){const t=Nt(e),a=kt(e,0);return a.setFullYear(t.getFullYear(),0,1),a.setHours(0,0,0,0),a}(t));return a+1}function At(e,t){const a=wt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Nt(e),n=s.getDay(),o=(n<r?7:0)+n-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Tt(e){return At(e,{weekStartsOn:1})}function Dt(e){const t=Nt(e),a=t.getFullYear(),r=kt(e,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const s=Tt(r),n=kt(e,0);n.setFullYear(a,0,4),n.setHours(0,0,0,0);const o=Tt(n);return t.getTime()>=s.getTime()?a+1:t.getTime()>=o.getTime()?a:a-1}function Pt(e){const t=Nt(e),a=+Tt(t)-+function(e){const t=Dt(e),a=kt(e,0);return a.setFullYear(t,0,4),a.setHours(0,0,0,0),Tt(a)}(t);return Math.round(a/jt)+1}function Et(e,t){const a=Nt(e),r=a.getFullYear(),s=wt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=kt(e,0);o.setFullYear(r+1,0,n),o.setHours(0,0,0,0);const i=At(o,t),l=kt(e,0);l.setFullYear(r,0,n),l.setHours(0,0,0,0);const c=At(l,t);return a.getTime()>=i.getTime()?r+1:a.getTime()>=c.getTime()?r:r-1}function Mt(e,t){const a=Nt(e),r=+At(a,t)-+function(e,t){const a=wt(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Et(e,t),n=kt(e,0);return n.setFullYear(s,0,r),n.setHours(0,0,0,0),At(n,t)}(a,t);return Math.round(r/jt)+1}function It(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const Rt={y(e,t){const a=e.getFullYear(),r=a>0?a:1-a;return It("yy"===t?r%100:r,t.length)},M(e,t){const a=e.getMonth();return"M"===t?String(a+1):It(a+1,2)},d:(e,t)=>It(e.getDate(),t.length),a(e,t){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];default:return"am"===a?"a.m.":"p.m."}},h:(e,t)=>It(e.getHours()%12||12,t.length),H:(e,t)=>It(e.getHours(),t.length),m:(e,t)=>It(e.getMinutes(),t.length),s:(e,t)=>It(e.getSeconds(),t.length),S(e,t){const a=t.length,r=e.getMilliseconds();return It(Math.trunc(r*Math.pow(10,a-3)),t.length)}},Lt="midnight",Ft="noon",zt="morning",Ut="afternoon",Ot="evening",Bt="night",qt={G:function(e,t,a){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return a.era(r,{width:"abbreviated"});case"GGGGG":return a.era(r,{width:"narrow"});default:return a.era(r,{width:"wide"})}},y:function(e,t,a){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return a.ordinalNumber(r,{unit:"year"})}return Rt.y(e,t)},Y:function(e,t,a,r){const s=Et(e,r),n=s>0?s:1-s;if("YY"===t){return It(n%100,2)}return"Yo"===t?a.ordinalNumber(n,{unit:"year"}):It(n,t.length)},R:function(e,t){return It(Dt(e),t.length)},u:function(e,t){return It(e.getFullYear(),t.length)},Q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return It(r,2);case"Qo":return a.ordinalNumber(r,{unit:"quarter"});case"QQQ":return a.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(r,{width:"narrow",context:"formatting"});default:return a.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return It(r,2);case"qo":return a.ordinalNumber(r,{unit:"quarter"});case"qqq":return a.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(r,{width:"narrow",context:"standalone"});default:return a.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,a){const r=e.getMonth();switch(t){case"M":case"MM":return Rt.M(e,t);case"Mo":return a.ordinalNumber(r+1,{unit:"month"});case"MMM":return a.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(r,{width:"narrow",context:"formatting"});default:return a.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,a){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return It(r+1,2);case"Lo":return a.ordinalNumber(r+1,{unit:"month"});case"LLL":return a.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(r,{width:"narrow",context:"standalone"});default:return a.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,a,r){const s=Mt(e,r);return"wo"===t?a.ordinalNumber(s,{unit:"week"}):It(s,t.length)},I:function(e,t,a){const r=Pt(e);return"Io"===t?a.ordinalNumber(r,{unit:"week"}):It(r,t.length)},d:function(e,t,a){return"do"===t?a.ordinalNumber(e.getDate(),{unit:"date"}):Rt.d(e,t)},D:function(e,t,a){const r=St(e);return"Do"===t?a.ordinalNumber(r,{unit:"dayOfYear"}):It(r,t.length)},E:function(e,t,a){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return a.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return It(n,2);case"eo":return a.ordinalNumber(n,{unit:"day"});case"eee":return a.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"});default:return a.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return It(n,t.length);case"co":return a.ordinalNumber(n,{unit:"day"});case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"});default:return a.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,a){const r=e.getDay(),s=0===r?7:r;switch(t){case"i":return String(s);case"ii":return It(s,t.length);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return a.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,a){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(r,{width:"narrow",context:"formatting"});default:return a.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,a){const r=e.getHours();let s;switch(s=12===r?Ft:0===r?Lt:r/12>=1?"pm":"am",t){case"b":case"bb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,a){const r=e.getHours();let s;switch(s=r>=17?Ot:r>=12?Ut:r>=4?zt:Bt,t){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,a){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),a.ordinalNumber(t,{unit:"hour"})}return Rt.h(e,t)},H:function(e,t,a){return"Ho"===t?a.ordinalNumber(e.getHours(),{unit:"hour"}):Rt.H(e,t)},K:function(e,t,a){const r=e.getHours()%12;return"Ko"===t?a.ordinalNumber(r,{unit:"hour"}):It(r,t.length)},k:function(e,t,a){let r=e.getHours();return 0===r&&(r=24),"ko"===t?a.ordinalNumber(r,{unit:"hour"}):It(r,t.length)},m:function(e,t,a){return"mo"===t?a.ordinalNumber(e.getMinutes(),{unit:"minute"}):Rt.m(e,t)},s:function(e,t,a){return"so"===t?a.ordinalNumber(e.getSeconds(),{unit:"second"}):Rt.s(e,t)},S:function(e,t){return Rt.S(e,t)},X:function(e,t,a){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return $t(r);case"XXXX":case"XX":return Wt(r);default:return Wt(r,":")}},x:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"x":return $t(r);case"xxxx":case"xx":return Wt(r);default:return Wt(r,":")}},O:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Vt(r,":");default:return"GMT"+Wt(r,":")}},z:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Vt(r,":");default:return"GMT"+Wt(r,":")}},t:function(e,t,a){return It(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,a){return It(e.getTime(),t.length)}};function Vt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),n=r%60;return 0===n?a+String(s):a+String(s)+t+It(n,2)}function $t(e,t){if(e%60==0){return(e>0?"-":"+")+It(Math.abs(e)/60,2)}return Wt(e,t)}function Wt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+It(Math.trunc(r/60),2)+t+It(r%60,2)}const Ht=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Gt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Kt={p:Gt,P:(e,t)=>{const a=e.match(/(P+)(p+)?/)||[],r=a[1],s=a[2];if(!s)return Ht(e,t);let n;switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Ht(r,t)).replace("{{time}}",Gt(s,t))}},Yt=/^D+$/,Qt=/^Y+$/,Xt=["D","DD","YY","YYYY"];function Jt(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const a=Nt(e);return!isNaN(Number(a))}const Zt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ea=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ta=/^'([^]*?)'?$/,aa=/''/g,ra=/[a-zA-Z]/;function sa(e,t,a){const r=wt(),s=a?.locale??r.locale??bt,n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=Nt(e);if(!Jt(i))throw new RangeError("Invalid time value");let l=t.match(ea).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,Kt[t])(e,s.formatLong)}return e}).join("").match(Zt).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:na(e)};if(qt[t])return{isToken:!0,value:e};if(t.match(ra))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});s.localize.preprocessor&&(l=s.localize.preprocessor(i,l));const c={firstWeekContainsDate:n,weekStartsOn:o,locale:s};return l.map(r=>{if(!r.isToken)return r.value;const n=r.value;(!a?.useAdditionalWeekYearTokens&&function(e){return Qt.test(e)}(n)||!a?.useAdditionalDayOfYearTokens&&function(e){return Yt.test(e)}(n))&&function(e,t,a){const r=function(e,t,a){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,a);if(Xt.includes(e))throw new RangeError(r)}(n,t,String(e));return(0,qt[n[0]])(i,n,s.localize,c)}).join("")}function na(e){const t=e.match(ta);return t?t[1].replace(aa,"'"):e}function oa(e,t,a){const r=i.getDefaultOptions(),s=function(e,t,a){return new Intl.DateTimeFormat(a?[a.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,a.timeZone,a.locale??r.locale);return"formatToParts"in s?function(e,t){const a=e.formatToParts(t);for(let r=a.length-1;r>=0;--r)if("timeZoneName"===a[r].type)return a[r].value;return}(s,t):function(e,t){const a=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(a);return r?r[0].substr(1):""}(s,t)}function ia(e,t){const a=function(e){ca[e]||(ca[e]=ua?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return ca[e]}(t);return"formatToParts"in a?function(e,t){try{const a=e.formatToParts(t),r=[];for(let e=0;e<a.length;e++){const t=la[a[e].type];void 0!==t&&(r[t]=parseInt(a[e].value,10))}return r}catch(a){if(a instanceof RangeError)return[NaN];throw a}}(a,e):function(e,t){const a=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}(a,e)}const la={year:0,month:1,day:2,hour:3,minute:4,second:5};const ca={},da=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),ua="06/25/2014, 00:00:00"===da||"06/25/2014 00:00:00"===da;function ma(e,t,a,r,s,n,o){const i=new Date(0);return i.setUTCFullYear(e,t,a),i.setUTCHours(r,s,n,o),i}const pa=36e5,ha={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function xa(e,t,a){if(!e)return 0;let r,s,n=ha.timezoneZ.exec(e);if(n)return 0;if(n=ha.timezoneHH.exec(e),n)return r=parseInt(n[1],10),ga(r)?-r*pa:NaN;if(n=ha.timezoneHHMM.exec(e),n){r=parseInt(n[2],10);const e=parseInt(n[3],10);return ga(r,e)?(s=Math.abs(r)*pa+6e4*e,"+"===n[1]?-s:s):NaN}if(function(e){if(va[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),va[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());const r=a?t:function(e){return ma(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),s=fa(r,e),n=a?s:function(e,t,a){const r=e.getTime();let s=r-t;const n=fa(new Date(s),a);if(t===n)return t;s-=n-t;const o=fa(new Date(s),a);if(n===o)return n;return Math.max(n,o)}(t,s,e);return-n}return NaN}function fa(e,t){const a=ia(e,t),r=ma(a[0],a[1]-1,a[2],a[3]%24,a[4],a[5],0).getTime();let s=e.getTime();const n=s%1e3;return s-=n>=0?n:1e3+n,r-s}function ga(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const va={};const ba={X:function(e,t,a){const r=ya(a.timeZone,e);if(0===r)return"Z";switch(t){case"X":return Na(r);case"XXXX":case"XX":return ja(r);default:return ja(r,":")}},x:function(e,t,a){const r=ya(a.timeZone,e);switch(t){case"x":return Na(r);case"xxxx":case"xx":return ja(r);default:return ja(r,":")}},O:function(e,t,a){const r=ya(a.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),n=r%60;if(0===n)return a+String(s);return a+String(s)+t+wa(n,2)}(r,":");default:return"GMT"+ja(r,":")}},z:function(e,t,a){switch(t){case"z":case"zz":case"zzz":return oa("short",e,a);default:return oa("long",e,a)}}};function ya(e,t){const a=e?xa(e,t,!0)/6e4:t?.getTimezoneOffset()??0;if(Number.isNaN(a))throw new RangeError("Invalid time zone specified: "+e);return a}function wa(e,t){const a=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return a+r}function ja(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+wa(Math.floor(r/60),2)+t+wa(Math.floor(r%60),2)}function Na(e,t){if(e%60==0){return(e>0?"-":"+")+wa(Math.abs(e)/60,2)}return ja(e,t)}function _a(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Ca=36e5,ka=6e4,Sa={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Aa(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const a=null==t.additionalDigits?2:Number(t.additionalDigits);if(2!==a&&1!==a&&0!==a)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const r=function(e){const t={};let a,r=Sa.dateTimePattern.exec(e);r?(t.date=r[1],a=r[3]):(r=Sa.datePattern.exec(e),r?(t.date=r[1],a=r[2]):(t.date=null,a=e));if(a){const e=Sa.timeZone.exec(a);e?(t.time=a.replace(e[1],""),t.timeZone=e[1].trim()):t.time=a}return t}(e),{year:s,restDateString:n}=function(e,t){if(e){const a=Sa.YYY[t],r=Sa.YYYYY[t];let s=Sa.YYYY.exec(e)||r.exec(e);if(s){const t=s[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(s=Sa.YY.exec(e)||a.exec(e),s){const t=s[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(r.date,a),o=function(e,t){if(null===t)return null;let a,r,s;if(!e||!e.length)return a=new Date(0),a.setUTCFullYear(t),a;let n=Sa.MM.exec(e);if(n)return a=new Date(0),r=parseInt(n[1],10)-1,Ma(t,r)?(a.setUTCFullYear(t,r),a):new Date(NaN);if(n=Sa.DDD.exec(e),n){a=new Date(0);const e=parseInt(n[1],10);return function(e,t){if(t<1)return!1;const a=Ea(e);if(a&&t>366)return!1;if(!a&&t>365)return!1;return!0}(t,e)?(a.setUTCFullYear(t,0,e),a):new Date(NaN)}if(n=Sa.MMDD.exec(e),n){a=new Date(0),r=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return Ma(t,r,e)?(a.setUTCFullYear(t,r,e),a):new Date(NaN)}if(n=Sa.Www.exec(e),n)return s=parseInt(n[1],10)-1,Ia(s)?Ta(t,s):new Date(NaN);if(n=Sa.WwwD.exec(e),n){s=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return Ia(s,e)?Ta(t,s,e):new Date(NaN)}return null}(n,s);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let a,s=0;if(r.time&&(s=function(e){let t,a,r=Sa.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),Ra(t)?t%24*Ca:NaN;if(r=Sa.HHMM.exec(e),r)return t=parseInt(r[1],10),a=parseFloat(r[2].replace(",",".")),Ra(t,a)?t%24*Ca+a*ka:NaN;if(r=Sa.HHMMSS.exec(e),r){t=parseInt(r[1],10),a=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return Ra(t,a,e)?t%24*Ca+a*ka+1e3*e:NaN}return null}(r.time),null===s||isNaN(s)))return new Date(NaN);if(r.timeZone||t.timeZone){if(a=xa(r.timeZone||t.timeZone,new Date(e+s)),isNaN(a))return new Date(NaN)}else a=_a(new Date(e+s)),a=_a(new Date(e+s+a));return new Date(e+s+a)}return new Date(NaN)}function Ta(e,t,a){t=t||0,a=a||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const s=7*t+a+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}const Da=[31,28,31,30,31,30,31,31,30,31,30,31],Pa=[31,29,31,30,31,30,31,31,30,31,30,31];function Ea(e){return e%400==0||e%4==0&&e%100!=0}function Ma(e,t,a){if(t<0||t>11)return!1;if(null!=a){if(a<1)return!1;const r=Ea(e);if(r&&a>Pa[t])return!1;if(!r&&a>Da[t])return!1}return!0}function Ia(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function Ra(e,t,a){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==a||!(a<0||a>=60)))}const La=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Fa(e,t,a,r){return function(e,t,a={}){const r=(t=String(t)).match(La);if(r){const s=Aa(a.originalDate||e,a);t=r.reduce(function(e,t){if("'"===t[0])return e;const r=e.indexOf(t),n="'"===e[r-1],o=e.replace(t,"'"+ba[t[0]](s,t,a)+"'");return n?o.substring(0,r-1)+o.substring(r+1):o},t)}return sa(e,t,a)}(function(e,t,a){const r=xa(t,e=Aa(e,a),!0),s=new Date(e.getTime()-r),n=new Date(0);return n.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),n.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),n}(e,t,{timeZone:(r={...r,timeZone:t,originalDate:e}).timeZone}),a,r)}const za={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Ua={date:ut({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:ut({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:ut({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Oa={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Ba={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},qa={ordinalNumber:(e,t)=>Number(e)+"º",era:ht({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:ht({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ht({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:ht({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:ht({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},Va={ordinalNumber:gt({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ft({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:ft({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ft({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:ft({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ft({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},$a={code:"es",formatDistance:(e,t,a)=>{let r;const s=za[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},formatLong:Ua,formatRelative:(e,t,a,r)=>1!==t.getHours()?Ba[e]:Oa[e],localize:qa,match:Va,options:{weekStartsOn:1,firstWeekContainsDate:1}},Wa={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ha={date:ut({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:ut({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:ut({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ga={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Ka={ordinalNumber:(e,t)=>{const a=Number(e);return"week"===t?.unit?a+"ª":a+"º"},era:ht({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:ht({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ht({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:ht({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:ht({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},Ya={ordinalNumber:gt({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ft({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:ft({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ft({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:ft({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:ft({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},Qa={code:"pt-BR",formatDistance:(e,t,a)=>{let r;const s=Wa[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",String(t)),a?.addSuffix?a.comparison&&a.comparison>0?"em "+r:"há "+r:r},formatLong:Ha,formatRelative:(e,t,a,r)=>{const s=Ga[e];return"function"==typeof s?s(t):s},localize:Ka,match:Ya,options:{weekStartsOn:0,firstWeekContainsDate:1}},Xa=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],Ja=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],Za=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],er="pt-BR",tr="dd/MM/yyyy HH:mm",ar="America/Sao_Paulo",rr=e=>Xa.some(t=>t.value===e),sr=e=>Za.some(t=>t.value===e),nr=()=>{if("undefined"==typeof navigator)return er;const e=navigator.language;if(rr(e))return e;const t=e.split("-")[0],a=Xa.find(e=>e.value.startsWith(t));return a?.value||er},or=()=>{if("undefined"==typeof Intl)return ar;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return sr(e)?e:ar}catch{return ar}},ir=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||tr),lr={"pt-BR":Qa,"en-US":bt,"es-ES":$a},cr=(e,t=tr,a=ar,r=er)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const n=lr[r]||Qa;try{return Fa(s,a,t,{locale:n})}catch(o){return Fa(s,ar,t,{locale:n})}},dr=(e,t=er,a=ar)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const s=lr[t]||Qa;try{return Fa(r,a,"PP",{locale:s})}catch(n){return Fa(r,ar,"PP",{locale:s})}};function ur(e){const t=e.replace("#",""),a=3===t.length?t.split("").map(e=>e+e).join(""):t;return{r:parseInt(a.substring(0,2),16),g:parseInt(a.substring(2,4),16),b:parseInt(a.substring(4,6),16)}}function mr(e,t=.1){const{r:a,g:r,b:s}=ur(e);return`rgba(${a}, ${r}, ${s}, ${t})`}function pr(e){const{r:t,g:a,b:r}=ur(e),[s,n,o]=[t,a,r].map(e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)});return.2126*s+.7152*n+.0722*o}function hr(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function xr(e,t){return t?e.replace(/\{alias\}/g,t):e}function fr(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const a=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}const gr=["hint","details","code","where","schema","table","column"],vr="Ocorreu um erro ao processar sua solicitação.",br=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function yr(e){const t=function(e){if(!e)return vr;if("string"==typeof e)return e;if(e instanceof Error)return e.message||vr;if("object"==typeof e&&"message"in e)return String(e.message);return vr}(e);return Ie()?t:br.some(e=>e.test(t))?vr:t}function wr(...e){return o.twMerge(n.clsx(e))}const jr=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(jr);if("object"==typeof e&&e.constructor===Object){const t={};for(const[a,r]of Object.entries(e))t[a]=jr(r);return t}return e},Nr=s.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),_r=te.forwardRef(({className:e,variant:a,size:s,asChild:n=!1,...o},i)=>{const l=n?r.Slot:"button";return t.jsx(l,{className:wr(Nr({variant:a,size:s,className:e})),ref:i,...o})});_r.displayName="Button";const Cr=a.forwardRef(({className:e,children:a,variant:r="action",...s},n)=>t.jsx(_r,{ref:n,variant:r,size:"icon",className:wr("h-8 w-8",e),...s,children:a||t.jsx(c.EllipsisVertical,{size:16})}));Cr.displayName="ActionButton";const kr=te.forwardRef(({className:e,type:a,showCharCount:r,maxLength:s,onChange:n,...o},i)=>{const[l,c]=te.useState(0);te.useEffect(()=>{"string"==typeof o.value?c(o.value.length):"string"==typeof o.defaultValue&&c(o.defaultValue.length)},[o.value,o.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("input",{type:a,className:wr("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:s,onChange:e=>{c(e.target.value.length),n?.(e)},...o}),r&&s&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",s]})]})});kr.displayName="Input";const Sr=s.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ar=te.forwardRef(({className:e,...a},r)=>t.jsx(re.Root,{ref:r,className:wr(Sr(),e),...a}));Ar.displayName=re.Root.displayName;const Tr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("rounded-lg border bg-card text-card-foreground shadow-sm",e),...a}));Tr.displayName="Card";const Dr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("flex flex-col space-y-1.5 p-6",e),...a}));Dr.displayName="CardHeader";const Pr=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:wr("text-2xl font-semibold leading-none tracking-tight",e),...a}));Pr.displayName="CardTitle";const Er=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));Er.displayName="CardDescription";const Mr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("p-6 pt-0",e),...a}));Mr.displayName="CardContent";const Ir=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("flex items-center p-6 pt-0",e),...a}));Ir.displayName="CardFooter";const Rr=te.forwardRef(({className:e,orientation:a="horizontal",decorative:r=!0,...s},n)=>t.jsx(ne.Root,{ref:n,decorative:r,orientation:a,className:wr("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Rr.displayName=ne.Root.displayName;const Lr=oe.Root,Fr=oe.Trigger,zr=oe.Portal,Ur=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Overlay,{className:wr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));Ur.displayName=oe.Overlay.displayName;const Or=te.forwardRef(({className:e,...a},r)=>t.jsxs(zr,{children:[t.jsx(Ur,{}),t.jsx(oe.Content,{ref:r,className:wr("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a})]}));Or.displayName=oe.Content.displayName;const Br=({className:e,...a})=>t.jsx("div",{className:wr("flex flex-col space-y-2 text-center sm:text-left",e),...a});Br.displayName="AlertDialogHeader";const qr=({className:e,...a})=>t.jsx("div",{className:wr("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});qr.displayName="AlertDialogFooter";const Vr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Title,{ref:r,className:wr("text-lg font-semibold",e),...a}));Vr.displayName=oe.Title.displayName;const $r=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Description,{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));$r.displayName=oe.Description.displayName;const Wr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Action,{ref:r,className:wr(Nr(),e),...a}));Wr.displayName=oe.Action.displayName;const Hr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Cancel,{ref:r,className:wr(Nr({variant:"outline"}),"mt-2 sm:mt-0",e),...a}));Hr.displayName=oe.Cancel.displayName;const Gr=se.Root,Kr=se.Trigger,Yr=se.Portal,Qr=se.Close,Xr=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{ref:r,className:wr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));Xr.displayName=se.Overlay.displayName;const Jr={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},Zr=te.forwardRef(({className:a,children:r,size:s,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:d,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:v,onInteractOutside:b,onEscapeKeyDown:y,...w},j)=>{const[N,_]=te.useState(!1),C=te.useRef(null),k=te.useRef(!1),S=s??(i||l||d||u||m||p?void 0:"md"),A=S?Jr[S]:{},T={...i??A.width?{width:i??A.width}:{},...l??A.minWidth?{minWidth:l??A.minWidth}:{},...d??A.maxWidth?{maxWidth:d??A.maxWidth}:{},...u??A.height?{height:u??A.height}:{},...m??A.minHeight?{minHeight:m??A.minHeight}:{},...p??A.maxHeight?{maxHeight:p??A.maxHeight}:{},...v},D=te.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),P=te.useRef(null),E="destructive"!==n;if("development"===process.env.NODE_ENV&&r){const e=te.Children.toArray(r);e.some(e=>te.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>te.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t.jsxs(Yr,{children:[t.jsx(Xr,{}),t.jsxs(se.Content,{ref:j,className:wr("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",a),style:T,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?b?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void D(()=>{k.current=!0,P.current?.click()})):void y?.(e);e.preventDefault()},...w,children:[r,E&&t.jsxs(se.Close,{ref:P,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),D(()=>{k.current=!0,P.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]}),t.jsx(Lr,{open:N,onOpenChange:_,children:t.jsxs(Or,{children:[t.jsxs(Br,{children:[t.jsx(Vr,{children:h}),t.jsx($r,{children:x})]}),t.jsxs(qr,{children:[t.jsx(Hr,{onClick:()=>{_(!1),C.current=null},children:f}),t.jsx(Wr,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});Zr.displayName=se.Content.displayName;const es=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:wr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Rr,{className:"mt-2"})]});es.displayName="DialogHeader";const ts=({className:e,...a})=>t.jsx("div",{className:wr("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...a});ts.displayName="DialogBody";const as=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Rr,{className:"mb-4"}),t.jsx("div",{className:wr("flex flex-row justify-end gap-2",e),...r,children:a})]});as.displayName="DialogFooter";const rs=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:wr("text-xl font-semibold leading-none tracking-tight",e),...a}));rs.displayName=se.Title.displayName;const ss=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));ss.displayName=se.Description.displayName;const ns=h.FormProvider,os=te.createContext({}),is=()=>{const e=te.useContext(os),t=te.useContext(ls),{getFieldState:a,formState:r}=h.useFormContext(),s=a(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=t;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...s}},ls=te.createContext({}),cs=te.forwardRef(({className:e,...a},r)=>{const s=te.useId();return t.jsx(ls.Provider,{value:{id:s},children:t.jsx("div",{ref:r,className:wr("space-y-1.5",e),...a})})});cs.displayName="FormItem";const ds=te.forwardRef(({className:e,...a},r)=>{const{error:s,formItemId:n}=is();return t.jsx(Ar,{ref:r,className:wr(s&&"text-destructive",e),htmlFor:n,...a})});ds.displayName="FormLabel";const us=te.forwardRef(({...e},a)=>{const{error:s,formItemId:n,formDescriptionId:o,formMessageId:i}=is();return t.jsx(r.Slot,{ref:a,id:n,"aria-describedby":s?`${o} ${i}`:`${o}`,"aria-invalid":!!s,...e})});us.displayName="FormControl";const ms=te.forwardRef(({className:e,...a},r)=>{const{formDescriptionId:s}=is();return t.jsx("p",{ref:r,id:s,className:wr("text-sm text-muted-foreground",e),...a})});ms.displayName="FormDescription";const ps=te.forwardRef(({className:e,children:a,...r},s)=>{const{error:n,formMessageId:o}=is(),i=n?String(n?.message):a;return i?t.jsx("p",{ref:s,id:o,className:wr("text-sm font-medium text-destructive",e),...r,children:i}):null});ps.displayName="FormMessage";const hs=te.createContext({showCheck:!1}),xs=({showCheck:e=!1,...a})=>t.jsx(hs.Provider,{value:{showCheck:e},children:t.jsx(ie.Root,{...a})}),fs=ie.Group,gs=ie.Value,vs=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ie.Trigger,{ref:s,className:wr("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...r,children:[a,t.jsx(ie.Icon,{asChild:!0,children:t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));vs.displayName=ie.Trigger.displayName;const bs=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollUpButton,{ref:r,className:wr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronUp,{className:"h-4 w-4"})}));bs.displayName=ie.ScrollUpButton.displayName;const ys=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollDownButton,{ref:r,className:wr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronDown,{className:"h-4 w-4"})}));ys.displayName=ie.ScrollDownButton.displayName;const ws=te.forwardRef(({className:e,children:a,position:r="popper",container:s,collisionBoundary:n,...o},i)=>t.jsx(ie.Portal,{container:s,children:t.jsxs(ie.Content,{ref:i,className:wr("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,collisionBoundary:n,...o,children:[t.jsx(bs,{}),t.jsx(ie.Viewport,{className:wr("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),t.jsx(ys,{})]})}));ws.displayName=ie.Content.displayName;const js=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Label,{ref:r,className:wr("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...a}));js.displayName=ie.Label.displayName;const Ns=te.forwardRef(({className:e,children:a,...r},s)=>{const{showCheck:n}=te.useContext(hs);return t.jsxs(ie.Item,{ref:s,className:wr("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...r,children:[n&&t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ie.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),t.jsx(ie.ItemText,{children:a})]})});Ns.displayName=ie.Item.displayName;const _s=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Separator,{ref:r,className:wr("-mx-1 my-1 h-px bg-muted",e),...a}));_s.displayName=ie.Separator.displayName;const Cs=te.forwardRef(({className:e,...a},r)=>t.jsx(le.Root,{ref:r,className:wr("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:t.jsx(le.Indicator,{className:wr("flex items-center justify-center text-current"),children:t.jsx(c.Check,{className:"h-4 w-4"})})}));Cs.displayName=le.Root.displayName;const ks=te.forwardRef(({className:e,showCharCount:a,maxLength:r,onChange:s,...n},o)=>{const[i,l]=te.useState(0);te.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("textarea",{className:wr("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:r,onChange:e=>{l(e.target.value.length),s?.(e)},...n}),a&&r&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",r]})]})});ks.displayName="Textarea";const Ss=s.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),As=te.forwardRef(({className:e,variant:a,...r},s)=>t.jsx("div",{ref:s,className:wr(Ss({variant:a}),e),...r}));As.displayName="Badge";const Ts={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Ds({size:e="md",className:a}){return t.jsx(c.Loader2,{className:wr("animate-spin text-muted-foreground",Ts[e],a)})}function Ps({isLoading:e,children:a,className:r,type:s="spinner",size:n="md"}){return e?"overlay"===s?t.jsxs("div",{className:wr("relative",r),children:[a,t.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:t.jsx(Ds,{size:n})})]}):"skeleton"===s?t.jsx("div",{className:wr("animate-pulse",r),children:t.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):t.jsx("div",{className:wr("flex items-center justify-center py-8",r),children:t.jsx(Ds,{size:n})}):t.jsx(t.Fragment,{children:a})}const Es=({...e})=>t.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:t.jsx(c.CircleCheckIcon,{className:"h-4 w-4"}),info:t.jsx(c.InfoIcon,{className:"h-4 w-4"}),warning:t.jsx(c.TriangleAlertIcon,{className:"h-4 w-4"}),error:t.jsx(c.OctagonXIcon,{className:"h-4 w-4"}),loading:t.jsx(c.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),Ms=ce.Root,Is=ce.Trigger,Rs=ce.Group,Ls=ce.Portal,Fs=ce.Sub,zs=ce.RadioGroup,Us=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(ce.SubTrigger,{ref:n,className:wr("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Us.displayName=ce.SubTrigger.displayName;const Os=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.SubContent,{ref:r,className:wr("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Os.displayName=ce.SubContent.displayName;const Bs=te.forwardRef(({className:e,sideOffset:a=4,...r},s)=>t.jsx(ce.Portal,{children:t.jsx(ce.Content,{ref:s,sideOffset:a,className:wr("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Bs.displayName=ce.Content.displayName;const qs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Item,{ref:s,className:wr("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));qs.displayName=ce.Item.displayName;const Vs=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(ce.CheckboxItem,{ref:n,className:wr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Vs.displayName=ce.CheckboxItem.displayName;const $s=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ce.RadioItem,{ref:s,className:wr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));$s.displayName=ce.RadioItem.displayName;const Ws=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Label,{ref:s,className:wr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Ws.displayName=ce.Label.displayName;const Hs=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.Separator,{ref:r,className:wr("-mx-1 my-1 h-px bg-muted",e),...a}));Hs.displayName=ce.Separator.displayName;const Gs=({className:e,...a})=>t.jsx("span",{className:wr("ml-auto text-xs tracking-widest opacity-60",e),...a});Gs.displayName="DropdownMenuShortcut";const Ks=({delayDuration:e=300,...a})=>t.jsx(de.Provider,{delayDuration:e,...a}),Ys=de.Root,Qs=de.Trigger,Xs=te.forwardRef(({className:e,sideOffset:a=4,container:r,...s},n)=>t.jsx(de.Portal,{container:r,children:t.jsx(de.Content,{ref:n,sideOffset:a,className:wr("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Xs.displayName=de.Content.displayName;const Js=te.forwardRef(({children:e,disabledReason:a,className:r},s)=>{const n=t.jsx(qs,{ref:s,className:wr("opacity-50 cursor-not-allowed pointer-events-auto",r),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return a?t.jsx(Ks,{delayDuration:100,children:t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("div",{className:"w-full",children:n})}),t.jsx(Xs,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:a})]})}):n});Js.displayName="DisabledMenuItem";const Zs=ue.Root,en=ue.Trigger,tn=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,container:s,...n},o)=>t.jsx(ue.Portal,{container:s,children:t.jsx(ue.Content,{ref:o,align:a,sideOffset:r,className:wr("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));tn.displayName=ue.Content.displayName;const an=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a}));an.displayName="Command";const rn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:t.jsx("input",{ref:r,className:wr("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...a})}));rn.displayName="CommandInput";const sn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a}));sn.displayName="CommandList";const nn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("py-6 text-center text-sm text-muted-foreground",e),...a}));nn.displayName="CommandEmpty";const on=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a}));on.displayName="CommandGroup";const ln=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("-mx-1 h-px bg-border",e),...a}));ln.displayName="CommandSeparator";const cn=te.forwardRef(({className:e,disabled:a,onSelect:r,value:s,...n},o)=>t.jsx("div",{ref:o,className:wr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":a,onClick:()=>!a&&r?.(s||""),...n}));cn.displayName="CommandItem";const dn=({className:e,...a})=>t.jsx("span",{className:wr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});function un({className:e,...a}){return t.jsx("div",{className:wr("animate-pulse rounded-md bg-muted",e),...a})}dn.displayName="CommandShortcut";const mn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function pn({multiple:r,options:s,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f,required:g,className:v,sortOptions:b,maxDisplayedBadges:y,popoverContainer:w,onOpen:j,onClose:N,clearable:_,showCheck:C}){const[k,S]=a.useState(!1),[A,T]=a.useState(""),D=a.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),P=a.useMemo(()=>{if(!w)return;let e=w,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[w]),E=a.useMemo(()=>{const e=s.map(e=>({original:e,value:i(e),label:l(e)}));return b?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[s,i,l,b]),M=a.useMemo(()=>{if(!A)return E;const e=mn(A);return E.filter(t=>mn(t.label).includes(e))},[E,A]),I=a.useMemo(()=>E.filter(e=>D.includes(e.value)),[E,D]),R=e=>{S(e),e?j?.():(T(""),N?.())},L=(e,t)=>{t.preventDefault(),t.stopPropagation(),o&&o(r?D.filter(t=>t!==e):"")},F=y?I.slice(0,y):I,z=y&&I.length>y?I.length-y:0;return t.jsxs("div",{className:wr("space-y-2",v),children:[m&&t.jsxs(Ar,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(Zs,{open:k,onOpenChange:R,modal:!1,children:[r?t.jsx(en,{asChild:!0,children:t.jsxs("div",{role:"combobox","aria-expanded":k,"aria-disabled":f,tabIndex:f?-1:0,onKeyDown:e=>{f||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R(!k))},className:wr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",f&&"pointer-events-none opacity-50 cursor-not-allowed",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex items-center gap-2",children:[p&&t.jsx(p,{className:"h-4 w-4"}),u]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[F.map(e=>t.jsxs(As,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&L(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>L(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),z>0&&t.jsxs(As,{variant:"outline",className:"gap-1",children:["+",z]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t.jsxs("div",{className:"relative",children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{variant:"outline",role:"combobox","aria-expanded":k,disabled:f,className:wr("relative w-full justify-start min-h-10 h-auto pr-10",_&&I.length>0&&"pr-16",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:u})]}):t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:I[0]?.label})]}),t.jsx(c.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),_&&I.length>0&&t.jsx("button",{type:"button",disabled:f,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>L("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(tn,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:P,collisionBoundary:P,children:t.jsxs(an,{children:[t.jsxs("div",{className:"relative",children:[t.jsx(rn,{placeholder:x,value:A,onChange:e=>T(e.target.value)}),A&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(sn,{children:0===s.length?t.jsx(nn,{children:h}):0===M.length?t.jsx(nn,{children:e.t("no_results")}):t.jsx(on,{children:M.map(e=>{const a=D.includes(e.value);return t.jsxs(cn,{value:e.value,onSelect:()=>(e=>{if(o)if(r){const t=D.includes(e)?D.filter(t=>t!==e):[...D,e];o(t)}else o(e),S(!1)})(e.value),className:wr("cursor-pointer",a&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[C&&t.jsx(c.Check,{className:wr("mr-2 h-4 w-4",a?"opacity-100":"opacity-0")}),d?d(e.original):e.label]},e.value)})})})]})})]})]})}function hn({multiple:e=!1,options:a,items:r,value:s,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f=!1,required:g=!1,isLoading:v=!1,error:b,className:w,sortOptions:j=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:T}=y.useTranslation(),D=a||r||[],P=o||n,E=u||T("select_placeholder","Selecione..."),M=h||T("no_results",T("no_results")),I=x||T("search_placeholder","Pesquisar...");if(v)return t.jsxs("div",{className:wr("space-y-2",w),children:[m&&t.jsxs(Ar,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(un,{className:"h-10 w-full"})]});const R="string"==typeof b?b:b instanceof Error?b.message:b?T("error_loading",T("error_loading")):void 0;return R?t.jsxs("div",{className:wr("space-y-2",w),children:[m&&t.jsxs(Ar,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:R})]})]}):t.jsx(pn,{multiple:e,options:D,value:s||(e?[]:""),onChange:P,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:E,label:m,icon:p,emptyMessage:M,searchPlaceholder:I,disabled:f,required:g,className:w,sortOptions:j,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const xn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function fn(e,t){if(!t)return null;const a=xn(t),r=[];for(const s of e){const e=xn(s.label).includes(a),n=s.children?fn(s.children,t):null,o=n&&n.length>0;(e||o)&&r.push({...s,children:e?s.children:o?n:s.children})}return r}function gn(e,t){for(const a of e){if(a.value===t)return a.label;if(a.children){const e=gn(a.children,t);if(e)return e}}}function vn({node:e,level:a,expanded:r,onToggleExpand:s,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,d=n.includes(e.value),u=8+20*a;return t.jsxs("div",{role:"treeitem","aria-expanded":l?r:void 0,"aria-selected":d,className:wr("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(d?2:0)+"px"},children:[t.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:t=>{t.stopPropagation(),o(e.value)},children:[i&&t.jsx(c.Check,{className:wr("h-4 w-4 shrink-0",d?"opacity-100":"opacity-0")}),(()=>{const a=d?e.iconSelected??(r?e.iconOpen:null)??e.icon:r?e.iconOpen??e.icon:e.icon;return a?t.jsx(a,{className:wr("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),t.jsx("span",{className:"truncate",children:e.label})]}),l&&t.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:t=>{t.stopPropagation(),s(e.value)},tabIndex:-1,"aria-label":r?"Recolher":"Expandir",children:r?t.jsx(c.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function bn({nodes:e,level:r,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return t.jsx(t.Fragment,{children:e.map(e=>{const c=s.has(e.value);return t.jsxs(a.Fragment,{children:[t.jsx(vn,{node:e,level:r,expanded:c,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),c&&e.children&&e.children.length>0&&t.jsx(bn,{nodes:e.children,level:r+1,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function yn({multiple:e=!1,options:r,value:s,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:d,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:v,onOpen:b,onClose:w,defaultExpanded:j=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),[S,A]=a.useState(""),[T,D]=a.useState(()=>j?function(e){const t=new Set;return function e(a){for(const r of a)r.children&&r.children.length>0&&(t.add(r.value),e(r.children))}(e),t}(r):new Set),P=o||_("select_placeholder","Selecione..."),E=d||_("no_results",_("no_results")),M=u||_("search_placeholder","Pesquisar..."),I=a.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),R=a.useMemo(()=>{if(!v)return;let e=v,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[v]),L=a.useMemo(()=>fn(r,S),[r,S])??r,F=a.useMemo(()=>S?function(e,t){const a=new Set,r=xn(t);function s(e){if(!e.children||0===e.children.length)return xn(e.label).includes(r);let t=!1;for(const a of e.children)s(a)&&(t=!0);return t&&a.add(e.value),t||xn(e.label).includes(r)}for(const n of e)s(n);return a}(r,S):new Set,[r,S]),z=S?F:T,U=a.useCallback(e=>{S||D(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[S]),O=a.useMemo(()=>I.map(e=>({value:e,label:gn(r,e)||e})),[I,r]),B=e=>{k(e),e?b?.():(A(""),w?.())},q=a.useCallback(t=>{if(n)if(e){const e=I.includes(t)?I.filter(e=>e!==t):[...I,t];n(e)}else n(t),k(!1)},[n,e,I]),V=(t,a)=>{a.preventDefault(),a.stopPropagation(),n&&n(e?I.filter(e=>e!==t):"")},$=g?O.slice(0,g):O,W=g&&O.length>g?O.length-g:0;if(h)return t.jsxs("div",{className:wr("space-y-2",f),children:[i&&t.jsxs(Ar,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(un,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?t.jsxs("div",{className:wr("space-y-2",f),children:[i&&t.jsxs(Ar,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:H})]})]}):t.jsxs("div",{className:wr("space-y-2",f),children:[i&&t.jsxs(Ar,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(Zs,{open:C,onOpenChange:B,modal:!1,children:[t.jsx(en,{asChild:!0,children:e?t.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(!C))},className:wr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),P]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>t.jsxs(As,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&V(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>V(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&t.jsxs(As,{variant:"outline",className:"gap-1",children:["+",W]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t.jsxs(_r,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:wr("w-full justify-between min-h-10 h-auto font-normal",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),P]}):t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),O[0]?.label]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(tn,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(c.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:M,value:S,onChange:e=>A(e.target.value)}),S&&t.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>A(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:t.jsx("div",{role:"tree",className:"p-1",children:0===L.length?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?E:_("no_search_results",_("no_results"))}):t.jsx(bn,{nodes:L,level:0,expandedIds:z,onToggleExpand:U,selectedValues:I,onSelect:q,showCheck:N})})})]})]})]})}const wn=void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:Z&&"SCRIPT"===Z.tagName.toUpperCase()&&Z.src||new URL("index.js",document.baseURI).href}&&!1,jn=new Map;function Nn(e,t=1/0){if(!wn)return 0;const a=(jn.get(e)??0)+1;return jn.set(e,a),a}function _n(e){if(wn)try{performance.mark(`auth:${e}`)}catch{}}async function Cn(e,t){if(!wn)return t();const a=performance.now();try{return await t()}finally{performance.now()}}function kn(e){if(!wn)return;if(0===jn.size)return;const t={};for(const[a,r]of jn.entries())t[a]=r}let Sn=null;function An(e,t,a){if(!wn||!t)return;if(a&&"object"==typeof a)for(const r in a)/^co\d+$/.test(r)&&0}const Tn=()=>wn;var Dn=Object.defineProperty;const Pn=class e{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const a=(4-t.length%4)%4;return t+="=".repeat(a),t}static parseJwtPayload(t){if(Tn()){return Nn(`parseJwtPayload:${t.length}:${t.slice(-8)}`,4),Nn("parseJwtPayload:total"),function(e,t){if(!wn)return t();performance.now();try{return t()}finally{performance.now()}}(t.length,()=>e._parseJwtPayloadImpl(t))}return e._parseJwtPayloadImpl(t)}static _parseJwtPayloadImpl(e){try{const s=e.split(".");if(3!==s.length)return null;const n=s[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),t=atob(e),a=new Uint8Array(t.length);for(let s=0;s<t.length;s++)a[s]=t.charCodeAt(s);const r=new TextDecoder("utf-8").decode(a);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(n),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(a){try{const e=this.normalizeBase64Url(n),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(s){return null}}static validateTokens(e,t){const a=[],r=[];try{t.split(".")[1],e.split(".")[1];const s=this.parseJwtPayload(t),n=this.parseJwtPayload(e);if(!s){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";a.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";a.push(e),o=!1}if(s.exp&&s.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:a,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:a,errors:r}}catch(s){const e=`Erro na validação de tokens: ${s}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}};((e,t,a)=>{t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(Pn,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let En=Pn;const Mn="qualiex_access_token",In="qualiex_id_token",Rn="supabase_token",Ln="oauth_state",Fn="oauth_nonce",zn="selected_alias",Un="manual_logout",On="supabase_project_id",Bn={setAccessToken:e=>localStorage.setItem(Mn,e),getAccessToken:()=>localStorage.getItem(Mn),setIdToken:e=>localStorage.setItem(In,e),getIdToken:()=>localStorage.getItem(In),getSupabaseToken:()=>localStorage.getItem(Rn),setOAuthState:e=>sessionStorage.setItem(Ln,e),getOAuthState:()=>sessionStorage.getItem(Ln),clearOAuthState:()=>sessionStorage.removeItem(Ln),setOAuthNonce:e=>sessionStorage.setItem(Fn,e),getOAuthNonce:()=>sessionStorage.getItem(Fn),clearOAuthNonce:()=>sessionStorage.removeItem(Fn),setSelectedAlias:e=>localStorage.setItem(zn,e),getSelectedAlias:()=>localStorage.getItem(zn),clearSelectedAlias:()=>localStorage.removeItem(zn),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Bn.getAccessToken()||!Bn.getIdToken()),checkProjectMismatch:()=>{const e=Me().supabaseProjectId;if(!e)return!1;const t=localStorage.getItem(On);return t&&t!==e?(Bn.clearAll(),localStorage.setItem(On,e),!0):(t||localStorage.setItem(On,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Rn,e),Bn._clearValidationCache()},areAllTokensValid:()=>{const e=Bn.getAccessToken(),t=Bn.getIdToken();if(!e||!t)return!1;try{const a=En.validateTokens(e,t);return!!a.idTokenValid&&a.idTokenValid}catch(a){return!1}},clearExpiredTokens:()=>{let e=!1;const t=Bn.getAccessToken(),a=Bn.getIdToken(),r=Bn.getSupabaseToken();return t&&Bn.isTokenExpired(t)&&(localStorage.removeItem(Mn),e=!0),a&&Bn.isTokenExpired(a)&&(localStorage.removeItem(In),e=!0),r&&Bn.isTokenExpired(r)&&(localStorage.removeItem(Rn),e=!0),e},clearAll:()=>{localStorage.removeItem(Mn),localStorage.removeItem(In),localStorage.removeItem(Rn),localStorage.removeItem(zn),sessionStorage.removeItem(Ln),sessionStorage.removeItem(Fn),Bn._clearValidationCache()},setManualLogout:()=>localStorage.setItem(Un,"true"),isManualLogout:()=>"true"===localStorage.getItem(Un),clearManualLogout:()=>localStorage.removeItem(Un),isTokenExpired:e=>{try{return En.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Bn._validationCache.isValid=!1,Bn._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Bn.getSupabaseToken();if(!e)return!1;if(Bn.isTokenExpired(e))return Bn._clearValidationCache(),Bn._handleExpiredToken(),!1;const t=Date.now();return t-Bn._validationCache.timestamp<Bn._validationCache.cacheValidityMs?Bn._validationCache.isValid:(Bn._validationCache.isValid=!0,Bn._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>Bn.isSupabaseTokenValid()?Bn.getSupabaseToken():null,_handleExpiredToken:()=>{Bn.clearAll()},extractTokenData:()=>{if(Nn("TokenManager.extractTokenData"),!Bn.isSupabaseTokenValid())return null;const e=Bn.getSupabaseToken();if(!e)return null;try{const t=En.parseJwtPayload(e);if(!t)return null;const a=t.alias||t.default||t.user_alias,r=t.place_id||null,s=t.place_name||null;let n=t.company_id;if(!n&&a)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===a){n=e[7];break}}}return{alias:a,companyId:n,placeId:r,placeName:s,payload:t}}catch(t){return Bn._handleExpiredToken(),null}},getCompanyId:e=>{Nn("TokenManager.getCompanyId");const t=Bn.getAccessToken();if(t)try{const a=En.parseJwtPayload(t);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}const a=Bn.extractTokenData();if(a?.companyId)return a.companyId;const r=Bn.getIdToken();if(r)try{const t=En.parseJwtPayload(r);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}return null},getCompanyIdInt:e=>{Nn("TokenManager.getCompanyIdInt");const t=[Bn.getAccessToken(),Bn.getIdToken()];for(const a of t)if(a)try{const t=En.parseJwtPayload(a);if(!t)continue;for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>1&&t[0]===e)return t[1];if(!e&&t.length>1)return t[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=Bn.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{Nn("TokenManager.getAllCompaniesData");const e=Bn.getIdToken();if(!e)return[];try{const t=En.parseJwtPayload(e);if(!t)return[];const a=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&a.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return a}catch{return[]}}};var qn=Object.defineProperty,Vn=(e,t,a)=>((e,t,a)=>t in e?qn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);const $n=new class{constructor(){Vn(this,"errors",[]),Vn(this,"toastCount",0),Vn(this,"lastToastTime",0)}handleError(e,t=!0){const a="string"==typeof e?e:e.message,r=yr(a);if(this.errors.push({id:fr("short"),message:a,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),t&&this.shouldShowToast()){const e=this.getErrorTitle(r);l.toast.error(e,{description:r})}}getErrorTitle(t){const a=t.toLowerCase();return a.includes("401")||a.includes("unauthorized")||a.includes("expirou")?e.t("error_session_expired"):a.includes("token")||a.includes("autenticação")?e.t("error_authentication"):a.includes("api")||a.includes("network")?e.t("error_connection"):"Erro"}success(e,t){l.toast.success(e,{description:t})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function Wn(e){return!!e&&e.startsWith("eyJ")}let Hn=!1;var Gn=Object.defineProperty,Kn=(e,t,a)=>((e,t,a)=>t in e?Gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);function Yn(){if(Ie()){const e=Me();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}const e=(void 0).VITE_SUPABASE_URL,t=(void 0).VITE_SUPABASE_PK_OVERRIDE||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&t?{url:e,key:t}:null}const Qn=class e{constructor(e){Kn(this,"client"),Kn(this,"currentToken",null),Kn(this,"config"),this.config=e,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,t=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;Hn?Wn(t):e&&Wn(t)?Hn=!0:Wn(t)?Hn=!0:Hn=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:this.config.key};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return w.createClient(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>{const a="string"==typeof e?e:e.url;if(a.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(a.includes("apikey="))try{const e=new URL(a,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=a.startsWith("http")?e.toString():e.pathname+e.search+e.hash,s={...t,headers:{...t?.headers,apikey:this.config.key}};return fetch(r,s)}}catch{}return fetch(e,t)}}})}static getInstance(){if(!e.instance){const t=Yn();if(!t)throw new Error("[forlogic-core] Supabase não configurado. Defina VITE_SUPABASE_URL e VITE_SUPABASE_PUBLISHABLE_KEY no .env, ou não invoque getSupabaseClient() (use isSupabaseConfigured() para checar antes).");e.instance=new e(t)}return e.instance}getClient(){const e=Bn.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!En.isTokenExpired(e)}catch(t){return $n.handleError(t instanceof Error?t:"Supabase - Error validating token",!1),!1}}};Kn(Qn,"instance");let Xn=Qn;function Jn(){return Xn.getInstance().getClient()}class Zn{static async generateToken(e,t,a,r=!1){try{if(!r){const e=Bn.getSupabaseToken();if(e&&Bn.isSupabaseTokenValid())return e}const s=Jn();Nn("SupabaseTokenService.generateToken:invoke");const{data:n,error:o}=await Cn(0,()=>s.functions.invoke("validate-token",{body:{access_token:e,alias:t}}));return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(a?.(),null):n?.access_token?(Bn.setSupabaseToken(n.access_token),n.access_token):null}catch(s){return s instanceof Error&&(s.message.includes("401")||s.message.includes("Unauthorized"))&&a?.(),null}}}var eo=Object.defineProperty,to=(e,t,a)=>((e,t,a)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);class ao{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const t=Bn.getAccessToken(),a=Bn.getSelectedAlias();if(!t||!a)return null;const r=await Zn.generateToken(t,a,this.onLogoutCallback||void 0,e);return r||null}catch(t){return null}}}to(ao,"regenerationPromise",null),to(ao,"onLogoutCallback",null);class ro{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(Bn.clearAll(),window.location.href=Ue("/login"),!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const a=t.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>a.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var so=Object.defineProperty;class no{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,a=e.message||e.toString();if(401===t||a.includes("401")||a.includes("Unauthorized")){this.isRetrying=!0;try{return await ao.attemptRegeneration()?(this.isRetrying=!1,!0):(ro.handleError(e),this.isRetrying=!1,!1)}catch(r){return ro.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Bn.getAccessToken();return e?Bn.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,a)=>{((e,t,a)=>{t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,t+"",a)})(no,"isRetrying",!1);const oo=new class{get baseUrl(){return Ge()}async makeApiCall(e,t,a,r){const s=no.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const n=Bn.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!a||""===a.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":a}});if(!i.ok){const e=new Error(`API call failed: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}return await i.json()}mapToQualiexUser(e){let t;return t="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:t}}parseUsersResponse(e,t=""){let a=e;if(e.data)a=e.data;else{if(!Array.isArray(e))return $n.handleError(`[QualiexApi] Formato de resposta inesperado${t}`,!1),null;a=e}return Array.isArray(a)?a.map(e=>this.mapToQualiexUser(e)):($n.handleError(`[QualiexApi] Resposta não é um array${t}`,!1),null)}async fetchUsers(e,t,a="active"){const r={companyId:t,search:"",filterStatus:a};try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t)??[]}catch(s){if(await no.handleApiError(s))try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t," após retry")??[]}catch(n){return $n.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return $n.handleError(s instanceof Error?s.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,t,a){try{return(await this.fetchUsers(t,a)).find(t=>t.userId===e)||null}catch(r){return $n.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const a=await this.fetchUsers(e,t,"active"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async fetchAllUsersMap(e,t){const a=await this.fetchUsers(e,t,"all"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async getUsers(e,t="active"){const a=Bn.extractTokenData();return a&&a.companyId?this.fetchUsers(e,a.companyId,t):[]}async fetchSoftwares(e){try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):($n.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(t){if(await no.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(a){return $n.handleError(a instanceof Error?a:"Erro ao buscar softwares após renovação de token",!0),[]}return $n.handleError(t instanceof Error?t.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,t,a){const r=!!a?.baseUrl,s=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,n=r?a.baseUrl:void 0,o=e=>e.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1}));try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):($n.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(i){if(await no.handleApiError(i))try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):[]}catch(l){return $n.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return $n.handleError(i instanceof Error?i.message:"Erro ao buscar associações do usuário",!0),[]}}};function io(e,t){const a=t||Qe.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function lo(e,t){const a=t||Qe.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function co(e,t){const a=t||Qe.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function uo(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||io(e.idField),emailField:e.emailField||lo(e.idField),usernameField:e.usernameField||co(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:io(e),emailField:lo(e),usernameField:co(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const mo=new Map;class po{static async fetchQualiexUsers(e,t){const a=`${t}_${e}_all`,r=mo.get(a);if(r&&Date.now()-r.timestamp<3e5)return r.users;let s=await oo.fetchUsers(e,t,"all");return 0===s.length&&(s=await oo.fetchUsers(e,t,"active")),mo.set(a,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const a=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&a.add(t)}return a}static indexUsers(e){const t=new Map;for(const a of e)a.id&&t.set(a.id,a),a.userId&&t.set(a.userId,a);return t}static enrichEntity(e,t,a){const r={...e};for(const s of t){const t=e[s.idField];if(!t)continue;const n=a.get(t);if(n){if(s.nameField){r[s.nameField]||(r[s.nameField]=n.userName||null)}if(s.emailField){r[s.emailField]||(r[s.emailField]=n.userEmail||null)}if(s.usernameField){r[s.usernameField]||(r[s.usernameField]=n.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{if(!Bn.areAllTokensValid())return e;const a=Bn.extractTokenData();if(!a)return e;const{alias:r,companyId:s}=a;if(!r||!s)return e;const n=uo(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(r,s),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(a){return $n.handleError(a instanceof Error?a:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}}const ho=["responsible_name"],xo=e=>ho.includes(e);function fo(e,t,a){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:a||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:s,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,d=()=>{if(!Bn.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Jn().schema(i).from(s)},u=(e,t,a,r)=>{let s=d().select(o||"*",{count:"exact"});s=s.eq("is_removed",!1),Object.entries(r).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?s=s.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?s=s.not(e,"is",null):"is_null"===t.operator&&(s=s.is(e,null)):null!==t&&(s=s.eq(e,t)))}),s=((e,t)=>{if(t&&n.length>0){const a=n.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(a)}return e})(s,e);const i=t.includes(".");return i||xo(t)||(s=s.order(t,{ascending:"asc"===a})),{query:s,isForeignKey:i}},m=async(e,t,a,s,n)=>{const o=uo(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===t||e.emailField===t||e.usernameField===t),i=t.includes(".");if(xo(t)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const c=await po.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let d;d=i?c.sort((e,r)=>{const s=t.split(".").reduce((e,t)=>e?.[t],e)||"",n=t.split(".").reduce((e,t)=>e?.[t],r)||"",o=String(s).localeCompare(String(n),"pt-BR");return"asc"===a?o:-o}):((e,t,a)=>[...e].sort((e,r)=>{const s=e[t]||"",n=r[t]||"",o=s.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===a?o:-o}))(c,t,a);const u=((e,t=1,a=25)=>{const r=(t-1)*a,s=r+a;return{data:e.slice(r,s),pagination:{currentPage:t,totalPages:Math.ceil(e.length/a),totalItems:e.length,itemsPerPage:a,hasNextPage:s<e.length,hasPreviousPage:t>1}}})(d,s,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await po.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:t,sortField:a,sortDirection:n,page:o,limit:i,additionalFilters:d}=(e=>{const{search:t="",sortField:a="updated_at",sortDirection:r="desc",page:s=1,limit:n=25,...o}=e;return{search:t,sortField:a,sortDirection:r,page:s,limit:n,additionalFilters:o}})(e),{query:p}=u(t,a,n,d),h=((e,t,a)=>{const r=(t-1)*a,s=r+a-1;return e.range(r,s)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${s}: ${f.message}`);let v=((e,t,a,r)=>{const s=Math.ceil((t||0)/r);return{data:e,currentPage:a,totalPages:s,totalItems:t||0,itemsPerPage:r,hasNextPage:a<s,hasPreviousPage:a>1}})(x||[],g,o,i);if((e=>{if(!c||!l||0===e.length)return!1;const t=uo(r.userIdFields,r.userFieldsMapping);return e.some(e=>t.some(t=>e[t.idField]))})(v.data)){const e=await m(v.data,a,n,o,i);if(!Array.isArray(e))return e;v={...v,data:e}}return v},async getById(e){const{data:t,error:a}=await d().select(o||"*").eq("id",e).maybeSingle();if(a)throw new Error(`Error fetching ${s}: ${a.message}`);return t},async create(e){const t=jr(e),a=Object.entries(t).reduce((e,[t,a])=>(void 0!==a&&(e[t]=a),e),{}),{data:r,error:n}=await d().insert(a).select().single();if(n)throw new Error(`Error creating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from create ${s} operation`);return r},async update(e,t){const a={...jr(t),updated_at:(new Date).toISOString()},{data:r,error:n}=await d().update(a).eq("id",e).select().single();if(n)throw new Error(`Error updating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from update ${s} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:a}=await d().update(t).eq("id",e);if(a)throw new Error(`Error soft deleting ${s}: ${a.message}`)}};return p}const go={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},vo=class{static async initialize(){try{const e=Fe();if(e){if(Bn.checkProjectMismatch())return{...go}}if(!Bn.hasAllTokens()||!Bn.areAllTokensValid())return Bn.clearExpiredTokens(),{...go};const t=Bn.getAccessToken(),a=Bn.getIdToken();Bn.clearManualLogout();const r=this.extractUserFromIdToken(a,t),s=this.extractCompaniesFromIdToken(a),n=e?Bn.extractTokenData():null,o=this.resolveAliasFromContext(s,t,n?.alias??null);if(e&&(!Bn.isSupabaseTokenValid()&&o&&await ao.attemptRegeneration(),!Bn.isSupabaseTokenValid()))return{...go};let i=null;if(o){const e=Bn.getCompanyId(o),t=s.find(e=>e.alias===o);t&&(i={id:e||t.id,name:t.name,alias:t.alias})}const l=n?.placeId??null,c=n?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:o,companies:s,selectedUnit:i,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:c,activePlaceId:l,activePlaceName:c}}catch(e){return{...go}}}static async loginDev(){if(!Fe())return this.loginProd(),!0;try{const e=Jn(),{data:t,error:a}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(a)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL(Ue("/callback"));return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";Bn.setOAuthState(e);const t=Bn.generateOAuthNonce();Bn.setOAuthNonce(t);const a=Ue("/callback"),r=new URL(ze.oauth.authUrl);r.searchParams.set("client_id",ze.oauth.clientId),r.searchParams.set("response_type",ze.oauth.responseType),r.searchParams.set("scope",ze.oauth.scope),r.searchParams.set("redirect_uri",a),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),window.location.href=r.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),a=a=>e.get(a)||t.get(a),r=a("access_token"),s=a("id_token"),n=a("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(r&&s){const e=Bn.getAccessToken();e!==r&&Bn.clearAll()}const o=Fe();if(Bn.hasAllTokens()){if(o){Bn.getValidSupabaseToken()||await ao.attemptRegeneration(!0)}return!0}const i=r,l=s;if(!i||!l)throw new Error("Tokens não encontrados na URL de callback");Bn.setAccessToken(i),Bn.setIdToken(l),Bn.clearManualLogout();const c=this.extractCompaniesFromIdToken(l),d=this.resolveAliasFromContext(c,i,null);if(!d)throw new Error("Nenhuma empresa encontrada nos tokens");if(Bn.setSelectedAlias(d),o){if(!await ao.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return Bn.clearOAuthState(),Bn.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){const e=Bn.getIdToken();Bn.clearAll(),Bn.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}const t=Ue("/login");if(e)try{const a=new URL(ze.oauth.logoutUrl);return a.searchParams.set("id_token_hint",e),a.searchParams.set("post_logout_redirect_uri",t),a.searchParams.set("client_id",ze.oauth.clientId),void(window.location.href=a.toString())}catch{}window.location.href=Ue("/login")}static decodeToken(e){return En.parseJwtPayload(e)}static extractUserFromIdToken(e,t){const a=this.decodeToken(e);if(!a)return null;const r=t?this.decodeToken(t):null;return{id:a.subNewId,email:a.email,name:a.name,identifier:a.identifier,isSysAdmin:"1"===r?.admin}}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const a=[];Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)a.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,s]=t[e].split("|");r&&s&&a.push({id:"",alias:r.trim(),name:s.trim()})}}});const r=new Map;for(const n of a){if(!n.alias)continue;const e=r.get(n.alias);(!e||!e.id&&n.id)&&r.set(n.alias,n)}const s=Array.from(r.values());a.length,s.length;return s.length,s}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const t=e.split(".");if(t.length<3)return null;const a=t[0];return"www"===a||"admin"===a?null:t.length>=4?t[1]:a}static resolveAliasFromContext(e,t,a){const r=t=>!!t&&e.some(e=>e.alias===t),s=this.getSubdomainAlias();if(r(s))return s;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(a))return a;const n=Bn.getSelectedAlias();if(r(n))return n;const o=this.extractAliasFromAccessToken(t);return r(o)?o:e[0]?.alias||null}};ao.setLogoutCallback(()=>{vo.logout()});let bo=vo;const yo=e=>e?.placeId||null,wo=e=>e?.placeName||null,jo=a.createContext(void 0),No=({children:e})=>{const[r,s]=a.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=j.useQueryClient()}catch{}const[o,i]=a.useState(!1),l=a.useRef(0),c=a.useCallback(e=>{s(t=>({...t,...e}))},[]),d=a.useCallback(e=>{s(t=>({...t,isLoading:e}))},[]),u=a.useCallback(()=>{s({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=a.useCallback(async e=>{if(e.alias===r.alias)return;const t=++l.current;try{const s=Bn.getAccessToken();if(!s)return;const o=Fe();let i=null;if(o){const a=await Zn.generateToken(s,e.alias,void 0,!0);if(l.current!==t)return;if(!a)return;Bn.setSupabaseToken(a),i=Bn.extractTokenData()}Bn.setSelectedAlias(e.alias);const d=i?.alias||e.alias,u=i?.companyId||Bn.getCompanyId(e.alias),m={id:u||e.id,name:e.name,alias:d};let p=null,h=null;if(r.user?.id&&d&&u)try{const e=await oo.fetchActiveUsersMap(d,u);if(l.current!==t)return;const a=e.get(r.user.id);if(a){const e=(e=>({placeId:yo(e),placeName:wo(e)}))(a);p=e.placeId,h=e.placeName}}catch(a){}if(l.current!==t)return;c({alias:d,selectedUnit:m,placeId:p,placeName:h,activePlaceId:p,activePlaceName:h}),n&&await n.clear()}catch(a){}},[c,n,r.user,r.alias]),p=a.useCallback(async()=>{Nn("AuthContext.processCallback");const e=await Cn(0,()=>bo.processCallback());if(e){const e=await Cn(0,()=>bo.initialize());e&&e.isAuthenticated&&(c({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[c,n]),h=a.useCallback(async()=>{await bo.logout(),u(),n&&await n.clear()},[u,n]),x=a.useCallback(e=>{i(e)},[]),f=a.useCallback(()=>{},[]),g=a.useCallback(()=>{n&&n.invalidateQueries()},[n]);a.useEffect(()=>{if(!r.isAuthenticated)return;let e=!0;const t=setInterval(async()=>{if(e)if(Bn.areAllTokensValid()){if(Fe()&&!Bn.isSupabaseTokenValid())try{await ao.attemptRegeneration()||e&&h()}catch(t){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(t)}},[r.isAuthenticated,h]),a.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await bo.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&d(!1)}catch(t){e&&(ro.handleError(t),d(!1))}})(),()=>{e=!1}},[c,d,h]);const v=a.useMemo(()=>({...r,logout:h,processCallback:p,switchUnit:m,availableUnits:r.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[r.user,r.companies,r.alias,r.isAuthenticated,r.isLoading,r.selectedUnit,r.userId,r.userAlias,r.placeId,r.placeName,r.activePlaceId,r.activePlaceName,h,p,m,o,x,f,g]);return t.jsx(jo.Provider,{value:v,children:e})},_o=()=>{const e=a.useContext(jo);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function Co({queryKey:e,service:t,entityName:r,searchFields:s,additionalFilters:n={},onSuccess:o}){const[i,c]=N.useSearchParams(),d=j.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=_o(),{t:h}=y.useTranslation(),x=a.useCallback(t=>{const a=`${e}_${t}`,r=i.get(a);return r||(i.get(t)||"")},[i,e]),f=x("search"),g=x("sortField")||qe.sorting.defaultField,v=x("sortDirection")||qe.sorting.defaultDirection,b=parseInt(x("page")||"1"),w=parseInt(x("limit")||String(qe.pagination.defaultPageSize)),_=f,C=a.useMemo(()=>({search:_,sortField:g,sortDirection:v,page:b,limit:w,...n}),[_,g,v,b,w,n]),k=a.useCallback(()=>t.getAll(C),[t,C]),S=j.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const A=j.useMutation({mutationFn:t.create,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Je.success.created(r)),o?.()},onError:e=>{l.toast.error(`${Je.error.create(r)}: ${e.message}`)}}),T=j.useMutation({mutationFn:({id:e,data:a})=>t.update(e,a),onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Je.success.updated(r)),o?.()},onError:e=>{l.toast.error(`${Je.error.update(r)}: ${e.message}`)}}),D=j.useMutation({mutationFn:t.delete,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Je.success.deleted(r))},onError:e=>{l.toast.error(`${Je.error.delete(r)}: ${e.message}`)}}),P=a.useCallback(t=>{const a={...Object.fromEntries(i)};Object.entries(t).forEach(([t,r])=>{const s=`${e}_${t}`;""===r||0===r?delete a[s]:a[s]=String(r)}),delete a.sortField,delete a.sortDirection,c(a)},[i,c,e]),E=a.useCallback(e=>{P({search:e,page:1})},[P]),M=a.useCallback(e=>{P({sortField:e,sortDirection:g===e&&"asc"===v?"desc":"asc",page:1})},[g,v,P]),I=a.useCallback(e=>{P({page:e})},[P]),R=a.useCallback(e=>{P({limit:e,page:1})},[P]),L=a.useCallback(()=>{const t=Object.fromEntries(i),a=`${e}_`,r=Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith(a)));c(r)},[c,i,e]),[F,z]=a.useState([]),U=a.useCallback(e=>{z(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),O=a.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(t=>t.length===e.length?[]:e)},[S?.data?.data]),B=a.useCallback(()=>{z([])},[]),q=a.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,S?.data?.data]),V=j.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>t.delete(e)))},onSuccess:(t,a)=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${a.length} ${r}(s) deletado(s) com sucesso`)),B()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=a.useCallback((e,t)=>{const a=t?t(e):e;e.id?T.mutate({id:e.id,data:a}):A.mutate({...a,alias:u})},[u,A,T]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||qe.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:T?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:v,currentPage:b,itemsPerPage:w,queryKey:e,createEntity:A.mutate,updateEntity:(e,t)=>T.mutate({id:e,data:t}),deleteEntity:D.mutate,save:$,handleSearch:E,handleSort:M,handlePageChange:I,handleItemsPerPageChange:R,clearFilters:L,refetch:S.refetch,selectedIds:F,selectItem:U,selectAll:O,clearSelection:B,isAllSelected:q,bulkDelete:e=>V.mutateAsync(e),isBulkDeleting:V.isPending}}function ko(e){const[t,r]=a.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return a.useEffect(()=>{const t=window.matchMedia(e);r(t.matches);const a=e=>{r(e.matches)};return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),t}function So(e=768){return ko(`(max-width: ${e-1}px)`)}const Ao=te.forwardRef(({className:e,...a},r)=>t.jsx("table",{ref:r,className:wr("w-full caption-bottom text-[13px] table-fixed",e),...a}));Ao.displayName="Table";const To=te.forwardRef(({className:e,...a},r)=>t.jsx("thead",{ref:r,className:wr("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...a}));To.displayName="TableHeader";const Do=te.forwardRef(({className:e,...a},r)=>t.jsx("tbody",{ref:r,className:wr("[&_tr:last-child]:border-0",e),...a}));Do.displayName="TableBody";const Po=te.forwardRef(({className:e,...a},r)=>t.jsx("tfoot",{ref:r,className:wr("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));Po.displayName="TableFooter";const Eo=te.forwardRef(({className:e,...a},r)=>t.jsx("tr",{ref:r,className:wr("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...a}));Eo.displayName="TableRow";const Mo=te.forwardRef(({className:e,...a},r)=>t.jsx("th",{ref:r,className:wr("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...a}));Mo.displayName="TableHead";const Io=te.forwardRef(({className:e,...a},r)=>t.jsx("td",{ref:r,className:wr("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...a}));Io.displayName="TableCell";const Ro=te.forwardRef(({className:e,...a},r)=>t.jsx("caption",{ref:r,className:wr("mt-4 text-sm text-muted-foreground",e),...a}));function Lo({rows:e=5,columns:a=4}){return t.jsx("div",{className:"w-full",children:t.jsxs("div",{className:"rounded-md border",children:[t.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(un,{className:"h-4 w-24"},a))})}),t.jsx("div",{children:Array.from({length:e}).map((e,r)=>t.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(un,{className:"h-4 w-20"},a))})},r))})]})})}function Fo({count:e=3}){return t.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,a)=>t.jsxs(Tr,{children:[t.jsxs(Dr,{children:[t.jsx(un,{className:"h-4 w-3/4"}),t.jsx(un,{className:"h-3 w-1/2"})]}),t.jsx(Mr,{children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(un,{className:"h-3 w-full"}),t.jsx(un,{className:"h-3 w-2/3"})]})})]},a))})}Ro.displayName="TableCaption";const zo={default:c.FileX,search:c.Search,error:c.AlertCircle};function Uo({icon:e,title:a,description:r,action:s,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,c=zo[o];return t.jsxs("div",{className:wr("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[t.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:t.jsx(c,{className:"h-8 w-8 text-muted-foreground"})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:a}),r&&t.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),s&&t.jsx(_r,{onClick:s.onClick,variant:"outline",children:s.label})]})}function Oo({children:e,className:a}){const r=te.useRef(null),[s,n]=te.useState(!1);te.useEffect(()=>{const e=()=>{const e=r.current;e&&n(e.scrollWidth>e.clientWidth)};e();const t=new ResizeObserver(e);return r.current&&t.observe(r.current),()=>t.disconnect()},[e]);const o=t.jsx("div",{ref:r,className:`truncate w-full max-w-full ${a||""}`,children:e});return s?t.jsx(Ks,{delayDuration:300,children:t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:o}),t.jsx(Xs,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const Bo=te.forwardRef(({direction:e,onMouseDown:a,isDragging:r,className:s},n)=>{const o="horizontal"===e;return t.jsx("div",{ref:n,onMouseDown:a,className:wr("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],r&&"bg-primary/30",s),children:t.jsx("div",{className:wr("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});Bo.displayName="TableResizeHandle";const qo=me.Root,Vo=me.Trigger,$o=me.Group,Wo=me.Portal,Ho=me.Sub,Go=me.RadioGroup,Ko=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(me.SubTrigger,{ref:n,className:wr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Ko.displayName=me.SubTrigger.displayName;const Yo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.SubContent,{ref:r,className:wr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Yo.displayName=me.SubContent.displayName;const Qo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Portal,{children:t.jsx(me.Content,{ref:r,className:wr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Qo.displayName=me.Content.displayName;const Xo=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Item,{ref:s,className:wr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Xo.displayName=me.Item.displayName;const Jo=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(me.CheckboxItem,{ref:n,className:wr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Jo.displayName=me.CheckboxItem.displayName;const Zo=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(me.RadioItem,{ref:s,className:wr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Zo.displayName=me.RadioItem.displayName;const ei=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Label,{ref:s,className:wr("px-2 py-1.5 text-sm font-semibold text-foreground",a&&"pl-8",e),...r}));ei.displayName=me.Label.displayName;const ti=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Separator,{ref:r,className:wr("-mx-1 my-1 h-px bg-border",e),...a}));ti.displayName=me.Separator.displayName;const ai=({className:e,...a})=>t.jsx("span",{className:wr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});ai.displayName="ContextMenuShortcut";const ri=({onEdit:e,onDelete:a,onToggleStatus:r,isActive:s=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),d=[];if(e){const t={icon:c.Edit,label:l("edit"),onClick:e};d.push(t)}if(o.forEach(e=>{d.push(e)}),r){const e={icon:s?c.PowerOff:c.Power,label:s?"Inativar":"Ativar",onClick:r};d.push(e)}if(n&&a){const e={icon:c.Trash2,label:l("ap_delete"),onClick:a,destructive:!0};d.push(e)}const u="dropdown"===i?qs:Xo;return t.jsx(t.Fragment,{children:d.map((e,a)=>t.jsxs(u,{onClick:e.onClick,className:wr("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[t.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},a))})},si=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsx(_r,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:t.jsx(c.EllipsisVertical,{size:12})})}),t.jsx(Bs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:t.jsx(ri,{onEdit:e?t=>{t?.stopPropagation(),e?.()}:void 0,onDelete:a?e=>{e?.stopPropagation(),a?.()}:void 0,onToggleStatus:s?e=>{e?.stopPropagation(),s?.()}:void 0,isActive:n,canDelete:r&&!!a,customActions:o,renderAs:"dropdown"})})]}),ni=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return t.jsx(Ks,{delayDuration:200,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e()},children:t.jsx(c.Pencil,{size:14})})}),t.jsx(Xs,{children:i("edit")})]}),o.map((e,a)=>{const r=e.icon;return t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e.onClick()},children:t.jsx(r,{size:14})})}),t.jsx(Xs,{children:e.label})]},a)}),s&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),s()},children:n?t.jsx(c.ToggleRight,{size:14}):t.jsx(c.ToggleLeft,{size:14})})}),t.jsx(Xs,{children:n?"Inativar":"Ativar"})]}),a&&r&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:wr("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),a()},children:t.jsx(c.Trash2,{size:14})})}),t.jsx(Xs,{children:i("ap_delete")})]})]})})},oi=150;function ii({columns:e,storageKey:t,onResize:r,enabled:s=!0}){const[n,o]=a.useState(()=>{if(!s||"undefined"==typeof window)return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??oi,e),{});if(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??oi,e),{})}),[i,l]=a.useState(!1),[c,d]=a.useState(null),u=a.useRef(0),m=a.useRef(0),p=a.useCallback((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),l(!0),d(e),u.current=t.clientX,m.current=n[e]??oi)},[s,n]);a.useEffect(()=>{if(!i||!c)return;const a=e.find(e=>e.key===c),s=a?.minWidth??60,n=a?.maxWidth??500,p=e=>{const t=e.clientX-u.current,a=Math.max(s,Math.min(n,m.current+t));o(e=>{const t={...e,[c]:a};return r?.(t),t})},h=()=>{l(!1),d(null),t&&o(e=>(localStorage.setItem(t,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,c,e,t,r]),a.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=a.useCallback(()=>{const a=e.reduce((e,t)=>(e[t.key]=t.defaultWidth??oi,e),{});o(a),t&&localStorage.removeItem(t),r?.(a)},[e,t,r]);return{columnWidths:n,isDragging:i,activeColumn:c,handleMouseDown:p,resetWidths:h}}const li=s.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),ci=te.forwardRef(({className:e,variant:a,size:r,...s},n)=>t.jsx(he.Root,{ref:n,className:wr(li({variant:a,size:r,className:e})),...s}));ci.displayName=he.Root.displayName;const di=te.createContext({size:"default",variant:"default"}),ui=te.forwardRef(({className:e,variant:a,size:r,children:s,...n},o)=>t.jsx(pe.Root,{ref:o,className:wr("flex items-center justify-center gap-1",e),...n,children:t.jsx(di.Provider,{value:{variant:a,size:r},children:s})}));ui.displayName=pe.Root.displayName;const mi=te.forwardRef(({className:e,children:a,variant:r,size:s,...n},o)=>{const i=te.useContext(di);return t.jsx(pe.Item,{ref:o,className:wr(li({variant:i.variant||r,size:i.size||s}),e),...n,children:a})});mi.displayName=pe.Item.displayName;const pi=a.memo(function({onNew:e,newButtonLabel:a,showNewButton:r=!0,showSearch:s=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:d=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:v=!1,availableViewModes:b=["table","list","grid"],rightSlot:w,className:j}){const{t:N}=y.useTranslation(),_=d>0,C=e&&r||h.length>0,k=x||v||w,S=s&&o;return C||S||k||l&&_?t.jsxs("div",{className:wr("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",j),children:[t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&r&&t.jsxs(_r,{onClick:e,children:[t.jsx(c.Plus,{size:16,className:"mr-2"}),a||"Novo"]}),h.map((e,a)=>{const r=e.icon;return t.jsxs(_r,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[r&&t.jsx(r,{size:16,className:"mr-2"}),e.label]},a)})]}),l&&_&&t.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[t.jsx(As,{variant:"secondary",className:"mr-1 tabular-nums",children:d}),t.jsxs(Ks,{delayDuration:200,children:[u.length>0?u.map((e,a)=>{const r=e.icon,s=e.disabled;return t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:wr("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:s,onClick:()=>e.action([]),children:r?t.jsx(r,{size:16}):t.jsx("span",{className:"text-xs",children:e.label[0]})})}),t.jsx(Xs,{children:e.label})]},a)}):t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:t.jsx(c.Trash2,{size:16})})}),t.jsx(Xs,{children:N("ap_delete")})]}),t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:t.jsx(c.X,{size:16})})}),t.jsx(Xs,{children:N("clear_selection")})]})]})]}),S&&t.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t.jsxs("div",{className:"relative w-full",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(kr,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,v&&f&&g&&t.jsx(ui,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:b.map(e=>{const a=(e=>{switch(e){case"table":return c.Table2;case"list":return c.List;case"grid":return c.LayoutGrid}})(e);return t.jsx(mi,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:t.jsx(a,{className:"h-4 w-4"})},e)})}),w]})]}):null}),hi=a.memo(({checked:e,onCheckedChange:a})=>t.jsx(Cs,{checked:e,onCheckedChange:a}),(e,t)=>e.checked===t.checked);function xi(e){try{const t=localStorage.getItem(e);if(!t)return null;const a=JSON.parse(t);let r=a.groupByColumns||[];return 0===r.length&&a.groupByColumn&&(r=[a.groupByColumn]),{hiddenColumns:new Set(a.hiddenColumns||[]),columnOrder:a.columnOrder||[],groupByColumns:r}}catch{return null}}function fi({columns:e,storageKey:t,enabled:r=!0,defaultHiddenColumns:s}){const n=a.useMemo(()=>e.map(e=>String(e.key)),[e]),o=a.useMemo(()=>new Set(s??[]),[s]),[i,l]=a.useState(()=>{if(!r)return o;if(!t)return o;const e=xi(t);return e?.hiddenColumns??o}),[c,d]=a.useState(()=>{if(!r||!t)return n;const e=xi(t)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=a.useState(()=>r&&t?xi(t)?.groupByColumns??[]:[]),[p,h]=a.useState(new Set);a.useEffect(()=>{r&&t&&function(e,t){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(t.hiddenColumns),columnOrder:t.columnOrder,groupByColumns:t.groupByColumns}))}catch{}}(t,{hiddenColumns:i,columnOrder:c,groupByColumns:u})},[i,c,u,t,r]),a.useEffect(()=>{const t=new Set(e.map(e=>String(e.key))),a=new Set(c),r=[...t].filter(e=>!a.has(e));r.length>0&&d(e=>[...e.filter(e=>t.has(e)),...r])},[e]);const x=a.useCallback(e=>i.has(e),[i]),f=a.useCallback(e=>{l(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),g=a.useCallback(()=>{l(new Set)},[]),v=a.useCallback(()=>{if(l(o),d(n),m([]),h(new Set),t)try{localStorage.removeItem(t)}catch{}},[n,o,t]),b=a.useCallback((e,t)=>{d(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r})},[]),y=a.useCallback(e=>{h(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),w=a.useCallback(e=>{m(e),h(new Set)},[]),j=a.useCallback(e=>{m(t=>t.includes(e)?t:[...t,e])},[]),N=a.useCallback(e=>{m(t=>t.filter(t=>t!==e)),h(t=>{const a=new Set;for(const r of t)r.includes(`${e}:`)||a.add(r);return a})},[]),_=a.useCallback((e,t)=>{m(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r}),h(new Set)},[]),C=u[0]??null,k=a.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=a.useMemo(()=>{if(!r)return e;const t=new Map(e.map(e=>[String(e.key),e]));return c.filter(e=>!i.has(e)&&t.has(e)).map(e=>t.get(e))},[e,c,i,r]),A=a.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(t,a,r,s){if(0===a.length)return[{groupKey:s||"__leaf__",groupValue:"",items:t,count:t.length,level:r}];const[n,...o]=a,i=new Map;for(const l of t){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([t,a])=>{const i=s?`${s}|${n}:${t}`:`${n}:${t}`,l=o.length>0?e(a,o,r+1,i):void 0;return{groupKey:i,groupValue:t,items:a,count:a.length,level:r,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:v,columnOrder:c,reorderColumns:b,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:w,addGroupByColumn:j,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:A,collapsedGroups:p,toggleGroupCollapse:y}}function gi({enabled:e=!1,onReorder:t}){const[r,s]=a.useState(null),[n,o]=a.useState(null),i=a.useCallback(()=>{s(null),o(null)},[]),l=a.useCallback((a,n)=>({draggable:e,onDragStart:t=>{e&&(s(a),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",String(a)),n&&t.dataTransfer.setData("application/column-key",n))},onDragOver:t=>{e&&null!==r&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},onDragEnter:t=>{e&&null!==r&&(t.preventDefault(),o(a))},onDrop:s=>{s.preventDefault(),e&&null!==r&&r!==a?(t(r,a),i()):i()},onDragEnd:()=>{i()}}),[e,r,t,i]);return a.useMemo(()=>({dragFromIndex:r,dragOverIndex:n,isDragging:null!==r,getDragProps:l}),[r,n,l])}function vi({columns:e,columnOrder:r,isColumnHidden:s,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:d,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=a.useState(null),[v,b]=a.useState(null),w=a.useRef(null),j=new Map(e.map(e=>[String(e.key),e])),N=r.filter(e=>j.has(e)).map(e=>j.get(e)),_=()=>{w.current=null,g(null),b(null)};N.some(e=>s(String(e.key)));const C=N.every(e=>!s(String(e.key)));return t.jsxs(Zs,{children:[t.jsx(en,{asChild:!0,children:t.jsx(_r,{variant:"outline",size:"icon",className:"h-8 w-8",children:t.jsx(c.Columns3,{size:16})})}),t.jsxs(tn,{className:"w-[260px] p-0",align:"end",children:[t.jsx("div",{className:"px-3 py-2 border-b",children:t.jsx("span",{className:"text-sm font-medium",children:"Colunas"})}),t.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:t.jsx(Ks,{delayDuration:300,children:N.map((e,a)=>{const r=String(e.key),o=s(r),h=!1!==e.hideable,y=!0===e.groupable,j=u.includes(r)||l===r;return t.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,g(e)})(a),onDragOver:e=>((e,t)=>{e.preventDefault(),b(t)})(e,a),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&i(w.current,e),w.current=null,g(null),b(null)})(a),onDragEnd:_,className:wr("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===a&&"opacity-50",v===a&&"border-t-2 border-primary"),children:[t.jsx(c.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx(Cs,{checked:!o,onCheckedChange:()=>h&&n(r),disabled:!h,className:"shrink-0"}),t.jsx("span",{className:wr("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:wr("h-6 w-6 shrink-0",j&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),j?p?p(r):d?.(null):m?m(r):d?.(r)},children:t.jsx(c.Group,{size:14})})}),t.jsx(Xs,{children:x(j?"remove_grouping":"group_by_column")})]})]},r)})})}),t.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[t.jsx(_r,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&t.jsx(_r,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:"Redefinir padrão"})]})]})]})}function bi({columns:e,groupByColumns:r,addGroupByColumn:s,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=a.useState(!1),[d,u]=a.useState(null),[m,p]=a.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=r.length>0;return t.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const t=e.dataTransfer.getData("application/column-key");if(t&&!r.includes(t)){const e=h.get(t);e&&e.groupable&&s(t)}},className:wr("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[t.jsx(c.Group,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?r.map((e,r)=>{const s=h.get(e);if(!s)return null;const i=d===r,l=m===r&&d!==r;return t.jsxs(a.Fragment,{children:[r>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),t.jsxs(As,{variant:"secondary",className:wr("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,t)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(t)),e.dataTransfer.effectAllowed="move",u(t)})(e,r),onDragOver:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),p(t)})(e,r),onDrop:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const a=e.dataTransfer.getData("application/group-chip-index");if(""!==a){const e=parseInt(a,10);isNaN(e)||e===t||o(e,t)}u(null),p(null)})(e,r),onDragEnd:x,children:[s.header,t.jsx("button",{onClick:t=>{t.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:t.jsx(c.X,{size:12})})]})]},e)}):t.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const yi=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:v,showActionBar:b=!0,showSearch:w=!1,searchValue:j,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D=!1,enableColumnResize:P=!0,resizeStorageKey:E,enableColumnManager:M=!0,columnManagerStorageKey:I,defaultHiddenColumns:R,enableGrouping:L=!1,enableExpandableRows:F=!1,renderExpandedContent:z,expandedRowIds:U,onToggleExpand:O,defaultExpandAll:B=!1,hideActionsColumn:q=!1})=>{const{t:V}=y.useTranslation(),{setSearchVisible:$}=_o(),W=So(),[H,G]=a.useState(()=>B&&F?new Set(r.entities.map(e=>e.id)):new Set),K=void 0!==U,Y=K?new Set(U):H,Q=a.useCallback(e=>{K&&O?O(e):G(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[K,O]),X=void 0!==v?!v:b;a.useEffect(()=>{if(!w)return $(!0),()=>$(!1)},[$,w]);const J=fi({columns:s,storageKey:I,enabled:M,defaultHiddenColumns:R}),Z=gi({enabled:M,onReorder:J.reorderColumns}),ee=M?J.visibleColumns:s,{columnWidths:te,isDragging:ae,activeColumn:re,handleMouseDown:se}=ii({columns:ee.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:E?`${E}-columns`:void 0,enabled:P}),ne=a.useMemo(()=>(()=>{if(P){const e=ee.map(e=>te[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return ee.map((a,r)=>({...a,calculatedWidth:e[r],style:{width:e[r]/t*100+"%"}}))}let e=0;const t=ee.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const a=t.minWidth||120,r=t.weight||1;return e+=a,{...t,calculatedWidth:a,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[ee,P,te]),oe=h||g.length>0||w||m||S||D||M,ie=X&&oe,le=k||(()=>{r.bulkDelete?.(r.selectedIds)}),ce=e=>t.jsx(Io,{className:"text-center",children:d?d(e):"inline"===p?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):t.jsx(si,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),de=e=>t.jsx(Qo,{className:"w-[160px]",children:t.jsx(ri,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),ue=M?t.jsx(vi,{columns:s,columnOrder:J.columnOrder,isColumnHidden:J.isColumnHidden,toggleColumn:J.toggleColumn,showAllColumns:J.showAllColumns,resetColumns:J.resetColumns,reorderColumns:J.reorderColumns,groupByColumn:L?J.groupByColumn:void 0,setGroupByColumn:L?J.setGroupByColumn:void 0,groupByColumns:L?J.groupByColumns:void 0,addGroupByColumn:L?J.addGroupByColumn:void 0,removeGroupByColumn:L?J.removeGroupByColumn:void 0}):void 0;if(W)return r.isLoading?t.jsx(Fo,{count:3}):0===r.entities.length?t.jsx(Uo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t.jsxs("div",{className:"flex flex-col h-full",children:[ie&&t.jsx(pi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),t.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>t.jsxs(qo,{children:[t.jsx(Vo,{asChild:!0,children:t.jsx(Tr,{className:wr("overflow-hidden cursor-pointer hover:bg-muted/50",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:t.jsx(Mr,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[m&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(hi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1",children:[ee.map(a=>t.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||d)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):t.jsx(si,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})})}),de(e)]},e.id))})]});const me=L&&J.groupByColumns.length>0?J.getGroupedData(r.entities):null,pe=null!==me,he=(F?1:0)+(m?1:0)+ee.length+(q?0:1),xe=e=>{const s=F&&Y.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(qo,{children:[t.jsx(Vo,{asChild:!0,children:t.jsxs(Eo,{className:wr("cursor-pointer hover:bg-muted/50 relative",("inline"===p||q)&&"group",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:[F&&t.jsx(Io,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),Q(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":V(s?"collapse_row":"expand_row"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&t.jsx(Io,{onClick:e=>e.stopPropagation(),children:t.jsx(hi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),ee.map(a=>t.jsx(Io,{className:a.className,children:t.jsx(Oo,{children:a.render?a.render(e):String(e[a.key]??"")})},String(a.key))),!q&&ce(e)]})}),de(e)]}),s&&z&&t.jsx(Eo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Io,{colSpan:he,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},fe=(e,r)=>{const{t:s}=y.useTranslation();return e.map(e=>{const s=J.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return t.jsxs(a.Fragment,{children:[t.jsx(Eo,{className:wr("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>J.toggleGroupCollapse(e.groupKey),children:t.jsx(Io,{colSpan:r,className:"py-2 px-4",children:t.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[s?t.jsx(c.ChevronRight,{size:16}):t.jsx(c.ChevronDown,{size:16}),t.jsx("span",{children:e.groupValue}),t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!s&&(e.children?fe(e.children,r):e.items.map(xe))]},e.groupKey)})};return t.jsxs("div",{className:"flex flex-col h-full",children:[ie&&t.jsx(pi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),r.isLoading?t.jsx(Lo,{rows:5,columns:ee.length}):t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L&&t.jsx(bi,{columns:s,groupByColumns:J.groupByColumns,addGroupByColumn:J.addGroupByColumn,removeGroupByColumn:J.removeGroupByColumn,reorderGroupByColumns:J.reorderGroupByColumns}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(Ao,{className:"table-fixed w-full",children:[t.jsxs("colgroup",{children:[F&&t.jsx("col",{style:{width:"40px"}}),m&&t.jsx("col",{style:{width:"50px"}}),ne.map((e,a)=>t.jsx("col",{style:e.style},a)),!q&&t.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),t.jsx(To,{children:t.jsxs(Eo,{children:[F&&t.jsx(Mo,{className:"w-[40px]"}),m&&t.jsx(Mo,{className:"w-[50px]",children:t.jsx(hi,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),ee.map((e,a)=>{const s=P&&!1!==e.resizable,n=re===String(e.key),o=M?Z.getDragProps(a,String(e.key)):{},i=Z.dragFromIndex===a,l=Z.dragOverIndex===a&&Z.dragFromIndex!==a;return t.jsxs(Mo,{className:wr(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",M&&Z.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...o,children:[t.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(d=String(e.key),r.sortField!==d?null:"asc"===r.sortDirection?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}),s&&t.jsx(Bo,{direction:"horizontal",onMouseDown:t=>se(String(e.key),t),isDragging:n})]},String(e.key));var d}),!q&&t.jsx(Mo,{className:"w-[50px] text-center",children:ue||e.t("actions")})]})}),t.jsx(Do,{children:0===r.entities.length?t.jsx(Eo,{children:t.jsx(Io,{colSpan:he,className:"h-32",children:t.jsx(Uo,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):pe?fe(me,he):r.entities.map(xe)})]})})]})]})};function wi(e,t,r,s){const[n,o]=a.useState({}),[i,l]=a.useState({}),c=a.useMemo(()=>e,[e]),d=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(a){return u(e)}},p=(e,t,a)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let s;if("function"==typeof e.validation?s=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(s=e.validation.custom),s)try{const e=s(t,a);if(e)return e}catch(r){}}};a.useEffect(()=>{if(!s)return;const e=t=>{const a=[];return t.forEach(t=>{a.push(t),t.fields&&a.push(...e(t.fields))}),a},a=e(c),n={};a.forEach(e=>{let a;if(t&&void 0!==t[e.name]){if(a=t[e.name],null==a&&(a=""),"date"===e.type&&a)if("string"==typeof a){const e=new Date(a);d(e)&&(a=e.toISOString().split("T")[0])}else d(a)&&(a=a.toISOString().split("T")[0])}else a=u(e);n[e.name]=a}),a.forEach(e=>{const t=m(e,n);void 0!==t&&(n[e.name]=t)}),t&&Object.keys(t).forEach(e=>{a.find(t=>t.name===e)||void 0===t[e]||(n[e]=t[e])}),o(n),l({}),r&&r(n)},[c,t,r,s]);const h=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...h(e.fields))}),t},x=()=>{const e=h(c),t={};return e.forEach(e=>{const a=p(e,n[e.name],n);a&&(t[e.name]=a)}),l(t),0===Object.keys(t).length};return{formData:n,errors:i,updateField:(e,t)=>{o(a=>{const s={...a,[e]:t},n=((e,t)=>{let a={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=m(e,a);void 0!==t&&(a={...a,[e.name]:t})}),a})(e,s);return r&&r(n),n}),i[e]&&l(t=>{const a={...t};return delete a[e],a});const a=h(c).find(t=>t.name===e);if(a){const r=p(a,t,n);r&&l(t=>({...t,[e]:r}))}},validateForm:x,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),x()&&e(n)}}}const ji=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],Ni=[10,22,35,45,55,68,78,87,94].flatMap(e=>ji.map(({hue:t,saturation:a})=>((e,t,a)=>{a/=100;const r=t=>(t+e/30)%12,s=(t/=100)*Math.min(a,1-a),n=e=>{const t=a-s*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return Math.round(255*t).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(t,a,e))),_i=({value:e="#3b82f6",onChange:r,label:s,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),d=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=a.useState(!1),h=a.useRef([]),x=ji.length,f=a.useMemo(()=>{const t=Ni.findIndex(t=>t.toLowerCase()===e.toLowerCase());return t>=0?t:0},[e]),[g,v]=a.useState(f);a.useEffect(()=>{m&&(v(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const b=e=>{const t=Math.max(0,Math.min(Ni.length-1,e));v(t),h.current[t]?.focus()},w=e=>{r?.(e),p(!1)};return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Ar,{children:s}),t.jsxs(Zs,{open:m,onOpenChange:p,children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[t.jsxs("span",{className:"flex items-center min-w-0",children:[t.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&t.jsx("span",{className:"truncate",children:e})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),t.jsx(tn,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(Ar,{children:u}),t.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${ji.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),b(g+1);break;case"ArrowLeft":e.preventDefault(),b(g-1);break;case"ArrowDown":e.preventDefault(),b(g+x);break;case"ArrowUp":e.preventDefault(),b(g-x);break;case"Home":e.preventDefault(),b(0);break;case"End":e.preventDefault(),b(Ni.length-1);break;case"Enter":e.preventDefault(),w(Ni[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:Ni.map((a,r)=>{const s=a.toLowerCase()===e.toLowerCase();return t.jsx("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(s?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:a},onClick:()=>w(a),"aria-label":`Selecionar cor ${a}`},`${a}-${r}`)})})]}),t.jsxs("div",{children:[t.jsx(Ar,{htmlFor:"color-input",children:d}),t.jsx(kr,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Ci=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(xe.Root,{ref:s,className:wr("relative overflow-hidden",e),...r,children:[t.jsx(xe.Viewport,{className:"h-full w-full rounded-[inherit]",children:a}),t.jsx(ki,{}),t.jsx(xe.Corner,{})]}));Ci.displayName=xe.Root.displayName;const ki=te.forwardRef(({className:e,orientation:a="vertical",...r},s)=>t.jsx(xe.ScrollAreaScrollbar,{ref:s,orientation:a,className:wr("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:t.jsx(xe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ki.displayName=xe.ScrollAreaScrollbar.displayName;const Si=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function Ai({name:e,filled:a,className:r}){return t.jsx("span",{className:`material-symbols-outlined ${r??""}`,style:a?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Ti=({value:e=null,onChange:r,label:s,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=a.useState(!1),d=a.useRef([]),u=e?(m=e,Si.find(e=>e.name===m)):null;var m;const p=a.useMemo(()=>{if(!e)return 0;const t=Si.findIndex(t=>t.name===e);return t>=0?t:0},[e]),[h,x]=a.useState(p);a.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{d.current[p]?.focus()}))},[i,p]);const f=a.useCallback(e=>{const t=Math.max(0,Math.min(Si.length-1,e));x(t),d.current[t]?.focus()},[]),g=a.useCallback(e=>{r?.(e),l(!1)},[r]),v=a.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),b=a.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Si.length-1);break;case"Enter":e.preventDefault(),g(Si[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Ar,{children:s}),t.jsxs(Zs,{open:i,onOpenChange:l,children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:v,children:[u?t.jsx(Ai,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):t.jsx("span",{className:"text-muted-foreground text-sm",children:n}),t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),t.jsx(tn,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{d.current[p]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(Ci,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:t.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:b,role:"grid",children:Si.map((a,r)=>t.jsx("button",{ref:e=>{d.current[r]=e},type:"button",tabIndex:r===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===a.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(a.name),title:a.name,children:t.jsx(Ai,{name:a.name,filled:a.filled,className:"text-2xl"})},a.name))})}),t.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Di=te.forwardRef(({className:e,...a},r)=>t.jsx(fe.Root,{className:wr("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...a,ref:r,children:t.jsx(fe.Thumb,{className:wr("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Di.displayName=fe.Root.displayName;const Pi=(e={})=>{const{user:t,alias:a}=_o(),{enabled:r=!0,status:s="active"}=e;return j.useQuery({queryKey:["qualiex-users",a,s],queryFn:()=>oo.getUsers(a,s),enabled:r&&!!a&&!!t,staleTime:3e5,retry:2,retryDelay:1e3})},Ei=({value:r,onChange:s,multiple:n=!1,label:o,required:i,placeholder:l,icon:c,maxDisplayedBadges:d,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:v,onOpen:b,onClose:w})=>{const{t:j}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Pi({enabled:p}),[k,S]=a.useState(new Map),A=a.useMemo(()=>r?Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean):[],[r]),T=a.useMemo(()=>{if(0===A.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return A.filter(t=>t&&!e.has(t)&&!k.has(t)).sort().join(",")},[A,N,k]);a.useEffect(()=>{if(!T)return;const e=T.split(",");let t=!1;const a=Bn.extractTokenData();return a?.alias&&a?.companyId?(oo.fetchUsers(a.alias,a.companyId,"all").then(a=>{t||S(t=>{const r=new Map(t);for(const s of e){const e=a.find(e=>e.userId===s||e.id===s);e&&r.set(s,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{t=!0}):void 0},[T]);const D=a.useMemo(()=>f?N.filter(f):N,[N,f]),P=a.useMemo(()=>{if(0===A.length)return D;const t=new Set(D.map(e=>e.userId||e.id||"")),a=A.filter(e=>e&&!t.has(e));if(0===a.length)return D;const r=a.map(t=>{const a=k.get(t);return a||{userId:t,id:t,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...D,...r]},[D,A,k]),E=a.useCallback(t=>{let a;if("custom"===h&&x)a=x(t);else{const e=t.userName||"";switch(h){case"name-email":a=t.userEmail?`${e} (${t.userEmail})`:e;break;case"name-role":a=t.roleName?`${e} - ${t.roleName}`:e;break;default:a=e}}return!1===t.isActive?`${a} (${e.t("inactive")})`:a},[h,x]);return t.jsx(hn,{multiple:n,value:r??(n?[]:""),onChange:s,options:P,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:E,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:j("no_results"),label:o,required:i,icon:c,maxDisplayedBadges:d,disabled:m,className:u,sortOptions:g,popoverContainer:v,onOpen:b,onClose:w})};function Mi({title:e,sections:r,initialData:s,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:c=!1,usersData:d}){const[u,m]=a.useState(r?.[0]?.id||""),p=a.useRef(null),[h,x]=a.useState(null),f=a.useCallback(e=>{p.current=e,x(e)},[]),g=a.useMemo(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:v,errors:b,updateField:y,handleSubmit:w}=wi(g,s,void 0,i),j=a.useMemo(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(v):e.disabled||!1})):[],[r,v]),N=a.useMemo(()=>{const e=j.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=j.find(e=>!e.disabled);return t?.id||u},[j,u]);a.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=j.find(e=>e.id===N),C=e=>{const a=(e.computedValue,v[e.name]),r=void 0!==a?a:"",s=b[e.name];switch(e.type){case"group":const a="horizontal"===e.layout,n=a?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=a?wr("space-y-2 w-full",e.wrapperClassName):wr("space-y-2",e.className,e.wrapperClassName);return t.jsxs("div",{className:o,children:[e.label,t.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ei,{value:r||"",onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:s?"border-destructive":""}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"textarea":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(ks,{id:e.name,value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(xs,{value:String(r),onValueChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[t.jsx(vs,{className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:t.jsx(gs,{placeholder:e.placeholder})}),t.jsx(ws,{children:e.options?.map(e=>t.jsx(Ns,{value:e.value,children:e.label},e.value))})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"multiselect":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(hn,{options:e.options||[],value:Array.isArray(r)?r:[],onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,error:s,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"date":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(kr,{id:e.name,type:"date",value:String(r),onChange:t=>y(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:wr("w-full",s?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"color":return t.jsxs("div",{children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(kr,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>y(e.name,t.target.value),className:"h-10"}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"color-picker":return t.jsxs("div",{children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(_i,{value:r||e.defaultValue||"#3b82f6",onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"icon-picker":return t.jsxs("div",{children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ti,{value:r||e.defaultValue||null,onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(v):e.componentProps||{};return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(i,{value:r,onChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:s,popoverContainer:h,...l}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"number":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(kr,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const a=t.target.value,r=""===a?null:Number(a);y(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"checkbox":return t.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[t.jsx(Cs,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),t.jsxs(Ar,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"switch":return t.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Di,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive mt-2",children:s})]},e.name);default:return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Ar,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(kr,{id:e.name,type:"text",value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name)}},k=a.useCallback(()=>{if(!_)return null;if(_.disabled)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:t.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return t.jsx(e,{formData:v,updateField:y,errors:b,users:d,disabled:_.disabled})}return t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,v,y,b,d,C]),S=t.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[j.length>1&&t.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:t.jsx("div",{className:"flex space-x-2",children:j.map(e=>t.jsx(_r,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=j.find(t=>t.id===e);t&&!t.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:c?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):t.jsxs("form",{onSubmit:w(n),className:"space-y-3 md:space-y-4",children:[k(),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(_r,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(_r,{type:"submit",disabled:c,children:l||"Salvar"})]})]})})]});return t.jsx(Gr,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:t.jsxs(Zr,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t.jsxs(es,{showSeparator:!0,children:[t.jsx(rs,{children:e}),t.jsx(ss,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function Ii({currentPage:e,totalPages:a,totalItems:r,itemsPerPage:s,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===r)return null;const d=(e-1)*s+1,u=Math.min(e*s,r);return t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[t.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),t.jsxs(xs,{value:String(s),onValueChange:e=>o(Number(e)),children:[t.jsx(vs,{className:"h-8 w-[70px]",children:t.jsx(gs,{})}),t.jsxs(ws,{children:[t.jsx(Ns,{value:"10",children:"10"}),t.jsx(Ns,{value:"25",children:"25"}),t.jsx(Ns,{value:"50",children:"50"}),t.jsx(Ns,{value:"100",children:"100"})]})]})]})}),t.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[d,"-",u," ",l("of","de")," ",r," ",l("items","itens")]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(_r,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsLeft,{size:16})}),t.jsx(_r,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronLeft,{size:16})}),t.jsxs("div",{className:"flex items-center gap-1 px-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e}),t.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),t.jsx("span",{className:"text-sm font-medium",children:a})]}),t.jsx(_r,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronRight,{size:16})}),t.jsx(_r,{variant:"outline",size:"sm",onClick:()=>n(a),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsRight,{size:16})})]})]})}function Ri({manager:e}){return t.jsx(Ii,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const Li={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Fi={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},zi={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Ui({children:e,direction:a="column",gap:r="md",align:s="stretch",justify:n="start",wrap:o=!1,className:i}){return t.jsx("div",{className:wr("flex","column"===a?"flex-col":"flex-row",Li[r],Fi[s],zi[n],o&&"flex-wrap",i),children:e})}function Oi({manager:e,filters:a,inline:r=!1}){const{t:s}=y.useTranslation(),{isSearchVisible:n}=_o(),o=e.searchTerm,i=t.jsxs(t.Fragment,{children:[a.some(e=>"search"===e.type)&&!n&&t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(kr,{placeholder:"Pesquisar",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),a.filter(e=>"select"===e.type&&e.options).map((e,a)=>t.jsxs(xs,{value:e.value||"",onValueChange:t=>e.onChange?.(t),children:[t.jsx(vs,{className:"w-[180px]",children:t.jsx(gs,{placeholder:e.placeholder})}),t.jsx(ws,{children:e.options.map(e=>t.jsx(Ns,{value:e.value,children:e.label},e.value))})]},`select-${a}`)),a.filter(e=>"custom"===e.type&&e.component).map((e,a)=>{const s=e.component;return t.jsx("div",{className:r?"":"w-full sm:w-auto",children:t.jsx(s,{...e.props})},`custom-${a}`)}),o&&t.jsxs(_r,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[t.jsx(c.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return r?t.jsx("div",{className:"flex items-center gap-2",children:i}):t.jsx(Ui,{direction:"column",gap:"md",className:"mb-6",children:t.jsx(Ui,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function Bi({manager:e,config:r,formSections:s,onSave:n,onToggleStatus:o,defaultSort:i}){e&&e.queryKey;const{setSearchVisible:l}=_o(),[c,d]=N.useSearchParams(),[u,m]=a.useState(!1),[p,h]=a.useState(null),[x,f]=a.useState({isOpen:!1,entityId:null,entityName:""}),[g,v]=a.useState({isOpen:!1,count:0});a.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),a.useEffect(()=>{if(i&&e){const t=`${e.queryKey}_sortField`,a=`${e.queryKey}_sortDirection`;if(!c.has(t)&&!c.has(a)){const e=Object.fromEntries(c);e[t]=i.column,e[a]=i.direction,d(e)}}},[]);const b=s.length>0?e=>{r.onEdit?r.onEdit(e):(h(e),m(!0))}:void 0,y="function"==typeof e?.deleteEntity?e=>{f({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,w=()=>{f({isOpen:!1,entityId:null,entityName:""})},j=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,_=(r.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return t.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&t.jsx(pi,{onNew:()=>{r.onNew?r.onNew():(h(null),m(!0))},newButtonLabel:r.newButtonLabel,showNewButton:j,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{v({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:_,filters:r.filters&&r.filters.length>0?t.jsx(Oi,{manager:e,filters:r.filters,inline:!0}):void 0}),t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?t.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):t.jsx(yi,{manager:e,columns:r.columns,onEdit:b,onDelete:y,onToggleStatus:o,enableBulkActions:r.enableBulkActions,customRowActions:r.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:r.defaultHiddenColumns})}),t.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:t.jsx(Ri,{manager:e})}),!r.useCustomRouting&&!r.onNew&&s.length>0&&t.jsx(Mi,{open:u,title:p?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:s,initialData:p||void 0,onSubmit:e=>{n(e),m(!1),h(null)},onCancel:()=>{m(!1),h(null)},isLoading:e.isLoading,submitButtonText:p?"Atualizar":"Criar"}),t.jsx(Gr,{open:x.isOpen,onOpenChange:w,children:t.jsxs(Zr,{size:"sm",variant:"destructive",children:[t.jsx(es,{showSeparator:!0,children:t.jsx(rs,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:x.entityName}),". Esta ação não pode ser desfeita."]})}),t.jsxs(as,{children:[t.jsx(_r,{variant:"outline",onClick:w,children:"Cancelar"}),t.jsx(_r,{variant:"destructive",onClick:()=>{x.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(x.entityId),f({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),t.jsx(Gr,{open:g.isOpen,onOpenChange:()=>v({isOpen:!1,count:0}),children:t.jsxs(Zr,{size:"sm",variant:"destructive",children:[t.jsx(es,{showSeparator:!0,children:t.jsx(rs,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:g.count})," ",1===g.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t.jsxs(as,{children:[t.jsx(_r,{variant:"outline",onClick:()=>v({isOpen:!1,count:0}),children:"Cancelar"}),t.jsx(_r,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),v({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function qi(e,t){const a=e.toLowerCase();return a.includes("email")?{type:"email",required:!0}:a.includes("phone")||a.includes("tel")?{type:"tel"}:a.includes("description")||a.includes("content")||a.includes("notes")?{type:"textarea"}:a.includes("status")||a.includes("type")||a.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function Vi(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function $i(e={}){const{paramName:t="alias"}=e,r=N.useParams(),{alias:s,companies:n}=_o(),o=r[t]||null;return a.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,t=!!e;return{urlAlias:o,isAliasMismatch:t&&o!==s,isValidAlias:t,isMissing:!1,matchedCompany:e}},[o,s,n])}const Wi=s.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),Hi={info:c.Info,warning:c.Info,danger:c.AlertTriangle,success:c.CheckCircle},Gi=te.forwardRef(({className:e,variant:a="info",showIcon:r=!0,children:s,...n},o)=>{const i=Hi[a||"info"];return t.jsxs("div",{ref:o,role:"alert",className:wr(Wi({variant:a}),e),...n,children:[r&&t.jsx(i,{className:"h-4 w-4"}),s]})});Gi.displayName="Alert";const Ki=te.forwardRef(({className:e,...a},r)=>t.jsx("h5",{ref:r,className:wr("mb-1 font-medium leading-none tracking-tight",e),...a}));Ki.displayName="AlertTitle";const Yi=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("text-sm [&_p]:leading-relaxed",e),...a}));Yi.displayName="AlertDescription";const Qi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Root,{ref:r,className:wr("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...a}));Qi.displayName=ge.Root.displayName;const Xi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Image,{ref:r,className:wr("aspect-square h-full w-full",e),...a}));Xi.displayName=ge.Image.displayName;const Ji=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Fallback,{ref:r,className:wr("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...a}));function Zi(){return Ge()||"https://common-v4-api.qualiex.com"}function el(){const e=Ye();if(e)return e;const t=Zi().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://login-api${t[1]||""}.${t[2]}`}return"https://login-api.qualiex.com"}function tl(e){const t=Bn.getAccessToken();if(!t)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function al(e,t,a){const r=async()=>{const r=await fetch(e,{...a,headers:{...tl(t),...a?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(s){if(await no.handleApiError(s))return await r();throw s}}async function rl(e){const t=Bn.getAccessToken(),a=Bn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const t=En.parseJwtPayload(e),a="string"==typeof t?.subNewId?t.subNewId.trim():"";if(!a)throw new Error("NewId do usuário não encontrado no id-token.");return a}(a),s=Bn.getSelectedAlias()?.trim()||Bn.extractTokenData()?.alias||"",n=`${el()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,o=async()=>{const r=Bn.getAccessToken()||t,o=Bn.getIdToken()||a,i=new FormData;i.append(e.name,e,e.name);const l=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":o,Accept:"application/json, text/plain, */*",...s?{"un-alias":s}:{},AppGroupId:"1"},body:i});if(!l.ok){const e=new Error(`Upload falhou: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await o()}catch(i){if(await no.handleApiError(i))try{return void await o()}catch(l){throw $n.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw i}}Ji.displayName=ge.Fallback.displayName;const sl={"en-US":1,"pt-BR":2,"es-ES":3,"fr-FR":4};function nl(e,t){const a=e?.trim();if(a)return a;const r=En.parseJwtPayload(t),s="string"==typeof r?.subNewId?r.subNewId.trim():"";if(s)return s;throw new Error("Identificador do usuário não encontrado.")}function ol(e){const t=Bn.getSelectedAlias()?.trim();if(t)return t;const a=Bn.getSupabaseToken(),r=a?En.parseJwtPayload(a):null,s="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(s)return s;const n=En.parseJwtPayload(e),o="string"==typeof n?.default?n.default.trim():"string"==typeof n?.alias?n.alias.trim():"string"==typeof n?.user_alias?n.user_alias.trim():"";if(o)return o;for(const i in n||{}){if(!/^co\d+$/.test(i))continue;const e=n?.[i];if("string"!=typeof e)continue;const[t]=e.split(";");if(t?.trim())return t.trim()}}async function il(e){const t=Bn.getAccessToken(),a=Bn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=nl(e.newId,a),s=ol(a),n={};e.name&&e.name.trim()&&(n.Name=e.name.trim()),e.email&&e.email.trim()&&(n.Email=e.email.trim());const o=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e||4===e?e:null:sl[e]??null}(e.language);void 0!==o&&(n.LanguageId=o);const i=`${el()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=Bn.getAccessToken()||t,r=Bn.getIdToken()||a,o=await fetch(i,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...s?{"un-alias":s}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok){const e=new Error(`Falha ao atualizar perfil: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}};try{await l()}catch(c){if(await no.handleApiError(c))return void await l();throw c}}const ll={1:"en-US",2:"pt-BR",3:"es-ES",4:"fr-FR"};function cl(e,...t){for(const a of t){const t=e[a];if("string"==typeof t&&t.trim())return t}return null}async function dl(e){const t=Bn.getAccessToken(),a=Bn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=nl(e,a),s=ol(a),n=`${el()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,o=async()=>{const e=Bn.getAccessToken()||t,o=Bn.getIdToken()||a,i=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":o,...s?{"un-alias":s}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*"}});if(404===i.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!i.ok){const e=new Error(`Falha ao obter perfil: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}const l=await i.json(),c=function(e,...t){for(const a of t){const t=e[a];if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t&&t.trim()&&!Number.isNaN(Number(t)))return Number(t)}return null}(l,"languageId","LanguageId"),d=1===c||2===c||3===c||4===c?c:null,u=cl(l,"photoUrl","PhotoUrl");let m=null;if(u)if(/^https?:\/\//i.test(u))m=u;else{const e=u.replace(/^\/+/,""),t=e.includes("?")?"&":"?";m=`${el()}/api/${e}${t}size=96`}return{newId:r,name:cl(l,"name","Name"),email:cl(l,"email","Email"),languageId:d,language:d?ll[d]:null,photoUrl:m}};try{return await o()}catch(i){if(await no.handleApiError(i))return await o();throw i}}const ul=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],ml=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,pl=({open:e,onOpenChange:r,user:s,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:d}=y.useTranslation(),u=a.useRef(null),[m,p]=a.useState(null),[h,x]=a.useState(null),[f,g]=a.useState(d.language||"pt-BR"),[v,b]=a.useState(s.name||""),[w,j]=a.useState(s.email||""),[N,_]=a.useState(!1),[C,k]=a.useState(null);a.useEffect(()=>{if(!e)return;b(s.name||""),j(s.email||""),g(d.language||"pt-BR"),k(null);let t=!1;return(async()=>{try{const e=await dl(s.id||void 0);if(t)return;e.name&&b(e.name),e.email&&j(e.email),e.language&&g(e.language),k(e.photoUrl)}catch{}})(),()=>{t=!0}},[e,s.id,s.name,s.email,d.language]);const S=m||C||n,A=e=>{N||(e||(p(null),x(null),g(d.language||"pt-BR"),b(s.name||""),j(s.email||"")),r(e))};return t.jsx(Gr,{open:e,onOpenChange:A,children:t.jsxs(Zr,{className:"sm:max-w-md",children:[t.jsx(es,{children:t.jsx(rs,{children:i("edit_profile","Editar Perfil")})}),t.jsxs(ts,{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(Qi,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[S&&t.jsx(Xi,{src:S,alt:s.name||""}),t.jsx(Ji,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]}),t.jsxs("div",{children:[t.jsxs(_r,{variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[t.jsx(c.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),t.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target.files?.[0];if(!t)return;const a=URL.createObjectURL(t);p(a),x(t)}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"profile-name",children:i("name","Nome")}),t.jsx(kr,{id:"profile-name",value:v,onChange:e=>b(e.target.value),maxLength:150,autoComplete:"name"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"profile-email",children:i("email","E-mail")}),t.jsx(kr,{id:"profile-email",type:"email",value:w,onChange:e=>j(e.target.value),maxLength:200,autoComplete:"email"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:i("language","Idioma")}),t.jsxs(xs,{value:f,onValueChange:g,children:[t.jsx(vs,{children:t.jsx(gs,{})}),t.jsx(ws,{children:ul.map(e=>t.jsx(Ns,{value:e.value,children:e.label},e.value))})]})]})]}),t.jsxs(as,{children:[t.jsx(_r,{variant:"outline",onClick:()=>A(!1),disabled:N,children:i("cancel","Cancelar")}),t.jsxs(_r,{onClick:async()=>{if(v.trim())if(ml.test(w.trim())){_(!0);try{if(h)try{await rl(h),window.dispatchEvent(new Event("user-photo-updated")),l.toast.success("Foto atualizada com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error("Falha ao atualizar foto"+(t?`: ${t}`:""))}if(v.trim()!==(s.name||"")||w.trim()!==(s.email||"")||f!==d.language)try{await il({newId:s.id||void 0,name:v.trim(),email:w.trim(),language:f}),l.toast.success("Perfil atualizado com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error(t||"Falha ao atualizar perfil")}f!==d.language&&d.changeLanguage(f),x(null),p(null),r(!1)}finally{_(!1)}}else l.toast.error("Informe um e-mail válido.");else l.toast.error("Informe o nome.")},disabled:N,children:[N&&t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),N?i("saving","Salvando..."):i("save","Salvar")]})]})]})})},hl=a.createContext(void 0);function xl({children:e,actions:r}){const{t:s}=y.useTranslation(),[n,o]=a.useState({}),[i,l]=a.useState(r);a.useEffect(()=>{l(r)},[r]);const c=a.useCallback(()=>o({}),[]),d=a.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:c,headerActions:i,setHeaderActions:l}),[n,c,i]);return t.jsx(hl.Provider,{value:d,children:e})}function fl(){const e=a.useContext(hl);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var gl={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",change_photo:"Trocar foto",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nome",electronic_signature:"Assinatura Eletrônica",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Imediato",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_team:"Remover da equipe",leadership_select_subordinates:"Selecione pelo menos um liderado",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",updates:"Atualizações",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_like:"Curtir",updates_dialog_do_not_show_again:"Não exibir novamente",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},vl={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",change_photo:"Change photo",cannot_be_own_leader:"A leader cannot be their own superior",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_profile:"Edit Profile",edit_name:"Edit Name",electronic_signature:"Electronic Signature",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_immediate_superior:"Immediate Superior",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_team:"Remove from team",leadership_select_subordinates:"Select at least one subordinate",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",updates:"Updates",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_like:"Like",updates_dialog_do_not_show_again:"Do not show again",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},bl={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",change_photo:"Cambiar foto",cannot_be_own_leader:"Un líder no puede ser su propio superior",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nombre",electronic_signature:"Firma Electrónica",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Inmediato",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_team:"Quitar del equipo",leadership_select_subordinates:"Seleccione al menos un subordinado",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",updates:"Actualizaciones",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_like:"Me gusta",updates_dialog_do_not_show_again:"No mostrar de nuevo",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const yl="true"===(void 0).VITE_I18N_DEBUG_MODE;function wl(t,a){e.addResourceBundle(t,"app",a,!0,!0)}yl&&e.use({type:"postProcessor",name:"debugKeys",process:(e,t)=>`🔑 ${Array.isArray(t)?t[0]:t}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:gl},"en-US":{core:vl},"es-ES":{core:bl}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:yl?["debugKeys"]:[]});const jl=a.createContext({moduleAlias:null,associationsBaseUrl:null,signDocumentsSchema:"common",signDocumentsTable:"sign_documents"});function Nl({moduleAlias:e=null,associationsBaseUrl:a=null,signDocumentsSchema:r="common",signDocumentsTable:s="sign_documents",children:n}){return t.jsx(jl.Provider,{value:{moduleAlias:e,associationsBaseUrl:a,signDocumentsSchema:r,signDocumentsTable:s},children:n})}function _l(){return a.useContext(jl)}const Cl={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},kl=6e5;function Sl(e){const{moduleAlias:t,associationsBaseUrl:r}=_l(),{alias:s,user:n,isAuthenticated:o}=_o(),i=e??t,l=n?.id??null,c=o&&!!s&&!!l,{data:d=[],isLoading:u}=j.useQuery({queryKey:["qualiex-associations",l,s,r??null],queryFn:()=>oo.fetchUserAssociations(l,s,r?{baseUrl:r}:void 0),enabled:c,staleTime:kl,gcTime:12e5}),m=a.useMemo(()=>s&&0!==d.length?d.find(e=>e.companyAlias===s)??null:null,[d,s]),p=a.useCallback(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const t=Cl[e];return void 0!==t&&m.softwares.includes(t)})},[m]);return{hasAccess:a.useMemo(()=>!i||p(i),[i,p]),isLoading:c&&u,role:a.useMemo(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}const Al={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES"};function Tl(){const{association:t}=Sl(),r=t?.language;return a.useEffect(()=>{if(!r)return;const t=Al[r];t&&e.language!==t&&e.changeLanguage(t)},[r]),null}const Dl=a.createContext(void 0),Pl={locale:er,timezone:ar,datetimeFormat:tr},El=async()=>{},Ml=({children:e})=>t.jsx(Dl.Provider,{value:{...Pl,setLocale:El,setTimezone:El,setDatetimeFormat:El,isLoading:!1},children:e}),Il=()=>{const e=a.useContext(Dl);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Rl=ve.Root,Ll=ve.CollapsibleTrigger,Fl=ve.CollapsibleContent;var zl=Object.defineProperty,Ul=(e,t,a)=>((e,t,a)=>t in e?zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,t+"",a);class Ol extends a.Component{constructor(t){super(t),Ul(this,"copyErrorDetails",()=>{const t=$n.getErrors().slice(0,2),a=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${t.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(a),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,t){if((void 0).DEV)throw e;$n.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const a=$n.getErrors().slice(0,2);return t.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:t.jsxs(Tr,{className:"w-full max-w-2xl",children:[t.jsxs(Dr,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),t.jsx(Pr,{children:e.t("something_went_wrong")})]}),t.jsxs(Mr,{className:"space-y-4",children:[t.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t.jsxs(Rl,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[t.jsx(Ll,{asChild:!0,children:t.jsxs(_r,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t.jsxs(Fl,{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t.jsxs("div",{className:"text-sm space-y-2",children:[t.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&t.jsx(Ci,{className:"h-32 w-full rounded border bg-muted p-2",children:t.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),a.length>0&&t.jsxs("div",{className:"pt-3 border-t",children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),t.jsx("div",{className:"space-y-2",children:a.map((e,a)=>t.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[a+1,"."]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),t.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t.jsxs(_r,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),t.jsx(_r,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const Bl=be.Root,ql=te.forwardRef(({className:e,...a},r)=>t.jsx(be.List,{ref:r,className:wr("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));ql.displayName=be.List.displayName;const Vl=te.forwardRef(({className:e,...a},r)=>t.jsx(be.Trigger,{ref:r,className:wr("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));Vl.displayName=be.Trigger.displayName;const $l=te.forwardRef(({className:e,...a},r)=>t.jsx(be.Content,{ref:r,className:wr("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));function Wl({className:e}){return t.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),t.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),t.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function Hl({className:e}){return t.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),t.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),t.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}$l.displayName=be.Content.displayName;const Gl={init(e){!function(e){try{return t=window,a=document,r="clarity",s="script",n=e,void(a.getElementById("clarity-script")||(t[r]=t[r]||function(){(t[r].q=t[r].q||[]).push(arguments)},(o=a.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+n+"?ref=npm",o.id="clarity-script",(i=a.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var t,a,r,s,n,o,i}(e)},setTag(e,t){window.clarity("set",e,t)},identify(e,t,a,r){window.clarity("identify",e,t,a,r)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Kl="forlogic_";function Yl(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Ql(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Xl(e){return Ql()?`${Kl}${e}`:e}function Jl(e){return Ql()?`${Kl}${e}`:e}function Zl(e){try{e()}catch(t){(void 0).DEV}}function ec(e){for(const[t,a]of Object.entries(e))null!=a&&""!==a&&Gl.setTag(Jl(t),a)}function tc({module:e,isContracted:t,sourceModule:a,alias:r}){Yl()&&Zl(()=>{ec({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(t),source_module:a,alias:r}),Gl.event(Xl("module_menu_click"))})}function ac({module:e,sourceModule:t,alias:a}){Yl()&&Zl(()=>{ec({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:t,alias:a}),Gl.event(Xl("module_interest_click"))})}function rc({resource:e,sourceModule:t,alias:a}){Yl()&&Zl(()=>{ec({footer_resource:e,source_module:t,alias:a}),Gl.event(Xl("module_footer_click"))})}function sc({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:a="https://sabergestao.com.br/",wikiUrl:r,alias:s,sourceModule:n}){const{t:o}=y.useTranslation(),i=xr(e||r||"https://educacao.sabergestao.com.br/{alias}/fe",s),l=e=>{rc({resource:e,sourceModule:n,alias:s})};return t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Rr,{className:"mb-4"}),t.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Wl,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),t.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Hl,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t.jsxs("a",{href:r||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(c.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const nc=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]},{id:"admin",label:"Admin",modules:[{name:"Admin",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function oc({module:e,onClick:a}){return t.jsxs("button",{type:"button",onClick:a,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[t.jsx("div",{className:wr("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function ic(e,t){if(0===e.length)return e;const a=Math.ceil(e.length/t),r=[];for(let s=0;s<a;s++)for(let n=0;n<t;n++){const t=n*a+s;t<e.length&&r.push(e[t])}return r}function lc({modules:e,onModuleClick:r,contractedModules:s,onModuleInterest:n}){const o=function(){const[e,t]=a.useState(4);return a.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?t(4):window.matchMedia("(min-width: 768px)").matches?t(3):window.matchMedia("(min-width: 640px)").matches?t(2):t(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,t)=>e.name.localeCompare(t.name)),l=void 0!==s,c=e=>!0===e.alwaysContracted||!l||s.includes(e.name),d=i.filter(c),u=l?i.filter(e=>!c(e)):[],m=ic(d,o),p=ic(u,o),h=(e,t)=>{t?r?.(e):n?.(e)};return t.jsxs("div",{className:"space-y-6",children:[m.length>0&&t.jsx("section",{children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>t.jsx(oc,{module:e,onClick:()=>h(e,!0)},e.name))})}),p.length>0&&t.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[t.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>t.jsx(oc,{module:e,onClick:()=>h(e,!1)},e.name))})]})]})}function cc({onModuleClick:e,contractedModules:r,onModuleInterest:s,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:c,sourceModule:d,showAdminGroup:u=!1}){const[m,p]=a.useState("qualiex"),h=u?nc.find(e=>"admin"===e.id)?.modules??[]:[],x=nc.filter(e=>"admin"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...h]}:e),f=e=>{ac({module:e,sourceModule:d,alias:c}),window.open(n,"_blank","noopener,noreferrer"),s?.(e)};return t.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t.jsxs(Bl,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[t.jsx(ql,{className:"w-fit shrink-0",children:x.map(e=>t.jsxs(Vl,{value:e.id,children:[e.label,t.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),x.map(a=>t.jsx($l,{value:a.id,className:"flex-1 mt-4 overflow-auto pr-2",children:t.jsx(lc,{modules:a.modules,onModuleClick:t=>{return s=t,n=a.id,tc({module:s,isContracted:!!s.alwaysContracted||"qualiex"!==n||!r||r.includes(s.name),sourceModule:d,alias:c}),void e?.(s);var s,n},contractedModules:"qualiex"===a.id?r:void 0,onModuleInterest:f})},a.id))]}),t.jsx(sc,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c,sourceModule:d})]})}function dc(e){const{association:t}=Sl();return a.useMemo(()=>{if(e)return e;if(!t?.softwares)return;const a=t.softwares,r=nc.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const t=Cl[e.softwareAlias];return void 0!==t&&a.includes(t)}).map(e=>e.name):void 0},[e,t])}function uc({open:e,onOpenChange:a,onModuleClick:r,contractedModules:s,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:c,showAdminGroup:d}){const{alias:u,user:m}=_o(),p=dc(s),h=d??!!m?.isSysAdmin;return t.jsx(Gr,{open:e,onOpenChange:a,children:t.jsxs(Zr,{size:"lg",className:"overflow-hidden flex flex-col",children:[t.jsx(es,{className:"sr-only",children:t.jsx(rs,{children:"Módulos"})}),t.jsx(cc,{onModuleClick:e=>{r?r(e):e.url&&hr(xr(e.url,u||void 0))},contractedModules:p,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:u||void 0,sourceModule:c,showAdminGroup:h})]})})}function mc({open:r,onOpenChange:s,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:d,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:v=!0,size:b="lg",children:w,sourceModule:j}){const{t:N}=y.useTranslation(),_=a.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(t=>e.set(t.alias,t));const t=Array.from(e.values()),a=t.find(e=>e.alias===m),r=t.filter(e=>e.alias!==m).sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"}));return a?[a,...r]:r},[u,m]);return t.jsx(Gr,{open:r,onOpenChange:v?void 0:s,children:t.jsxs(Zr,{size:b,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:v?e=>e.preventDefault():void 0,onEscapeKeyDown:v?e=>e.preventDefault():void 0,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[t.jsx(rs,{children:N("no_access_page")}),t.jsx(ss,{children:"Selecione um módulo para continuar navegando!"})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsxs(_r,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[t.jsx(c.Building2,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate text-xs",children:d||"Unidade"}),t.jsx(c.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),t.jsx(Bs,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t.jsxs(qs,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&t.jsx(As,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsxs(_r,{variant:"ghost",size:"sm",className:"gap-2",children:[t.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:t.jsx(c.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),t.jsx(c.ChevronDown,{className:"h-3 w-3"})]})}),t.jsxs(Bs,{align:"end",children:[t.jsxs("div",{className:"px-2 py-1.5",children:[t.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:d})]}),t.jsx(Hs,{}),t.jsxs(qs,{onClick:h,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),w?t.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[t.jsx("div",{className:"flex-1",children:w}),t.jsx(sc,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]}):t.jsx(cc,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]})})}function pc(e,t){return t.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t)}function hc({children:e,contractedModules:r,onModuleClick:s,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:c,noAccessRedirectPath:d,noAccessRedirectMode:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=y.useTranslation(),{hasAccess:x,isLoading:f,association:g}=Sl(),{user:v,alias:b,companies:w,isAuthenticated:j,isLoading:N,logout:_,switchUnit:C}=_o(),k=dc(r),S=a.useMemo(()=>w?.length?b&&w.find(e=>e.alias===b)||w[0]:null,[w,b]),A=a.useMemo(()=>w?.length?w.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[w]),T=a.useCallback(e=>{const t=w?.find(t=>t.alias===e.alias);if(!t)return;const{pathname:a,search:r,hash:s}=window.location;if(b){const e=a.split("/"),n=e.indexOf(b);if(n>=0)return e[n]=t.alias,void(window.location.href=e.join("/")+r+s)}C(t)},[b,C,w]),D=a.useCallback(e=>{s?s(e):e.url&&hr(xr(e.url,b||void 0))},[s,b]),P=a.useMemo(()=>{if(!m)return;const e="undefined"!=typeof window?window.location.pathname:"",t=Object.keys(m).find(t=>pc(e,[t]));return t?m[t]:void 0},[m]),E="undefined"!=typeof window?window.location.pathname:"",M=!(!c?.length||!pc(E,c)),I=!N&&j&&!f&&!x&&!M&&!!d&&"always"===(u??"always")?function(e,t){return t&&e.startsWith("/")?e.split("/")[1]===t?e:`/${t}${e}`:e}(d,b):null;return a.useEffect(()=>{I&&I!==E&&window.location.replace(I)},[I,E]),N||!j||M?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Ds,{size:"lg"})}):x?t.jsx(t.Fragment,{children:e}):I?I===E?t.jsx(t.Fragment,{children:e}):t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Ds,{size:"lg"})}):t.jsx(mc,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:n,userName:v?.name,unitName:S?.name,units:A,currentAlias:b||void 0,onUnitChange:T,onLogout:_,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:p,blocking:!0,children:P})}let xc=!1;function fc(){if(xc||"undefined"==typeof document)return;xc=!0;for(const t of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=t,t.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const t of e)if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}}function gc({projectId:e,mode:t="auto"}){const{user:r,alias:s,isAuthenticated:n}=_o();a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&e&&!We()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Gl.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(a){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,t]),a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&n&&r&&"function"==typeof window.clarity)try{const e=r.email||r.identifier||"anonymous";Gl.identify(e,void 0,"modules-menu",r.name||void 0),s&&Gl.setTag("alias",s),"boolean"==typeof r.isSysAdmin&&Gl.setTag("isSysAdmin",String(r.isSysAdmin))}catch(e){(void 0).DEV}},[r,s,n,t])}let vc="legacy";function bc({projectId:e,mode:t}){return gc({projectId:e,mode:t}),null}function yc(){if(!Fe())return null;const e=Wn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),a=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||a||!(void 0).DEV)return null;const r={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[t.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",t.jsx("code",{style:r,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",t.jsx("code",{style:r,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const wc=ye.Root,jc=te.forwardRef(({className:e,...a},r)=>t.jsx(ye.Item,{ref:r,className:wr("border-b",e),...a}));jc.displayName="AccordionItem";const Nc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Header,{className:"flex",children:t.jsxs(ye.Trigger,{ref:s,className:wr("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[a,t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Nc.displayName=ye.Trigger.displayName;const _c=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:t.jsx("div",{className:wr("pb-4 pt-0",e),children:a})}));_c.displayName=ye.Content.displayName;const Cc=te.forwardRef(({...e},a)=>t.jsx("nav",{ref:a,"aria-label":"breadcrumb",...e}));Cc.displayName="Breadcrumb";const kc=te.forwardRef(({className:e,...a},r)=>t.jsx("ol",{ref:r,className:wr("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...a}));kc.displayName="BreadcrumbList";const Sc=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:wr("inline-flex items-center gap-1.5",e),...a}));Sc.displayName="BreadcrumbItem";const Ac=te.forwardRef(({asChild:e,className:a,...s},n)=>{const o=e?r.Slot:"a";return t.jsx(o,{ref:n,className:wr("transition-colors hover:text-foreground",a),...s})});Ac.displayName="BreadcrumbLink";const Tc=te.forwardRef(({className:e,...a},r)=>t.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:wr("font-normal text-foreground",e),...a}));Tc.displayName="BreadcrumbPage";const Dc=({children:e,className:a,...r})=>t.jsx("li",{role:"presentation","aria-hidden":"true",className:wr("[&>svg]:h-3.5 [&>svg]:w-3.5",a),...r,children:e??t.jsx(c.ChevronRight,{})});Dc.displayName="BreadcrumbSeparator";const Pc=({className:e,...a})=>t.jsxs("span",{role:"presentation","aria-hidden":"true",className:wr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Mais"})]});Pc.displayName="BreadcrumbEllipsis";const Ec=s.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),Mc=te.forwardRef(({className:e,orientation:a,...r},s)=>t.jsx("div",{ref:s,className:wr(Ec({orientation:a}),e),...r}));function Ic({className:e,classNames:a,showOutsideDays:r=!0,...s}){return t.jsx(M.DayPicker,{showOutsideDays:r,className:wr("p-3 pointer-events-auto",e),locale:Qa,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:"flex h-9 w-full items-center justify-center px-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1",button_previous:wr(Nr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:wr(Nr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:wr(Nr({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...a},components:{Chevron:({orientation:e})=>"left"===e?t.jsx(c.ChevronLeft,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})},...s})}Mc.displayName="ButtonGroup",Ic.displayName="Calendar";const Rc={Root:function({children:e,className:a}){return t.jsx("div",{className:wr("space-y-4",a),children:e})},Item:function({children:e,onClick:a,className:r}){return t.jsx(Tr,{className:wr("transition-colors",a&&"cursor-pointer hover:bg-muted/50",r),onClick:a,children:t.jsx(Mr,{className:"p-4",children:e})})},Field:function({label:e,value:a,className:r}){return t.jsxs("div",{className:wr("flex justify-between items-center text-sm",r),children:[t.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),t.jsx("span",{className:"text-foreground",children:a})]})}};const Lc=({shouldScaleBackground:e=!0,...a})=>t.jsx(I.Drawer.Root,{shouldScaleBackground:e,...a});Lc.displayName="Drawer";const Fc=I.Drawer.Trigger,zc=I.Drawer.Portal,Uc=I.Drawer.Close,Oc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Overlay,{ref:r,className:wr("fixed inset-0 z-50 bg-black/80",e),...a}));Oc.displayName=I.Drawer.Overlay.displayName;const Bc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(zc,{children:[t.jsx(Oc,{}),t.jsxs(I.Drawer.Content,{ref:s,className:wr("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[t.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),a]})]}));Bc.displayName="DrawerContent";const qc=({className:e,...a})=>t.jsx("div",{className:wr("grid gap-1.5 p-4 text-center sm:text-left",e),...a});qc.displayName="DrawerHeader";const Vc=({className:e,...a})=>t.jsx("div",{className:wr("mt-auto flex flex-col gap-2 p-4",e),...a});Vc.displayName="DrawerFooter";const $c=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Title,{ref:r,className:wr("text-lg font-semibold leading-none tracking-tight",e),...a}));$c.displayName=I.Drawer.Title.displayName;const Wc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Description,{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));Wc.displayName=I.Drawer.Description.displayName;const Hc={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},Gc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Kc=we.Root,Yc=we.Trigger,Qc=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,...s},n)=>t.jsx(we.Content,{ref:n,align:a,sideOffset:r,className:wr("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));Qc.displayName=we.Content.displayName;const Xc=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-slot":"input-group",className:wr("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...a}));Xc.displayName="InputGroup";const Jc=s.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),Zc=te.forwardRef(({className:e,align:a,...r},s)=>t.jsx("div",{ref:s,"data-slot":"input-group-addon",className:wr(Jc({align:a}),e),...r}));Zc.displayName="InputGroupAddon";const ed=s.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),td=te.forwardRef(({className:e,size:a,variant:r="ghost",...s},n)=>t.jsx(_r,{ref:n,"data-slot":"input-group-button",variant:r,className:wr(ed({size:a}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...s}));td.displayName="InputGroupButton";const ad=te.forwardRef(({className:e,...a},r)=>t.jsx(kr,{ref:r,"data-slot":"input-group-control",className:wr("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));ad.displayName="InputGroupInput";const rd=te.forwardRef(({className:e,...a},r)=>t.jsx(ks,{ref:r,"data-slot":"input-group-control",className:wr("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));rd.displayName="InputGroupTextarea";const sd=te.forwardRef(({className:e,...a},r)=>t.jsx("h1",{ref:r,className:wr("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...a}));sd.displayName="H1";const nd=te.forwardRef(({className:e,...a},r)=>t.jsx("h2",{ref:r,className:wr("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...a}));nd.displayName="H2";const od=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:wr("scroll-m-20 text-2xl font-semibold tracking-tight",e),...a}));od.displayName="H3";const id=te.forwardRef(({className:e,...a},r)=>t.jsx("h4",{ref:r,className:wr("scroll-m-20 text-xl font-semibold tracking-tight",e),...a}));id.displayName="H4";const ld=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:wr("leading-7 [&:not(:first-child)]:mt-6",e),...a}));ld.displayName="P";const cd=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:wr("text-xl text-muted-foreground",e),...a}));cd.displayName="Lead";const dd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:wr("text-lg font-semibold",e),...a}));dd.displayName="Large";const ud=te.forwardRef(({className:e,...a},r)=>t.jsx("small",{ref:r,className:wr("text-sm font-medium leading-none",e),...a}));ud.displayName="Small";const md=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));md.displayName="Muted";const pd=te.forwardRef(({className:e,...a},r)=>t.jsx("code",{ref:r,className:wr("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...a}));pd.displayName="InlineCode";const hd=te.forwardRef(({className:e,...a},r)=>t.jsx("blockquote",{ref:r,className:wr("mt-6 border-l-2 pl-6 italic",e),...a}));hd.displayName="Blockquote";const xd=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:wr("my-6 ml-6 list-disc [&>li]:mt-2",e),...a}));xd.displayName="List";const fd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Root,{ref:s,className:wr("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...r,children:[a,t.jsx(Nd,{})]}));fd.displayName=je.Root.displayName;const gd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.List,{ref:r,className:wr("group flex flex-1 list-none items-center justify-center space-x-1",e),...a}));gd.displayName=je.List.displayName;const vd=je.Item,bd=s.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),yd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Trigger,{ref:s,className:wr(bd(),"group",e),...r,children:[a," ",t.jsx(c.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));yd.displayName=je.Trigger.displayName;const wd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Content,{ref:r,className:wr("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...a}));wd.displayName=je.Content.displayName;const jd=je.Link,Nd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:wr("absolute left-0 top-full flex justify-center"),children:t.jsx(je.Viewport,{className:wr("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:r,...a})}));Nd.displayName=je.Viewport.displayName;const _d=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Indicator,{ref:r,className:wr("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...a,children:t.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));_d.displayName=je.Indicator.displayName;const Cd=({className:e,...a})=>t.jsx("nav",{role:"navigation","aria-label":"pagination",className:wr("mx-auto flex w-full justify-center",e),...a});Cd.displayName="Pagination";const kd=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:wr("flex flex-row items-center gap-1",e),...a}));kd.displayName="PaginationContent";const Sd=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:wr("",e),...a}));Sd.displayName="PaginationItem";const Ad=({className:e,isActive:a,size:r="icon",...s})=>t.jsx("a",{"aria-current":a?"page":void 0,className:wr(Nr({variant:a?"outline":"ghost",size:r}),e),...s});Ad.displayName="PaginationLink";const Td=({className:a,...r})=>t.jsxs(Ad,{"aria-label":e.t("go_to_previous_page"),size:"default",className:wr("gap-1 pl-2.5",a),...r,children:[t.jsx(c.ChevronLeft,{className:"h-4 w-4"}),t.jsx("span",{children:"Previous"})]});Td.displayName="PaginationPrevious";const Dd=({className:a,...r})=>t.jsxs(Ad,{"aria-label":e.t("go_to_next_page"),size:"default",className:wr("gap-1 pr-2.5",a),...r,children:[t.jsx("span",{children:"Next"}),t.jsx(c.ChevronRight,{className:"h-4 w-4"})]});Dd.displayName="PaginationNext";const Pd=({className:e,...a})=>t.jsxs("span",{"aria-hidden":!0,className:wr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"More pages"})]});Pd.displayName="PaginationEllipsis";const Ed=te.forwardRef(({className:e,value:a,...r},s)=>t.jsx(Ne.Root,{ref:s,className:wr("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:t.jsx(Ne.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));Ed.displayName=Ne.Root.displayName;const Md=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Root,{className:wr("grid gap-2",e),...a,ref:r}));Md.displayName=_e.Root.displayName;const Id=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Item,{ref:r,className:wr("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:t.jsx(_e.Indicator,{className:"flex items-center justify-center",children:t.jsx(c.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Id.displayName=_e.Item.displayName;const Rd=Ce.Panel,Ld=se.Root,Fd=se.Trigger,zd=se.Close,Ud=se.Portal,Od=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{className:wr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));Od.displayName=se.Overlay.displayName;const Bd=s.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),qd=te.forwardRef(({side:e="right",className:a,children:r,...s},n)=>t.jsxs(Ud,{children:[t.jsx(Od,{}),t.jsxs(se.Content,{ref:n,className:wr(Bd({side:e}),a),...s,children:[r,t.jsxs(se.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qd.displayName=se.Content.displayName;const Vd=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:wr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Rr,{className:"mt-2"})]});Vd.displayName="SheetHeader";const $d=({className:e,...a})=>t.jsx("div",{className:wr("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...a});$d.displayName="SheetBody";const Wd=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Rr,{className:"mb-4"}),t.jsx("div",{className:wr("flex flex-row justify-end gap-2",e),...r,children:a})]});Wd.displayName="SheetFooter";const Hd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:wr("text-lg font-semibold text-foreground",e),...a}));Hd.displayName=se.Title.displayName;const Gd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:wr("text-sm text-muted-foreground",e),...a}));Gd.displayName=se.Description.displayName;const Kd="sidebar:state",Yd=te.createContext(null);function Qd(){const e=te.useContext(Yd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Xd=te.forwardRef(({defaultOpen:e=!0,open:a,onOpenChange:r,className:s,style:n,children:o,...i},l)=>{const c=So(),[d,u]=te.useState(!1),[m,p]=te.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(Kd);return null!==t?"true"===t:e}return e}),h=a??m,x=te.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):p(t),"undefined"!=typeof window&&localStorage.setItem(Kd,String(t))},[r,h]),f=te.useCallback(()=>c?u(e=>!e):x(e=>!e),[c,x,u]);te.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",v=te.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:f}),[g,h,x,c,d,u,f]);return t.jsx(Yd.Provider,{value:v,children:t.jsx(Ks,{delayDuration:0,children:t.jsx("div",{className:wr("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",s),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});Xd.displayName="SidebarProvider";const Jd=te.forwardRef(({side:e="left",variant:a="sidebar",collapsible:r="offcanvas",className:s,children:n,...o},i)=>{const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Qd();return"none"===r?t.jsx("div",{className:wr("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:i,...o,children:n}):l?t.jsx(Ld,{open:d,onOpenChange:u,...o,children:t.jsxs(qd,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[t.jsx(Hd,{className:"sr-only",children:"Menu de Navegação"}),t.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):t.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?r:"","data-variant":a,"data-side":e,children:[t.jsx("div",{className:wr("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:wr("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});Jd.displayName="Sidebar";const Zd=te.forwardRef(({className:e,onClick:a,...r},s)=>{const{toggleSidebar:n}=Qd();return t.jsxs(_r,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:wr("h-7 w-7",e),onClick:e=>{a?.(e),n()},...r,children:[t.jsx(c.PanelLeft,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Zd.displayName="SidebarTrigger";const eu=te.forwardRef(({className:e,...a},r)=>{const{toggleSidebar:s}=Qd();return t.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:wr("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...a})});eu.displayName="SidebarRail";const tu=te.forwardRef(({className:e,...a},r)=>t.jsx("main",{ref:r,className:wr("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...a}));tu.displayName="SidebarInset";const au=te.forwardRef(({className:e,...a},r)=>t.jsx(kr,{ref:r,"data-sidebar":"input",className:wr("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...a}));au.displayName="SidebarInput";const ru=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"header",className:wr("flex flex-col gap-2 p-2",e),...a}));ru.displayName="SidebarHeader";const su=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"footer",className:wr("flex flex-col gap-2 p-2",e),...a}));su.displayName="SidebarFooter";const nu=te.forwardRef(({className:e,...a},r)=>t.jsx(Rr,{ref:r,"data-sidebar":"separator",className:wr("mx-2 w-auto bg-sidebar-border",e),...a}));nu.displayName="SidebarSeparator";const ou=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"content",className:wr("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...a}));ou.displayName="SidebarContent";const iu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group",className:wr("relative flex w-full min-w-0 flex-col p-2",e),...a}));iu.displayName="SidebarGroup";const lu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"div";return t.jsx(o,{ref:n,"data-sidebar":"group-label",className:wr("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})});lu.displayName="SidebarGroupLabel";const cu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"button";return t.jsx(o,{ref:n,"data-sidebar":"group-action",className:wr("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...s})});cu.displayName="SidebarGroupAction";const du=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group-content",className:wr("w-full text-sm",e),...a}));du.displayName="SidebarGroupContent";const uu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu",className:wr("flex w-full min-w-0 flex-col gap-1",e),...a}));uu.displayName="SidebarMenu";const mu=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,"data-sidebar":"menu-item",className:wr("group/menu-item relative",e),...a}));mu.displayName="SidebarMenuItem";const pu=s.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),hu=te.forwardRef(({asChild:e=!1,isActive:a=!1,variant:s="default",size:n="default",tooltip:o,className:i,...l},c)=>{const d=e?r.Slot:"button",{isMobile:u,state:m}=Qd(),p=t.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":n,"data-active":a,className:wr(pu({variant:s,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:p}),t.jsx(Xs,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});hu.displayName="SidebarMenuButton";const xu=te.forwardRef(({className:e,asChild:a=!1,showOnHover:s=!1,...n},o)=>{const i=a?r.Slot:"button";return t.jsx(i,{ref:o,"data-sidebar":"menu-action",className:wr("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});xu.displayName="SidebarMenuAction";const fu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:wr("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...a}));fu.displayName="SidebarMenuBadge";const gu=te.forwardRef(({className:e,showIcon:a=!1,...r},s)=>{const n=te.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:wr("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[a&&t.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});gu.displayName="SidebarMenuSkeleton";const vu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:wr("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...a}));vu.displayName="SidebarMenuSub";const bu=te.forwardRef(({...e},a)=>t.jsx("li",{ref:a,...e}));bu.displayName="SidebarMenuSubItem";const yu=te.forwardRef(({asChild:e=!1,size:a="md",isActive:s,className:n,...o},i)=>{const l=e?r.Slot:"a";return t.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":a,"data-active":s,className:wr("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});yu.displayName="SidebarMenuSubButton";const wu=te.forwardRef(({className:e,value:a,defaultValue:r,...s},n)=>{const o=a||r||[0];return t.jsxs(ke.Root,{ref:n,value:a,defaultValue:r,className:wr("relative flex w-full touch-none select-none items-center",e),...s,children:[t.jsx(ke.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:t.jsx(ke.Range,{className:"absolute h-full bg-primary"})}),o.map((e,a)=>t.jsx(ke.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},a))]})});wu.displayName=ke.Root.displayName;const ju=Se.Menu,Nu=Se.Group,_u=Se.Portal,Cu=Se.Sub,ku=Se.RadioGroup,Su=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Root,{ref:r,className:wr("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...a}));Su.displayName=Se.Root.displayName;const Au=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Trigger,{ref:r,className:wr("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...a}));Au.displayName=Se.Trigger.displayName;const Tu=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(Se.SubTrigger,{ref:n,className:wr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Tu.displayName=Se.SubTrigger.displayName;const Du=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.SubContent,{ref:r,className:wr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Du.displayName=Se.SubContent.displayName;const Pu=te.forwardRef(({className:e,align:a="start",alignOffset:r=-4,sideOffset:s=8,...n},o)=>t.jsx(Se.Portal,{children:t.jsx(Se.Content,{ref:o,align:a,alignOffset:r,sideOffset:s,className:wr("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Pu.displayName=Se.Content.displayName;const Eu=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Item,{ref:s,className:wr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Eu.displayName=Se.Item.displayName;const Mu=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(Se.CheckboxItem,{ref:n,className:wr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Mu.displayName=Se.CheckboxItem.displayName;const Iu=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Se.RadioItem,{ref:s,className:wr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Iu.displayName=Se.RadioItem.displayName;const Ru=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Label,{ref:s,className:wr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Ru.displayName=Se.Label.displayName;const Lu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Separator,{ref:r,className:wr("-mx-1 my-1 h-px bg-muted",e),...a}));Lu.displayName=Se.Separator.displayName;const Fu=({className:e,...a})=>t.jsx("span",{className:wr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});Fu.displayname="MenubarShortcut";const zu={light:"",dark:".dark"},Uu=te.createContext(null);function Ou(){const e=te.useContext(Uu);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Bu=te.forwardRef(({id:e,className:a,children:r,config:s,...n},o)=>{const i=te.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return t.jsx(Uu.Provider,{value:{config:s},children:t.jsxs("div",{"data-chart":l,ref:o,className:wr("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...n,children:[t.jsx(qu,{id:l,config:s}),t.jsx(Ae.ResponsiveContainer,{children:r})]})})});Bu.displayName="Chart";const qu=({id:e,config:a})=>{const r=Object.entries(a).filter(([,e])=>e.theme||e.color);return r.length?t.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(zu).map(([t,a])=>`\n${a} [data-chart=${e}] {\n${r.map(([e,a])=>{const r=a.theme?.[t]||a.color;return r?` --color-${e}: ${r};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Vu=Ae.Tooltip,$u=te.forwardRef(({active:e,payload:a,className:r,indicator:s="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:c,formatter:d,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=Ou(),f=te.useMemo(()=>{if(n||!a?.length)return null;const[e]=a,r=Gu(x,e,`${p||e?.dataKey||e?.name||"value"}`),s=p||"string"!=typeof i?r?.label:x[i]?.label||i;return l?t.jsx("div",{className:wr("font-medium",c),children:l(s,a)}):s?t.jsx("div",{className:wr("font-medium",c),children:s}):null},[i,l,a,n,c,x,p]);if(!e||!a?.length)return null;const g=1===a.length&&"dot"!==s;return t.jsxs("div",{ref:h,className:wr("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:f,t.jsx("div",{className:"grid gap-1.5",children:a.map((e,a)=>{const r=`${m||e.name||e.dataKey||"value"}`,n=Gu(x,e,r),i=u||e.payload?.fill||e.color;return t.jsx("div",{className:wr("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===s&&"items-center"),children:d&&void 0!==e?.value&&e.name?d(e.value,e.name,e,a,e.payload):t.jsxs(t.Fragment,{children:[n?.icon?t.jsx(n.icon,{}):!o&&t.jsx("div",{className:wr("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===s,"w-1":"line"===s,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===s,"my-0.5":g&&"dashed"===s}),style:{"--color-bg":i,"--color-border":i}}),t.jsxs("div",{className:wr("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[t.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,t.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&t.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||a)})})]})});$u.displayName="ChartTooltip";const Wu=Ae.Legend,Hu=te.forwardRef(({className:e,hideIcon:a=!1,payload:r,verticalAlign:s="bottom",nameKey:n},o)=>{const{config:i}=Ou();return r?.length?t.jsx("div",{ref:o,className:wr("flex items-center justify-center gap-4","top"===s?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${n||e.dataKey||"value"}`,s=Gu(i,e,r);return t.jsxs("div",{className:wr("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[s?.icon&&!a?t.jsx(s.icon,{}):t.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),s?.label]},e.value)})}):null});function Gu(e,t,a){if("object"!=typeof t||null===t)return;const r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let s=a;return a in t&&"string"==typeof t[a]?s=t[a]:r&&a in r&&"string"==typeof r[a]&&(s=r[a]),s in e?e[s]:e[a]}Hu.displayName="ChartLegend";const Ku=({onClick:e,isActive:a,disabled:r,children:s,title:n})=>t.jsx("button",{type:"button",onClick:e,disabled:r,title:n,className:wr("p-1.5 rounded hover:bg-muted transition-colors",a?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:s}),Yu=()=>t.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Qu({image:e,title:a,className:r}){return t.jsx("div",{className:wr("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?t.jsx("img",{src:e,alt:a,className:"w-full h-full object-cover"}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(c.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function Xu({steps:e,currentStepIndex:a,onStepSelect:r,stepLabel:s,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(a+1)/i*100;return t.jsxs("div",{className:wr("flex items-center gap-3",n),children:[t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsxs(_r,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[s," ",a+1,"/",i,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(Bs,{align:"start",children:e.map((e,s)=>t.jsxs(qs,{onClick:()=>r(s),className:wr(s===a&&"bg-accent"),children:[s+1,". ",e.title]},e.id))})]}),t.jsx(Ed,{value:l,className:"w-32 h-2"})]})}function Ju({currentStepIndex:e,totalSteps:a,onBack:r,onNext:s,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:d}){const{t:u}=y.useTranslation(),m=0===e,p=e===a-1;return t.jsxs("div",{className:wr("flex items-center gap-2",d),children:[!m&&t.jsxs(_r,{variant:"outline",onClick:r,size:"sm",children:[t.jsx(c.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),t.jsxs(_r,{onClick:p?n:s,size:"sm",children:[p?l:i,!p&&t.jsx(c.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const Zu=te.forwardRef(({open:a,onOpenChange:r,steps:s,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:d="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[v,b]=te.useState(0),y=void 0!==h,w=y?h:v,j=te.useCallback(e=>{y?x?.(e):b(e),o?.(e)},[y,x,o]);te.useEffect(()=>{a||y||b(0)},[a,y]);const N=s[w],_=s.length;return N?t.jsx(Gr,{open:a,onOpenChange:r,children:t.jsxs(Zr,{ref:g,size:m,variant:"informative",className:wr("p-0 gap-0 overflow-hidden",f),children:[t.jsxs(Qr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Fechar"})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(Qu,{image:N.image,title:N.title}),t.jsx(rs,{className:"text-xl font-semibold",children:N.title}),t.jsx(ss,{className:"text-muted-foreground",children:N.description})]})}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx(Rr,{}),t.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?t.jsx(Xu,{steps:s,currentStepIndex:w,onStepSelect:e=>{j(e)},stepLabel:u}):t.jsx("div",{}),t.jsx(Ju,{currentStepIndex:w,totalSteps:_,onBack:()=>{w>0&&j(w-1)},onNext:()=>{w<_-1&&j(w+1)},onComplete:()=>{n?.(),r(!1)},backButtonText:l,continueButtonText:i,finishButtonText:d})]})]})]})}):null});function em({label:e,onClick:a,icon:r,actions:s=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:d="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(s.length>0))return t.jsxs(_r,{variant:n,size:o,disabled:p,onClick:a,className:u,children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]});return t.jsxs("div",{className:wr("inline-flex rounded-md shadow-sm",u),children:[t.jsxs(_r,{variant:n,size:o,disabled:p,onClick:a,className:"rounded-r-none border-r-0 focus:z-10",children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]}),t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsx(_r,{variant:n,size:o,disabled:p,className:wr("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:t.jsx(c.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),t.jsx(Bs,{align:d,className:"min-w-[160px]",children:s.map(e=>{const a=e.icon;return t.jsxs(qs,{onClick:e.onClick,disabled:e.disabled,className:wr("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}Zu.displayName="OnboardingDialog";var tm=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(tm||{});const am=[{value:"csv",label:"CSV",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:t.jsx(c.FileSpreadsheet,{className:"h-5 w-5"})}],rm=[{value:"png",label:"PNG",icon:t.jsx(c.Image,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})}];const sm=a.forwardRef(({value:e,onChange:r,onTimeChange:s,label:n,error:o,format:i="24h",className:l,id:d,...u},m)=>{const p=d??te.useId(),h=a.useCallback(e=>{const t=e.target.value;r?.(t),s?.(t)},[r,s]),x=a.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t.jsxs("div",{className:wr("grid gap-1.5",l),children:[n&&t.jsx(Ar,{htmlFor:p,children:n}),t.jsxs("div",{className:"relative",children:[t.jsx(kr,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:wr("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),t.jsx(c.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&t.jsx("p",{className:"text-sm text-destructive",children:o})]})});function nm({currentStep:e,totalSteps:a,onStepChange:r,stepLabels:s,canGoToStep:n,className:o,progressWidth:i="w-32"}){te.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:a},(e,t)=>t+1),d=t=>!(t<=e)&&(!!n&&!n(t));return t.jsxs("div",{className:wr("flex items-center gap-3",o),children:[t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsxs(_r,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",a,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(Bs,{align:"start",children:l.map(a=>t.jsxs(qs,{onClick:()=>{var t;(t=a)<e?r(t):n&&!n(t)||r(t)},disabled:d(a),className:wr("cursor-pointer",a===e&&"bg-muted font-medium",d(a)&&"opacity-50 cursor-not-allowed"),children:[t.jsxs("span",{className:"mr-2 text-muted-foreground",children:[a,"."]}),s?.[a-1]||`Etapa ${a}`,a===e&&t.jsx(c.Check,{className:"h-4 w-4 ml-auto"})]},a))})]}),t.jsx(Ed,{value:e/a*100,className:wr("h-2",i)})]})}function om(e){const t=Bn.getAccessToken(),a={"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},"un-alias":e};if(t)try{const e=JSON.parse(atob(t.split(".")[1]));e.sub&&(a["x-waf-rate"]=btoa(e.sub))}catch{}return a}async function im(e,t,a){let r=await fetch(e,t);if(401===r.status){if(await no.handleApiError({status:401})){const s={...t,headers:om(a)};r=await fetch(e,s)}}return r}function lm(e){const[t,r]=a.useState([]),[s,n]=a.useState(0),[o,i]=a.useState(!1);a.useEffect(()=>{if(!e)return;let t=!1;const a=`${Ge().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const s=om(e),o=await im(a,{method:"GET",headers:s},e);if(!o.ok)return;const i=await o.json();!t&&i.data?.[0]&&(r(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(s){}finally{t||i(!1)}}(),()=>{t=!0}},[e]);const l=a.useCallback(async()=>{if(!e||s<=0||0===t.length)return;const a=t[0].id,r=`${Ge().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const t=om(e),s=JSON.stringify({id:a,idUpdateType:3});await im(r,{method:"POST",headers:t,body:s},e)}catch(o){}},[e,s,t]);return{updates:t,badgeCount:s,loading:o,markAsVisualized:l}}sm.displayName="Timepicker";const cm=a.forwardRef(({updates:a,badgeCount:r,onOpen:s,onViewAll:n},o)=>{const i=void 0===a,l=_o(),d=l?.alias??null,u=lm(i?d:null),m=N.useNavigate(),p=i?u.updates??[]:a,h=i?u.badgeCount??0:r??0,x=s??(i?u.markAsVisualized:void 0),f=n??(i&&d?()=>{m(`/${d}/up/view`)}:void 0);return t.jsxs(Zs,{children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:x,title:e.t("updates"),children:[t.jsx(c.Coffee,{className:"h-7 w-7"}),h>0&&t.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:h>99?"99+":h})]})}),t.jsxs(tn,{align:"end",className:"w-80 p-0",children:[t.jsx("div",{className:"border-b border-border px-4 py-3",children:t.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),t.jsx("div",{className:"max-h-72 overflow-y-auto",children:p.length>0?t.jsx("ul",{className:"divide-y divide-border",children:p.map(e=>t.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:f,children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[t.jsx(c.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.jsxs(_r,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:f,children:["Ver todas as atualizações",t.jsx(c.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});cm.displayName="UpdatesNotification";var dm=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(dm||{}),um=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(um||{});const mm={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function pm(e){const{t:t}=y.useTranslation();return e?mm[e.toLowerCase()]??0:0}const hm={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function xm(e){const{t:t}=y.useTranslation();return hm[e?.toLowerCase()]||""}function fm(e){const{t:t}=y.useTranslation(),a=e%60;return`${Math.floor(e/60)}min ${a<10?"0":""}${a}`}function gm({open:e,onOpenChange:r,url:s,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),d=a.useCallback(()=>{r(!1)},[r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&d()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,d]),t.jsx(Gr,{open:e,onOpenChange:r,children:t.jsxs(Zr,{className:wr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[t.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&t.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Xs,{children:"Fechar"})]})]}),t.jsx("iframe",{src:s,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function vm({term:r,open:s,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:d=e.t("terms_read_agree")}){const u=a.useMemo(()=>r.file?function(e,t=""){const{t:a}=y.useTranslation(),r=atob(e),s=[];for(let o=0;o<r.length;o+=512){const e=r.slice(o,o+512),t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);s.push(new Uint8Array(t))}const n=new Blob(s,{type:t});return URL.createObjectURL(n)}(r.file,r.type):null,[r.file,r.type]),m=a.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=a.useCallback(()=>{r.hasUserSignature?m():o?.(r.id)},[r,o,m]),h=!i&&!r.hasUserSignature&&o;return t.jsx(Gr,{open:s,onOpenChange:e=>!e&&m(),children:t.jsxs(Zr,{className:wr("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[t.jsx(c.FileText,{className:"h-5 w-5 text-primary"}),l]}),t.jsxs("div",{className:"flex items-center gap-2",children:[h&&t.jsx(_r,{size:"sm",onClick:p,children:d}),t.jsx(_r,{variant:"ghost",size:"icon",onClick:m,children:t.jsx(c.X,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"flex-1 min-h-0",children:r.file&&u?t.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function bm(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function ym(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function wm(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.allowedIds?.forEach(e=>a.add(e)),r.inheritedIds?.forEach(e=>a.add(e));return a}var jm=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))(jm||{});const Nm={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function _m(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Cm(e){const{t:t}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const km={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};var Sm=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Sm||{}),Am=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(Am||{}),Tm=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Tm||{}),Dm=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(Dm||{}),Pm=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(Pm||{}),Em=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(Em||{}),Mm=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(Mm||{}),Im=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(Im||{}),Rm=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(Rm||{}),Lm=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(Lm||{}),Fm=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(Fm||{}),zm=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(zm||{}),Um=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(Um||{}),Om=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(Om||{}),Bm=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(Bm||{}),qm=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))(qm||{}),Vm=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(Vm||{}),$m=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))($m||{}),Wm=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(Wm||{}),Hm=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))(Hm||{}),Gm=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(Gm||{}),Km=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(Km||{}),Ym=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(Ym||{}),Qm=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(Qm||{}),Xm=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(Xm||{}),Jm=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(Jm||{});const Zm={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},ep=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],tp=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function ap(e){if(!e)return 0;const[t,a]=e.split("/"),r=Zm[t?.toLowerCase()]??0;return 12*(parseInt(a)||0)+r}function rp(e){const t=e.split("/"),a=t[t.length-1];return`${t.slice(0,-1).join("/")}/${encodeURIComponent(a.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function sp(e){for(const t of tp)if(e[t])return e[t];return null}function np(e){const t=[];for(const a of Object.keys(e)){const r=e[a];null!=r&&(r instanceof Date?t.push(`${a}=${r.toISOString()}`):Array.isArray(r)?r.forEach(e=>{t.push(...np({[a]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||t.push(`${a}=${r}`))}return t}const op=/^-?\d+(,\d{3})*(\.\d+)?$/;const ip=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const lp=new Set([Lm.Text]),cp=new Set([Lm.Text,Lm.Numeric,Lm.RiskMatrix,Lm.Burndown,Lm.PerformanceColumns]),dp=new Set([Lm.Text,Lm.RiskMatrix,Lm.Burndown,Lm.PerformanceColumns]);function up({config:e,viewOnly:r=!1,complement:s,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:d,className:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(e.onlyMine??!1),x=lp.has(e.typeId),f=!cp.has(e.typeId),g=!dp.has(e.typeId),v=a.useMemo(()=>{if(!e.jsonRules||e.typeId===Lm.PerformanceColumns)return!1;try{const t=JSON.parse(e.jsonRules);return t?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),b=a.useMemo(()=>o?.(e)??"#",[o,e]),w=a.useCallback(()=>{const e=!p;h(e),d?.(e)},[p,d]),j=[];return p&&j.push(m("dashboard_only_mine")),e.onlyLate&&j.push(m("dashboard_only_overdue")),v&&j.push(m("dashboard_advanced_filter")),t.jsxs("div",{className:wr("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&s,t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("span",{className:"block truncate",children:e.title})}),t.jsx(Xs,{children:e.title})]}),j.length>0&&t.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:j.join(" | ")})]}),"after-title"===n&&s]}),!r&&t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&s,t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-6 w-6",children:t.jsx(c.MoreVertical,{className:"h-3.5 w-3.5"})})}),t.jsxs(Bs,{align:"end",className:"w-48",children:[e.canUpdate&&t.jsxs(qs,{onClick:()=>e.onEdit?.(e.id),children:[t.jsx(c.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&t.jsxs(qs,{onClick:i,children:[t.jsx(c.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&t.jsxs(qs,{disabled:e.noData,onClick:l,children:[t.jsx(c.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&t.jsxs(qs,{disabled:!e.openQueryEnabled,onClick:()=>window.open(b,"_blank"),children:[t.jsx(c.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&t.jsxs(t.Fragment,{children:[t.jsx(Hs,{}),t.jsxs(qs,{onClick:w,children:[p&&t.jsx(c.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&t.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t.jsxs(t.Fragment,{children:[t.jsx(Hs,{}),t.jsxs(qs,{onClick:()=>e.onDuplicate?.(e.id),children:[t.jsx(c.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t.jsxs(qs,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[t.jsx(c.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&s]})]})}function mp({config:e,queryUrl:a,className:r}){return t.jsxs("div",{className:wr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t.jsxs("p",{className:"mt-2 text-xs",children:[a&&t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),a&&e.canUpdate&&t.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function pp({panelType:e,className:a}){const r=e===Lm.Burndown;return t.jsxs("div",{className:wr("flex flex-1 flex-col items-center justify-center gap-2 p-4",a),children:[t.jsx(Ds,{className:"h-10 w-10 text-muted-foreground/40"}),r&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function hp({hasRemovedColumn:a=!1,className:r}){return t.jsxs("div",{className:wr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),t.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function xp({onRemove:e,className:a}){return t.jsxs("div",{className:wr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",a),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&t.jsx("p",{className:"mt-2 text-xs",children:t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const fp={[Sm.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Sm.Sum]:"Sum",[Sm.Average]:e.t("dashboard_average"),[Sm.DistinctCount]:e.t("dashboard_distinct_count"),[Sm.Max]:e.t("dashboard_max_value"),[Sm.Min]:e.t("dashboard_min_value")};function gp({config:e,state:a,value:r,label:s,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:c,className:d}){const{t:u}=y.useTranslation(),m=s??fp[e.aggregationType??""]??"",p=function(e,t){if(null==e)return"—";const a=ep.includes(t.field),r=t.aggregationType===Sm.Count||t.aggregationType===Sm.DistinctCount;return a&&!r?ip.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(r,e);return t.jsxs("div",{className:wr("flex h-full flex-col",d),children:[t.jsx(up,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:c}),a===Wm.Loading&&t.jsx(pp,{}),a===Wm.Loaded&&t.jsxs("div",{className:wr("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[t.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),a===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),a===Wm.Error&&t.jsx(mp,{config:e,queryUrl:l}),a===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function vp({config:e,state:a,htmlContent:r,viewOnly:s=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const c=r??e.textTypeString??"";return t.jsxs("div",{className:wr("flex h-full flex-col",l),children:[t.jsx(up,{config:e,viewOnly:s,onRefresh:n,queryUrlBuilder:i}),a===Wm.Loading&&t.jsx(pp,{}),a===Wm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),a===Wm.Error&&t.jsx(mp,{config:e,queryUrl:o})]})}function bp({config:e,state:r,data:s=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=a.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=a.useCallback(e=>{if(i)i(e);else if(m){const t=sp(e);t&&window.open(rp(t),"_blank")}},[i,m]);return t.jsxs("div",{className:wr("flex h-full flex-col",p),children:[t.jsx(up,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Wm.Loading&&t.jsx(pp,{}),r===Wm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:t.jsx("tr",{children:h.map(e=>t.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),t.jsx("tbody",{children:s.map((e,a)=>{const r=m&&!!sp(e);return t.jsx("tr",{className:wr("border-b border-border/50 transition-colors hover:bg-muted/30",(r||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(a=>t.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:a.render?a.render(e[a.columnName],e):yp(e[a.columnName],a)},a.columnName))},a)})})]})}),r===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),r===Wm.Error&&t.jsx(mp,{config:e,queryUrl:d}),r===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function yp(e,t){return null==e?"":e instanceof Date?"datetime"===t.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const wp=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function jp({config:e,variant:r,state:s,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:c,viewOnly:d=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:wp,v=a.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),b="bar"===r,y="stacked-column"===r,w=a.useMemo(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t.jsxs("div",{className:wr("flex h-full flex-col",f),children:[t.jsx(up,{config:e,viewOnly:d,onRefresh:m,onExport:p,queryUrlBuilder:x}),s===Wm.Loading&&t.jsx(pp,{}),s===Wm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:Np({variant:r,data:n,series:v,colors:g,categoryKey:l,isHorizontalBar:b,isStacked:y,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),s===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),s===Wm.Error&&t.jsx(mp,{config:e,queryUrl:h}),s===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Np({variant:e,data:a,series:r,colors:s,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:c,onPointClick:d}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=t.jsx(q.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=t.jsx(q.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=t.jsx(q.Tooltip,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=r.length>1?t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=d?(e,t)=>d(a[t],t):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t.jsxs(q.BarChart,{data:a,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||s[a%s.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:d?"pointer":void 0},e.dataKey))]}):"area"===e?t.jsxs(q.AreaChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>{const r=e.color||s[a%s.length];return t.jsx(q.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:d?"pointer":void 0}},e.dataKey)})]}):t.jsxs(q.LineChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||s[a%s.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:d?"pointer":void 0}},e.dataKey))]})}const _p=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function Cp({config:e,state:r,data:s=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:_p,h=a.useMemo(()=>s.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[s]),x=a.useMemo(()=>h.reduce((e,t)=>e+(t.value??0),0),[h]);return t.jsxs("div",{className:wr("flex h-full flex-col",m),children:[t.jsx(up,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Wm.Loading&&t.jsx(pp,{}),r===Wm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.PieChart,{children:[t.jsx(q.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:t})=>`${e??""}: ${(100*(t??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,t)=>i(s[t],t):void 0,cursor:i?"pointer":void 0,children:h.map((e,a)=>t.jsx(q.Cell,{fill:p[a%p.length]},a))}),t.jsx(q.Tooltip,{formatter:e=>{const t="number"==typeof e?e:0,a=x>0?(t/x*100).toFixed(1):"0";return`${t.toLocaleString("pt-BR")} (${a}%)`}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),r===Wm.Error&&t.jsx(mp,{config:e,queryUrl:d}),r===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function kp({config:e,state:r,data:s=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:c,onExport:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=a.useMemo(()=>{const e=[...s].sort((e,t)=>(t.value??0)-(e.value??0)),t=e.reduce((e,t)=>e+(t.value??0),0);let a=0;return e.map(e=>(a+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:t>0?Math.round(a/t*100):0}))},[s]);return t.jsxs("div",{className:wr("flex h-full flex-col",p),children:[t.jsx(up,{config:e,viewOnly:i,onRefresh:c,onExport:d,queryUrlBuilder:m}),r===Wm.Loading&&t.jsx(pp,{}),r===Wm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),t.jsx(q.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:(e,t)=>"% Acumulado"===t?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,t)=>l(s[t],t):void 0,cursor:l?"pointer":void 0}),t.jsx(q.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),r===Wm.Error&&t.jsx(mp,{config:e,queryUrl:u}),r===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Sp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:c,queryUrl:d,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=s??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return t.jsxs("div",{className:wr("flex h-full flex-col",m),children:[t.jsx(up,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:u}),a===Wm.Loading&&t.jsx(pp,{panelType:Lm.Burndown}),a===Wm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.AreaChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),t.jsx(q.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),a===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),a===Wm.Error&&t.jsx(mp,{config:e,queryUrl:d}),a===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Ap({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=s??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return t.jsxs("div",{className:wr("flex h-full flex-col",p),children:[t.jsx(up,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:m}),a===Wm.Loading&&t.jsx(pp,{}),a===Wm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.BarChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),t.jsx(q.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:c?(e,t)=>c(r[t],t):void 0,cursor:c?"pointer":void 0}),t.jsx(q.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),a===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),a===Wm.Error&&t.jsx(mp,{config:e,queryUrl:u}),a===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Tp({config:e,state:r,rule:s,risks:n=[],matrixViewType:o=qm.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=a.useMemo(()=>[...s?.parametersY??[]].sort((e,t)=>t.position-e.position),[s?.parametersY]),x=s?.parametersX??[],f=a.useMemo(()=>{const e={};return n.forEach(t=>{const a=`${t.parameterYPosition}-${t.parameterXPosition}`;e[a]||(e[a]=[]),e[a].push(t)}),e},[n]);return t.jsxs("div",{className:wr("flex h-full flex-col",p),children:[t.jsx(up,{config:e,viewOnly:i,onRefresh:d,queryUrlBuilder:m}),r===Wm.Loading&&t.jsx(pp,{}),r===Wm.Loaded&&s&&t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:s.name_y})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex mb-1",children:[t.jsx("div",{className:"w-16 shrink-0"}),t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.threat_strategy_type_name}),!s.disable_opportunities&&t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.opportunity_strategy_type_name})]}),h.map((e,a)=>t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((r,n)=>{const i=((e,t)=>f[`${t.position}-${e.position}`]??[])(r,e),d=((e,t)=>s?.colorMatrix?.[t]?.[e]??"hsl(var(--muted))")(n,a);return t.jsxs("div",{className:wr("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||c)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:d},onClick:()=>i.length>0&&l?.(r,e,i),children:[o===qm.Quantity&&i.length>0&&t.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===qm.AllRisksList&&i.map(e=>t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:t=>{t.stopPropagation(),c?.(e)},children:e.code})}),t.jsxs(Xs,{className:"max-w-[250px]",children:[t.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",t.jsx("strong",{children:e.analysisDate})]}),e.strategy&&t.jsxs("p",{className:"text-xs",children:["Estratégia: ",t.jsx("strong",{children:e.strategy})]}),e.resultName&&t.jsxs("p",{className:"text-xs",children:["Criticidade: ",t.jsx("strong",{style:{backgroundColor:d},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},r.position)})]},e.position)),t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>t.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),t.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:s.name_x})]})]})}),r===Wm.NoData&&t.jsx(hp,{hasRemovedColumn:e.hasRemovedColumn}),r===Wm.Error&&t.jsx(mp,{config:e,queryUrl:u}),r===Wm.Unavailable&&t.jsx(xp,{onRemove:()=>e.onRemove?.(e.id)})]})}const Dp=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Dp.Translate.toString(e),Dp.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function Pp(e){switch(Number(e)){case Lm.Area:case Lm.Bar:case Lm.Column:case Lm.Line:case Lm.Numeric:case Lm.Pie:case Lm.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Ep({panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=a.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*s+(e.sizeY-1)*n+"px",transform:Dp.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,r,s,n,u,m,p]);return t.jsxs("div",{ref:d,style:h,className:wr("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[t.jsx("div",{className:wr("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?c:{}}),t.jsx("div",{className:"h-full",children:i})]})}function Mp({panels:e,columns:r=8,cellHeight:s=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:c,className:d}){const[u,m]=a.useState(e);a.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=a.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=a.useMemo(()=>u.map(e=>e.id),[u]),f=a.useCallback(e=>{const{active:t,over:a}=e;if(!a||t.id===a.id)return;const r=u.findIndex(e=>e.id===t.id),s=u.findIndex(e=>e.id===a.id);if(-1===r||-1===s)return;const n=[...u],o={...n[r]},i={...n[s]},l=o.col,d=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=d,n[r]=o,n[s]=i,m(n),c?.(n)},[u,c]),g=a.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${h}, ${s}px)`,gap:`${n}px`}),[r,h,s,n]);return 0===u.length?t.jsxs("div",{className:wr("flex flex-col items-center justify-center py-16 text-center",d),children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):t.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:t.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:t.jsx("div",{style:g,className:wr("relative w-full",i&&"bg-muted/30",d),children:u.map(e=>t.jsx(Ep,{panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const Ip={[Lm.Bar]:"bar",[Lm.Column]:"column",[Lm.StackedColumn]:"stacked-column",[Lm.Area]:"area",[Lm.Line]:"line",[Lm.EvolutionLine]:"evolution-line"};function Rp({config:e,state:a,data:r,numericValue:s,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:c,matrixRule:d,matrixRisks:u,onPanelClick:m}){const p=Ip[e.typeId];if(p)return t.jsx(jp,{config:e,variant:p,state:a,data:o,series:i});switch(e.typeId){case Lm.Numeric:return t.jsx(gp,{config:e,state:a,value:s});case Lm.Text:return t.jsx(vp,{config:e,state:a});case Lm.List:return t.jsx(bp,{config:e,state:a,data:r,columns:n??[]});case Lm.Pie:return t.jsx(Cp,{config:e,state:a,data:r});case Lm.Pareto:return t.jsx(kp,{config:e,state:a,data:r});case Lm.Burndown:return t.jsx(Sp,{config:e,state:a,data:l});case Lm.PerformanceColumns:return t.jsx(Ap,{config:e,state:a,data:c});case Lm.RiskMatrix:return t.jsx(Tp,{config:e,state:a,rule:d,risks:u??[]});default:return t.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function Lp({dashboard:e,panels:r,pages:s,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:c,onRefresh:d,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:v,onLayoutChange:b,onPageChange:w,toolbarActions:j,className:N}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),S=e.idViewType===zm.Carousel,A=a.useMemo(()=>r,[r,S,n]),T=a.useMemo(()=>A.map(e=>{const t=Pp(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:t.x,minSizeY:t.y}}),[A]),D=a.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:v}),[o,f,g,v]),P=a.useCallback(()=>{C||l||(k(!0),d?.(),setTimeout(()=>k(!1),3e4))},[C,l,d]),E=a.useCallback(e=>{const a=A.find(t=>t.id===e);if(!a)return null;const r=D(a),s=c?.(e)??{state:Wm.Loaded};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx(up,{config:r,onRefresh:()=>{}}),t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(Rp,{config:r,...s})})]})},[A,D,c,o,f,g,v]);return t.jsxs("div",{className:wr("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[j,d&&t.jsx("button",{onClick:P,disabled:C||l,className:wr("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&t.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?t.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):t.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&t.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&t.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:t.jsx("svg",{className:wr("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&s&&s.length>1&&t.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:s.map(e=>t.jsx("button",{onClick:()=>w?.(e.id),className:wr("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&t.jsx("div",{className:"flex justify-center py-3",children:t.jsxs("button",{onClick:x,className:wr("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&t.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:t.jsx(Mp,{panels:T,allowDragging:o,showGridLines:o,renderPanel:E,onLayoutChange:b})})]})}function Fp(e,t=Bm.PtBr){const{t:a}=y.useTranslation();switch(t){case Bm.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case Bm.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function zp(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Up=[{value:Qm.All,label:"Todos"},{value:Qm.OnlyMine,label:e.t("dashboard_my")},{value:Qm.Favorites,label:"Favoritos"}];function Op({dashboards:e,limit:r,isLoading:s=!1,language:n=Bm.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:c,onEdit:d,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:v,toolbarExtra:b,className:w}){const{t:j}=y.useTranslation(),[N,_]=a.useState(""),[C,k]=a.useState(Qm.All),[S,A]=a.useState(null),T=a.useCallback(e=>{_(e),g?.(e)},[g]),D=a.useCallback(e=>{k(e),v?.(e)},[v]),P=a.useMemo(()=>{let t=e;if(N){const e=N.toLowerCase();t=t.filter(t=>t.code?.toLowerCase().includes(e)||Fp(t,n).toLowerCase().includes(e)||t.responsibleName?.toLowerCase().includes(e))}switch(C){case Qm.OnlyMine:break;case Qm.Favorites:t=t.filter(e=>e.isFavorite)}return t},[e,N,C,n]);return t.jsxs("div",{className:wr("flex flex-col h-full",w),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),r&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.countDashboards,"/",r.maxDashboards,")"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative",children:[t.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"m21 21-4.3-4.3"})]}),t.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>T(e.target.value),className:wr("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),b,o&&h&&t.jsxs("button",{onClick:h,className:wr("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),t.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Up.map(e=>t.jsx("button",{onClick:()=>D(e.value),disabled:s,className:wr("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),s&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!s&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t.jsxs("tr",{children:[t.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:t.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),t.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),t.jsx("th",{className:"w-12 px-3 py-2"})]})}),t.jsxs("tbody",{children:[0===P.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),P.map(e=>t.jsxs("tr",{onClick:()=>c?.(e),className:wr("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[t.jsx("td",{className:"px-3 py-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsx("svg",{className:wr("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),t.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),t.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Fp(e,n)}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),t.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:zp(e.lastModified)}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:wr("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),t.jsx("td",{className:"px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(null)}),t.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-1 border-t border-border"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Bp=[{value:Fm.NotUpdate,label:e.t("dashboard_no_refresh")},{value:Fm.FiveMinutes,label:"5 minutos"},{value:Fm.TenMinutes,label:"10 minutos"},{value:Fm.FifteenMinutes,label:"15 minutos"},{value:Fm.ThirtyMinutes,label:"30 minutos"},{value:Fm.OneHour,label:"1 hora"}],qp=[{value:zm.NormalPage,label:e.t("dashboard_normal_page")},{value:zm.Carousel,label:"Carrossel"}],Vp=[{value:Pm.FiveSeconds,label:"5 segundos"},{value:Pm.TenSeconds,label:"10 segundos"},{value:Pm.FifteenSeconds,label:"15 segundos"},{value:Pm.ThirtySeconds,label:"30 segundos"},{value:Pm.OneMinute,label:"1 minuto"},{value:Pm.ThreeMinutes,label:"3 minutos"},{value:Pm.FiveMinutes,label:"5 minutos"},{value:Pm.TenMinutes,label:"10 minutos"}],$p=[{value:Om.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:Om.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:Om.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Wp=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Hp({dashboard:e,initialTab:r=Um.General,isSaving:s=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:c=[],onSave:d,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=a.useState(r),[g,v]=a.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[b,w]=a.useState(e?.titlePtBr??""),[j,N]=a.useState(e?.titleEnUs??""),[_,C]=a.useState(e?.titleEsEs??""),[k,S]=a.useState(e?.responsibleId??""),[A,T]=a.useState(e?.isActive??!0),[D,P]=a.useState(e?.idUpdateTime??Fm.NotUpdate),[E,M]=a.useState(e?.idViewType??zm.NormalPage),[I,R]=a.useState(e?.idPageTime??Pm.FifteenSeconds),[L,F]=a.useState(e?.idShare??Om.NotShared),[z,U]=a.useState(e?.groups??[]),[O,B]=a.useState(e?.places??[]),[q,V]=a.useState(e?.collaborators??[]),$=E===zm.Carousel,W=g["pt-br"]||g.en||g.es,H=a.useMemo(()=>!!W&&(!(g["pt-br"]&&!b.trim())&&(!(g.en&&!j.trim())&&!(g.es&&!_.trim()))),[W,g,b,j,_]),G=a.useCallback(e=>{v(t=>({...t,[e]:!t[e]}))},[]),K=a.useCallback(()=>{H&&!s&&d?.({titlePtBr:g["pt-br"]?b:"",titleEnUs:g.en?j:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:A,idUpdateTime:D,idViewType:E,idPageTime:$?I:null,idShare:L,groups:L===Om.SharedWithUsersGroupsPlacesCollaborators?z:[],places:L===Om.SharedWithUsersGroupsPlacesCollaborators?O:[],collaborators:L===Om.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[H,s,d,g,b,j,_,k,A,D,E,I,$,L,z,O,q]);return t.jsxs("div",{className:wr("flex flex-col h-full bg-background",m),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&t.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t.jsxs("button",{onClick:K,disabled:!H||s,className:wr("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[s?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t.jsxs("div",{className:"flex border-b border-border bg-card",children:[t.jsx("button",{onClick:()=>f(Um.General),className:wr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Um.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),t.jsx("button",{onClick:()=>f(Um.Share),className:wr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Um.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===Um.General&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),t.jsx("div",{className:"flex gap-2",children:Wp.map(e=>t.jsx("button",{onClick:()=>G(e.key),className:wr("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&t.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),t.jsx("input",{value:b,onChange:e=>w(e.target.value),maxLength:200,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[b.length,"/200"]})]}),g.en&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),t.jsx("input",{value:j,onChange:e=>N(e.target.value),maxLength:200,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[j.length,"/200"]})]}),g.es&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),t.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[t.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),t.jsx("select",{value:D,onChange:e=>P(Number(e.target.value)),disabled:n,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Bp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t.jsxs("div",{className:"flex items-center gap-3 h-10",children:[t.jsx("button",{onClick:()=>T(!A),disabled:e?.isGeneralViewUse,className:wr("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",A?"bg-primary":"bg-muted","disabled:opacity-50"),children:t.jsx("span",{className:wr("inline-block h-4 w-4 rounded-full bg-white transition-transform",A?"translate-x-6":"translate-x-1")})}),t.jsx("span",{className:"text-sm text-foreground",children:A?"Ativo":"Inativo"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),t.jsx("select",{value:E,onChange:e=>M(Number(e.target.value)),disabled:n||$,className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:qp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),$&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),t.jsx("select",{value:I??"",onChange:e=>R(Number(e.target.value)),className:wr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Vp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===Um.Share&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M12 16v-4"}),t.jsx("path",{d:"M12 8h.01"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),t.jsx("div",{className:"space-y-3",children:$p.map(a=>t.jsxs("label",{className:wr("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",L===a.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"shareType",value:a.value,checked:L===a.value,onChange:()=>F(a.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:a.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})]},a.value))}),L===Om.SharedWithUsersGroupsPlacesCollaborators&&t.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),t.jsx("select",{multiple:!0,value:z,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);U(t)},className:wr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",O.length,")"]}),t.jsx("select",{multiple:!0,value:O,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);B(t)},className:wr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),t.jsx("select",{multiple:!0,value:q,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);V(t)},className:wr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:c.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Gp(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Kp(e,t){return{id:t?.id??Gp(),text:e,children:t?.children,collapsed:t?.collapsed,color:t?.color,icon:t?.icon,note:t?.note,side:t?.side}}function Yp(e,t){if(e.id===t)return{node:e,parent:null};const a=[];for(const r of e.children??[])a.push({node:r,parent:e});for(;a.length;){const e=a.pop();if(e.node.id===t)return{node:e.node,parent:e.parent};for(const t of e.node.children??[])a.push({node:t,parent:e.node})}return null}function Qp(e,t){const a=t(e);return a.children?.length?{...a,children:a.children.map(e=>Qp(e,t))}:a}function Xp(e,t,a){return Qp(e,e=>e.id===t?a(e):e)}function Jp(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Zp(e,t,a){const r=Kp(a||"");let s=r.id;return{root:Qp(e,a=>{if(a.id!==t)return a;let n=r;if(a.id===e.id){const t=Jp(e);n={...n,side:t.left<=t.right?"left":"right"}}else n={...n,side:a.side};return s=n.id,{...a,collapsed:!1,children:[...a.children??[],n]}}),newId:s}}function eh(e,t,a){if(e.id===t)return Zp(e,t,a);const r=Yp(e,t);if(!r||!r.parent)return{root:e,newId:t};const s=r.parent,n=Kp(a||"",{side:r.node.side}),o=n.id;return{root:Qp(e,e=>{if(e.id!==s.id)return e;const a=(e.children??[]).findIndex(e=>e.id===t),r=[...e.children??[]];return r.splice(a+1,0,n),{...e,children:r}}),newId:o}}function th(e,t){if(e.id===t)return{root:e,nextSelectedId:t};const a=Yp(e,t);if(!a||!a.parent)return{root:e,nextSelectedId:null};const r=a.parent,s=r.children??[],n=s.findIndex(e=>e.id===t),o=s[n+1]?.id??s[n-1]?.id??r.id;return{root:Qp(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==t)}),nextSelectedId:o}}function ah(e,t,a){if(t===a)return e;if(t===e.id)return e;if(function(e,t,a){const r=Yp(e,t);return!!r&&!!Yp(r.node,a)}(e,t,a))return e;const r=Yp(e,t);if(!r)return e;const s=(()=>{if(a===e.id){const t=Jp(e);return{...r.node,side:t.left<=t.right?"left":"right"}}const t=Yp(e,a)?.node;return{...r.node,side:t?.side}})(),n=Qp(e,e=>e.children?.length&&e.children.some(e=>e.id===t)?{...e,children:e.children.filter(e=>e.id!==t)}:e);return Qp(n,e=>e.id!==a?e:{...e,collapsed:!1,children:[...e.children??[],s]})}function rh(e,t){return Xp(e,t,e=>({...e,collapsed:!e.collapsed}))}function sh(e,t){return Qp(e,a=>a.children?.length?a.id===e.id&&t?a:{...a,collapsed:t}:a)}function nh(e){const{value:t,defaultValue:r,onChange:s,readOnly:n}=e,o=void 0!==t,[i,l]=a.useState(()=>r??t??Kp("Mapa Mental",{id:"root"})),c=o?t:i,[d,u]=a.useState(c.id),m=a.useRef([]),p=a.useRef([]),h=a.useCallback((e,t)=>{n||(m.current.push(t),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),s?.(e))},[o,s,n]),x=a.useCallback((e,t)=>{const a=Xp(c,e,e=>({...e,text:t}));h(a,c)},[c,h]),f=a.useCallback((e,t)=>{const a=Xp(c,e,e=>({...e,...t}));h(a,c)},[c,h]),g=a.useCallback((e,t="")=>{const{root:a,newId:r}=Zp(c,e,t);return h(a,c),u(r),r},[c,h]),v=a.useCallback((e,t="")=>{const{root:a,newId:r}=eh(c,e,t);return h(a,c),u(r),r},[c,h]),b=a.useCallback(e=>{const{root:t,nextSelectedId:a}=th(c,e);t!==c&&(h(t,c),u(a))},[c,h]),y=a.useCallback((e,t)=>{const a=ah(c,e,t);a!==c&&h(a,c)},[c,h]),w=a.useCallback(e=>{const t=Yp(c,e);if(!t||!t.node.children?.length)return;const a=rh(c,e);h(a,c)},[c,h]),j=a.useCallback(()=>{h(sh(c,!1),c)},[c,h]),N=a.useCallback(()=>{h(sh(c,!0),c)},[c,h]),_=a.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(c),o||l(e),s?.(e))},[c,o,s]),C=a.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(c),o||l(e),s?.(e))},[c,o,s]),k=m.current.length>0,S=p.current.length>0,A=a.useMemo(()=>d?Yp(c,d)?.node??null:null,[c,d]),T=a.useCallback(e=>{h(e,c)},[c,h]);return{root:c,setRoot:T,selectedId:d,selectedNode:A,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:v,removeNode:b,moveNode:y,toggleNode:w,expandAll:j,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const oh=180,ih=80,lh=16,ch=60;function dh(e){const t=(e.collapsed?[]:e.children??[]).map(dh);if(!t.length)return{node:e,visibleChildren:t,height:44};const a=t.reduce((e,t)=>e+t.height,0)+lh*(t.length-1);return{node:e,visibleChildren:t,height:Math.max(44,a)}}function uh(e,t,a,r,s,n,o){const i=[],l={node:e.node,parent:t,x:a,y:r,width:180,height:44,side:s,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let c=r+22-(e.visibleChildren.reduce((e,t)=>e+t.height,0)+lh*(e.visibleChildren.length-1))/2;for(const d of e.visibleChildren){const t="right"===s?a+180+ih:a-ih-oh,r=c+d.height/2-22,l=uh(d,e.node,t,r,s,n+1,o);i.push(l),c+=d.height+lh}return l}function mh(e){return a.useMemo(()=>function(e){const t=e.collapsed?[]:e.children??[],a=t.filter(e=>"left"!==e.side).map(dh),r=t.filter(e=>"left"===e.side).map(dh),s=a.reduce((e,t)=>e+t.height,0)+lh*Math.max(0,a.length-1),n=r.reduce((e,t)=>e+t.height,0)+lh*Math.max(0,r.length-1),o=Math.max(s,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=a.length?Math.max(...a.map(i))+1:0,c=260*(r.length?Math.max(...r.map(i))+1:0),d=220+260*l+c+120,u=o+120,m=ch+c,p=[],h={node:e,parent:null,x:m,y:ch+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=ch+o/2-s/2;for(const v of a){const t=x+v.height/2-22,a=uh(v,e,m+220+ih,t,"right",1,p);h.visibleChildren.push(a),x+=v.height+lh}let f=ch+o/2-n/2;for(const v of r){const t=f+v.height/2-22,a=uh(v,e,m-ih-oh,t,"left",1,p);h.visibleChildren.push(a),f+=v.height+lh}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:d,height:u}}(e),[e])}function ph(e,t){const{layout:a,selectedId:r,setSelectedId:s}=t;if(!r)return void s(a.nodes[0]?.node.id??null);const n=a.byId.get(r);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const t=n.visibleChildren.find(t=>t.side===e);return void(t&&s(t.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&s(e.node.id)}else n.parent&&s(n.parent.id);return}if(!n.parent)return;const o=a.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===r),c="up"===e?i[l-1]:i[l+1];c&&s(c.node.id)}const hh=({layout:e,selected:a,editing:r,readOnly:s,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,v=(b=f.icon)?ae[b]??null:null;var b;const y=!!f.children?.length,w=te.useRef(null),[j,N]=te.useState(f.text);te.useEffect(()=>{if(r){N(f.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[r,f.text]);const _=()=>{i(j.trim()||f.text)},C=f.color;return t.jsxs("div",{role:"treeitem","aria-selected":a,"aria-expanded":y?!f.collapsed:void 0,tabIndex:a?0:-1,"data-node-id":f.id,draggable:!s&&!g&&!r,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),s||o()},className:wr("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",a&&!g&&"ring-2 ring-primary ring-offset-1",a&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[v&&t.jsx(v,{className:wr("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),t.jsx("div",{className:"flex-1 min-w-0",children:r?t.jsx("input",{ref:w,value:j,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:wr("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?t.jsx("div",{className:"text-sm truncate",children:x(f)}):t.jsx("div",{className:"text-sm truncate",children:f.text||t.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!r&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:wr("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:t.jsx(c.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),t.jsx(Xs,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&t.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:wr("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?t.jsx(c.Plus,{className:"h-3 w-3"}):"left"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3"}):t.jsx(c.Minus,{className:"h-3 w-3"})})]})},xh=({parent:e,child:a})=>{const r=a.x+a.width/2<e.x+e.width/2,s=r?e.x:e.x+e.width,n=e.y+e.height/2,o=r?a.x+a.width:a.x,i=a.y+a.height/2,l=(s+o)/2,c=`M ${s} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return t.jsx("path",{d:c,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},fh=({label:e,icon:a,onClick:r,disabled:s})=>t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:s,"aria-label":e,className:"h-8 w-8",children:a})}),t.jsx(Xs,{children:e})]}),gh=e=>{const{t:a}=y.useTranslation();return t.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[t.jsx(fh,{label:a("mind_map_add_child"),icon:t.jsx(c.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),t.jsx(fh,{label:a("mind_map_add_sibling"),icon:t.jsx(c.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),t.jsx(fh,{label:a("mind_map_delete_node"),icon:t.jsx(c.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),t.jsx(Rr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(fh,{label:a("mind_map_expand_all"),icon:t.jsx(c.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),t.jsx(fh,{label:a("mind_map_collapse_all"),icon:t.jsx(c.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),t.jsx(Rr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(fh,{label:a("mind_map_zoom_out"),icon:t.jsx(c.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),t.jsx(fh,{label:a("mind_map_zoom_in"),icon:t.jsx(c.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),t.jsx(fh,{label:a("mind_map_fit_to_screen"),icon:t.jsx(c.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),t.jsx(Rr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(fh,{label:a("mind_map_undo"),icon:t.jsx(c.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),t.jsx(fh,{label:a("mind_map_redo"),icon:t.jsx(c.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),t.jsx("div",{className:"flex-1"}),t.jsx(fh,{label:a("mind_map_export_json"),icon:t.jsx(c.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),t.jsx(fh,{label:a("mind_map_export_image"),icon:t.jsx(c.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function vh(e){return JSON.stringify(e,null,2)}function bh(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const t=e;if("string"!=typeof t.text)throw new Error('Invalid mind map node: missing "text"');const a=Array.isArray(t.children)?t.children.map(e=>bh(e)):void 0;return Kp(t.text,{id:"string"==typeof t.id?t.id:void 0,collapsed:"boolean"==typeof t.collapsed?t.collapsed:void 0,color:"string"==typeof t.color?t.color:void 0,icon:"string"==typeof t.icon?t.icon:void 0,note:"string"==typeof t.note?t.note:void 0,side:"left"===t.side||"right"===t.side?t.side:void 0,children:a})}function yh({data:e,columns:r,sortField:s,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:d=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:v=!0,onColumnResize:b,enableColumnReorder:w=!1,onReorderColumns:j,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:A=!1,rowActionsVariant:T="default",hideActionsColumn:D=!1,actionsHeaderContent:P}){const{t:E}=y.useTranslation(),M=u||E("no_items_found",E("no_items_found_empty")),[I,R]=a.useState(()=>A?new Set(e.map(e=>e.id)):new Set),L=void 0!==k,F=L?new Set(k):I,z=a.useCallback(e=>{L&&S?S(e):R(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[L,S]),{columnWidths:U,isDragging:O,activeColumn:B,handleMouseDown:q}=ii({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:b,enabled:v}),V=gi({enabled:w&&!!j,onReorder:j??(()=>{})}),$=a.useMemo(()=>{if(v){const e=r.map(e=>U[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return e.map(e=>e/t*100+"%")}const e=r.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return r.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const a=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${a}%)`:`${a}%`})},[r,v,U]);if(d)return t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,a)=>t.jsx(un,{className:"h-12 w-full"},a))})});if(0===e.length)return t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-center text-muted-foreground",children:t.jsx("p",{children:M})})});const W=l&&!D,H=(p?1:0)+(_?1:0)+r.length+(W?1:0);return t.jsx("div",{className:"flex-1 overflow-auto "+(O?"select-none":""),children:t.jsxs(Ao,{className:wr("table-fixed w-full",m),children:[t.jsx(To,{className:"sticky top-0 bg-background z-10",children:t.jsxs(Eo,{children:[_&&t.jsx(Mo,{className:"w-[40px]"}),p&&t.jsx(Mo,{className:"w-[40px]",children:t.jsx(Cs,{checked:g,onCheckedChange:f,"aria-label":E("select_all","Selecionar todos")})}),r.map((e,a)=>{const r=v&&!1!==e.resizable,i=B===String(e.key),l=w&&!!j,d=l?V.getDragProps(a):{},u=V.dragFromIndex===a,m=V.dragOverIndex===a&&V.dragFromIndex!==a;return t.jsxs(Mo,{className:wr(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&V.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:$[a]},...d,children:[!1!==e.sortable&&o?t.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),s!==p?null:"asc"===n?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}):t.jsx("span",{className:"font-medium",children:e.header}),r&&t.jsx(Bo,{direction:"horizontal",onMouseDown:t=>q(String(e.key),t),isDragging:i})]},String(e.key));var p}),W&&t.jsx(Mo,{className:"w-[80px] text-right",children:P??E("actions","Ações")})]})}),t.jsx(Do,{children:e.map(e=>{const s=_&&F.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(Eo,{onClick:()=>i?.(e),className:wr(i?"cursor-pointer":"","relative","inline"===T&&"group"),children:[_&&t.jsx(Io,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":s?E("collapse_row","Recolher linha"):E("expand_row","Expandir linha"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&t.jsx(Io,{children:t.jsx(Cs,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${E("select_all","Selecionar todos")} ${e.id}`})}),r.map(a=>t.jsx(Io,{className:a.className,children:t.jsx(Oo,{children:a.render?a.render(e):String(e[a.key]??"-")})},String(a.key))),W&&t.jsx(Io,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===T?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),s&&C&&t.jsx(Eo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Io,{colSpan:H,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function wh({searchValue:e="",onSearchChange:a,customFilters:r=[],onClearFilters:s,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||r.length>0;return t.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[a&&t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(kr,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>a(e.target.value),className:"pl-9 h-9"})]}),r.map((e,a)=>t.jsx("div",{className:"vertical"===o?"w-full":"",children:e},a)),n&&l&&s&&t.jsxs(_r,{variant:"ghost",size:"sm",onClick:s,className:"h-9 px-3 whitespace-nowrap",children:[t.jsx(c.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function jh(e,t){const a=new Set;function r(e){if(e)for(const t of e)a.add(t.id),r(t.children)}return function e(a){for(const s of a){if(s.id===t)return r(s.children),!0;if(s.children&&e(s.children))return!0}return!1}(e),a}function Nh({children:e,itemId:a,enableDrag:r,onDragStartCell:s,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return t.jsx(Io,{draggable:r,onDragStart:r?e=>s(a,e):void 0,onDragEnd:r?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(a,e)},className:l,children:e})}function _h({item:e,level:a,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w,dragCount:j}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*a,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),A=g===e.id&&f!==e.id,T=p?.has(e.id)??!1,D={itemId:e.id,enableDrag:x,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w};return t.jsxs(t.Fragment,{children:[t.jsxs(Eo,{className:wr(l&&"cursor-pointer",k&&"group",S&&"opacity-40",A&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[t.jsx(Nh,{...D,children:t.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&t.jsx(Cs,{checked:T,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&t.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?t.jsx(c.ChevronDown,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})}):t.jsx("div",{className:"w-6 shrink-0"}),n??t.jsx(c.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate",children:String(e[s]??e.id)}),f===e.id&&j&&j>1&&t.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:j})]})}),r.map(r=>{const s=e[r.key],n=r.render?r.render(e,a):null!=s?String(s):"—";return t.jsx(Nh,{...D,className:wr("text-center",r.className),children:r.hoverContent?t.jsxs(Kc,{openDelay:200,children:[t.jsx(Yc,{asChild:!0,children:t.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),t.jsx(Qc,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):n},String(r.key))}),d&&t.jsx(Nh,{...D,className:"text-right",children:t.jsx("div",{onClick:e=>e.stopPropagation(),className:wr("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:d(e)})})]}),_&&N&&e.children.map(e=>t.jsx(_h,{item:e,level:a+1,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:w,dragCount:j},e.id))]})}function Ch({onDrop:a,isDragOver:r,onDragOver:s,onDragLeave:n,label:o}){return t.jsxs("div",{className:wr("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:s,onDragEnter:s,onDragLeave:n,onDrop:a,children:[t.jsx(c.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function kh(e){const t=N.useNavigate();return{onNew:()=>{const a=e.newPath||`${e.basePath}/new`;t(a)},onEdit:a=>{const r=e.editPath?e.editPath.replace(":id",a.id):`${e.basePath}/${a.id}/edit`;t(r)}}}const Sh="true"===(void 0).VITE_SHOW_EDIT_PROFILE,Ah=a.memo(({variant:e="card",className:r="",selectedUnit:s,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:d,isAuthenticated:u,logout:m,switchUnit:p}=_o(),{role:h}=Sl(),x=h?.name||null,f=l?.[0]||null,g=d?l?.find(e=>e.alias===d):f,v=l||[],b=s||g||f||f,[w,j]=a.useState(0);a.useEffect(()=>{const e=()=>j(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const N=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48&v=${w}`},[i?.id,w]),_=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=96&v=${w}`},[i?.id,w]),C=a.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),k=a.useCallback(e=>{n?n(e):p(e)},[n,p]),S=a.useMemo(()=>{if(!v?.length)return[];const e=new Map;v.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),a=t.find(e=>e.alias===b?.alias),r=t.filter(e=>e.alias!==b?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),a?[a,...r]:r},[v,b?.alias]),[A,T]=a.useState(!1);if(!u||!i)return null;const D=()=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsxs(Qi,{className:"w-10 h-10",children:[N&&t.jsx(Xi,{src:N,alt:i.name||o("user_photo")}),t.jsx(Ji,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||t.jsx(c.User,{className:"h-5 w-5"})})]})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",b?.name||"N/A"]})]})]}),b&&t.jsx("div",{className:"mt-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(c.Building2,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:b.name})]})}),S.length>1&&t.jsxs("div",{className:"mt-2",children:[t.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>t.jsx(As,{variant:e.alias===b?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t.jsxs(As,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]});return"dropdown"===e?t.jsxs(t.Fragment,{children:[t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsx(_r,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${r}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"hidden md:block text-right",children:[t.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),t.jsx("p",{className:"text-xs text-primary-foreground/70",children:b?.name||"N/A"})]}),t.jsxs(Qi,{className:"w-8 h-8 border border-primary-foreground/30",children:[N&&t.jsx(Xi,{src:N,alt:i.name||o("user_photo")}),t.jsx(Ji,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||t.jsx(c.User,{className:"h-4 w-4"})})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4"})]})})}),t.jsxs(Bs,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t.jsxs(Fs,{children:[t.jsxs(Us,{children:[t.jsx(c.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),t.jsx(Os,{children:S.map(e=>t.jsxs(qs,{onClick:()=>k(e),className:e.alias===b?.alias?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===b?.alias&&t.jsx(As,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Sh&&t.jsxs(t.Fragment,{children:[t.jsx(Hs,{}),t.jsxs(qs,{onClick:()=>T(!0),children:[t.jsx(c.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),t.jsx(Hs,{}),t.jsxs(qs,{onClick:m,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),Sh&&t.jsx(pl,{open:A,onOpenChange:T,user:i,userPhotoUrl:_,userInitials:C})]}):t.jsxs(Tr,{className:r,children:[t.jsx(Dr,{children:t.jsx(Pr,{className:"text-lg",children:o("user_info")})}),t.jsxs(Mr,{className:"space-y-4",children:[t.jsx(D,{}),t.jsx(Rr,{}),t.jsxs(_r,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),Th=a.createContext({});function Dh({children:e,config:r}){const s=a.useMemo(()=>{const e=Ie(),t=r?.appName?e?`${r.appName} (Dev)`:r.appName:void 0;return{navigation:r?.navigation,appName:t}},[r?.navigation,r?.appName]);return t.jsx(Th.Provider,{value:s,children:e})}function Ph(){return a.useContext(Th)}function Eh(e,t){if(!e)return"";const a=e.find(e=>e.path===t);if(a)return a.label;const r=e.find(e=>t.startsWith(e.path+"/"));return r?.label||""}function Mh(e,t){const[r,s]=a.useState(e),n=a.useRef(),o=a.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return a.useEffect(()=>(o(),n.current=setTimeout(()=>{s(e)},t),o),[e,t,o]),[r,o]}function Ih({appName:e}){const[r,s]=a.useState(!1),{association:n}=Sl(),o=nt({isQualitfy:n?.isQualitfy,isMetroex:n?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between w-[258px]",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:t.jsx("img",{src:o,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&t.jsx("button",{className:"min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground/80 hover:text-primary-foreground/60 transition-colors leading-tight py-1",onClick:()=>s(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),t.jsx(uc,{open:r,onOpenChange:s})]})}const Rh=a.memo(function({actions:r}){const s=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=Ph(),l=Eh(o,s.pathname),{metadata:d,headerActions:u}=fl(),{setOpenMobile:m}=Qd(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:v}=_o(),b=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,w]=N.useSearchParams(),j=a.useCallback(e=>{const{pathname:t,search:a,hash:r}=s;if(h){const s=t.split("/"),o=s.indexOf(h);if(o>=0)return s[o]=e.alias,void n(s.join("/")+a+r)}v(e)},[h,s,n,v]),[_,C]=a.useState(()=>y.get("search")||""),[k,S]=Mh(_,Ve.debounceDelay);a.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),w(e)},[k,w,x]);const A=o?.find(e=>e.path===s.pathname)||o?.find(e=>s.pathname.startsWith(e.path+"/")),T=d.title||l,D=d.subtitle||A?.complementaryText||"";return t.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(_r,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:t.jsx(c.Menu,{size:20})}),t.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:t.jsx(Ih,{appName:i})}),t.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t.jsxs("div",{className:"flex-shrink-0",children:[d.breadcrumbs&&d.breadcrumbs.length>0&&t.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:d.breadcrumbs.map((e,a)=>t.jsxs("span",{className:"flex items-center gap-1",children:[a>0&&t.jsx(c.ChevronRight,{className:"h-3 w-3"}),e.href?t.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):t.jsx("span",{children:e.label})]},a))}),t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:T})}),D&&t.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:D})]}),x&&t.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(kr,{placeholder:"Pesquisar",value:_,onChange:e=>(e=>{C(e)})(e.target.value),className:"w-full pl-10 pr-8"}),_&&t.jsx(_r,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),w(e)},title:e.t("clear_search"),children:t.jsx(c.X,{size:14})})]}),t.jsx(_r,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:t.jsx(c.RefreshCw,{size:14})})]}),t.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||r)&&t.jsx("div",{className:"flex items-center gap-2",children:u||r}),(void 0).VITE_WIKI_URL&&t.jsx(_r,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>hr((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),t.jsx(cm,{}),t.jsx("div",{className:"text-sm",children:t.jsx(Ah,{variant:"dropdown",selectedUnit:b,onUnitChange:j})})]})]})})}),Lh=({key:e,enabled:t,checkFn:a,staleTime:r=3e5,gcTime:s=6e5})=>j.useQuery({queryKey:["permission",e],queryFn:a,enabled:t,staleTime:r,gcTime:s,retry:0,refetchOnWindowFocus:!1});function Fh({config:e,isCollapsed:a=!1,isDisabled:r=!1,className:s}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=c.Plus,variant:d="button"}=e;if(!o||0===o.length)return null;if("split-button"===d){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(a){const a=t.jsx(_r,{onClick:e.onClick,disabled:r||e.disabled,className:wr("justify-center px-2 w-full",s),variant:"outline",size:"default",children:t.jsx(n,{className:"h-4 w-4 shrink-0"})});return t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:a}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:e.label})})]})}return t.jsx(em,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:r||e.disabled,className:wr("w-full",s),menuAlign:"start"})}const u=(e,r,s=!1)=>t.jsxs(t.Fragment,{children:[e,!a&&r&&t.jsx("span",{className:"truncate",children:r}),!a&&s&&t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=r||e.disabled,c=t.jsx(_r,{onClick:e.onClick,disabled:i,className:wr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return a?t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:c}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:e.label})})]}):c}const m=t.jsx(_r,{disabled:r,className:wr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:a?t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:m}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:i})})]}):m}),t.jsx(Bs,{align:"start",side:a?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const a=e.icon;return t.jsxs(qs,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const zh="forlogic-sidebar-pinned",Uh=()=>{try{const e=localStorage.getItem(zh);return!!e&&JSON.parse(e)}catch{return!1}};function Oh({direction:e="right",minWidth:t=224,maxWidth:r=384,defaultWidth:s=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,c]=a.useState(()=>{if("undefined"==typeof window)return s;const e=localStorage.getItem(n);return e?parseInt(e):s}),[d,u]=a.useState(!1),m=a.useRef(null);a.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=a.useCallback(e=>{e.preventDefault(),u(!0)},[]);return a.useEffect(()=>{if(!d)return;const a=a=>{let s;s="left"===e?window.innerWidth-a.clientX:a.clientX,s=Math.max(t,Math.min(r,s)),c(s),o?.(s)},s=()=>{u(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s)}},[d,e,t,r,l,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d,e]),{width:l,isDragging:d,dragRef:m,handleMouseDown:p}}const Bh=a.createContext(void 0);function qh(){const e=a.useContext(Bh);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}const Vh="2.4.9";function $h({config:e,customContent:r,resizable:s=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:d,setOpenMobile:u}=Qd(),m=N.useLocation(),{alias:p,user:h}=_o(),{appName:x}=Ph(),{hasOpenModal:f}=qh(),[g,v]=a.useState(Uh),b=So(),w=!!b||l,j=a.useCallback(()=>{b&&u(!1)},[b,u]),_=s?Oh({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;a.useEffect(()=>{d(!!g)},[g,d]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return t.jsxs(Jd,{collapsible:"icon",className:wr("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:_&&w?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&t.jsx("div",{className:"py-3",children:t.jsx(Ks,{children:t.jsx(Fh,{config:e.moduleActions,isCollapsed:!w,isDisabled:f})})}),t.jsx(ou,{className:wr(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||t.jsx(iu,{className:"p-0",children:t.jsx(du,{children:t.jsx(uu,{className:"gap-1",children:t.jsx(Ks,{children:e?.navigation?.map((e,a)=>{if("separator"===e.type)return t.jsx(nu,{className:"my-2"},`sep-${a}`);const r=({item:e,index:a})=>{const s=`${e.path}-${a}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=Lh({key:s,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,d=o?c.Loader2:l?c.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?t.jsx(Rl,{defaultOpen:!0,className:"group/collapsible",children:t.jsxs(mu,{children:[t.jsx(Ll,{asChild:!0,children:t.jsx(hu,{size:"default",children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label}),t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),t.jsx(Fl,{children:t.jsx(vu,{children:e.children.map((e,a)=>t.jsx(r,{item:e,index:a},e.path))})})]})},e.path):t.jsx(mu,{children:t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("div",{className:wr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path):t.jsx(mu,{children:l||o?t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:w?t.jsx(hu,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):w?t.jsx(hu,{asChild:!0,isActive:C(e.path),size:"default",children:t.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:j,children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(N.Link,{to:e.path,onClick:j,className:wr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path)};return t.jsx(r,{item:e,index:a},e.path)})})})})})}),!b&&t.jsxs("div",{className:wr("mt-auto pb-4 pt-2 flex items-center gap-2",w?"justify-between px-1":"justify-center flex-col"),children:[w&&t.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/70 select-text truncate",title:`forlogic-core v${Vh}`,children:["v",Vh]}),!w&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground/60 select-text",children:["v",Vh.split(".").slice(0,2).join(".")]})}),t.jsx(Xs,{side:"right",children:t.jsxs("p",{children:["forlogic-core v",Vh]})})]}),t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;v(e),(e=>{try{localStorage.setItem(zh,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?t.jsx(c.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),t.jsx(Xs,{side:"right",children:t.jsx("p",{children:l?"Recolher":"Expandir"})})]})]}),s&&_&&w&&t.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:wr("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}function Wh(e){if("string"!=typeof e)return;return e.trim()||void 0}function Hh(){const{alias:e,isAuthenticated:t,isLoading:r,selectedUnit:s}=_o(),n=s?.id??null,o=!!Bn.getAccessToken(),i=function(e,t){const a=Wh(t);if(a)return a;const r=Bn,s=Wh(r.getCurrentCompanyId?.());if(s)return s;const n=Bn.extractTokenData(),o=Wh(n?.companyId)??Wh(n?.company_id);if(o)return o;if(e){const t=Wh(Bn.getCompanyId(e));if(t)return t}}(e,n),l=!!e&&!!t&&o,c=l&&!!i,[,d]=a.useReducer(e=>e+1,0);a.useEffect(()=>{if(!t||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[t,o,i]);let u=null;return r?u="Carregando autenticação...":t?e?o?i||(u="Aguardando unidade ativa..."):u="Aguardando token de acesso Qualiex...":u="Aguardando alias...":u="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!r,isAuthenticated:!!t,isReadyForQualiex:l,isReadyForQualiexWithCompany:c,isWaitingCompanyId:!!t&&o&&!i,waitingReason:u}}async function Gh(e,t){const a=await al(`${Zi()}/api/common/v1/updates/userView/${t}`,e),r=await a.json(),s=r?.data??r;return Array.isArray(s)?s:[]}async function Kh(e,t,a,r){const s=void 0===r?"undefined":String(r),n={id:t,idUpdateType:a};void 0!==r&&(n.liked=r),await al(`${Zi()}/api/common/v1/Updates/userVisualized/${a}/${s}`,e,{method:"POST",body:JSON.stringify(n)})}const Yh=3e5;function Qh(){const{alias:e,isReadyForQualiex:t}=Hh();return j.useQuery({queryKey:["user-updates","bar",e],queryFn:()=>Gh(e,1),enabled:t,staleTime:Yh})}function Xh(){const{alias:e,isReadyForQualiex:t}=Hh();return j.useQuery({queryKey:["user-updates","dialog",e],queryFn:()=>Gh(e,2),enabled:t,staleTime:Yh})}function Jh({item:e,onDismiss:a}){const{t:r}=y.useTranslation(),s=e.text||e.title,n=e.color||"hsl(var(--primary))";return t.jsxs("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:n},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[s,t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]}):t.jsx("span",{children:s}),t.jsx("button",{type:"button",onClick:()=>a(e.id),"aria-label":r("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:t.jsx(c.X,{className:"h-4 w-4"})})]})}function Zh(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const a of t){const t=e.match(a);if(t)return t[1]}return null}function ex(e,t){const a=Zh(e);if(!a)return e;return`https://www.youtube.com/embed/${a}${t?"?autoplay=1&mute=1":""}`}function tx(e){const t=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return t?t[1]:null}function ax(e,t){const a=tx(e);if(!a)return e;return`https://player.vimeo.com/video/${a}${t?"?autoplay=1&muted=1":""}`}function rx(e){if(!e)return;const t=e.match(/src="([^"]+)"/);return t?t[1]:void 0}function sx(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function nx({item:e,open:r,onClose:s}){const{t:n}=y.useTranslation(),[o,i]=a.useState(!1),[l,d]=a.useState(!1);a.useEffect(()=>{i(!1),d(!1)},[e.id]);const u=e.countLiked+(o?1:0);return t.jsx(Gr,{open:r,onOpenChange:e=>{e||s({liked:o,doNotShowAgain:l})},children:t.jsxs(Zr,{size:"md",children:[t.jsx(es,{showSeparator:!0,children:t.jsx(rs,{style:e.color?{color:e.color}:void 0,children:e.title})}),t.jsxs(ts,{children:[(()=>{const a=e.urlVideo??e.videoUrl??e.url??"",r=a?Zh(a):null;return r?t.jsx("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),t.jsx("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t.jsxs(as,{className:"!justify-between items-center",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>i(e=>!e),"aria-pressed":o,"aria-label":n("updates_dialog_like","Curtir"),className:wr("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",o?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:t.jsx(c.Heart,{className:wr("h-4 w-4",o&&"fill-current")})}),t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[t.jsx(Cs,{checked:l,onCheckedChange:e=>d(!0===e)}),n("updates_dialog_do_not_show_again","Não exibir novamente")]}),t.jsx(_r,{variant:"ghost",onClick:()=>s({liked:o,doNotShowAgain:l}),children:n("updates_dialog_close","Fechar")})]})]})]})})}function ox(e){return e&&e.trim()?e.trim():"anon"}function ix(e){try{const t=localStorage.getItem(e);if(!t)return new Set;const a=JSON.parse(t);return new Set(Array.isArray(a)?a.map(String):[])}catch{return new Set}}function lx(e,t){try{localStorage.setItem(e,JSON.stringify(Array.from(t)))}catch{}}function cx(){const{alias:e}=Hh(),{data:r=[]}=Qh(),{data:s=[]}=Xh(),n=a.useMemo(()=>function(e){return`updates.bar.dismissed.${ox(e)}`}(e),[e]),o=a.useMemo(()=>function(e){return`updates.dialog.seen.${ox(e)}`}(e),[e]),[i,l]=a.useState(()=>ix(n)),[c,d]=a.useState(()=>ix(o)),[u,m]=a.useState(new Set),[p,h]=a.useState(0);if(a.useEffect(()=>{l(ix(n)),d(ix(o)),m(new Set),h(0)},[n,o]),!e)return null;const x=r.find(e=>!i.has(e.id)),f=s.filter(e=>!c.has(e.id)&&!u.has(e.id))[p];return t.jsxs(t.Fragment,{children:[x&&t.jsx(Jh,{item:x,onDismiss:async t=>{const a=new Set(i);a.add(t),l(a),lx(n,a);try{await Kh(e,t,1)}catch{}}}),f&&t.jsx(nx,{item:f,open:!0,onClose:async({liked:t,doNotShowAgain:a})=>{if(!f)return;const r=f.id;if(!a)return m(e=>{const t=new Set(e);return t.add(r),t}),void h(0);const s=new Set(c);s.add(r),d(s),lx(o,s),h(0);try{await Kh(e,r,2,t)}catch{}}})]})}const dx=a.memo(function({children:e,sidebar:r,sidebarConfig:s,showHeader:n=!0,showSidebar:o=!0}){const i=a.useMemo(()=>o?r||t.jsx($h,{config:s}):null,[r,s,o]),l=a.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=a.useRef(null),d=a.useRef(null),u=a.useCallback(()=>{if(c.current&&d.current){const e=c.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return a.useEffect(()=>{u();const e=new ResizeObserver(u);return c.current&&e.observe(c.current),()=>e.disconnect()},[u]),t.jsx(Dh,{config:s,children:t.jsx(xl,{children:t.jsx(Xd,{defaultOpen:!1,style:l,children:t.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&t.jsxs("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[t.jsx(Rh,{}),t.jsx(cx,{})]}),t.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[i,t.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class ux{static async sendEmail(e){const t=Jn(),{data:a,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return a}}const mx=ux,px=J.z.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),hx=J.z.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),xx=J.z.string().uuid("UUID inválido"),fx=J.z.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),gx=J.z.object({page:J.z.coerce.number().int().min(1).default(1),pageSize:J.z.coerce.number().int().min(1).max(500).default(50)});function vx(e){const[t,r]=a.useState(!1),{uploadFunction:s,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:c}=e||{};return{upload:async(e,t)=>{if(!s){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}r(!0);try{const a={...o,...t};if(a.maxSize&&e.size>a.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(a.maxSize/1024/1024)}MB`);if(a.allowedTypes){if(!a.allowedTypes.some(t=>t.endsWith("/*")?e.type.startsWith(t.replace("/*","")):e.type===t))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${a.allowedTypes.join(", ")}`)}const r=await s(e,a);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(r),r}catch(a){const e=a instanceof Error?a:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),c?.(e),e}finally{r(!1)}},deleteMedia:async(e,t)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,t),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(a){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),a}},uploading:t}}function bx(e,t){return e/t}const yx=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function wx(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const t=e/1024;if(t<1024)return`${Math.round(t)} KB`;const a=t/1024;if(a<1024)return`${Math.round(a)} MB`;const r=a/1024;return Math.round(100*r)/100+" GB"}function jx(e){const t=e.lastIndexOf(".");return-1===t?"":e.substring(t+1).toLowerCase()}var Nx=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(Nx||{}),_x=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(_x||{}),Cx=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Cx||{});function kx(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function Sx(e,t){if(!t)return!0;const a=null!=kx(e)&&""!==kx(e)&&!(Array.isArray(kx(e))&&0===kx(e).length);return!1!==e.isActive||a}function Ax({field:e}){return t.jsxs("div",{className:"space-y-1",children:[e.name&&t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&t.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Tx({field:e,readOnly:a,onChange:r}){const s=e.config,n=s?.multiline??!1,o=a||e.readOnly,i=t=>{r?.({...e,textValue:t})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?t.jsx(ks,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):t.jsx(kr,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function Dx({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(kr,{type:"date",value:n,onChange:t=>{return a=t.target.value,void r?.({...e,dateValue:a||void 0});var a},placeholder:e.placeholder,disabled:s})]})}function Px({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e=>{if(!e)return;const[t,a]=e.split(":").map(Number);return 60*t+a};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(kr,{type:"time",value:(e=>{if(null==e)return"";const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`})(e.timeValue),onChange:t=>r?.({...e,timeValue:n(t.target.value)}),placeholder:e.placeholder,disabled:s})]})}function Ex({field:e,readOnly:r,onChange:s}){const n=e.config,o=n?.multiple??!1,i=r||e.readOnly,[l,d]=a.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const t={value:crypto.randomUUID(),text:l.trim()};s?.({...e,itemsValue:[...u,t]}),d("")};if(!o){const a=u[0]?.text||"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(kr,{type:"url",value:a,onChange:t=>(t=>{const a={value:t,text:t};s?.({...e,itemsValue:t?[a]:[]})})(t.target.value),placeholder:e.placeholder||"https://",disabled:i}),a&&t.jsx(_r,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:t.jsx(c.ExternalLink,{className:"h-4 w-4"})})})]})]})}return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(kr,{type:"url",value:l,onChange:e=>d(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),t.jsx(_r,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:t.jsx(c.Plus,{className:"h-4 w-4"})})]}),u.length>0&&t.jsx("div",{className:"space-y-1",children:u.map((a,r)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("a",{href:a.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:a.text}),!i&&t.jsx(_r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(t=>{const a=u.filter((e,a)=>a!==t);s?.({...e,itemsValue:a})})(r),children:t.jsx(c.Trash2,{className:"h-3 w-3"})})]},a.value))})]})}function Mx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=null!=s?.decimals&&s.decimals>0?(1/Math.pow(10,s.decimals)).toString():"1";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(kr,{type:"number",value:e.numberValue??"",onChange:t=>(t=>{if(""===t)return void r?.({...e,numberValue:void 0});const a=parseFloat(t);isNaN(a)||r?.({...e,numberValue:a})})(t.target.value),placeholder:e.placeholder,disabled:n,min:s?.min,max:s?.max,step:o}),null!=s?.min&&null!=s?.max&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",s.min," | Max: ",s.max]})]})}function Ix({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??_x.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=e.itemsValue?.[0]?.value||"",c=t=>{const a=i.find(e=>e.value===t);if(!a)return;const s={value:a.value,text:a.text,isActive:a.isActive};r?.({...e,itemsValue:[s]})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===_x.dropdown&&t.jsxs(xs,{value:l,onValueChange:c,disabled:n,children:[t.jsx(vs,{children:t.jsx(gs,{placeholder:e.placeholder||"Selecione..."})}),t.jsx(ws,{children:i.map(e=>t.jsxs(Ns,{value:e.value,children:[e.text,!1===e.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===_x.radio||o===_x.buttons)&&t.jsx(Md,{value:l,onValueChange:c,disabled:n,className:wr(o===_x.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Id,{value:a.value,id:`${e.id}-${a.value}`}),t.jsxs(Ar,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))}),!n&&l&&!e.required&&t.jsx("button",{type:"button",onClick:()=>{r?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Rx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??_x.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(a=>t.jsxs(As,{variant:"secondary",className:"gap-1 pr-1",children:[t.jsx("span",{className:"text-xs",children:a.text}),!n&&t.jsx("button",{type:"button",onClick:()=>(t=>{const a=(e.itemsValue||[]).filter(e=>e.value!==t);r?.({...e,itemsValue:a})})(a.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:t.jsx(c.X,{className:"h-3 w-3"})})]},a.value))}),!n&&t.jsx("div",{className:wr(o===_x.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Cs,{id:`${e.id}-${a.value}`,checked:l.has(a.value),onCheckedChange:()=>(t=>{const a=e.itemsValue||[],s=a.some(e=>e.value===t.value)?a.filter(e=>e.value!==t.value):[...a,{value:t.value,text:t.text,isActive:t.isActive}];r?.({...e,itemsValue:s})})(a),disabled:n}),t.jsxs(Ar,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))})]})}function Lx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.questions||[],i=s?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{children:e.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{className:wr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx("div",{className:"border rounded-md overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b bg-muted/50",children:[t.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>t.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),t.jsx("tbody",{children:o.map((a,s)=>t.jsxs("tr",{className:wr(s<o.length-1&&"border-b"),children:[t.jsx("td",{className:"p-2 text-muted-foreground",children:a.text}),i.map(s=>{return t.jsx("td",{className:"text-center p-2",children:t.jsx(Md,{value:(o=a.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:t=>((t,a,s,n)=>{const o={questionValue:t,questionText:a,optionValue:s,optionText:n},i=l.filter(e=>e.questionValue!==t);i.push(o),r?.({...e,questionsValue:i})})(a.value,a.text,t,s.text),disabled:n,className:"flex justify-center",children:t.jsx(Id,{value:s.value,id:`${e.id}-${a.value}-${s.value}`})})},s.value);var o})]},a.value))})]})})]})}function Fx({field:e,readOnly:a,onChange:r}){const s={field:e,readOnly:a,onChange:r};switch(e.type){case Nx.readOnlyText:return t.jsx(Ax,{...s});case Nx.text:return t.jsx(Tx,{...s});case Nx.date:return t.jsx(Dx,{...s});case Nx.time:return t.jsx(Px,{...s});case Nx.url:return t.jsx(Ex,{...s});case Nx.number:return t.jsx(Mx,{...s});case Nx.singleSelection:return t.jsx(Ix,{...s});case Nx.multiSelection:return t.jsx(Rx,{...s});case Nx.questions:return t.jsx(Lx,{...s});default:return null}}function zx({open:r,onOpenChange:s,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:c=[],setDefaultApproverOnInit:d=!0,onSubmit:u}){const[m,p]=a.useState(!0),[h,x]=a.useState(d&&n.length>0?n[0].id:null),[f,g]=a.useState(o),v=e=>{p(e),e&&!d?x(null):!e&&!d&&n.length>0&&x(n[0].id)},b=f!==o||!m;return t.jsx(Gr,{open:r,onOpenChange:s,children:t.jsxs(Zr,{className:"sm:max-w-[480px]",variant:"form",isDirty:b,children:[t.jsx(es,{children:t.jsx(rs,{children:i})}),t.jsxs("div",{className:"space-y-4",children:[c.length>0&&t.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:c.map((e,a)=>t.jsx("p",{dangerouslySetInnerHTML:{__html:e}},a))}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>v(!0),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>v(!1),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{children:"Etapa"}),t.jsxs(xs,{value:h??void 0,onValueChange:x,disabled:m,children:[t.jsx(vs,{children:t.jsx(gs,{placeholder:e.t("approval_select_step")})}),t.jsx(ws,{children:n.map(e=>t.jsx(Ns,{value:e.id,children:e.name},e.id))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ar,{children:e.t("approval_opinion")}),t.jsx(ks,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),t.jsxs(as,{children:[t.jsx(_r,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),t.jsx(_r,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!b,children:"Concluir"})]})]})})}function Ux({open:e,onOpenChange:r,approvers:s,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[c,d]=a.useState(null),u=a.useMemo(()=>{const e=new Set(o);return s.filter(t=>!e.has(t.id))},[s,o]),m=a.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return t.jsx(Gr,{open:e,onOpenChange:r,children:t.jsxs(Zr,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!c,children:[t.jsx(es,{children:t.jsx(rs,{children:l("approval_select_approver")})}),t.jsx(Ps,{isLoading:n,type:"spinner",children:t.jsx("div",{className:"space-y-4",children:t.jsx(hn,{options:m,value:c??void 0,onValueChange:e=>d("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),t.jsxs(as,{children:[t.jsx(_r,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),t.jsx(_r,{onClick:()=>{if(!c)return;const e=u.find(e=>e.id===c);e&&i(e)},disabled:!c||n,children:"Concluir"})]})]})})}function Ox(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Bx({text:e,maxLength:r=130}){const{t:s}=y.useTranslation(),[n,o]=a.useState(!1);return e.length<=r?t.jsx("span",{children:e}):t.jsxs("span",{children:[n?e:`${e.substring(0,r)}... `,t.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:s(n?"approval_read_less":"approval_read_more")})]})}function qx({approver:e}){if(1===e.type&&e.approverId)return t.jsxs(Qi,{className:"h-9 w-9 shrink-0",children:[t.jsx(Xi,{src:e.photoUrl,alt:e.name}),t.jsx(Ji,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const a=2===e.type?c.Users:3===e.type?c.MapPin:c.User;return t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:t.jsx(a,{className:"h-4 w-4 text-background"})})}function Vx({approver:e}){return e.date?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[t.jsx(c.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Ox(e.date)}),1!==e.type&&e.approvedUsername&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[t.jsx(c.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Ox(e.returnDate)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function $x({approver:e}){const{t:a}=y.useTranslation(),r=1!==e.type||e.approverId?e.name:"A definir";return t.jsxs("div",{children:[2===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:a("approval_user_group")}),3===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),t.jsx("p",{className:"text-sm font-medium break-words",children:r}),t.jsx(Vx,{approver:e})]})}var Wx=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(Wx||{});exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),exports.DialogPrimitive=se,Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AccordionPrimitive=ye,exports.AUTH_CONFIG=ze,exports.AccessDeniedDialog=mc,exports.Accordion=wc,exports.AccordionContent=_c,exports.AccordionItem=jc,exports.AccordionTrigger=Nc,exports.ActionButton=Cr,exports.ActionMenu=Cr,exports.ActionMenuItems=ri,exports.AggregationType=Sm,exports.Alert=Gi,exports.AlertDescription=Yi,exports.AlertDialog=Lr,exports.AlertDialogAction=Wr,exports.AlertDialogCancel=Hr,exports.AlertDialogContent=Or,exports.AlertDialogDescription=$r,exports.AlertDialogFooter=qr,exports.AlertDialogHeader=Br,exports.AlertDialogOverlay=Ur,exports.AlertDialogPortal=zr,exports.AlertDialogTitle=Vr,exports.AlertDialogTrigger=Fr,exports.AlertTitle=Ki,exports.AliasRedirect=function(){const{alias:e}=_o(),{pathname:a,search:r,hash:s}=N.useLocation();return e?t.jsx(N.Navigate,{to:`/${e}${a}${r}${s}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:r="alias"}){const s=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:c,switchUnit:d}=_o(),{urlAlias:u,isAliasMismatch:m,isValidAlias:p,isMissing:h,matchedCompany:x}=$i({paramName:r}),[f,g]=a.useState(!1),v=a.useRef(!1),b=r in o,y=a.useCallback(e=>{const t=o[r],{pathname:a,search:s,hash:i}=n;if(t){const r=a.split("/"),n=r.findIndex(e=>e===t);if(n>=0)return r[n]=e,r.join("/")+s+i}return`/${e}${"/"===a?"":a}${s}${i}`},[o,r,n]);return a.useEffect(()=>{if(b&&!c&&l&&i&&!v.current)if(h)s(y(i),{replace:!0});else if(!u||p){if(m&&x&&!v.current){(async()=>{v.current=!0,g(!0);try{await d(x)}catch(e){i&&s(y(i),{replace:!0})}finally{v.current=!1,g(!1)}})()}}else s(y(i),{replace:!0})},[b,c,l,i,h,u,p,m,x,d,y,s]),c||!l?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(Ds,{size:"lg"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):t.jsx(t.Fragment,{children:e})},exports.AnalysisFunctionality=Am,exports.AppHeader=Rh,exports.AppLayout=dx,exports.AppSidebar=$h,exports.ApprovalFlowReturnStep=Wx,exports.ApprovalSidenav=function({config:e,isLoading:r=!1,onClose:s,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:d=!1}){const{t:u}=y.useTranslation(),[m,p]=a.useState(!1),[h,x]=a.useState(!1),[f,g]=a.useState(""),[v,b]=a.useState(""),[w,j]=a.useState(!1),[N,_]=a.useState(""),C=r||m,k=a.useCallback((e,t)=>{g(e),b(t??""),x(!0)},[]),S=a.useCallback(async t=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...t}))return k(f,t.observation),void p(!1);s(),p(!1)},[e.associationId,f,n,s,k]),A=a.useCallback(e=>{_(e),j(!0)},[]),T=a.useCallback(async t=>{j(!1),p(!0),await o(e.associationId,N,t),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),D=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],P=(t,a)=>e.canApprove&&t.isCurrentStep&&a.approverId&&!a.date&&a.canApprove,E=(t,a)=>!e.flowReproved&&t.isCurrentStep&&1===a.type&&a.canApprove&&(!a.approverId||a.isToBeDefined);return t.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[t.jsx(_r,{variant:"ghost",size:"icon",onClick:s,className:"shrink-0",children:t.jsx(c.X,{className:"h-5 w-5"})}),t.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?t.jsx(Ps,{isLoading:!0,type:"spinner",className:"flex-1",children:t.jsx("div",{})}):t.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&t.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,a)=>t.jsx("div",{className:wr("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},a))}),t.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(a=>t.jsxs("div",{className:wr("space-y-2",(!a.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t.jsxs("p",{className:"font-semibold text-sm",children:[a.index,". Etapa: ",a.name]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground break-words",children:t.jsx(Bx,{text:a.description})}),a.returnDate&&t.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.returnUserName," em ",Ox(a.returnDate)]})]}),a.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:t.jsx(Bx,{text:a.returnObservation})})]}),a.approvers.map(e=>t.jsxs("div",{className:"p-2 space-y-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx(qx,{approver:e}),t.jsx($x,{approver:e})]}),P(a,e)&&t.jsx(_r,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),E(a,e)&&t.jsx(_r,{size:"sm",variant:"outline",onClick:()=>A(e.id),children:"Selecionar"})]}),e.observation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Bx,{text:e.observation})}),e.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Bx,{text:e.returnObservation})})]},e.id))]},a.id))]}),t.jsx(zx,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:v,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),t.jsx(Ux,{open:w,onOpenChange:j,approvers:l,isLoading:d,ignoreUserIds:D,onSubmit:T})]})},exports.ApproveDialog=zx,exports.AuthErrorInterceptor=ro,exports.AuthProvider=No,exports.AuthService=bo,exports.AutoComplete=hn,exports.Avatar=Qi,exports.AvatarFallback=Ji,exports.AvatarImage=Xi,exports.Badge=As,exports.BaseForm=Mi,exports.Blockquote=hd,exports.BodyContent=function({breadcrumbs:e,children:a,className:r}){return t.jsxs("div",{className:wr("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",r),children:[e&&e.length>0&&t.jsx(Cc,{className:"mb-4",children:t.jsx(kc,{children:e.map((a,r)=>{const s=r===e.length-1;return t.jsxs(te.Fragment,{children:[r>0&&t.jsx(Dc,{}),t.jsx(Sc,{children:s||!a.href?t.jsx(Tc,{children:a.label}):a.asChild&&a.children?t.jsx(Ac,{asChild:!0,children:a.children}):t.jsx(Ac,{asChild:!0,children:t.jsx(N.Link,{to:a.href||"/",children:a.label})})})]},`${a.label}-${r}`)})})}),t.jsx("div",{className:"space-y-6",children:a})]})},exports.Breadcrumb=Cc,exports.BreadcrumbEllipsis=Pc,exports.BreadcrumbItem=Sc,exports.BreadcrumbLink=Ac,exports.BreadcrumbList=kc,exports.BreadcrumbPage=Tc,exports.BreadcrumbSeparator=Dc,exports.BurndownPanel=Sp,exports.Button=_r,exports.ButtonGroup=Mc,exports.CRUD_CONFIG=qe,exports.CURRENCY_FIELDS=ep,exports.Calendar=Ic,exports.CallbackPage=()=>{const{processCallback:e}=_o(),r=N.useNavigate(),[s,n]=a.useState(null),[o,i]=a.useState(!1);a.useEffect(()=>{let t=!1;if(Tn()){jn.clear(),function(){if(wn&&"undefined"!=typeof PerformanceObserver&&!Sn)try{Sn=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration}),Sn.observe({type:"longtask",buffered:!0})}catch{}}(),_n("callback:start");try{const e=Bn.getAccessToken(),t=Bn.getIdToken();if(e){An(0,e,En.parseJwtPayload(e))}if(t){An(0,t,En.parseJwtPayload(t))}}catch{}}const a=Tn()?window.setTimeout(()=>{t||kn()},15e3):0;return(async()=>{try{const a=await e();if(t=!0,Tn()&&(_n("callback:processCallback:end"),function(e,t,a){if(!wn)return null;try{return performance.measure(`auth:${e}`,`auth:${t}`,`auth:${a}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),kn()),a){window.history.replaceState({},document.title,Ue("/"));const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),r(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){t=!0,Tn()&&kn(),localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{a&&window.clearTimeout(a),function(){if(Sn){try{Sn.disconnect()}catch{}Sn=null}}()}},[e,r]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(t){n(t?.message||"Erro ao tentar novamente.")}finally{i(!1)}},d=()=>{window.location.href=Ue("/")};return s?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsxs(Pr,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[t.jsx(c.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t.jsxs(Mr,{className:"space-y-4",children:[t.jsx(Gi,{variant:"danger",children:t.jsx(Yi,{children:s})}),t.jsx("div",{className:"text-sm text-muted-foreground",children:t.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(_r,{onClick:l,disabled:o,className:"flex-1",children:o?t.jsxs(t.Fragment,{children:[t.jsx(Ds,{size:"sm",className:"mr-2"}),"Tentando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),t.jsx(_r,{onClick:d,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t.jsxs(Mr,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(Ds,{size:"lg"})}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=Tr,exports.CardContent=Mr,exports.CardDescription=Er,exports.CardFooter=Ir,exports.CardHeader=Dr,exports.CardSkeleton=Fo,exports.CardTitle=Pr,exports.CartesianPanel=jp,exports.ChartContainer=Bu,exports.ChartLegend=Wu,exports.ChartLegendContent=Hu,exports.ChartStyle=qu,exports.ChartTooltip=Vu,exports.ChartTooltipContent=$u,exports.Checkbox=Cs,exports.Collapsible=Rl,exports.CollapsibleContent=Fl,exports.CollapsibleTrigger=Ll,exports.ColorPicker=_i,exports.ColumnSettingsPopover=vi,exports.ComboTree=yn,exports.Combobox=hn,exports.Command=an,exports.CommandDialog=({children:e,...a})=>t.jsx("div",{...a,children:t.jsx(an,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=nn,exports.CommandGroup=on,exports.CommandInput=rn,exports.CommandItem=cn,exports.CommandList=sn,exports.CommandSeparator=ln,exports.CommandShortcut=dn,exports.ContentContainer=function({title:e,subtitle:a,children:r,className:s,hasHeader:n=!0}){const o=e||a;return t.jsxs("div",{className:wr("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",s),children:[n&&o&&t.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&t.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),a&&t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:a})]}),r&&t.jsx("div",{className:wr("p-6",!n&&o&&"pt-4"),children:r})]})},exports.ContextMenu=qo,exports.ContextMenuCheckboxItem=Jo,exports.ContextMenuContent=Qo,exports.ContextMenuGroup=$o,exports.ContextMenuItem=Xo,exports.ContextMenuLabel=ei,exports.ContextMenuPortal=Wo,exports.ContextMenuRadioGroup=Go,exports.ContextMenuRadioItem=Zo,exports.ContextMenuSeparator=ti,exports.ContextMenuShortcut=ai,exports.ContextMenuSub=Ho,exports.ContextMenuSubContent=Yo,exports.ContextMenuSubTrigger=Ko,exports.ContextMenuTrigger=Vo,exports.CoreProviders=function({children:r,queryClient:s,moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i="common",signDocumentsTable:l="sign_documents",moduleAccessGuardProps:c,appTranslations:d,clarityProjectId:u,clarityMode:m="auto",backend:p="supabase",securityMode:h="legacy"}){Le(p),vc=h,fc();const[x]=a.useState(()=>new j.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=s??x;a.useEffect(()=>{if(d)for(const[e,t]of Object.entries(d))wl(e,t)},[d]);const g={sourceModule:n,...c};return t.jsxs(Ol,{children:[t.jsx(yc,{}),t.jsx(y.I18nextProvider,{i18n:e,children:t.jsx(j.QueryClientProvider,{client:f,children:t.jsxs(No,{children:[t.jsx(bc,{projectId:u,mode:m}),t.jsx(Ml,{children:t.jsxs(Nl,{moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i,signDocumentsTable:l,children:[t.jsx(Tl,{}),t.jsx(hc,{...g,children:r})]})})]})})})]})},exports.CrudActionBar=pi,exports.CrudActionMenu=function({onEdit:e,onDelete:r,onToggleStatus:s,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:d="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=a.useMemo(()=>{const t=[];return e&&o&&t.push({key:"edit",icon:c.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),s&&t.push({key:"toggle-status",icon:n?c.PowerOff:c.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:s,variant:"default"}),l.forEach(e=>{!1!==e.show&&t.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),r&&i&&t.push({key:"delete",icon:c.Trash2,label:m("remove","Remover"),onClick:r,variant:"destructive"}),t},[e,r,s,n,o,i,l,m]);return 0===p.length?null:"dropdown"===d?t.jsx(Ks,{delayDuration:200,children:t.jsxs(Ms,{children:[t.jsx(Is,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:t.jsx(c.EllipsisVertical,{size:"compact"===u?14:16})})}),t.jsx(Bs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t.jsxs(Js,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t.jsxs(qs,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):t.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>t.jsxs(_r,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&t.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&t.jsx("span",{className:"ml-1",children:e.label})]},e.key))})},exports.CrudGrid=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:d,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:v=!1,searchValue:b,onSearchChange:w,searchPlaceholder:j,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:A,onViewModeChange:T,listCardRenderer:D,gridCardRenderer:P,showViewToggle:E=!1})=>{const{setSearchVisible:M}=_o(),I=void 0!==f?!f:g;a.useEffect(()=>{if(!v)return M(!0),()=>M(!1)},[M,v]);const R=m||x.length>0||v||u||C||E,L=_||(()=>{r.bulkDelete?.(r.selectedIds)}),F=A||"grid",z="list"===F,U={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],O=I&&R?t.jsx(pi,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:v,searchValue:b,onSearchChange:w,searchPlaceholder:j,showBulkActions:u,selectedCount:r.selectedIds.length,bulkActions:N,onBulkDelete:L,onClearSelection:r.clearSelection,customActions:x,filters:C,viewMode:F,onViewModeChange:T,showViewToggle:E,availableViewModes:["list","grid"]}):null;return r.isLoading?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx(Fo,{count:6})})]}):0===r.entities.length?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Uo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx("div",{className:wr("grid gap-4",U),children:r.entities.map(e=>{const a=(e=>{const{t:t}=y.useTranslation();return z&&D?D(e):!z&&P?P(e):S?S(e):null})(e);return t.jsxs(qo,{children:[t.jsx(Vo,{asChild:!0,children:a?t.jsx("div",{className:"cursor-pointer",onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:a}):t.jsx(Tr,{className:wr("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&r.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:t.jsxs(Mr,{className:wr("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&t.jsx("div",{className:wr(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:t.jsx(hi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),z?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:s.map(a=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key)))}),(n||o||c)&&t.jsx("div",{onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(si,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]}):t.jsxs("div",{className:"flex items-start gap-3",children:[u&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(hi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[s.map((a,r)=>t.jsxs("div",{className:wr("flex justify-between items-start gap-2",r!==s.length-1&&"mb-2"),children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||c)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(si,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]})]})]})})}),t.jsx(Qo,{className:"w-[160px]",children:t.jsx(ri,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:d?d(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=Bi,exports.CrudPagination=Ri,exports.CrudPrimitiveFilterBar=wh,exports.CrudPrimitivePagination=Ii,exports.CrudPrimitiveTable=yh,exports.CrudTable=yi,exports.CustomFormFields=function({fields:e,readOnly:r=!1,hideInactiveWithoutValue:s=!1,onChange:n,onFieldChange:o}){const i=a.useCallback(t=>{if(o?.(t),n){const a=e.map(e=>e.id===t.id?t:e);n(a)}},[e,n,o]),l=e.filter(e=>Sx(e,s));return 0===l.length?null:t.jsx("div",{className:"space-y-4",children:l.map(e=>t.jsx(Fx,{field:e,readOnly:r,onChange:i},e.id))})},exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=Ja,exports.DEFAULT_DATETIME_FORMAT=tr,exports.DEFAULT_LOCALE=er,exports.DEFAULT_TIMEZONE=ar,exports.DashboardForm=Hp,exports.DashboardFormTab=Um,exports.DashboardFunctionality=Tm,exports.DashboardGeneralView=function({dashboards:e,limit:r,generalView:s,language:n=Bm.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:c=!1,canEditStandard:d=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:v=!1,onOpen:b,onBackToList:y,onRefresh:w,onRefreshList:j,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:A,onAddPanel:T,onEditPanel:D,onRemovePanel:P,onDuplicatePanel:E,onLayoutChange:M,onSearch:I,onQuickFilterChange:R,onSetGeneralView:L,viewState:F,onViewStateChange:z,listToolbarExtra:U,viewToolbarActions:O,className:B}){const[q,V]=a.useState({mode:"list"}),$=F??q,W=a.useCallback(e=>{z?z(e):V(e)},[z]),H=a.useMemo(()=>"view"===$.mode||"edit"===$.mode||"share"===$.mode?e.find(e=>e.id===$.dashboardId)??null:null,[e,$]),[G,K]=a.useState(!1),[Y,Q]=a.useState(m[0]?.id);a.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),a.useEffect(()=>{if("view"!==$.mode||!H||H.idViewType!==zm.Carousel||m.length<=1)return;const e=function(e){switch(e){case Pm.FiveSeconds:return 5e3;case Pm.TenSeconds:return 1e4;case Pm.FifteenSeconds:return 15e3;case Pm.ThirtySeconds:return 3e4;case Pm.OneMinute:return 6e4;case Pm.ThreeMinutes:return 18e4;case Pm.FiveMinutes:return 3e5;case Pm.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),t=setInterval(()=>{Q(e=>{const t=(m.findIndex(t=>t.id===e)+1)%m.length;return m[t]?.id})},e);return()=>clearInterval(t)},[$,H,m]);const X=a.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),b?.(e)},[W,b]),J=a.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=a.useCallback(()=>{W({mode:"create"})},[W]),ee=a.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),te=a.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),ae=a.useCallback(e=>{"edit"===$.mode||"share"===$.mode?C?.($.dashboardId,e):_?.(e)},[$,_,C]),re=a.useCallback(()=>{"edit"===$.mode||"share"===$.mode?W({mode:"view",dashboardId:$.dashboardId}):W({mode:"list"})},[$,W]),se=a.useCallback(()=>{H&&N?.(H)},[H,N]),ne=a.useCallback(()=>{H&&ee(H)},[H,ee]),oe=a.useCallback(()=>{H&&te(H)},[H,te]);return t.jsxs("div",{className:wr("flex flex-col h-full",B),children:["list"===$.mode&&t.jsx(Op,{dashboards:e,limit:r,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:c,onOpen:X,onEdit:ee,onShare:te,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:j,onSearch:I,onQuickFilterChange:R,toolbarExtra:U,className:"flex-1"}),"view"===$.mode&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[!G&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),s?.dashboardId===H.id&&t.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[t.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&L&&s?.dashboardId!==H.id&&t.jsx("button",{onClick:()=>L(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),t.jsx(Lp,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||d&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:w,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:se,onEdit:ne,onShare:oe,onAddPanel:T,onEditPanel:D,onRemovePanel:P,onDuplicatePanel:E,onLayoutChange:M,onPageChange:Q,toolbarActions:O,className:"flex-1"})]}),"create"===$.mode&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),t.jsx(Hp,{users:h,groups:x,places:f,collaborators:g,isSaving:v,onSave:ae,onCancel:re,className:"flex-1"})]}),("edit"===$.mode||"share"===$.mode)&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:re,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),t.jsx(Hp,{dashboard:H,initialTab:"share"===$.mode?Um.Share:Um.General,users:h,groups:x,places:f,collaborators:g,isSaving:v,isQualitfy:!!H.isStandard&&!d,onSave:ae,onCancel:re,className:"flex-1"})]})]})},exports.DashboardGrid=Mp,exports.DashboardLanguage=Bm,exports.DashboardList=Op,exports.DashboardListType=Dm,exports.DashboardPageTime=Pm,exports.DashboardPanelDimension=Em,exports.DashboardPanelOrderBy=Im,exports.DashboardPanelOrderByType=Mm,exports.DashboardPanelPeriod=Rm,exports.DashboardPanelRenderer=Rp,exports.DashboardPanelType=Lm,exports.DashboardShareType=Om,exports.DashboardUpdateTime=Fm,exports.DashboardView=Lp,exports.DashboardViewType=zm,exports.DataFilterBar=wh,exports.DataList=Rc,exports.DataPagination=Ii,exports.DataTable=yh,exports.DatePicker=function({date:e,onDateChange:a,placeholder:r,disabled:s=!1,className:n,disabledDates:o}){const{t:l}=y.useTranslation(),d=r??l("select_date");return t.jsxs(Zs,{children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{variant:"outline",disabled:s,className:wr("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[t.jsx(c.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Qa}):t.jsx("span",{children:d})]})}),t.jsx(tn,{className:"w-auto p-0",align:"start",children:t.jsx(Ic,{mode:"single",selected:e,onSelect:a,disabled:o,initialFocus:!0,className:"pointer-events-auto"})})]})},exports.Dialog=Gr,exports.DialogBody=ts,exports.DialogClose=Qr,exports.DialogContent=Zr,exports.DialogDescription=ss,exports.DialogFooter=as,exports.DialogHeader=es,exports.DialogOverlay=Xr,exports.DialogPortal=Yr,exports.DialogTitle=rs,exports.DialogTrigger=Kr,exports.DialogWizard=function({open:a,onOpenChange:r,currentStep:s,onStepChange:n,steps:o,canGoToStep:i,children:l,title:d,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:v="lg",unsavedChangesTitle:b,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=y.useTranslation(),T=o.length,D=s>=T,P=s<=1;return t.jsx(Gr,{open:a,onOpenChange:r,children:t.jsxs(Zr,{size:v,variant:f,isDirty:g,unsavedChangesTitle:b,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:wr("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[t.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),t.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,a)=>{const r=a+1,o=r===s,l=(e=>e<s)(r),d=(u=r)<=s||!i||i(u);var u;return t.jsxs("button",{type:"button",onClick:()=>(e=>{e!==s&&(e<s?n(e):i&&!i(e)||n(e))})(r),disabled:!d,className:wr("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&d&&"hover:bg-primary-foreground/10 cursor-pointer",!d&&"opacity-40 cursor-not-allowed"),children:[t.jsx("span",{className:wr("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?t.jsx(c.Check,{className:"h-3.5 w-3.5"}):r}),t.jsx("span",{className:wr("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},r)})})]}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsxs(es,{className:"p-6 pb-0",children:[t.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",s," de ",T]}),t.jsx(rs,{children:d}),u&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),t.jsx(ts,{className:"px-6",children:l}),!k&&t.jsx(as,{className:"px-6 pb-6",children:t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("div",{className:"flex items-center gap-2",children:S}),t.jsxs("div",{className:"flex items-center gap-2",children:[!P&&t.jsx(_r,{variant:"outline",onClick:()=>n(s-1),children:x}),D?t.jsx(_r,{onClick:m,disabled:C,children:p}):t.jsx(_r,{onClick:()=>n(s+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=Js,exports.Drawer=Lc,exports.DrawerClose=Uc,exports.DrawerContent=Bc,exports.DrawerDescription=Wc,exports.DrawerFooter=Vc,exports.DrawerHeader=qc,exports.DrawerOverlay=Oc,exports.DrawerPortal=zc,exports.DrawerTitle=$c,exports.DrawerTrigger=Fc,exports.DropdownMenu=Ms,exports.DropdownMenuCheckboxItem=Vs,exports.DropdownMenuContent=Bs,exports.DropdownMenuGroup=Rs,exports.DropdownMenuItem=qs,exports.DropdownMenuLabel=Ws,exports.DropdownMenuPortal=Ls,exports.DropdownMenuRadioGroup=zs,exports.DropdownMenuRadioItem=$s,exports.DropdownMenuSeparator=Hs,exports.DropdownMenuShortcut=Gs,exports.DropdownMenuSub=Fs,exports.DropdownMenuSubContent=Os,exports.DropdownMenuSubTrigger=Us,exports.DropdownMenuTrigger=Is,exports.ECustomFormFieldType=Nx,exports.EFieldViewMode=_x,exports.ESelectionFieldDataSource=Cx,exports.EditProfileDialog=pl,exports.ElectronicSignatureDialog=function({open:r,onOpenChange:s,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:d=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,v=g?e.t("esign_password_description"):e.t("esign_code_description"),b=m??v,[y,w]=a.useState(""),[j,N]=a.useState(!1),[_,C]=a.useState(!1),[k,S]=a.useState(null),A=a.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(w(""),s(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,s,f,g]),T=a.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),D=e=>{e||(w(""),S(null)),s(e)},P=g?c.Lock:c.ShieldCheck,E=g?"Senha":e.t("verification_code"),M=g?e.t("enter_password"):e.t("enter_code");return t.jsx(Gr,{open:r,onOpenChange:D,children:t.jsxs(Zr,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[t.jsx(es,{children:t.jsxs(rs,{className:"flex items-center gap-2",children:[t.jsx(P,{className:"h-5 w-5 text-primary"}),u]})}),t.jsxs("div",{className:"py-4 space-y-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:b}),!g&&l&&t.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[t.jsx(c.Mail,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),t.jsx("span",{className:"font-medium",children:l})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"signature-input",children:E}),t.jsx(kr,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),A())},maxLength:g?void 0:d,placeholder:M,autoFocus:!0,className:wr(k&&"border-destructive focus-visible:ring-destructive")}),k&&t.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&t.jsxs(_r,{variant:"ghost",size:"sm",onClick:T,disabled:_,className:"text-primary",children:[t.jsx(c.RefreshCw,{className:wr("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),t.jsxs(as,{children:[t.jsx(_r,{variant:"outline",onClick:()=>D(!1),disabled:j,children:h}),t.jsx(_r,{onClick:A,disabled:!y.trim()||j,children:j?"Validando...":p})]})]})})},exports.EllipsisText=Oo,exports.EmailService=ux,exports.EmptyState=Uo,exports.EntitySelect=hn,exports.ErrorBoundary=Ol,exports.ExportDialog=function({open:e,onOpenChange:r,onExport:s,mode:n="table",options:o,title:i,description:l,cancelLabel:c="Cancelar",exportLabel:d="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=a.useState(""),h=o??("chart"===n?rm:am),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),r(e)};return t.jsx(Gr,{open:e,onOpenChange:g,children:t.jsxs(Zr,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[t.jsx(es,{children:t.jsx(rs,{children:x})}),t.jsxs("div",{className:"py-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),t.jsx(Md,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Id,{value:e.value,id:`export-${e.value}`}),t.jsxs(Ar,{htmlFor:`export-${e.value}`,className:wr("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t.jsxs(as,{children:[t.jsx(_r,{variant:"outline",onClick:()=>g(!1),children:c}),t.jsx(_r,{onClick:()=>{m&&(s(m),r(!1),p(""))},disabled:!m,children:d})]})]})})},exports.ExportFormat=tm,exports.FORBIDDEN_FILE_TYPES=yx,exports.FilePrintType=um,exports.FileViewerType=dm,exports.FilterBar=Oi,exports.Form=ns,exports.FormControl=us,exports.FormDateField=Dx,exports.FormDescription=ms,exports.FormField=({...e})=>t.jsx(os.Provider,{value:{name:e.name},children:t.jsx(h.Controller,{...e})}),exports.FormItem=cs,exports.FormLabel=ds,exports.FormMessage=ps,exports.FormMultiSelectionField=Rx,exports.FormNumericField=Mx,exports.FormQuestionsField=Lx,exports.FormSingleSelectionField=Ix,exports.FormSkeleton=function({fields:e=4}){return t.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,a)=>t.jsxs("div",{className:"space-y-2",children:[t.jsx(un,{className:"h-4 w-24"}),t.jsx(un,{className:"h-10 w-full"})]},a)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(un,{className:"h-10 w-20"}),t.jsx(un,{className:"h-10 w-20"})]})]})},exports.FormTextField=Tx,exports.FormTimeField=Px,exports.FormUrlField=Ex,exports.Grid=function({children:e,cols:a="auto-fit",gap:r="md",className:s}){return t.jsx("div",{className:wr("grid",Hc[a],Gc[r],s),children:e})},exports.H1=sd,exports.H2=nd,exports.H3=od,exports.H4=id,exports.HeaderSkeleton=function(){return t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(un,{className:"h-8 w-8 rounded-full"}),t.jsx(un,{className:"h-6 w-32"})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(un,{className:"h-8 w-8"}),t.jsx(un,{className:"h-8 w-24"})]})]})},exports.HoverCard=Kc,exports.HoverCardContent=Qc,exports.HoverCardTrigger=Yc,exports.IconPicker=Ti,exports.IframeDialog=gm,exports.ImageEditor=function({value:e,onChange:r,onSubmit:s,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:d}){const{t:u}=y.useTranslation(),[m,p]=a.useState(e||{alignment:"center",allowDownload:!1}),h=a.useRef(null),{upload:x,uploading:f}=vx({uploadFunction:o,deleteFunction:i,defaultOptions:{...d,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,t)=>{const a={...m,[e]:t};p(a),r(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"URL"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(kr,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await x(t),a={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(a),r(a)}catch(a){}finally{h.current&&(h.current.value="")}},className:"hidden"}),t.jsx(_r,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:t.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:t.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"caption",children:"Legenda"}),t.jsx(ks,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"alt",children:u("alt_text")}),t.jsx(kr,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"Alinhamento"}),t.jsxs(xs,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[t.jsx(vs,{children:t.jsx(gs,{})}),t.jsxs(ws,{children:[t.jsx(Ns,{value:"left",children:"Esquerda"}),t.jsx(Ns,{value:"center",children:"Centro"}),t.jsx(Ns,{value:"right",children:"Direita"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"width",children:"Largura"}),t.jsx(kr,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"height",children:"Altura"}),t.jsx(kr,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Cs,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),t.jsx(Ar,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(_r,{variant:"outline",onClick:n,children:"Cancelar"}),t.jsx(_r,{onClick:()=>{m.imageUrl?s(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:a="",style:r}){const{t:s}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return t.jsx("div",{className:`flex ${n} my-4 ${a}`,style:r,children:t.jsxs("div",{className:"space-y-2 max-w-full",children:[t.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&t.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[t.jsx(c.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=pd,exports.Input=kr,exports.InputGroup=Xc,exports.InputGroupAddon=Zc,exports.InputGroupButton=td,exports.InputGroupInput=ad,exports.InputGroupTextarea=rd,exports.LINK_PROPERTIES=tp,exports.LOGO_CONFIG=Xe,exports.Label=Ar,exports.LanguageBootstrap=Tl,exports.Large=dd,exports.Lead=cd,exports.List=xd,exports.ListPanel=bp,exports.LoadingState=Ps,exports.LocaleProvider=Ml,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsx(Pr,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t.jsxs(Mr,{className:"text-center space-y-4",children:[t.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),t.jsx(_r,{onClick:async()=>{We()?await bo.loginDev():bo.loginProd()},className:"w-full",size:"lg",children:We()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=Je,exports.MODULES_DATA=nc,exports.MONTHS_MAP=Zm,exports.MatrixRiskPanel=Tp,exports.MatrixViewType=qm,exports.Menubar=Su,exports.MenubarCheckboxItem=Mu,exports.MenubarContent=Pu,exports.MenubarGroup=Nu,exports.MenubarItem=Eu,exports.MenubarLabel=Ru,exports.MenubarMenu=ju,exports.MenubarPortal=_u,exports.MenubarRadioGroup=ku,exports.MenubarRadioItem=Iu,exports.MenubarSeparator=Lu,exports.MenubarShortcut=Fu,exports.MenubarSub=Cu,exports.MenubarSubContent=Du,exports.MenubarSubTrigger=Tu,exports.MenubarTrigger=Au,exports.MindMap=({value:e,defaultValue:r,onChange:s,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:c,className:d,height:u=600})=>{const{t:m}=y.useTranslation(),p=nh({value:e,defaultValue:r,onChange:s,readOnly:o}),h=mh(p.root),x=function(){const[e,t]=a.useState({x:0,y:0,scale:1}),r=a.useRef(!1),s=a.useRef({x:0,y:0,tx:0,ty:0}),n=a.useCallback(t=>{0!==t.button&&1!==t.button||(r.current=!0,s.current={x:t.clientX,y:t.clientY,tx:e.x,ty:e.y},t.currentTarget.setPointerCapture(t.pointerId))},[e.x,e.y]),o=a.useCallback(e=>{r.current&&t(t=>({...t,x:s.current.tx+(e.clientX-s.current.x),y:s.current.ty+(e.clientY-s.current.y)}))},[]),i=a.useCallback(e=>{if(r.current){r.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=a.useCallback((e,a,r)=>{t(t=>{const s=Math.min(2.5,Math.max(.3,t.scale+e));if(s===t.scale)return t;if(void 0===a||void 0===r)return{...t,scale:s};const n=s/t.scale;return{scale:s,x:a-(a-t.x)*n,y:r-(r-t.y)*n}})},[]),c=a.useCallback(()=>l(.15),[l]),d=a.useCallback(()=>l(-.15),[l]),u=a.useCallback(()=>t({x:0,y:0,scale:1}),[]),m=a.useCallback((e,a,r,s)=>{const n=Math.min((r-64)/e,(s-64)/a,1.5),o=Math.max(.3,n);t({scale:o,x:(r-e*o)/2,y:(s-a*o)/2})},[]),p=a.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),a=e.clientX-t.left,r=e.clientY-t.top;l(e.deltaY>0?-.1:.1,a,r)},[l]);return a.useEffect(()=>{const e=()=>r.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:t,zoomIn:c,zoomOut:d,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=te.useRef(null),g=te.useRef(null),v=te.useRef(null),[b,w]=te.useState(null),[j,N]=te.useState(null);te.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:t,containerRef:r,onStartEditing:s,readOnly:n,extraShortcuts:o}){a.useEffect(()=>{const a=a=>{const i=r.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=a.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const c={layout:t,selectedId:e.selectedId,setSelectedId:e.setSelectedId},d=e.selectedId;for(const t of o??[])if(t.key.toLowerCase()===a.key.toLowerCase()&&!!t.ctrl===(a.ctrlKey||a.metaKey)&&!!t.shift===a.shiftKey&&!!t.alt===a.altKey)return a.preventDefault(),void t.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((a.ctrlKey||a.metaKey)&&"z"===a.key.toLowerCase())return a.preventDefault(),void(a.shiftKey?e.redo():e.undo());if("ArrowUp"===a.key)return a.preventDefault(),void ph("up",c);if("ArrowDown"===a.key)return a.preventDefault(),void ph("down",c);if("ArrowLeft"===a.key)return a.preventDefault(),void ph("left",c);if("ArrowRight"===a.key)return a.preventDefault(),void ph("right",c);if(d){if(" "===a.key)return a.preventDefault(),void e.toggleNode(d);if("F2"===a.key){if(n)return;return a.preventDefault(),void s(d)}if(!n){if("Enter"===a.key&&!a.shiftKey)return a.preventDefault(),d===e.root.id?e.addChild(d,""):e.addSibling(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Insert"===a.key||"Tab"===a.key)return a.preventDefault(),e.addChild(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Delete"===a.key||"Backspace"===a.key){if(d===e.root.id)return;return a.preventDefault(),void e.removeNode(d)}}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,r,s,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||w(e)},readOnly:o,extraShortcuts:l});const _=te.useRef(!1);te.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:t,clientHeight:a}=e;t>0&&a>0&&h.width>0&&(x.fitTo(h.width,h.height,t,a),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,A=te.useRef(null),T=e=>t=>{if(o)return;const a=A.current;if(!a||a===e)return;const r=Yp(p.root,a);r&&Yp(r.node,e)||(t.preventDefault(),t.dataTransfer.dropEffect="move",N(e))},D=()=>N(null),P=e=>t=>{t.preventDefault();const a=A.current;N(null),A.current=null,a&&a!==e&&p.moveNode(a,e)};return t.jsx(Ks,{children:t.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:wr("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",d),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&t.jsx(gh,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");w(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void w(e)}const e=p.addSibling(C,"");w(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,t,a="application/json"){const r=new Blob([e],{type:a}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(vh(p.root),"mind-map.json")},onExportImage:async()=>{if(v.current)try{await async function(e,t="mind-map.png"){const a=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(a),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,n=new Image;await new Promise((e,t)=>{n.onload=()=>e(),n.onerror=()=>t(new Error("Failed to load SVG snapshot")),n.src=s});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const c=l.getContext("2d");if(!c)throw new Error("Canvas 2D context unavailable");c.fillStyle="#ffffff",c.fillRect(0,0,l.width,l.height),c.drawImage(n,0,0,l.width,l.height);const d=await new Promise(e=>l.toBlob(e,"image/png"));if(!d)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(d),m=document.createElement("a");m.href=u,m.download=t,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(v.current,"mind-map.png")}catch(e){}}}),t.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:t.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[t.jsx("svg",{ref:v,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(a=>t.jsx(xh,{parent:e,child:a},`${e.node.id}-${a.node.id}`)))}),h.nodes.map(e=>{return t.jsx(hh,{layout:e,selected:C===e.node.id,editing:b===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>w(e.node.id),onFinishEditing:t=>{null!==t&&p.renameNode(e.node.id,t),w(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(a=e.node.id,e=>{o||a===p.root.id||(A.current=a,e.dataTransfer.setData("text/plain",a),e.dataTransfer.effectAllowed="move")}),onDragOver:T(e.node.id),onDragLeave:D,onDrop:P(e.node.id),isDropTarget:j===e.node.id,renderNodeContent:c},e.node.id);var a})]})})]})})},exports.ModalStateProvider=function({children:e}){const[r,s]=a.useState(new Set),[n,o]=a.useState(!1),i=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.add(e),a})},[]),l=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.delete(e),a})},[]),c=a.useCallback(e=>{o(e)},[]),d=a.useMemo(()=>r.size>0||n,[r,n]),u=a.useMemo(()=>({openModals:r,hasOpenModal:d,registerModal:i,unregisterModal:l,setHasOpenModal:c}),[r,d,i,l,c]);return t.jsx(Bh.Provider,{value:u,children:e})},exports.ModuleAccessGuard=hc,exports.ModuleGrid=lc,exports.ModuleOfferContent=function({title:e,description:a,image:r,icon:s,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),d=n??l("want_to_know_more");return t.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(r||s)&&t.jsx("div",{className:"flex items-center justify-center",children:r?t.jsx("img",{src:r,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):s?t.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:t.jsx(s,{className:"h-12 w-12 text-primary"})}):null}),t.jsxs("div",{className:"space-y-3 max-w-lg",children:[t.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a})]}),i?t.jsx("div",{className:"w-full",children:i}):o?t.jsxs(_r,{onClick:o,size:"lg",className:"gap-2",children:[t.jsx(c.Sparkles,{className:"h-4 w-4"}),d]}):null]})},exports.ModuleProvider=Nl,exports.ModulesContent=cc,exports.ModulesDialog=uc,exports.ModulesFooterCards=sc,exports.MultiSelect=hn,exports.MultiselectPermissions=function({items:r,categories:s,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:d=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:v,onDisclaimerClick:b,className:w}){const[j,N]=a.useState(s[0]?.id??""),[_,C]=a.useState(""),[k,S]=a.useState([]),[A,T]=a.useState(!1),D=a.useMemo(()=>wm(n[j]),[n,j]),P=a.useMemo(()=>function(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.inheritedIds?.forEach(e=>a.add(e));return a}(n[j]),[n,j]),E=a.useMemo(()=>r.filter(e=>D.has(e.id)),[r,D]),M=a.useMemo(()=>{const e=ym(_);return r.filter(t=>!D.has(t.id)&&!(e&&!ym(t.name).includes(e)))},[r,D,_]),I=a.useMemo(()=>{const e={};for(const t of s)e[t.id]=wm(n[t.id]).size;return e},[s,n]),R=a.useCallback(e=>{N(e),S([]),C("")},[]),L=a.useCallback(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),F=a.useCallback(()=>{if(0===k.length)return;const e=[...n[j]??[]];for(const t of k){const a=r.find(e=>e.id===t),s=a?.group??"default",n=e.find(e=>e.context===s);n?n.allowedIds.includes(t)||(n.allowedIds=[...n.allowedIds,t]):e.push({context:s,allowedIds:[t],inheritedIds:[]})}o({...n,[j]:e}),S([]),C(""),T(!1)},[k,n,j,r,o]),z=a.useCallback(e=>{if(P.has(e))return;const t=(n[j]??[]).map(t=>({...t,allowedIds:t.allowedIds.filter(t=>t!==e)}));o({...n,[j]:t})},[n,j,P,o]);return l?t.jsxs("div",{className:wr("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[t.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),t.jsx("div",{className:"h-9 w-full bg-muted rounded"}),t.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):t.jsx("div",{className:wr("rounded-md border bg-muted/30",w),children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:d}),t.jsxs(xs,{value:j,onValueChange:R,children:[t.jsx(vs,{className:"h-9 text-sm",children:t.jsx(gs,{})}),t.jsx(ws,{children:s.map(e=>t.jsx(Ns,{value:e.id,children:t.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,I[e.id]>0&&t.jsx(As,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:I[e.id]})]})},e.id))})]})]}),!i&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(Zs,{open:A,onOpenChange:T,children:[t.jsx(en,{asChild:!0,children:t.jsxs(_r,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,t.jsx(c.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(tn,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[t.jsx("div",{className:"p-2 border-b",children:t.jsxs("div",{className:"relative",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(kr,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),t.jsx(Ci,{className:"max-h-[220px]",children:0===M.length?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):t.jsx("div",{className:"p-1",children:M.map(e=>{const a=k.includes(e.id);return t.jsxs("div",{className:wr("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",a&&"bg-accent/50"),onClick:()=>L(e.id),children:[t.jsx("div",{className:wr("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",a&&"bg-primary text-primary-foreground"),children:a&&t.jsx(c.Check,{className:"h-3 w-3"})}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&t.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),t.jsxs(_r,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:F,children:[t.jsx(c.Plus,{className:"h-4 w-4"}),u]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:m}),t.jsx("div",{className:wr("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===E.length?t.jsx("span",{className:"text-sm text-muted-foreground",children:p}):t.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(e=>{const a=P.has(e.id);return t.jsxs(As,{variant:a?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!a&&t.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:t.jsx(c.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",v&&b&&t.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:b,children:v})]})]})]})})},exports.Muted=md,exports.NavigationMenu=fd,exports.NavigationMenuContent=wd,exports.NavigationMenuIndicator=_d,exports.NavigationMenuItem=vd,exports.NavigationMenuLink=jd,exports.NavigationMenuList=gd,exports.NavigationMenuTrigger=yd,exports.NavigationMenuViewport=Nd,exports.NavigationProvider=Dh,exports.NumericPanel=gp,exports.OnboardingDialog=Zu,exports.OnlineEditorDialog=function({open:e,onOpenChange:r,identifier:s,fileName:n,mode:o="edit",type:i="document",onClose:l,className:d}){const[u,m]=a.useState(!0),p=function(e,t="edit",a="document"){return`https://docs.google.com/${a}/d/${e}/${t}?usp=drivesdk?embedded=true&rm=demo`}(s,o,i);a.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=a.useCallback(()=>{l?.(),r(!1)},[l,r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,h]),t.jsx(Gr,{open:e,onOpenChange:r,children:t.jsxs(Zr,{className:wr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",d),children:[t.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),t.jsx("div",{className:"flex items-center ml-4 z-20",children:t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Xs,{children:"Fechar"})]})})]}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?t.jsx(Ds,{className:"h-14 w-14"}):t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Ds,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=ld,exports.PageBreadcrumb=function({items:e,maxItems:a=3,className:r}){const s=e.length>a?[e[0],...e.slice(-(a-1))]:e,n=e.length>a;return t.jsx(Cc,{className:r,children:t.jsx(kc,{children:s.map((e,a)=>{const r=0===a,s=n&&1===a;return t.jsxs(Sc,{children:[!r&&t.jsx(Dc,{}),s&&t.jsxs(t.Fragment,{children:[t.jsx(Pc,{}),t.jsx(Dc,{})]}),e.isCurrentPage?t.jsx(Tc,{children:e.label}):t.jsx(Ac,{asChild:!0,children:t.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=xl,exports.Pagination=Cd,exports.PaginationContent=kd,exports.PaginationEllipsis=Pd,exports.PaginationItem=Sd,exports.PaginationLink=Ad,exports.PaginationNext=Dd,exports.PaginationPrevious=Td,exports.PaletteType=Jm,exports.PanelError=mp,exports.PanelHeader=up,exports.PanelItemsPerPanel=Vm,exports.PanelLoader=pp,exports.PanelNoData=hp,exports.PanelSortType=$m,exports.PanelState=Wm,exports.PanelUnavailable=xp,exports.ParetoPanel=kp,exports.PerformancePanel=Ap,exports.PiePanel=Cp,exports.PlanType=Gm,exports.Popover=Zs,exports.PopoverContent=tn,exports.PopoverTrigger=en,exports.Progress=Ed,exports.ProtectedRoute=({children:r})=>{const{isAuthenticated:s,isLoading:n}=_o();if(a.useEffect(()=>{if(n)return;if(s)return;if(Bn.isManualLogout())return void(window.location.pathname.endsWith("/login")||(window.location.href=Ue("/login")));const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const r=We(),o=Be(window.location.pathname),i=o+window.location.search+window.location.hash;["/","/login","/callback"].includes(o)||localStorage.setItem("auth_return_url",i);(async()=>{r?await bo.loginDev():bo.loginProd()})()},[s,n]),n&&!s)return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Carregando..."})}),t.jsxs(Mr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!s){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Processando..."})}),t.jsxs(Mr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Tr,{className:"w-full max-w-md",children:[t.jsx(Dr,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Iniciando..."})}),t.jsxs(Mr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:We()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return t.jsx(t.Fragment,{children:r})},exports.QUALIEX_CONFIG=Qe,exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=po,exports.QualiexErrorInterceptor=no,exports.QualiexUserField=Ei,exports.QueriesContextType=Km,exports.QueriesShareType=Ym,exports.QuickFilterDashboard=Qm,exports.RadioGroup=Md,exports.RadioGroupItem=Id,exports.ReadOnlyTextField=Ax,exports.ReportRequestList=function({requests:e,isLoading:r=!1,onGetReportUrl:s,formatDate:n=Cm,labels:o,className:i}){const{t:l}=y.useTranslation(),d={...Nm,...o},[u,m]=a.useState(""),[p,h]=a.useState(!1),[x,f]=a.useState(""),[g,v]=a.useState(""),[b,w]=a.useState(null),j=a.useMemo(()=>{if(!u)return e;const t=_m(u);return e.filter(e=>_m(e.reportName).includes(t))},[e,u]),N=a.useCallback(async e=>{if(!b){w(e.id);try{const t=await s(e.id);t&&(f(t),v(e.reportName),h(!0))}finally{w(null)}}},[s,b]);return r?t.jsx("div",{className:wr("space-y-3",i),children:Array.from({length:5}).map((e,a)=>t.jsx(un,{className:"h-12 w-full"},a))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:wr("space-y-3",i),children:[t.jsxs("div",{className:"relative max-w-sm",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(kr,{className:"pl-8 h-9 text-sm",placeholder:d.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),t.jsx(Ci,{className:"rounded-md border",children:t.jsxs(Ao,{children:[t.jsx(To,{children:t.jsxs(Eo,{children:[t.jsx(Mo,{className:"min-w-[140px]",children:d.report}),t.jsx(Mo,{className:"min-w-[150px]",children:d.status}),t.jsx(Mo,{className:"min-w-[160px]",children:d.requestDate}),t.jsx(Mo,{className:"min-w-[160px]",children:d.lastUpdate}),t.jsx(Mo,{className:"min-w-[160px]",children:d.expirationDate}),t.jsx(Mo,{className:"min-w-[140px]"})]})}),t.jsx(Do,{children:0===j.length?t.jsx(Eo,{children:t.jsx(Io,{colSpan:6,className:"text-center text-muted-foreground py-8",children:d.noResults})}):j.map(e=>{const a=function(e){const{t:t}=y.useTranslation();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),r=function(e,a){const{t:r}=y.useTranslation();switch(e){case 1:return{label:a.statusWaiting,icon:t.jsx(c.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:a.statusProcessing,icon:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:a.statusCompleted,icon:t.jsx(c.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:a.statusError,icon:t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:a.statusExpired,icon:t.jsx(c.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(a,d),s=3===a,o=5===a;return t.jsxs(Eo,{children:[t.jsx(Io,{className:"font-medium",children:e.reportName}),t.jsx(Io,{children:t.jsxs(As,{variant:r.variant,className:wr("gap-1",r.className),children:[r.icon,r.label]})}),t.jsx(Io,{className:"text-sm",children:n(new Date(e.requestDate))}),t.jsx(Io,{className:"text-sm",children:n(new Date(e.lastUpdate))}),t.jsx(Io,{className:wr("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),t.jsx(Io,{children:t.jsxs(_r,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!s||b===e.id,onClick:()=>N(e),children:[b===e.id?t.jsx(c.Loader2,{className:"h-4 w-4 animate-spin"}):t.jsx(c.Eye,{className:"h-4 w-4"}),d.viewReport]})})]},e.id)})})]})})]}),t.jsx(gm,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ReportRequestStatus=jm,exports.ResizableHandle=({withHandle:e,className:a,...r})=>t.jsx(Ce.PanelResizeHandle,{className:wr("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(c.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=Rd,exports.ResizablePanelGroup=({className:e,...a})=>t.jsx(Ce.PanelGroup,{className:wr("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),exports.RichTextEditor=({value:r,onChange:s,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:d=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=a.useState("visual"),x=V.useEditor({extensions:[$.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:r||"",editable:!n,onUpdate:({editor:e})=>{s(e.getHTML())}});te.useEffect(()=>{x&&r!==x.getHTML()&&x.commands.setContent(r||"")},[r,x]);const f=a.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""!==t?x.chain().focus().extendMarkRange("link").setLink({href:t}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?t.jsxs("div",{className:wr("space-y-2",u),children:[l&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1",children:[t.jsxs(_r,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[t.jsx(c.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t.jsxs(_r,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[t.jsx(c.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t.jsxs(_r,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[t.jsx(c.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),d&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",t.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&t.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[t.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[t.jsx(Ku,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:t.jsx(c.Heading1,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:t.jsx(c.Heading2,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:t.jsx(c.Heading3,{className:"h-4 w-4"})}),t.jsx(Yu,{}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:t.jsx(c.Bold,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:t.jsx(c.Italic,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:t.jsx(c.Underline,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:t.jsx(c.Strikethrough,{className:"h-4 w-4"})}),t.jsx(Yu,{}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:t.jsx(c.List,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:t.jsx(c.ListOrdered,{className:"h-4 w-4"})}),t.jsx(Yu,{}),t.jsx(Ku,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:t.jsx(c.Highlighter,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:t.jsx(c.Link,{className:"h-4 w-4"})}),t.jsx(Yu,{}),t.jsx(Ku,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:t.jsx(c.RemoveFormatting,{className:"h-4 w-4"})}),t.jsx(Yu,{}),t.jsx(Ku,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:t.jsx(c.Undo,{className:"h-4 w-4"})}),t.jsx(Ku,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:t.jsx(c.Redo,{className:"h-4 w-4"})})]}),t.jsx(V.EditorContent,{editor:x,className:wr("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&t.jsx("textarea",{value:r||"",onChange:e=>s(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&t.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:t.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:t.jsx("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.RiskCriticality=Xm,exports.SEARCH_CONFIG=Ve,exports.SUPPORTED_LOCALES=Xa,exports.ScrollArea=Ci,exports.ScrollBar=ki,exports.Select=xs,exports.SelectApproverDialog=Ux,exports.SelectContent=ws,exports.SelectGroup=fs,exports.SelectItem=Ns,exports.SelectLabel=js,exports.SelectScrollDownButton=ys,exports.SelectScrollUpButton=bs,exports.SelectSearch=hn,exports.SelectSeparator=_s,exports.SelectTrigger=vs,exports.SelectValue=gs,exports.Separator=Rr,exports.Sheet=Ld,exports.SheetBody=$d,exports.SheetClose=zd,exports.SheetContent=qd,exports.SheetDescription=Gd,exports.SheetFooter=Wd,exports.SheetHeader=Vd,exports.SheetOverlay=Od,exports.SheetPortal=Ud,exports.SheetTitle=Hd,exports.SheetTrigger=Fd,exports.Sidebar=Jd,exports.SidebarActionTrigger=Fh,exports.SidebarContent=ou,exports.SidebarFooter=su,exports.SidebarGroup=iu,exports.SidebarGroupAction=cu,exports.SidebarGroupContent=du,exports.SidebarGroupLabel=lu,exports.SidebarHeader=function({open:e,appName:r}){const[s,n]=a.useState(!1),{association:o}=Sl(),i=nt({isQualitfy:o?.isQualitfy,isMetroex:o?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsx(ru,{className:"p-0 gap-0",children:e?t.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:i,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),r&&t.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(r)})})]}):t.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:t.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:ot.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),t.jsx(uc,{open:s,onOpenChange:n})]})},exports.SidebarInput=au,exports.SidebarInset=tu,exports.SidebarLogo=Ih,exports.SidebarMenu=uu,exports.SidebarMenuAction=xu,exports.SidebarMenuBadge=fu,exports.SidebarMenuButton=hu,exports.SidebarMenuItem=mu,exports.SidebarMenuSkeleton=gu,exports.SidebarMenuSub=vu,exports.SidebarMenuSubButton=yu,exports.SidebarMenuSubItem=bu,exports.SidebarProvider=Xd,exports.SidebarRail=eu,exports.SidebarSeparator=nu,exports.SidebarSkeleton=function(){return t.jsx("div",{className:"w-64 border-r bg-muted/10",children:t.jsxs("div",{className:"p-4",children:[t.jsx(un,{className:"h-8 w-32 mb-6"}),t.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,a)=>t.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[t.jsx(un,{className:"h-4 w-4"}),t.jsx(un,{className:"h-4 w-20"})]},a))})]})})},exports.SidebarTrigger=Zd,exports.SingleFileUpload=function({storedFile:e,customFileName:r,allowedExtensions:s,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:d=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:v,onFileReplace:b,onDownload:w,onView:j,className:N}){const{t:_}=y.useTranslation(),C=a.useRef(null),[k,S]=a.useState(null),[A,T]=a.useState(null),[D,P]=a.useState(!1),E=k||e,M=k?.name||e?.name||"",I=k?.size||e?.size;M&&jx(M);const R=r||M,L=l&&!k&&!!e,F=d&&!k&&!!e,z=!!A||!!f||p&&h&&!E,U=!!E,O=a.useCallback(e=>{if(yx.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(s?.length){const t=jx(e.name);if(!s.includes(t))return{type:"extension",message:n}}return null},[o,i,s,n]),B=a.useCallback(e=>{const t=e.target.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),S(null),void(C.current&&(C.current.value=""));T(null),S(t),g?.(t),C.current&&(C.current.value="")},[O,g]),q=a.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const t=e.dataTransfer.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),void S(null);T(null),S(t),g?.(t)},[x,O,g]),V=a.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),$=a.useCallback(()=>{b?.(),C.current?.click()},[b]),W=a.useCallback(()=>{S(null),T(null),v?.(),C.current&&(C.current.value="")},[v]),H=a.useCallback(async()=>{if(!D&&e&&w){P(!0);try{await w(e)}finally{P(!1)}}},[D,e,w]),G=a.useCallback(()=>{e&&j&&j(e)},[e,j]),K=a.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!A)return p&&h&&!E?_("required_field"):null;switch(A.type){case"extension":return A.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${wx(o)}`;case"max-size":return`Tamanho máximo: ${wx(i)}`;default:return _("file_error")}})();return t.jsxs("div",{className:wr("space-y-1",N),children:[t.jsx("div",{className:wr("rounded-md border border-dashed transition-colors",U&&"border-solid border-border",!U&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:U?t.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(c.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("p",{className:"text-xs truncate",children:R})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=I&&t.jsx("span",{className:"text-xs text-muted-foreground",children:wx(I)}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[L&&w&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:D,onClick:H,children:t.jsx(c.Download,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Xs,{children:"Download"})]}),F&&j&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:t.jsx(c.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Xs,{children:"Visualizar"})]}),u&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:$,children:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Xs,{children:"Substituir"})]}),m&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground"})})}),t.jsx(Xs,{children:_("remove")})]})]})]})]}):t.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:q,onDragOver:V,children:[t.jsx(c.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),t.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",t.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&t.jsx("p",{className:"text-xs text-destructive",children:Y}),t.jsx("input",{ref:C,type:"file",className:"hidden",accept:s?.map(e=>`.${e}`).join(","),onChange:B,disabled:x})]})},exports.Skeleton=un,exports.Slider=wu,exports.Small=ud,exports.SonnerToaster=Es,exports.Spinner=Ds,exports.SplitButton=em,exports.Stack=Ui,exports.StatusBadge=function({label:e,color:a,icon:r,showIcon:s,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const c=km[n],d=s??!!r;return t.jsxs("span",{className:wr("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",c.badge,l),style:(()=>{switch(o){case"outline":return{color:a,borderColor:mr(a,.3),backgroundColor:"transparent"};case"ghost":return{color:a,backgroundColor:"transparent"};default:return{color:a,backgroundColor:i||mr(a,.1)}}})(),children:[d&&r&&t.jsx(r,{size:c.icon,strokeWidth:2}),e]})},exports.StepSelector=nm,exports.Stepper=nm,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:r={},minHeight:s="80vh",...n}){const o=a.useMemo(()=>{const t=`${e}/api/reports/v1/Viewer/InitViewer`,a=new URLSearchParams(r).toString();return a?`${t}?${a}`:t},[e,r]);return t.jsx(gm,{...n,url:o,minHeight:s})},exports.Switch=Di,exports.TIMEZONES=Za,exports.TabPageContent=function({children:e,className:a}){return t.jsx("div",{className:wr("space-y-6",a),children:e})},exports.TabPageHeader=function({title:e,description:a,actions:r,className:s}){return t.jsxs("div",{className:wr("space-y-4",s),children:[t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),a&&t.jsx("p",{className:"text-muted-foreground text-sm",children:a})]}),r&&t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),t.jsx(Rr,{})]})},exports.TabPageLayout=function({children:e,className:a}){return t.jsx("div",{className:wr("flex flex-col h-full",a),children:t.jsx(Ci,{className:"flex-1",children:t.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Ao,exports.TableBody=Do,exports.TableCaption=Ro,exports.TableCell=Io,exports.TableFooter=Po,exports.TableHead=Mo,exports.TableHeader=To,exports.TableResizeHandle=Bo,exports.TableRow=Eo,exports.TableRowActions=si,exports.TableSkeleton=Lo,exports.Tabs=Bl,exports.TabsContent=$l,exports.TabsList=ql,exports.TabsTrigger=Vl,exports.TeamSelector=function({users:e,value:r,onChange:s,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:d="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=a.useState(""),[v,b]=a.useState(!1),[w,j]=a.useState(null),N=a.useMemo(()=>new Set(r),[r]),_=a.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=a.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=a.useCallback(e=>{e&&!N.has(e)&&(s([...r,e]),g(""))},[r,s,N]),S=a.useCallback(e=>{i?(j(e),b(!0)):s(r.filter(t=>t!==e))},[r,s,i]),A=a.useCallback(()=>{w&&s(r.filter(e=>e!==w)),b(!1),j(null)},[w,r,s]);return t.jsxs("div",{className:wr("space-y-3",m),children:[t.jsx("div",{className:"flex items-start gap-3",children:t.jsx("div",{className:"flex-1",children:t.jsx(hn,{options:C,value:f,onValueChange:e=>{const t="string"==typeof e?e:e?.[0]??"";g(t),t&&k(t)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),t.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?t.jsx("div",{className:"space-y-2",children:_.map(e=>t.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t.jsxs(Qi,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Xi,{src:e.avatar,alt:e.name}),t.jsx(Ji,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.Shield,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.MapPin,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),t.jsx("button",{type:"button",className:wr("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:t.jsx(c.X,{className:"h-4 w-4"})})]})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[t.jsx(c.User,{className:"h-12 w-12 mb-2 opacity-30"}),t.jsx("p",{className:"text-sm",children:x})]}),t.jsx(Gr,{open:v,onOpenChange:b,children:t.jsxs(Zr,{className:"sm:max-w-[400px]",children:[t.jsx(es,{children:t.jsx(rs,{children:h})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:d}),t.jsxs(as,{children:[t.jsx(_r,{variant:"ghost",onClick:()=>b(!1),children:"Cancelar"}),t.jsx(_r,{variant:"destructive",onClick:A,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:r,open:s,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:d=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=a.useState(!1),h=a.useCallback(()=>{o(r.id)},[o,r.id]);return t.jsxs(t.Fragment,{children:[t.jsx(Gr,{open:s&&!m,onOpenChange:e=>!e&&n(),children:t.jsxs(Zr,{className:"sm:max-w-md",children:[t.jsx(es,{children:t.jsxs(rs,{className:"flex items-center gap-2",children:[t.jsx(c.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),t.jsxs("div",{className:"space-y-4",children:[r.description&&t.jsx(Ci,{className:"max-h-48",children:t.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r.description}})}),r.file&&t.jsxs(_r,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[t.jsx(c.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),t.jsxs(as,{className:"gap-2 sm:gap-0",children:[t.jsx(_r,{variant:"ghost",onClick:n,children:l}),t.jsx(_r,{onClick:h,children:d})]})]})}),m&&t.jsx(vm,{term:r,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=vm,exports.TextPanel=vp,exports.Textarea=ks,exports.Timepicker=sm,exports.Toaster=Es,exports.Toggle=ci,exports.ToggleGroup=ui,exports.ToggleGroupItem=mi,exports.TokenManager=Bn,exports.TokenService=En,exports.Tooltip=Ys,exports.TooltipContent=Xs,exports.TooltipProvider=Ks,exports.TooltipTrigger=Qs,exports.TreeSelect=yn,exports.TreeTable=function({data:r,columns:s,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:v,selectedIds:b,onSelectItem:y,onSelectAll:w,isAllSelected:j,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:A=200}){const[T,D]=a.useState(null),[P,E]=a.useState(null),[M,I]=a.useState(!1),[R,L]=a.useState(1),F=a.useRef(null),z=a.useRef([]),U=a.useRef(null),O=a.useMemo(()=>new Set(b??[]),[b]),B=a.useMemo(()=>{if(!T||!r)return new Set;const e=z.current.length>0?z.current:[T],t=function(e,t){const a=new Set;for(const r of t)jh(e,r).forEach(e=>a.add(e));return a}(r,e);return e.forEach(e=>t.add(e)),t},[T,r]),q=a.useRef(B);q.current=B;const V=a.useCallback(()=>{F.current=null,z.current=[],U.current=null,D(null),E(null),I(!1),L(1)},[]),$=a.useCallback((e,t)=>{e.length>1&&C?C(e,t):1===e.length&&_?.(e[0],t)},[_,C]),W=a.useCallback((e,t)=>{const a=O.has(e)&&O.size>1?Array.from(O):[e];F.current=e,z.current=a,U.current=null,D(e),L(a.length),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e),t.dataTransfer.setData("application/x-tree-ids",JSON.stringify(a))},[O]),H=a.useCallback((e,t)=>{t.preventDefault(),t.dataTransfer.dropEffect="move",q.current.has(e)?E(null):(U.current=e,E(e))},[]),G=a.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const a=q.current.has(e)?U.current:e;if(!a)return void V();let r=z.current;if(0===r.length){try{const e=t.dataTransfer.getData("application/x-tree-ids");if(e){const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(r=t)}}catch{}if(0===r.length){const e=t.dataTransfer.getData("text/plain");e&&(r=[e])}}0===r.length||r.includes(a)||$(r,a),V()},[$,V]),K=a.useCallback(e=>{e.preventDefault(),e.stopPropagation();let t=z.current;if(0===t.length){try{const a=e.dataTransfer.getData("application/x-tree-ids");if(a){const e=JSON.parse(a);Array.isArray(e)&&e.length>0&&(t=e)}}catch{}if(0===t.length){const a=e.dataTransfer.getData("text/plain");a&&(t=[a])}}0!==t.length?($(t,null),V()):V()},[$,V]),Y=a.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",I(!0)},[]),Q=a.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=a.useCallback(e=>{if(!N)return;const t=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),a=t?.dataset?.treeRowId??U.current;a&&G(a,e)},[N,G]);if(x)return t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[t.jsx(c.User,{className:"h-10 w-10 text-muted-foreground/50"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==T;return t.jsxs("div",{className:wr("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(E(null),I(!1))}:void 0,children:[N&&J&&t.jsx(Ch,{onDrop:K,isDragOver:M,onDragOver:Y,onDragLeave:()=>I(!1),label:k}),t.jsxs(Ao,{children:[t.jsx(To,{children:t.jsxs(Eo,{children:[t.jsx(Mo,{className:"text-left",style:{minWidth:A},children:t.jsxs("div",{className:"flex items-center gap-2",children:[v&&t.jsx(Cs,{checked:j??!1,onCheckedChange:()=>w?.()}),o]})}),s.map(e=>t.jsx(Mo,{className:wr("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&t.jsx(Mo,{className:"text-right",style:{width:S},children:p})]})}),t.jsx(Do,{children:r.map(e=>t.jsx(_h,{item:e,level:0,columns:s,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:v,selectedIds:O,onSelectItem:y,enableRowDrag:N,draggedId:T,dragOverId:P,onDragStartCell:W,onDragEndCell:V,onDragOverCell:H,onDropCell:G,dragCount:R},e.id))})]})]})},exports.TruncatedCell=Oo,exports.UpdatesBar=Jh,exports.UpdatesDialog=nx,exports.UpdatesNotification=cm,exports.UserUpdatesViewer=cx,exports.UsersGroupsSelector=function({users:r,groups:s=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:d=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:v}){const[b,y]=a.useState(!1),[w,j]=a.useState(""),[N,_]=a.useState(void 0),C=a.useMemo(()=>new Set(n),[n]),k=a.useMemo(()=>{let e=r;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),w){const t=bm(w);e=e.filter(e=>bm(e.name).includes(t)||bm(e.email??"").includes(t))}return e},[r,N,w]),S=a.useMemo(()=>b?k:r.filter(e=>C.has(e.id)),[b,k,r,C]),A=n.length,T=a.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),D=a.useCallback(e=>{if(i)return;const t=C.has(e)?n.filter(t=>t!==e):[...n,e];o(t)},[n,C,o,i]),P=a.useCallback(e=>{if(i)return;const t=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...t]);o(Array.from(e))}else o(n.filter(e=>!t.has(e)))},[n,k,o,i]),E=a.useCallback(()=>{y(e=>!e),j(""),_(void 0)},[]);return t.jsxs("div",{className:wr("rounded-md border bg-muted/30",v),children:[(!i||A>0)&&t.jsxs("div",{className:wr("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:E,children:[t.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(b?p:m)}),t.jsx("span",{className:"text-xs text-muted-foreground",children:A>0&&`${A} ${1===A?f:g}`})]}),t.jsxs("div",{className:"px-4 pb-3",children:[b&&t.jsxs("div",{className:"flex gap-3 mb-3",children:[!d&&s.length>0&&t.jsxs(xs,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[t.jsx(vs,{className:"w-[200px] h-9 text-sm",children:t.jsx(gs,{placeholder:e.t("approval_user_group")})}),t.jsxs(ws,{children:[t.jsx(Ns,{value:"__all__",children:e.t("team_all_groups")}),s.map(e=>t.jsx(Ns,{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(kr,{className:"pl-8 h-9 text-sm",placeholder:u,value:w,onChange:e=>j(e.target.value)})]})]}),!b&&0===A&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[t.jsx(c.Users,{className:"h-4 w-4 mr-2"}),x]}),b&&k.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(Cs,{checked:T,onCheckedChange:e=>P(!!e)}),t.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&t.jsx(Ci,{style:{maxHeight:l},className:"pr-2",children:t.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return t.jsxs("div",{className:wr("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",b&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:b?()=>D(e.id):void 0,children:[b&&t.jsx(Cs,{checked:C.has(e.id),onCheckedChange:()=>D(e.id),onClick:e=>e.stopPropagation()}),t.jsxs(Qi,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Xi,{src:e.avatar,alt:e.name}),t.jsx(Ji,{className:"text-xs",children:(a=e.name,a.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var a})})}),b&&0===k.length&&t.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:r,onChange:s,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:d,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(r||{inputType:"url",controls:!0}),x=a.useRef(null),f=a.useRef(null),{upload:g,uploading:v}=vx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:b,uploading:w}=vx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),j=a.useMemo(()=>sx(p.videoUrl||rx(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,t)=>{const a={...p,[e]:t};h(a),s(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:m("input_type")}),t.jsxs(xs,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[t.jsx(vs,{children:t.jsx(gs,{})}),t.jsxs(ws,{children:[t.jsx(Ns,{value:"url",children:"URL"}),t.jsx(Ns,{value:"upload",children:m("file_upload")}),t.jsx(Ns,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"Arquivo"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await g(t),a={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||t.name.replace(/\.[^/.]+$/,"")};h(a),s(a)}catch(a){}finally{x.current&&(x.current.value="")}},className:"hidden"}),t.jsx(_r,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:v,children:v?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:m("embed_code")}),t.jsx(ks,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"Thumbnail"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(kr,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),t.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await b(t),a={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(a),s(a)}catch(a){}finally{f.current&&(f.current.value="")}},className:"hidden"}),t.jsx(_r,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:w,children:w?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{htmlFor:"title",children:"Título"}),t.jsx(kr,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),t.jsxs("div",{className:"flex gap-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Cs,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),t.jsx(Ar,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Cs,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),t.jsx(Ar,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ar,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const a=p.videoUrl||rx(p.embedCode)||"";if(!a)return t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===j)return t.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[t.jsx("source",{src:a}),"Seu navegador não suporta este vídeo."]});const r="youtube"===j?ex(a,p.autoplay):ax(a,p.autoplay);return t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:p.title||e.t("video"),src:r,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(_r,{variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(_r,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:a,className:r="",style:s}){const n=a.videoUrl||rx(a.embedCode)||"";if(!n)return null;const o=sx(n);return t.jsx(Tr,{className:`overflow-hidden my-4 ${r}`,style:s,children:t.jsxs(Mr,{className:"p-0",children:["file"===o?t.jsxs("video",{controls:!1!==a.controls,autoPlay:a.autoplay,poster:a.thumbnail,className:"w-full h-auto",playsInline:!0,muted:a.autoplay,children:[t.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:a.title||e.t("video"),src:"youtube"===o?ex(n,a.autoplay):ax(n,a.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),a.title&&t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm font-medium",children:a.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:r,template:s,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:d=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:v=!1,readingConfirmationTimeRemaining:b,onIframeLoad:w,className:j}){const{t:N}=y.useTranslation(),_=a.useRef(null),C=n??pm(s.extension),k=d||v||h,S=s.code?`${s.code} – ${s.name}`:s.name,A=a.useCallback(()=>{_.current&&w&&w(_.current)},[w]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,r]),t.jsx(Gr,{open:e,onOpenChange:r,children:t.jsxs(Zr,{className:wr("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===C||6===C)&&"w-[90vw]",j),children:[t.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),t.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&t.jsxs(t.Fragment,{children:[(x||f)&&t.jsx(t.Fragment,{children:f?t.jsxs("div",{className:"flex flex-col mr-2.5",children:[t.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[t.jsx(c.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),t.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=b&&b>0?t.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[t.jsx("span",{children:N("terms_confirmation_available")}),t.jsx("span",{className:"font-medium min-w-[72px]",children:fm(b)}),t.jsx("span",{children:"segundos"})]}):t.jsxs(_r,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[t.jsx(c.ShieldCheck,{className:"h-4 w-4 mr-1"}),v?"Confirmando...":N("terms_confirm_reading")]})}),0!==C&&u&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:t.jsx(c.Star,{className:wr("h-4 w-4",m&&"fill-accent text-accent")})})}),t.jsx(Xs,{children:m?"Desfavoritar":"Favoritar"})]}),0!==C&&i&&t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:t.jsx(c.Download,{className:"h-4 w-4"})})}),t.jsx(Xs,{children:"Download"})]})]}),t.jsxs(Ys,{children:[t.jsx(Qs,{asChild:!0,children:t.jsx(_r,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>r(!1),children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Xs,{children:"Fechar"})]})]})]}),t.jsx("div",{className:wr("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",0===C&&"min-h-[124px]",1===C&&"max-h-[85vh]",(4===C||6===C)&&"min-w-[77vw] min-h-[80vh]"),children:o?t.jsx(Ds,{className:"h-14 w-14"}):t.jsxs(t.Fragment,{children:[(0===C||!s.url)&&t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),t.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),1===C&&t.jsx("img",{loading:"eager",src:s.url,alt:s.name,className:"max-w-full max-h-[85vh] object-contain"}),2===C&&t.jsx("video",{controls:!0,autoPlay:!0,src:s.url,className:"w-full h-full"}),3===C&&t.jsx("audio",{controls:!0,autoPlay:!0,src:s.url}),(4===C||6===C)&&t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Ds,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{ref:_,src:s.url,onLoad:A,className:"border-none w-full h-full z-[1] relative",title:s.name})]})]})}),!o&&0===C&&t.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[t.jsx(_r,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),i&&t.jsx(_r,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.VisualizationType=Hm,exports.addAppTranslations=wl,exports.addChild=Zp,exports.addSibling=eh,exports.aliasSchema=hx,exports.appRedirectUrl=Ue,exports.applyFavicon=ct,exports.assets=ot,exports.badgeVariants=Ss,exports.brandLogos=st,exports.buildModuleUrl=xr,exports.buildPlacesTree=function(e){e.forEach(t=>{t.children=e.filter(e=>e.parentId===t.id)});const t=e.filter(e=>!e.parentId);return function e(t,a){t?.forEach(t=>{a(t),t.children&&e(t.children,a)})}(t,t=>{t.children=e.filter(e=>e.parentId===t.id)}),t},exports.buildQualiexHeaders=tl,exports.buildWopiUrl=function(e){const{t:t}=y.useTranslation(),{viewerUrl:a,wopiUrl:r,fileId:s,token:n,extension:o,language:i="pt-br"}=e,l=xm(o);return l?`${a}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${r}${s}`)}`:null},exports.buttonGroupVariants=Ec,exports.buttonVariants=Nr,exports.calculateAspectRatio=bx,exports.cn=wr,exports.configureBrandAssets=function(e){at={...at,...e,logos:{...at.logos,...e.logos}}},exports.configureEnvironment=function(e){Ee={...Ee,...e,oauth:{...Ee.oauth,...e.oauth}}},exports.createCrudPage=function(e){return({manager:a})=>{const{manager:r,config:s,onSave:n,onEdit:o,onToggleStatus:i}=e,l=a??r,c={entityName:s.entityName,entityNamePlural:s.entityNamePlural,filters:s.filters||[],columns:s.columns,cardFields:s.cardFields||[],enableBulkActions:s.enableBulkActions??!1,bulkActions:s.bulkActions||[],customActions:s.customActions,customRowActions:s.customRowActions,customListView:s.customListView,onEdit:o||s.onEdit,onNew:s.onNew,useCustomRouting:s.useCustomRouting,hideNewButton:s.hideNewButton,showNewButton:s.showNewButton,newButtonLabel:s.newButtonLabel,showSearch:s.showSearch,searchPlaceholder:s.searchPlaceholder,showActionBar:s.showActionBar};return t.jsx(Bi,{manager:l,config:c,formSections:s.formSections,onSave:n,onToggleStatus:i,defaultSort:s.defaultSort})}},exports.createCrudRoutingConfig=function(e,t){const a=kh({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:a.onNew,onEdit:a.onEdit}},exports.createMindMapNode=Kp,exports.createRoutingHandlers=kh,exports.createService=fo,exports.createSimpleSaveHandler=function(e,t,a){return r=>{if(r.id){const t=a(r);e.updateEntity(r.id,t)}else{const a=t(r);e.createEntity(a)}}},exports.createSimpleService=function(e){const t=fo({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(a,r)=>Co({queryKey:e.tableName,service:t,entityName:e.entityName,additionalFilters:a,onSuccess:r})}},exports.createStatusConfig=function(e){return t=>e[t]},exports.createTranslatedMessages=t=>({success:{created:t=>e.t("msg_created_success",`${t} criado com sucesso`).replace("{{entity}}",t),updated:t=>e.t("msg_updated_success",`${t} atualizado com sucesso`).replace("{{entity}}",t),deleted:t=>e.t("msg_deleted_success",`${t} removido com sucesso`).replace("{{entity}}",t)},error:{create:t=>e.t("msg_create_error",`Erro ao criar ${t}`).replace("{{entity}}",t),update:t=>e.t("msg_update_error",`Erro ao atualizar ${t}`).replace("{{entity}}",t),delete:t=>e.t("msg_delete_error",`Erro ao remover ${t}`).replace("{{entity}}",t),load:t=>e.t("msg_load_error",`Erro ao carregar ${t}`).replace("{{entity}}",t)}}),exports.currencyFormatter=ip,exports.debounce=(e,t)=>{let a;return(...r)=>{clearTimeout(a),a=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=lo,exports.deriveNameField=io,exports.deriveUsernameField=co,exports.detectBrowserLocale=nr,exports.detectBrowserPreferences=()=>{const e=nr();return{locale:e,timezone:or(),datetimeFormat:ir(e)}},exports.detectBrowserTimezone=or,exports.detectVideoProvider=sx,exports.emailSchema=px,exports.emailService=mx,exports.errorService=$n,exports.exportMindMap=vh,exports.extractImageFileName=function(e){try{const t=new URL(e),a=t.pathname.split("/");return a[a.length-1]||"image"}catch{const t=e.split("/");return t[t.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const t=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(t)},exports.extractVimeoId=tx,exports.extractYouTubeId=Zh,exports.findDatetimeFormat=e=>Ja.find(t=>t.value===e),exports.findLocale=e=>Xa.find(t=>t.value===e),exports.findNode=Yp,exports.findTimezone=e=>Za.find(t=>t.value===e),exports.formatBytes=wx,exports.formatCurrency=(e,t="BRL",a="pt-BR")=>null==e?"":new Intl.NumberFormat(a,{style:"currency",currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=dr,exports.formatDatetime=cr,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.generateCrudConfig=function(e,t,a={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const a=t[e],s={key:e,header:Vi(e),label:Vi(e),...qi(e,a),sortable:!0,searchable:"string"==typeof a};r.push(s)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...a}},exports.generateId=fr,exports.generateNodeId=Gp,exports.generatePastelBg=mr,exports.getAppBasePath=Oe,exports.getAppEnv=Pe,exports.getBackendMode=function(){return Re},exports.getCommonBaseUrl=Zi,exports.getContrastRatio=function(e,t){const a=pr(e),r=pr(t);return(Math.max(a,r)+.05)/(Math.min(a,r)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case Lm.Bar:case Lm.Column:case Lm.Pie:case Lm.List:case Lm.Line:case Lm.Area:case Lm.Text:case Lm.StackedColumn:return{x:4,y:2};case Lm.Pareto:case Lm.RiskMatrix:case Lm.Burndown:case Lm.PerformanceColumns:return{x:8,y:2};case Lm.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getEnvironmentConfig=Me,exports.getFieldValue=kx,exports.getFileExtension=jx,exports.getFormFieldValues=function(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))},exports.getIdentApiUrlOverride=Ke,exports.getIdentBaseUrl=function(){const e=Ke();if(e)return e;const t=Zi().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://ident-api${t[1]||""}.${t[2]}`}return"https://ident-api.qualiex.com"},exports.getLinkFromRow=sp,exports.getLoginApiUrlOverride=Ye,exports.getLuminance=pr,exports.getMinPanelSize=Pp,exports.getOnlineViewerType=function(e){const{t:t}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getQualiexApiUrl=Ge,exports.getSecurityMode=function(){return vc},exports.getSupabaseClient=Jn,exports.getUserProfile=dl,exports.getViewerType=pm,exports.getWopiViewer=xm,exports.handleExternalLink=hr,exports.importMindMap=function(e){return bh(JSON.parse(e))},exports.inferDatetimeFormat=ir,exports.inputGroupAddonVariants=Jc,exports.inputGroupButtonVariants=ed,exports.isCurrency=function(e){return!!op.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnv=Ie,exports.isDevEnvironment=He,exports.isImageUrl=function(e){const t=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const a=new URL(e);return t.some(e=>a.pathname.toLowerCase().endsWith(e))}catch{const a=e.toLowerCase();return t.some(e=>a.endsWith(e))}},exports.isLovablePreview=$e,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isSupabaseBackend=Fe,exports.isSupabaseConfigured=function(){return null!==Yn()},exports.isValidDatetimeFormat=e=>Ja.some(t=>t.value===e),exports.isValidLocale=rr,exports.isValidTimezone=sr,exports.loadForlogicFonts=fc,exports.logoSrc=it,exports.markUpdateVisualized=Kh,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=ah,exports.navigationMenuTriggerStyle=bd,exports.normalizeVideoUrl=function(e,t,a){switch(t||sx(e)){case"youtube":return ex(e,a);case"vimeo":return ax(e,a);default:return e}},exports.normalizeVimeoUrl=ax,exports.normalizeYouTubeUrl=ex,exports.paginationSchema=gx,exports.parseIframeSrc=rx,exports.processUrl=rp,exports.qualiexApi=oo,exports.qualiexFetch=al,exports.removeNode=th,exports.resizeKeepingAspect=function(e,t,a,r){const s=bx(e,t);return a&&!r?{width:a,height:Math.round(a/s)}:r&&!a?{width:Math.round(r*s),height:r}:{width:e,height:t}},exports.resolveBrandLogo=nt,exports.resolveFieldMappings=uo,exports.resolvePageTitle=Eh,exports.safeStringSchema=(e=1e3)=>J.z.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),exports.sanitizeErrorMessage=yr,exports.setBackendMode=Le,exports.setCollapsedAll=sh,exports.setFormFieldValues=function(e,t){return t?.length?e.map(e=>{const a=t.find(t=>t.formFieldAssociationId===e.id);if(!a)return e;const r={...e};switch(e.type){case 2:r.textValue=a.textValue;break;case 6:r.numberValue=a.numberValue;break;case 3:r.dateValue=a.dateValue;break;case 4:r.timeValue=a.timeValue;break;case 5:case 7:case 8:r.itemsValue=a.itemsValue||[];break;case 9:r.questionsValue=a.questionsValue||[]}return r}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new j.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=Sx,exports.shouldUseDevTokens=We,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=lt,exports.sortByMonthYear=function(e){return e?.sort((e,t)=>{if(!e?.items?.length||!t?.items?.length)return 0;return ap(e.items[0]?.keyDate)-ap(t.items[0]?.keyDate)})},exports.stripTechHeaders=function(e){if(!e||"object"!=typeof e)return e;const t={...e};for(const a of gr)delete t[a];return t},exports.timestampId=()=>Date.now().toString(),exports.toQueryString=function(e){return e?np(e).join("&"):null},exports.toRouterPath=Be,exports.toggleCollapsed=rh,exports.toggleVariants=li,exports.trackFooterClick=rc,exports.trackInterestClick=ac,exports.trackModuleClick=tc,exports.trimTextFields=jr,exports.updateUserProfile=il,exports.uploadUserPhoto=rl,exports.useActiveModules=(e={})=>{const{enabled:t=!0}=e,{alias:a}=_o();return j.useQuery({queryKey:["active-modules",a],queryFn:async()=>{if(!a)return[];const e=Jn(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",a).eq("status","active").order("name");if(r){if(!ro.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!a})},exports.useAliasFromUrl=$i,exports.useAuth=_o,exports.useBaseForm=wi,exports.useClarity=gc,exports.useColumnManager=fi,exports.useColumnResize=ii,exports.useCrud=Co,exports.useDebounce=Mh,exports.useDerivedContractedModules=dc,exports.useFormField=is,exports.useHasOpenModal=function(){const{hasOpenModal:e}=qh();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:t}=Il(),a=tr;return{formatDatetime:r=>cr(r,a,t,e),formatDate:a=>dr(a,e,t),locale:e,timezone:t,datetimeFormat:a}},exports.useIsMobile=So,exports.useLocale=Il,exports.useMediaQuery=ko,exports.useMediaUpload=vx,exports.useModalState=qh,exports.useModuleAccess=Sl,exports.useModuleConfig=_l,exports.useNavigation=Ph,exports.usePageMetadata=function(e){const{setMetadata:t,clearMetadata:r}=fl(),s=a.useRef({});a.useEffect(()=>{const a=JSON.stringify(s.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(s.current.title!==e.title||s.current.subtitle!==e.subtitle||a)&&(s.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},t(e)),()=>r()},[e.title,e.subtitle,e.breadcrumbs,t,r])},exports.usePageMetadataContext=fl,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:t}=Ph();return Eh(t,e.pathname)},exports.usePermissionQuery=Lh,exports.useQualiexReady=Hh,exports.useQualiexUsers=Pi,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),a=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,s)=>{r+=`/${e}`;const n=s===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");a.push({label:o,href:n?void 0:r,isCurrentPage:n})}),a})()},exports.useRowResize=function({rowIds:e,defaultHeight:t=48,minHeight:r=32,maxHeight:s=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,c]=a.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[d,u]=a.useState(!1),[m,p]=a.useState(null),h=a.useRef(0),x=a.useRef(0),f=a.useCallback(e=>l[e]??t,[l,t]),g=a.useCallback((e,a)=>{i&&(a.preventDefault(),a.stopPropagation(),u(!0),p(e),h.current=a.clientY,x.current=l[e]??t)},[i,l,t]);a.useEffect(()=>{if(!d||!m)return;const e=e=>{const t=e.clientY-h.current,a=Math.max(r,Math.min(s,x.current+t));c(e=>{const t={...e,[m]:a};return o?.(t),t})},t=()=>{u(!1),p(null),n&&c(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[d,m,r,s,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d]);const v=a.useCallback(()=>{c({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:d,activeRow:m,handleMouseDown:g,resetHeights:v,getRowHeight:f}},exports.useSidebar=Qd,exports.useSidebarResize=Oh,exports.useUpdatesNotification=lm,exports.useUserUpdatesBar=Qh,exports.useUserUpdatesDialog=Xh,exports.useWizard=function(e){const{steps:t,initialStep:r=0,initialData:s={},onComplete:n,onCancel:o}=e,[i,l]=a.useState(r),[c,d]=a.useState(s),[u,m]=a.useState(!1),[p,h]=a.useState(!1),x=t.length,f=0===i,g=i===x-1,v=t[i],b=x>1?(i+1)/x*100:100,y=a.useCallback(()=>!v?.canProceed||v.canProceed(),[v]),w=a.useMemo(()=>y(),[y,c]),j=a.useMemo(()=>!f&&!v?.disableBack,[f,v]),N=a.useCallback(e=>{d(t=>({...t,...e}))},[]),_=a.useCallback((e,t)=>{d(a=>({...a,[e]:t}))},[]),C=a.useCallback(()=>{l(r),d(s),m(!1),h(!1),o?.()},[r,s,o]),k=a.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(c))}finally{h(!1)}}},[y,p,c,n]),S=a.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),A=a.useCallback(()=>{j&&!u&&l(e=>Math.max(e-1,0))},[j,u]),T=a.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),D=a.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:v,data:c,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:A,goTo:T,canProceed:w,canGoBack:j,setData:N,updateField:_,reset:C,complete:k,setLoading:D,progress:b,stepIndex:i,totalSteps:x}},exports.userIdSchema=fx,exports.uuidSchema=xx,exports.validateFields=function(e){const t=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const a=kx(e);if((null==a||""===a||Array.isArray(a)&&0===a.length)&&t.push(e.id),6===e.type&&null!=a){const r=e.config;null!=r?.min&&a<r.min&&t.push(e.id),null!=r?.max&&a>r.max&&t.push(e.id)}}),{valid:0===t.length,invalidFields:[...new Set(t)]}};
|