1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72709],{72709:(e,t,r)=>{r.d(t,{c:()=>b});var n=r(54568),l=r(40642),a=r(60604),o=r(3016),s=r(62666),i=r(14548),u=r(7620);function c(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function d(e,t,r){for(let l=t;l>=0&&l<e.length;l+=r){var n;if(!(null==(n=e[l])?void 0:n.disabled))return l}return -1}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:36;return Math.max(1,Math.floor(Math.max(0,e)/t))}let p=h(288);var f=r(95516),m=r(826);let x={placeholder:"Selecione",searchPlaceholder:"Buscarâ¦",empty:"Nenhuma op\xe7\xe3o encontrada",loading:"Carregandoâ¦",error:"N\xe3o foi poss\xedvel carregar as op\xe7\xf5es.",retry:"Tentar de novo",clearSearch:"Limpar busca",counter:"{count} de {total}"},g={danger:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] uppercase tracking-wide text-destructive",muted:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] uppercase tracking-wide text-neutral-500",accent:"rounded-full bg-sporticket-purple-50 px-2 py-0.5 text-[10px] uppercase tracking-wide text-sporticket-purple-800",plain:"text-[11px] font-normal text-muted-foreground"},b=u.forwardRef(function(e,t){var r;let{value:b,onChange:v,options:w,remote:k=null,labels:y,className:j,contentClassName:N,showSearch:C,disabled:M,...H}=e,S=u.useMemo(()=>({...x,...y}),[y]),[T,A]=u.useState(!1),[E,R]=u.useState(""),[D,P]=u.useState(""),[K,F]=u.useState(-1),[O,z]=u.useState(0),[U,_]=u.useState(288),[I,L]=u.useState(0),[q,W]=u.useState([]),[B,G]=u.useState(0),[J,Q]=u.useState(!1),[V,X]=u.useState("idle"),[Y,Z]=u.useState("idle"),$=u.useRef(null),ee=u.useRef(null),et=u.useRef(null),er=u.useId(),en=null!=k;u.useEffect(()=>{if(!en)return;let e=window.setTimeout(()=>P(E),250);return()=>window.clearTimeout(e)},[E,en]);let el=en?D:E,ea=u.useMemo(()=>w.map(e=>({item:e,key:c(e.label)})),[w]),eo=u.useMemo(()=>{if(en)return q;let e=c(el);if(!e)return ea.map(e=>e.item);let t=[];for(let r of ea)r.key.includes(e)&&t.push(r.item);return t},[en,q,ea,el]),es=null==k?void 0:k.fetchPage,ei=null!=(r=null==k?void 0:k.total)?r:0,eu=u.useRef(el),ec=u.useRef(null),ed=u.useRef(w);ed.current=w;let eh=u.useMemo(()=>{var e,t,r,n;return"".concat(w.length,"|").concat(null!=(r=null==(e=w[0])?void 0:e.value)?r:"","|").concat(null!=(n=null==(t=w[w.length-1])?void 0:t.value)?n:"")},[w]);u.useEffect(()=>{var e;if(!T||!en||!es)return;if(null==(e=ec.current)||e.abort(),ec.current=null,Z("idle"),eu.current=D,!D){let e=ed.current;W(e),G(ei),Q(e.length<ei),X("idle");return}let t=new AbortController;return X("loading"),es({search:D,take:200,skip:0,signal:t.signal}).then(e=>{t.signal.aborted||(W(e.items),G(e.total),Q(e.hasMore),X("idle"))}).catch(()=>{t.signal.aborted||(W([]),G(0),Q(!1),X("error"))}),()=>t.abort()},[T,en,es,D,eh,ei,I]);let ep=u.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!en||!es||!J||"loading"===V||"loading"===Y||"error"===Y&&!e)return;let t=new AbortController;ec.current=t;let r=q.length;Z("loading"),es({search:D,take:200,skip:r,signal:t.signal}).then(e=>{t.signal.aborted||eu.current===D&&(W(t=>t.length===r?[...t,...e.items]:t),G(e.total),Q(e.hasMore),Z("idle"))}).catch(()=>{t.signal.aborted||eu.current===D&&Z("error")})},[en,es,J,V,Y,q.length,D]);u.useEffect(()=>()=>{var e;null==(e=ec.current)||e.abort(),ec.current=null},[]);let ef=u.useCallback(()=>{if("error"===Y)return void ep(!0);L(e=>e+1)},[Y,ep]);u.useEffect(()=>{T&&(F(d(eo,0,1)),z(0),$.current&&($.current.scrollTop=0))},[el]);let em=u.useRef(!1);u.useEffect(()=>{if(!T){em.current=!1;return}if(em.current||0===eo.length)return;em.current=!0;let e=function(e,t){if(t){let r=e.findIndex(e=>e.value===t);if(r>=0)return r}return d(e,0,1)}(eo,b);if(F(e),e>0){var t;let r=Math.max(0,36*e-((null==(t=$.current)?void 0:t.clientHeight)||288)/2);z(r),requestAnimationFrame(()=>{$.current&&($.current.scrollTop=r)})}},[T,eo,b]),u.useEffect(()=>{T&&F(e=>e>=0&&e<eo.length?e:d(eo,0,1))},[T,eo]);let ex=u.useRef(""),eg=u.useRef(null),eb=u.useCallback(e=>{A(e),ex.current="",e&&(R(""),P(""),z(0),X("idle"),Z("idle"))},[]),ev=u.useMemo(()=>(function(e){var t,r;let n=null!=(t=e.rowHeight)?t:36,l=null!=(r=e.overscan)?r:4,a=Math.max(0,e.count);if(0===a)return{start:0,end:0,totalHeight:0};
1let o=Math.max(0,e.scrollTop),s=Math.max(n,e.viewportHeight),i=Math.floor(o/n);return{start:Math.max(0,i-l),end:Math.min(a,i+(Math.ceil(s/n)+1)+l),totalHeight:a*n}})({scrollTop:O,viewportHeight:U,count:eo.length}),[O,U,eo.length]);u.useLayoutEffect(()=>{if(!T)return;let e=$.current;if(!e)return;let t=()=>_(e.clientHeight);if(t(),"undefined"==typeof ResizeObserver)return;let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[T,eo.length]);let ew=u.useCallback(e=>{let t=e.currentTarget,r=t.scrollTop,n=t.clientHeight;null==et.current&&(et.current=requestAnimationFrame(()=>{et.current=null,z(r),_(n),en&&function(e){var t;let r=null!=(t=e.thresholdPx)?t:144;return e.scrollTop+e.viewportHeight+r>=e.totalHeight}({scrollTop:r,viewportHeight:n,totalHeight:36*eo.length})&&ep()}))},[en,eo.length,ep]);u.useEffect(()=>()=>{null!=et.current&&(cancelAnimationFrame(et.current),et.current=null),null!=eg.current&&(window.clearTimeout(eg.current),eg.current=null)},[]);let ek=u.useCallback(e=>{let t=$.current;if(!t||e<0)return;let r=function(e){var t;let r=null!=(t=e.rowHeight)?t:36,n=e.index*r,l=n+r;return n<e.scrollTop?n:l>e.scrollTop+e.viewportHeight?l-e.viewportHeight:null}({index:e,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});null!=r&&(t.scrollTop=r,z(r))},[]),ey=u.useCallback(e=>{let t=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:p;if(0===e.length)return -1;let l=(r,n)=>{let l=d(e,r,n);return -1===l?t:l};switch(r){case"ArrowDown":return l(Math.max(0,t+1),1);case"ArrowUp":if(t<0)return l(0,1);return 0===t?t:l(t-1,-1);case"Home":return l(0,1);case"End":return l(e.length-1,-1);case"PageDown":return l(Math.min(e.length-1,t+n),1);case"PageUp":return l(Math.max(0,t-n),-1);default:return t}}(eo,K,e,h(U));F(t),ek(t)},[eo,K,U,ek]),ej=u.useCallback(e=>{null!=eg.current&&window.clearTimeout(eg.current),eg.current=window.setTimeout(()=>{ex.current="",eg.current=null},500);let t=ex.current+e;ex.current=t;let r=t.length>1?K-1:K,n=function(e,t,r){let n=c(t);if(!n||0===e.length)return -1;let l=e.length,a=(r%l+l)%l;for(let t=1;t<=l;t++){let r=(a+t)%l,o=e[r];if(o&&!o.disabled&&c(o.label).startsWith(n))return r}return -1}(eo,t,r);n<0||(F(n),ek(n))},[eo,K,ek]),eN=u.useCallback(e=>{e.disabled||(v(e.value),A(!1))},[v]),eC=null!=C?C:en||w.length>8,eM=u.useCallback(e=>{switch(e.key){case"ArrowDown":case"ArrowUp":case"Home":case"End":case"PageDown":case"PageUp":e.preventDefault(),ey(e.key);break;case"Enter":{e.preventDefault();let t=eo[K];t&&eN(t);break}case"Tab":A(!1);break;default:if(eC||1!==e.key.length||e.metaKey||e.ctrlKey||e.altKey)break;e.preventDefault(),ej(e.key)}},[ey,eo,K,eN,eC,ej]),eH="".concat(er,"-listbox"),eS=en?B:eo.length,eT="loading"===V,eA="error"===V,eE=!eT&&!eA&&0===eo.length,eR=!eT&&!eA&&eo.length>0,eD=eR?eo.slice(ev.start,ev.end):[],eP=eR&&K>=ev.start&&K<ev.end?"".concat(er,"-opt-").concat(K):void 0,eK=S.counter.replace("{count}",String(eo.length)).replace("{total}",String(eS)),eF=T?eT?S.loading:eA?S.error:eE?S.empty:eK:"";return(0,n.jsxs)(f.AM,{open:T,onOpenChange:eb,modal:!0,children:[(0,n.jsx)(f.Wv,{asChild:!0,children:(0,n.jsxs)("button",{...H,ref:t,type:"button",disabled:M,"aria-haspopup":"listbox",className:(0,m.cn)("flex h-12 w-full min-w-0 items-center justify-between gap-2 rounded-[4px] border border-input bg-neutral-100 px-3 py-2 text-sm r
1ing-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",j),children:[(0,n.jsx)("span",{className:(0,m.cn)("min-w-0 flex-1 truncate text-left",!b&&"text-muted-foreground"),children:b||S.placeholder}),(0,n.jsx)(l.A,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),(0,n.jsxs)(f.hl,{align:"start",sideOffset:4,collisionPadding:12,className:(0,m.cn)("flex w-[var(--radix-popover-trigger-width)] max-w-[calc(100vw-24px)] flex-col overflow-hidden p-0","max-h-[var(--radix-popover-content-available-height)]","rounded-[4px]","motion-reduce:data-[state=open]:animate-none","motion-reduce:data-[state=closed]:animate-none",N),onOpenAutoFocus:e=>{var t,r;e.preventDefault(),eC?null==(t=ee.current)||t.focus():null==(r=$.current)||r.focus()},children:[eC&&(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b px-3",children:[(0,n.jsx)(a.A,{className:"h-4 w-4 shrink-0 opacity-50"}),(0,n.jsx)("input",{ref:ee,value:E,onChange:e=>R(e.target.value),onKeyDown:eM,placeholder:S.searchPlaceholder,className:"h-11 w-full min-w-0 bg-transparent text-base outline-none placeholder:text-muted-foreground md:h-10 md:text-sm",role:"combobox","aria-expanded":!0,"aria-controls":eH,"aria-autocomplete":"list","aria-activedescendant":eP,autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"done"}),E&&(0,n.jsx)("button",{type:"button",onClick:()=>{var e;R(""),null==(e=ee.current)||e.focus()},"aria-label":S.clearSearch,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-accent",children:(0,n.jsx)(o.A,{className:"h-3.5 w-3.5"})})]}),eT&&(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[(0,n.jsx)(s.A,{className:"h-4 w-4 animate-spin motion-reduce:animate-none"}),S.loading]}),eA&&(0,n.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-2 py-6 text-center text-sm",children:[(0,n.jsx)("span",{className:"text-destructive",children:S.error}),(0,n.jsx)("button",{type:"button",onClick:ef,className:"text-xs font-semibold text-sporticket-purple-800 hover:underline",children:S.retry})]}),eE&&(0,n.jsx)("div",{className:"shrink-0 py-6 text-center text-sm text-muted-foreground",children:S.empty}),(0,n.jsx)("div",{ref:$,id:eH,role:"listbox","aria-label":S.placeholder,onScroll:ew,style:{maxHeight:288},className:"min-h-0 flex-auto overflow-y-auto overflow-x-hidden overscroll-contain px-1 outline-none",...eC?{}:{tabIndex:0,"aria-activedescendant":eP,onKeyDown:eM},children:eR&&(0,n.jsx)("div",{role:"presentation",style:{height:ev.totalHeight,position:"relative"},children:eD.map((e,t)=>{let r=ev.start+t,l=e.value===b,a=r===K;return(0,n.jsxs)("div",{id:"".concat(er,"-opt-").concat(r),role:"option","aria-selected":l,"aria-disabled":e.disabled||void 0,"aria-setsize":eS,"aria-posinset":r+1,onClick:()=>eN(e),onMouseEnter:()=>!e.disabled&&F(r),style:{position:"absolute",top:36*r,height:36,left:0,right:0},className:(0,m.cn)("flex select-none items-center gap-2 rounded-sm px-2 text-sm",e.disabled?"cursor-not-allowed opacity-50":"cursor-pointer",a&&!e.disabled&&"bg-accent text-accent-foreground"),children:[(0,n.jsx)("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:l&&(0,n.jsx)(i.A,{className:"h-4 w-4"})}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.badge&&(0,n.jsx)("span",{className:(0,m.cn)("shrink-0 font-medium",g[e.badge.tone]),children:e.badge.text})]},e.value)})})}),"loading"===Y&&(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-center gap-2 border-t py-2 text-xs text-muted-foreground",children:[(0,n.jsx)(s.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}),S.loading]}),"error"===Y&&(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-2 border-t px-3 py-2 text-xs",children:[(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate text-destructive",children:S.error}),(0,n.jsx)("button",{type:"button",onClick:ef,className:"shrink-0 font-semibold text-sporticket-purple-800 hover:underline",children:S.retry})]}),en&&eS>0&&(0,n.jsx)("div",{className:"shrink-0 border-t px-3 py-1.5 text-[11px] text-muted-foreground",children:eK}),(0,n.jsx)("span",{"aria-live":"polite",role:"status",className:"sr-only",children:eF})]})]})})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.