1import{j as e}from"./jsx-runtime-u17CrQMm.js";import{u as L}from"./use-ai-usage-BKSoHDzB.js";import{a as c,b as $}from"./ai-credits-DvDtxmNM.js";import{i as M}from"./jwt-CjJO7hEe.js";import{u as C}from"./use-go-to-checkout-CBdH-tTI.js";import{c as i}from"./classname-DRuCqhNm.js";import{U as T}from"./upgrade-card-DuyUun4-.js";function A(t){const{percentUsed:r,className:s,...a}=t,n=7,o=2*Math.PI*n,d=Math.max(0,Math.min(1,r/100));return e.jsxs("svg",{viewBox:"0 0 18 18",className:i("size-3.5 shrink-0 -rotate-90",s),...a,children:[e.jsx("circle",{cx:"9",cy:"9",r:n,fill:"none",strokeWidth:"3.5",className:"stroke-gray-200"}),e.jsx("circle",{cx:"9",cy:"9",r:n,fill:"none",strokeWidth:"3.5",strokeLinecap:"round",strokeDasharray:o,strokeDashoffset:o*(1-d),className:i("transition-all duration-300",r>=90?"stroke-red-500":"stroke-green-500")})]})}function y(t,r){if(t==="message")return`${r} ${r===1?"chat":"chats"} left`;const s=r===1?$[t]:c[t];return`${r} ${s} left`}function E(t){const{variant:r,type:s="message",secondaryType:a,source:n,onUpgrade:o,showLoadingSkeleton:d=!1,className:l}=t,k=C(),{isLoading:U,isLoadingBilling:j,isPaidUser:N,hasData:f,getUsage:m,remaining:u,percentUsed:h}=L(),p=()=>{if(o){o();return}k(n)};if(!M()||j||N)return null;if(r==="sidebar-card"){const{limit:x}=m(s);return e.jsx(T,{onUpgrade:p,description:"Unlimited AI chats, courses, guides, roadmaps and more.*",className:l,children:f&&e.jsxs("span",{className:"mt-4 block",children:[e.jsx("span",{className:"relative block h-1 w-full rounded-full bg-amber-300/40",children:e.jsx("span",{className:"absolute inset-0 h-full rounded-full bg-amber-600/80",style:{width:`${h(s)}%`}})}),e.jsxs("span",{className:"mt-2 block text-xs text-amber-700",children:[u(s)," of ",x," free ",c[s]," ","left"]})]})})}if(U||!f)return d?e.jsx("div",{className:"hidden h-[26px] w-[150px] animate-pulse rounded-md bg-gray-200 lg:block"}):null;if(r==="form-banner"){const{used:x,limit:v}=m(s);return e.jsxs("div",{className:i("text-gray-500",l),children:[x," of ",v," ",c[s],e.jsx("button",{onClick:p,className:"ml-2 rounded-xl bg-yellow-600 px-2 py-1 text-sm text-white hover:opacity-80",children:"Need more? Upgrade"})]})}if(r==="text")return e.jsx("span",{className:i("text-xs text-gray-500",l),children:y(s,u(s))});const g=a?m(a):null,b=Math.max(0,Math.min(100,h(s))),w=b>=90;return e.jsxs("button",{type:"button",onClick:p,title:g&&a?`${g.used} of ${g.limit} free ${c[a]} used`:void 0,className:i("group inline-flex items-center gap-1.5 rounded-md border border-gray-200 bg-white py-0.5 pr-0.5 pl-2 text-xs font-medium transition-colors hover:bg-gray-100",l),children:[e.jsx(A,{percentUsed:b}),e.jsx("span",{className:w?"text-red-700":"text-gray-600",children:y(s,u(s))}),e.jsx("span",{className:"ml-1.5 rounded-sm bg-yellow-300 px-2 py-0.5 font-normal text-black group-hover:bg-yellow-400/80",children:"Upgrade"})]})}export{E as A,A as U};
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.