PageSourceSearch

https://labuladong.online/_next/static/chunks/15378.884ad61d0b202639.js

js labuladong.online collected 2026-09-24 09:59:03 UTC 3,352 bytes, 6 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15378],{15378:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var n=r(95155),s=r(12115);let a=[0,1,2,2,2,3,4],i=[{left:0,right:6,mid:3},{left:0,right:2,mid:1},{left:2,right:2,mid:2},{left:2,right:1,mid:null}];function d(e){let{active:t,locale:r}=e,[d,o]=(0,s.useState)(0);(0,s.useEffect)(()=>{let e;if(!t)return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return void o(3);let r=0;o(0);let n=()=>{var t;e=setTimeout(()=>{o(r=3===r?0:r+1),n()},3===(t=r)?2800:2===t?2200:1800)};return n(),()=>clearTimeout(e)},[t]);let l=i[d],m=3===d;return(0,n.jsx)("div",{className:"border-t border-border/40 pt-3.5",role:"img","aria-label":"zh"===r?"搜索左侧边界的二分搜索动画:使用两端都闭区间 left 到 right,在有序数组中寻找数字 2,命中后继续收缩右边界,最终返回最左侧索引 2。":"Left-bound binary search animation: use a closed interval from left to right to find 2 in a sorted array, keep shrinking the right boundary after a match, and return the leftmost index 2.",children:(0,n.jsxs)("div",{"aria-hidden":"true",className:"w-full bg-transparent px-3 pb-0.5",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1",children:[(0,n.jsx)("span",{className:"font-mono text-[10px] font-medium text-muted-foreground sm:text-[11px]",children:"index"}),(0,n.jsx)("div",{className:"grid grid-cols-7 gap-1 sm:gap-1.5",children:a.map((e,t)=>(0,n.jsx)("span",{className:"text-center font-mono text-[9px] text-muted-foreground/65 sm:text-[10px]",children:t},t))}),(0,n.jsx)("span",{className:"font-mono text-[10px] font-medium text-muted-foreground sm:text-[11px]",children:"nums"}),(0,n.jsx)("div",{className:"grid grid-cols-7 gap-1 sm:gap-1.5",children:a.map((e,t)=>{let r=t===l.mid,s=m&&t===l.left,a=t>=l.left&&t<=l.right;return(0,n.jsx)("span",{className:`
2                    transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-300 ease-out motion-reduce:transition-none
3                    flex h-8 min-w-0 items-center justify-center rounded border sm:h-9
4                    font-mono text-[11px] font-semibold sm:text-xs
5                    ${s||r?"scale-[1.04] border-blue-500/80 bg-blue-500/16 text-blue-700 shadow-[0_0_0_2px_rgba(59,130,246,0.10)] dark:text-blue-200":a?"border-border/60 bg-muted/30 text-foreground/75":"border-border/35 bg-muted/15 text-muted-foreground/30 opacity-60"}
6                  `,children:e},t)})}),(0,n.jsx)("span",{}),(0,n.jsx)("div",{className:"grid h-4 grid-cols-7 items-start gap-1 sm:gap-1.5",children:a.map((e,t)=>{let r=[t===l.left?"L":null,t===l.mid?"M":null,t===l.right?"R":null].filter(Boolean).join("\xb7");return(0,n.jsx)("span",{className:`text-center font-mono text-[9px] leading-4 sm:text-[10px] ${t===l.mid||m&&t===l.left?"text-blue-600 dark:text-blue-300":"text-muted-foreground"}`,children:r},t)})})]}),(0,n.jsx)("div",{className:"mt-1 flex h-8 items-center justify-center whitespace-nowrap text-center font-mono text-[9px] font-medium sm:text-[11px]",children:(0,n.jsx)("span",{className:"text-foreground/75",children:m?(0,n.jsxs)(n.Fragment,{children:["target = ",2]}):(0,n.jsxs)(n.Fragment,{children:["target = ",2,"\xa0\xa0 mid = (",l.left," + ",l.right,") / 2 = ",l.mid]})})})]})})}}}]);

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.