@qumra/fanar 0.0.23 → 0.0.24

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.d.ts CHANGED
@@ -1153,6 +1153,21 @@ interface PickerItem {
1153
1153
  disabled?: boolean;
1154
1154
  /** لماذا معطَّل — يظهر عند المرور */
1155
1155
  disabledReason?: string;
1156
+ /**
1157
+ * صفوف تحته — يُفرد في مكانه بدل أن يُختار.
1158
+ *
1159
+ * ── ⚠️ الأب **ليس خيارًا** ──────────────────────────────────────────
1160
+ * المنتج بمتغيّراته: الذي يُضاف إلى الطلب متغيّرٌ بعينه لا المنتج.
1161
+ * فالصفّ الذي له أولاد يفرد ويطوي، ولا يحمل خانة اختيار ولا يدخل في
1162
+ * «اختر الكل» ولا في العدّ — **أوراقه وحدها** هي الاختيارات.
1163
+ *
1164
+ * والذي بلا أولاد يبقى خيارًا كما هو: منتجٌ بلا متغيّرات يُضاف مباشرة.
1165
+ *
1166
+ * ── ولا تُفتح شاشة ثانية ────────────────────────────────────────────
1167
+ * الفرد **في مكانه**: التاجر يضيف ثلاثة مقاسات من القميص نفسه في لحظة
1168
+ * واحدة، والرجوع لكلٍّ منها كان ثلاث دورات فتح وإغلاق.
1169
+ */
1170
+ children?: PickerItem[];
1156
1171
  }
1157
1172
  interface PickerProps {
1158
1173
  open: boolean;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{ToastHost,Tooltip,useToasts}from"./chunk-GCIOTDW6.js";import{BarChart,ChoiceCards,DataTable,FunnelChart,Heatmap,Money,MoneyProvider,ShareList,Sparkline,TrendChart,currencyName,currencySymbol,isCurrency,useCurrency,useCurrencySymbol}from"./chunk-ZG3I7YUW.js";import{Button,Calendar,Checkbox,DateField,DateRangePicker,Input,Radio,RadioGroup,SearchInput,Select,Switch,Textarea,daysBetween,formatDate,formatRange,presets}from"./chunk-XAQJL7FX.js";import{AudioPlayer,Avatar,Badge,Card,CardHeader,Coach,CoachProvider,Counter,PageHeader,Progress,Scrubber,Skeleton,StatCard,VideoPlayer,coachSeconds,formatTime,useAudioLevel,useCoach,useCoachOptional,useMedia}from"./chunk-TWZR3X5H.js";import{Alert,Drawer,EmptyState,Modal,Sheet,Toast}from"./chunk-ZYLYQZBE.js";import{ANIMATE_SCALE,COLOR_SCALE,CONTAINER_SCALE,DARK_TOKENS,LocaleCtx,RADIUS_SCALE,SHADOW_SCALE,TEXT_SCALE,TOKENS,TONE_SOFT,TONE_SOLID,buttonClasses,cn,toLatinDigits,useMoneyLang,useMoneyLocale,useUIText}from"./chunk-N6V3LTIS.js";import{useEffect,useRef,useState}from"react";import{Minus,Plus,Trash2}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";var ar=new Intl.NumberFormat("ar-EG");var BOX={sm:"h-8",md:"h-11",lg:"h-14"};var BTN={sm:"w-8",md:"w-11",lg:"w-14"};var NUM={sm:"text-ui w-10",md:"text-body w-14",lg:"text-h3 w-20"};var ICON={sm:14,md:16,lg:20};function NumberStepper({value,onChange,min=0,max=Infinity,step=1,size="md",unit,onRemove,disabled,label,className}){const[draft,setDraft]=useState(null);const timer=useRef(void 0);useEffect(()=>()=>clearTimeout(timer.current),[]);const atMin=value<=min;const atMax=value>=max;const showRemove=Boolean(onRemove)&&atMin;const bump=dir=>onChange(Math.min(max,Math.max(min,value+dir*step)));const latest=useRef(value);useEffect(()=>{latest.current=value},[value]);function hold(dir){let delay=400;const tick=()=>{const next=Math.min(max,Math.max(min,latest.current+dir*step));if(next===latest.current)return;onChange(next);delay=Math.max(60,delay*.72);timer.current=setTimeout(tick,delay)};timer.current=setTimeout(tick,delay)}const stop=()=>clearTimeout(timer.current);function commit(raw){setDraft(null);const n=Number(toLatinDigits(raw).replace(/[^\d.-]/g,""));if(Number.isNaN(n))return;onChange(Math.min(max,Math.max(min,n)))}const btn=dir=>{const off=disabled||(dir===1?atMax:atMin&&!showRemove);const Icon=dir===1?Plus:showRemove?Trash2:Minus;return jsx("button",{type:"button",disabled:off,"aria-label":dir===1?"\u0632\u064A\u0627\u062F\u0629":showRemove?"\u062D\u0630\u0641":"\u0646\u0642\u0635\u0627\u0646",onClick:()=>dir===-1&&showRemove?onRemove?.():bump(dir),onPointerDown:()=>!off&&!showRemove&&hold(dir),onPointerUp:stop,onPointerLeave:stop,className:cn("flex items-center justify-center shrink-0 self-stretch cursor-pointer select-none","transition-colors",BTN[size],off?"text-muted2/45 cursor-not-allowed":cn("text-ink2 hover:bg-hover active:bg-soft",showRemove&&dir===-1&&"text-danger hover:bg-red-bg")),children:jsx(Icon,{size:ICON[size],strokeWidth:2.4,"aria-hidden":"true"})})};return jsxs("div",{dir:"ltr",className:cn("inline-flex items-center rounded-field border border-line bg-surface overflow-clip","divide-x divide-line","hover:border-border","focus-within:border-brand focus-within:ring-2 focus-within:ring-brand/25","transition-[border-color,box-shadow]",BOX[size],disabled&&"opacity-60",className),children:[btn(-1),jsxs("span",{className:"flex items-center justify-center gap-1 px-1 self-stretch",children:[jsx("input",{"data-num":true,value:draft??ar.format(value),disabled,inputMode:"numeric","aria-label":label??"\u0627\u0644\u0642\u064A\u0645\u0629",onFocus:()=>setDraft(String(value)),onChange:e=>setDraft(toLatinDigits(e.target.value)),onBlur:e=>commit(e.target.value),onKeyDown:e=>e.key==="Enter"&&e.target.blur(),className:cn("bg-transparent outline-none text-center font-extrabold text-ink","disabled:text-muted2",NUM[size])}),unit&&jsx("span",{className:"text-micro text-muted2 select-none shrink-0",children:unit})]}),btn(1)]})}import{MessageSquare,Phone as PhoneIcon}from"lucide-react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function WhatsAppIcon({size=15,...rest}){return jsx2("svg",{viewBox:"0 0 24 24",width:size,height:size,fill:"currentColor","aria-hidden":"true",...rest,children:jsx2("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}var DIAL={"20":{groups:[3,3,4],name:"\u0645\u0635\u0631"},"966":{groups:[2,3,4],name:"\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629"},"971":{groups:[2,3,4],name:"\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A"},"965":{groups:[4,4],name:"\u0627\u0644\u0643\u0648\u064A\u062A"},"974":{groups:[4,4],name:"\u0642\u0637\u0631"},"973":{groups:[4,4],name:"\u0627\u0644\u0628\u062D\u0631\u064A\u0646"},"968":{groups:[4,4],name:"\u0639\u064F\u0645\u0627\u0646"},"962":{groups:[1,4,4],name:"\u0627\u0644\u0623\u0631\u062F\u0646"},"964":{groups:[3,3,4],name:"\u0627\u0644\u0639\u0631\u0627\u0642"},"961":{groups:[2,3,3],name:"\u0644\u0628\u0646\u0627\u0646"},"963":{groups:[3,3,3],name:"\u0633\u0648\u0631\u064A\u0627"},"970":{groups:[2,3,4],name:"\u0641\u0644\u0633\u0637\u064A\u0646"},"967":{groups:[3,3,3],name:"\u0627\u0644\u064A\u0645\u0646"},"249":{groups:[3,3,3],name:"\u0627\u0644\u0633\u0648\u062F\u0627\u0646"},"212":{groups:[3,3,3],name:"\u0627\u0644\u0645\u063A\u0631\u0628"},"213":{groups:[3,3,3],name:"\u0627\u0644\u062C\u0632\u0627\u0626\u0631"},"216":{groups:[2,3,3],name:"\u062A\u0648\u0646\u0633"},"218":{groups:[2,3,4],name:"\u0644\u064A\u0628\u064A\u0627"},"222":{groups:[2,2,2,2],name:"\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627"},"252":{groups:[2,3,4],name:"\u0627\u0644\u0635\u0648\u0645\u0627\u0644"},"253":{groups:[2,2,2,2],name:"\u062C\u064A\u0628\u0648\u062A\u064A"},"269":{groups:[3,4],name:"\u062C\u0632\u0631 \u0627\u0644\u0642\u0645\u0631"}};var DIALS=Object.keys(DIAL).sort((a,b)=>b.length-a.length);function parsePhone(raw,defaultDial="20"){const digits=raw.replace(/\D/g,"");let rest=digits;const intl=raw.trim().startsWith("+")||digits.startsWith("00");if(digits.startsWith("00"))rest=digits.slice(2);if(intl){for(const d of DIALS){if(rest.startsWith(d)){return{dial:d,local:rest.slice(d.length),country:DIAL[d].name}}}return{dial:"",local:rest}}const local=rest.replace(/^0/,"");return{dial:defaultDial,local,country:DIAL[defaultDial]?.name}}function join(parts,format){if(format==="spaces"||parts.length<2)return parts.join(" ");const[head,...tail]=parts;return`(${head}) ${tail.join("-")}`}function group(local,dial){const rule=DIAL[dial]?.groups;const out=[];let i=0;if(rule){for(const n of rule){if(i>=local.length)break;out.push(local.slice(i,i+n));i+=n}}while(i<local.length){out.push(local.slice(i,i+3));i+=3}return out.filter(Boolean)}var SIZE={inherit:"",sm:"text-caption",md:"text-ui"};function Phone({value,defaultDial="20",format="parens",mask,call,sms,whatsapp,size="md",className}){const{dial,local,country}=parsePhone(value,defaultDial);const e164=`+${dial}${local}`;const shown=mask?`\u2022\u2022\u2022 ${local.slice(-4)}`:dial?join(group(local,dial),format):`+${local}`;const bare=size==="inherit";return jsxs2("span",{className:cn("inline-flex items-center gap-2 min-w-0",className),children:[jsxs2("span",{dir:"ltr",className:cn("inline-flex items-baseline gap-1.5 whitespace-nowrap min-w-0",SIZE[size]),children:[dial&&!mask&&jsxs2("span",{className:cn("opacity-70",!bare&&"text-muted2 font-normal"),title:country,children:["+",dial]}),jsx2("span",{style:{unicodeBidi:"isolate",fontVariantNumeric:"tabular-nums"},className:cn("truncate",!bare&&"font-bold text-ink"),children:shown})]}),(call||sms||whatsapp)&&!mask&&jsxs2("span",{className:"inline-flex items-center gap-0.5 shrink-0",children:[call&&jsx2(Action,{href:`tel:${e164}`,label:`\u0627\u062A\u0635\u0627\u0644 \u0628\u0640${e164}`,children:jsx2(PhoneIcon,{size:14,"aria-hidden":"true"})}),sms&&jsx2(Action,{href:`sms:${e164}`,label:`\u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u0651\u064A\u0629 \u0625\u0644\u0649 ${e164}`,children:jsx2(MessageSquare,{size:14,"aria-hidden":"true"})}),whatsapp&&jsx2(Action,{href:`https://wa.me/${dial}${local}`,label:`\u0648\u0627\u062A\u0633\u0627\u0628 ${e164}`,external:true,className:"hover:text-green",children:jsx2(WhatsAppIcon,{size:15})})]})]})}function Action({href,label,external,className,children}){return jsx2("a",{href,"aria-label":label,title:label,...external?{target:"_blank",rel:"noreferrer"}:{},className:cn("size-7 rounded-sm inline-flex items-center justify-center shrink-0","text-muted hover:text-brand-ink hover:bg-hover transition-colors no-underline",className),children})}import{forwardRef,useId}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";var LEAD={hex:"#",url:"/"};var TechnicalInput=forwardRef(function TechnicalInput2({kind="code",className,wrapperClassName,...rest},ref){return jsx3(Input,{ref,dir:"ltr",spellCheck:false,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",inputMode:kind==="url"?"url":"text",wrapperClassName:cn("[unicode-bidi:isolate]",wrapperClassName),className:cn("font-mono tracking-[.01em] [unicode-bidi:isolate] text-start [[dir=rtl]_&]:text-right",className),...rest})});function TechnicalText({children,className}){return jsx3("span",{dir:"ltr",className:cn("inline-block font-mono [unicode-bidi:isolate]",className),children})}function ColorField({label,note,value,onChange,disabled,id:idProp}){const auto=useId();const id=idProp??auto;return jsxs3("div",{className:"flex flex-col gap-1.5 min-w-0",children:[jsx3("label",{htmlFor:`${id}-hex`,className:"text-ui font-bold text-ink2",children:label}),note&&jsx3("span",{className:"text-caption leading-[1.6] text-muted",children:note}),jsxs3("div",{className:"flex items-center gap-2 min-w-0",children:[jsxs3("span",{className:"relative shrink-0 size-11",children:[jsx3("input",{id,type:"color",value:normalizeHex(value)??"#000000",disabled,onChange:e=>onChange(e.target.value.toUpperCase()),"aria-label":typeof label==="string"?label:void 0,className:"absolute inset-0 size-full opacity-0 cursor-pointer disabled:cursor-not-allowed"}),jsx3("span",{"aria-hidden":"true",className:"pointer-events-none block size-11 rounded-field border border-border",style:{background:normalizeHex(value)??"transparent"}})]}),jsx3(TechnicalInput,{id:`${id}-hex`,kind:"hex",hideLabel:true,size:"md",maxLength:7,disabled,value,onChange:e=>onChange(e.target.value),onBlur:()=>{const fixed=normalizeHex(value);if(fixed&&fixed!==value)onChange(fixed);else if(!fixed&&value&&!value.startsWith(LEAD.hex))onChange(`#${value}`)},wrapperClassName:"flex-1 min-w-0"})]})]})}function normalizeHex(input){const raw=input.trim().replace(/^#/,"");if(/^[0-9a-fA-F]{3}$/.test(raw)){return`#${raw.split("").map(c=>c+c).join("").toUpperCase()}`}if(/^[0-9a-fA-F]{6}$/.test(raw))return`#${raw.toUpperCase()}`;return null}import{useCallback,useEffect as useEffect2,useRef as useRef2,useState as useState2}from"react";import{Box,Loader2}from"lucide-react";import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";function detailOf(e){return e.detail??{}}function Product3DViewer({src,iosSrc,poster,alt,autoRotate=true,onLoad,onError,onARLaunch,className}){const en=useMoneyLang();const host=useRef2(null);const slot=useRef2(null);const viewer=useRef2(null);const[phase,setPhase]=useState2("idle");const[progress,setProgress]=useState2(0);const[canAR,setCanAR]=useState2(false);const cb=useRef2({onLoad,onError,onARLaunch});useEffect2(()=>{cb.current={onLoad,onError,onARLaunch}},[onLoad,onError,onARLaunch]);useEffect2(()=>{const mount=slot.current;const box=host.current;if(!mount||!box)return;let dead=false;let el=null;setPhase("idle");setProgress(0);setCanAR(false);async function build(target){try{await import("@google/model-viewer");await customElements.whenDefined("model-viewer");if(dead)return;el=document.createElement("model-viewer");viewer.current=el;el.setAttribute("src",src);if(iosSrc)el.setAttribute("ios-src",iosSrc);el.setAttribute("alt",alt);el.setAttribute("camera-controls","");el.setAttribute("touch-action","pan-y");el.setAttribute("shadow-intensity","1");el.setAttribute("ar","");el.setAttribute("ar-modes","webxr scene-viewer quick-look");el.setAttribute("loading","eager");el.style.width="100%";el.style.height="100%";el.style.backgroundColor="transparent";const silence=document.createElement("button");silence.slot="ar-button";silence.style.display="none";silence.tabIndex=-1;silence.setAttribute("aria-hidden","true");el.appendChild(silence);const reduce=typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches;if(autoRotate&&!reduce)el.setAttribute("auto-rotate","");el.addEventListener("progress",e=>{const total=detailOf(e).totalProgress??0;if(!dead)setProgress(total)});el.addEventListener("load",()=>{if(dead)return;setPhase("ready");setCanAR(Boolean(el?.canActivateAR));cb.current.onLoad?.()});el.addEventListener("error",e=>{if(dead)return;setPhase("error");cb.current.onError?.(detailOf(e).type??"load-failed")});target.appendChild(el);setPhase("loading")}catch{if(dead)return;setPhase("error");cb.current.onError?.("viewer-unavailable")}}const io=new IntersectionObserver(entries=>{if(entries.some(x=>x.isIntersecting)){io.disconnect();void build(mount)}},{rootMargin:"200px"});io.observe(box);return()=>{dead=true;io.disconnect();el?.remove();viewer.current=null}},[src,iosSrc,alt,autoRotate]);const launchAR=useCallback(()=>{cb.current.onARLaunch?.();void viewer.current?.activateAR().catch(()=>{})},[]);const pct=Math.round(progress*100);const showPoster=phase!=="ready";return jsxs4("div",{ref:host,className:cn("relative aspect-square w-full overflow-clip rounded-card bg-hover border border-line",className),children:[showPoster&&jsx4("img",{src:poster,alt,loading:"lazy",decoding:"async",draggable:false,className:"absolute inset-0 size-full object-contain"}),jsx4("div",{ref:slot,className:cn("absolute inset-0",showPoster&&"opacity-0"),"aria-hidden":showPoster}),phase==="loading"&&jsxs4("div",{className:"absolute inset-x-0 bottom-0 flex flex-col gap-1.5 p-3",children:[jsxs4("span",{className:"flex items-center gap-2 text-micro font-bold text-ink2",children:[jsx4(Loader2,{size:12,className:"animate-spin shrink-0","aria-hidden":"true"}),en?"Loading 3D model":"\u062C\u0627\u0631\u064A \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062C\u0633\u0651\u0645",jsxs4("span",{dir:"ltr","data-num":true,className:"ms-auto text-muted",children:[pct,"%"]})]}),jsx4("span",{role:"progressbar","aria-valuenow":pct,"aria-valuemin":0,"aria-valuemax":100,"aria-label":en?"Model loading progress":"\u062A\u0642\u062F\u0651\u0645 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062C\u0633\u0651\u0645",className:"h-1 w-full rounded-full bg-line overflow-clip",children:jsx4("span",{className:"block h-full rounded-full bg-brand transition-[width] duration-200",style:{width:`${pct}%`}})})]}),phase==="ready"&&canAR&&jsxs4("button",{type:"button",onClick:launchAR,className:cn("absolute bottom-3 end-3 inline-flex items-center gap-2 h-9 px-3.5 rounded-full","bg-surface/92 backdrop-blur border border-line shadow-pop","text-ui font-bold text-ink2 cursor-pointer transition-colors hover:text-brand-ink"),children:[jsx4(Box,{size:15,"aria-hidden":"true"}),en?"See it in your space":"\u0634\u0648\u0641\u0647 \u0641\u064A \u0645\u0643\u0627\u0646\u0643"]})]})}import{X}from"lucide-react";import{jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";function Tabs({items,value,onChange,variant="pill",label,className}){if(variant==="segmented"){return jsx5("div",{role:"tablist","aria-label":label,className:cn("flex flex-wrap gap-0.5 p-0.5 rounded-field bg-bg self-start","max-w-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",className),children:items.map(it=>{const on=it.key===value;return jsxs5("button",{role:"tab",type:"button","aria-selected":on,onClick:()=>onChange(it.key),className:cn("h-9 px-2 sm:px-3.5 rounded-sm inline-flex items-center gap-2 text-ui font-bold cursor-pointer transition-colors","shrink-0 whitespace-nowrap","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",on?"bg-surface text-ink shadow-raise":"text-muted hover:text-ink"),children:[it.icon&&jsx5(it.icon,{size:14}),it.label,typeof it.count==="number"&&jsx5("span",{"data-num":true,className:"opacity-60",children:it.count})]},it.key)})})}return jsx5("div",{role:"tablist","aria-label":label,className:cn("flex items-center gap-2.5 flex-wrap",className),children:items.map(it=>{const on=it.key===value;return jsxs5("button",{role:"tab",type:"button","aria-selected":on,onClick:()=>onChange(it.key),className:cn("h-10 px-3.5 rounded-field border inline-flex items-center gap-1.5 text-ui font-bold cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",on?"border-brand bg-soft text-brand-ink":"border-border bg-surface text-ink2 hover:border-brand"),children:[it.icon&&jsx5(it.icon,{size:14}),it.label,typeof it.count==="number"&&jsx5("span",{"data-num":true,className:"text-micro opacity-70",children:it.count})]},it.key)})})}function FilterChips({chips,onClearAll,label,clearAllLabel}){const ui=useUIText();if(chips.length===0)return null;return jsxs5("div",{className:"flex items-center gap-2 flex-wrap",children:[jsx5("span",{className:"text-caption text-muted",children:label??ui.activeFilters}),chips.map(c=>jsxs5("button",{type:"button",onClick:c.onClear,className:"inline-flex items-center gap-1.5 h-7 ps-3 pe-2 rounded-full bg-soft text-brand-ink text-caption font-bold cursor-pointer transition-colors hover:bg-soft2",children:[c.label,jsx5(X,{size:12,strokeWidth:2.5,"aria-hidden":"true"})]},c.label)),onClearAll&&jsx5("button",{type:"button",onClick:onClearAll,className:"text-caption font-bold text-muted cursor-pointer hover:text-ink transition-colors",children:clearAllLabel??ui.clearAll})]})}import{useEffect as useEffect3,useMemo,useRef as useRef3,useState as useState3}from"react";import{Check,Loader2 as Loader22,Minus as Minus2,SlidersHorizontal}from"lucide-react";import{useInView}from"react-intersection-observer";import{Fragment,jsx as jsx6,jsxs as jsxs6}from"react/jsx-runtime";function Picker({open,onClose,title,description,closeLabel,items,icon,isLoading,isError,errorText,emptyIcon,emptyText,search,onSearch,searchPlaceholder,header,multiple=false,selected,onPick,closeOnPick=true,onConfirm,hintText,cancelLabel,confirmLabel,selectedCountText,itemsCountText,allTabLabel,selectedTabLabel,selectAllLabel,deselectAllLabel,hasMore,isLoadingMore,onLoadMore}){const ui=useUIText();const current=selected??[];const[tab,setTab]=useState3("all");const[saved,setSaved]=useState3(()=>new Set(current));const[pending,setPending]=useState3(()=>new Set);const[removed,setRemoved]=useState3(()=>new Set);const[wasOpen,setWasOpen]=useState3(open);if(wasOpen!==open){setWasOpen(open);if(open){setTab("all");setSaved(new Set(current));setPending(new Set);setRemoved(new Set)}}const total=saved.size-removed.size+pending.size;const tabbed=multiple;const visible=useMemo(()=>{if(!tabbed)return items;if(tab==="selected")return items.filter(i=>saved.has(i.id));return items.filter(i=>!saved.has(i.id))},[items,tabbed,tab,saved]);function isChecked(id){if(!tabbed)return pending.has(id)||saved.has(id)&&!removed.has(id);if(tab==="selected")return!removed.has(id);return pending.has(id)}const[scroller,setScroller]=useState3(null);const{ref:sentinelRef,inView}=useInView({root:scroller,rootMargin:"160px"});const loadMore=useRef3(onLoadMore);useEffect3(()=>{loadMore.current=onLoadMore});useEffect3(()=>{if(inView&&hasMore&&!isLoadingMore)loadMore.current?.()},[inView,hasMore,isLoadingMore]);const anchor=useRef3(-1);function toggle(id){if(!tabbed){const item=items.find(i=>i.id===id);if(item)onPick?.(item);if(closeOnPick)onClose();return}if(tab==="selected"){setRemoved(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next});return}setPending(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})}function clickRow(id,index,shiftKey){if(tabbed&&shiftKey&&tab==="all"&&anchor.current>=0){const from=Math.min(anchor.current,index);const to=Math.max(anchor.current,index);setPending(prev=>{const next=new Set(prev);for(let i=from;i<=to;i++){const row=visible[i];if(row&&!row.disabled)next.add(row.id)}return next})}else{toggle(id)}anchor.current=index}const pickable=visible.filter(i=>!i.disabled);const allPicked=pickable.length>0&&pickable.every(i=>pending.has(i.id));function save(){const out=new Set([...saved,...pending]);for(const id of removed)out.delete(id);onConfirm?.([...out]);onClose()}return jsx6(Modal,{open,onClose,size:"lg",title:tabbed&&total>0?jsxs6("span",{className:"flex items-center gap-2 flex-wrap",children:[title,jsx6("span",{className:"text-caption font-bold px-2 py-0.5 rounded-full bg-soft text-brand-ink",children:selectedCountText?selectedCountText(total):jsxs6(Fragment,{children:[jsx6("span",{"data-num":true,children:total})," ",ui.selectedCount]})})]}):title,description,closeLabel:closeLabel??ui.close,footer:tabbed?jsxs6(Fragment,{children:[jsxs6("span",{className:"text-caption text-muted me-auto",children:[itemsCountText?itemsCountText(items.length):jsxs6(Fragment,{children:[jsx6("span",{"data-num":true,children:items.length})," ",ui.items]}),jsx6("span",{className:"text-muted2",children:" \xB7 Shift+Click"})]}),jsx6(Button,{variant:"ghost",size:"sm",onClick:onClose,children:cancelLabel??ui.cancel}),jsx6(Button,{size:"sm",onClick:save,children:confirmLabel??ui.save})]}):jsxs6(Fragment,{children:[jsx6("span",{className:"text-caption text-muted me-auto",children:hintText??ui.pickToSelect}),jsx6(Button,{variant:"ghost",size:"sm",onClick:onClose,children:cancelLabel??ui.cancel})]}),children:jsxs6("div",{className:"flex flex-col gap-3",children:[header,jsx6(SearchInput,{label:ui.search,hideLabel:true,size:"sm",value:search,onChange:e=>onSearch(e.target.value),placeholder:searchPlaceholder??ui.search}),tabbed&&jsxs6("div",{role:"tablist",className:"flex items-center gap-1.5",children:[jsx6(TabButton,{active:tab==="all",onClick:()=>setTab("all"),children:allTabLabel??ui.all}),jsxs6(TabButton,{active:tab==="selected",onClick:()=>setTab("selected"),children:[jsx6(SlidersHorizontal,{size:12,"aria-hidden":"true"}),selectedTabLabel??ui.selectedTab,saved.size>removed.size&&jsx6("span",{"data-num":true,className:"text-micro leading-none px-1.5 py-0.5 rounded-full bg-soft text-brand-ink",children:saved.size-removed.size})]})]}),jsx6("div",{ref:setScroller,className:"max-h-96 overflow-y-auto overscroll-contain [scrollbar-gutter:stable] -mx-1 px-1",children:isLoading?jsx6("div",{className:"flex flex-col gap-1.5",children:Array.from({length:6},(_,i)=>jsx6(Skeleton,{variant:"block",className:"h-13 rounded-sm"},i))}):isError?jsx6(Alert,{tone:"red",title:errorText??ui.somethingWentWrong}):visible.length===0?jsx6(EmptyState,{icon:emptyIcon,title:emptyText??ui.noResults}):jsxs6(Fragment,{children:[tabbed&&tab==="all"&&pickable.length>0&&jsxs6("button",{type:"button","aria-pressed":allPicked,onClick:()=>{if(allPicked)setPending(new Set);else setPending(prev=>new Set([...prev,...pickable.map(i=>i.id)]))},className:"w-full flex items-center gap-3 p-2 mb-1.5 rounded-sm border border-dashed border-line cursor-pointer text-start transition-colors hover:bg-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",children:[jsx6(Box2,{checked:allPicked,partial:!allPicked&&pending.size>0}),jsxs6("span",{className:"text-caption text-muted",children:[allPicked?deselectAllLabel??ui.deselectAll:selectAllLabel??ui.selectAll," ",jsxs6("span",{"data-num":true,children:["(",pickable.length,")"]})]})]}),jsx6("ul",{role:"listbox","aria-multiselectable":multiple,"aria-label":typeof title==="string"?title:void 0,className:"flex flex-col gap-1.5 list-none m-0 p-0",children:visible.map((item,index)=>jsx6(Row,{item,icon,box:tabbed,selected:isChecked(item.id),onPick:shiftKey=>clickRow(item.id,index,shiftKey)},item.id))}),hasMore&&(!tabbed||tab==="all")&&jsx6("div",{ref:sentinelRef,role:"status","aria-label":isLoadingMore?ui.loadingMore:void 0,className:"h-11 flex items-center justify-center",children:isLoadingMore&&jsx6(Loader22,{size:16,"aria-hidden":"true",className:"animate-spin text-muted"})})]})})]})})}function TabButton({active,onClick,children}){return jsx6("button",{type:"button",role:"tab","aria-selected":active,onClick,className:cn("flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-caption font-bold border cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",active?"border-line bg-surface text-ink":"border-transparent text-muted hover:text-ink hover:bg-hover"),children})}function Box2({checked,partial=false}){return jsx6("span",{"aria-hidden":"true",className:cn("shrink-0 size-5 rounded-xs border flex items-center justify-center transition-colors",checked||partial?"bg-brand border-brand text-white":"border-line bg-surface"),children:checked?jsx6(Check,{size:13,strokeWidth:3}):partial?jsx6(Minus2,{size:13,strokeWidth:3}):null})}function Row({item,icon,box,selected,onPick}){const[errored,setErrored]=useState3(false);const disabled=item.disabled??false;const src=item.image?.trim();const showImage=Boolean(src)&&!errored;return jsx6("li",{role:"none",children:jsxs6("button",{type:"button",role:"option","aria-selected":selected,"aria-disabled":disabled||void 0,title:disabled?item.disabledReason:void 0,onClick:e=>{if(!disabled)onPick(e.shiftKey)},className:cn("w-full flex items-center gap-3 p-2 rounded-sm text-start","border transition-colors",disabled?"opacity-45 cursor-not-allowed border-transparent":"cursor-pointer",!disabled&&(selected?"border-brand bg-soft":"border-transparent hover:border-line hover:bg-hover"),"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand"),children:[box&&jsx6(Box2,{checked:selected}),showImage?jsx6("img",{src,alt:"",loading:"lazy",onError:()=>setErrored(true),className:"size-9 rounded-sm border border-line object-cover shrink-0"}):jsx6("span",{"aria-hidden":"true",className:"size-9 shrink-0 inline-flex items-center justify-center [&>svg]:size-full",children:icon}),jsxs6("span",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsx6("span",{className:"text-caption font-bold text-ink truncate",children:jsx6("bdi",{children:item.title})}),item.sub&&jsx6("span",{className:"text-micro text-muted truncate",children:jsx6("bdi",{children:item.sub})})]}),!box&&selected&&jsx6("span",{"aria-hidden":"true",className:"shrink-0 size-5 rounded-full bg-brand text-white flex items-center justify-center",children:jsx6(Check,{size:12,strokeWidth:3})})]})})}import{useEffect as useEffect4,useId as useId2,useMemo as useMemo2,useRef as useRef4,useState as useState4}from"react";import{Check as Check2,ChevronDown,Plus as Plus2,Search,X as X2}from"lucide-react";import{jsx as jsx7,jsxs as jsxs7}from"react/jsx-runtime";function useDismiss(open,close){const ref=useRef4(null);useEffect4(()=>{if(!open)return;function onDown(e){if(ref.current&&!ref.current.contains(e.target))close()}function onKey(e){if(e.key==="Escape")close()}document.addEventListener("mousedown",onDown);document.addEventListener("keydown",onKey);return()=>{document.removeEventListener("mousedown",onDown);document.removeEventListener("keydown",onKey)}},[open,close]);return ref}var TRIGGER="w-full h-10 px-3.5 rounded-field border bg-surface flex items-center gap-2.5 text-body cursor-pointer transition-colors outline-none focus-visible:border-brand";var PANEL="absolute z-30 top-[calc(100%+6px)] inset-x-0 bg-surface border border-line rounded-card shadow-panel overflow-clip animate-[fade-in_.14s_ease-out]";var ITEM="w-full px-3 py-2.5 flex items-center gap-2.5 text-start text-ui cursor-pointer transition-colors hover:bg-hover disabled:opacity-45 disabled:cursor-not-allowed";function Label({id,children}){if(!children)return null;return jsx7("label",{htmlFor:id,className:"text-ui font-bold text-ink2",children})}function Dropdown({label,value,onChange,options,placeholder,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const ref=useDismiss(open,()=>setOpen(false));const current=options.find(o=>o.value===value);return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsx7(Label,{id,children:label}),jsxs7("div",{ref,className:"relative",children:[jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>setOpen(v=>!v),className:cn(TRIGGER,open?"border-brand":"border-border hover:border-brand"),children:[current?.icon,jsx7("span",{className:cn("flex-1 min-w-0 text-start truncate",!current&&"text-muted2"),children:current?.label??placeholder??ui.select}),current?.meta&&jsx7("span",{className:"text-caption text-muted shrink-0",children:current.meta}),jsx7(ChevronDown,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform",open&&"rotate-180")})]}),open&&jsx7("div",{role:"listbox",className:cn(PANEL,"max-h-72 overflow-y-auto py-1"),children:options.map(o=>jsxs7("button",{type:"button",role:"option","aria-selected":o.value===value,disabled:o.disabled,onClick:()=>{onChange(o.value);setOpen(false)},className:cn(ITEM,o.value===value&&"bg-soft"),children:[o.icon,jsxs7("span",{className:"flex-1 min-w-0 flex flex-col",children:[jsx7("span",{className:"font-bold truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted",children:o.meta})]}),o.value===value&&jsx7(Check2,{size:14,className:"text-brand-ink shrink-0","aria-hidden":"true"})]},o.value))})]})]})}function Combobox({label,value,onChange,options,placeholder,searchPlaceholder,emptyText,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const[query,setQuery]=useState4("");const ref=useDismiss(open,()=>setOpen(false));const current=options.find(o=>o.value===value);const results=useMemo2(()=>{const q=query.trim();if(!q)return options;return options.filter(o=>o.label.includes(q)||o.meta?.includes(q))},[options,query]);return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsx7(Label,{id,children:label}),jsxs7("div",{ref,className:"relative",children:[jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>{setOpen(v=>!v);setQuery("")},className:cn(TRIGGER,open?"border-brand":"border-border hover:border-brand"),children:[jsx7("span",{className:cn("flex-1 min-w-0 text-start truncate",!current&&"text-muted2"),children:current?.label??placeholder??ui.select}),current?.meta&&jsx7("span",{className:"text-caption text-muted shrink-0",children:current.meta}),jsx7(ChevronDown,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform",open&&"rotate-180")})]}),open&&jsxs7("div",{className:PANEL,children:[jsxs7("div",{className:"flex items-center gap-2.5 px-3 h-11 border-b border-line",children:[jsx7(Search,{size:15,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:searchPlaceholder??ui.search,"aria-label":searchPlaceholder??ui.search,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-ui text-ink placeholder:text-muted2"}),query&&jsx7("button",{type:"button",onClick:()=>setQuery(""),"aria-label":ui.clearSearch,className:"shrink-0 text-muted2 hover:text-ink cursor-pointer transition-colors",children:jsx7(X2,{size:14,"aria-hidden":"true"})}),jsx7("kbd",{dir:"ltr",className:"shrink-0 px-1.5 py-0.5 rounded-xs bg-bg border border-line text-micro font-bold text-muted2",children:"Esc"})]}),jsxs7("div",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:[results.map(o=>jsxs7("button",{type:"button",role:"option","aria-selected":o.value===value,onClick:()=>{onChange(o.value);setOpen(false)},className:cn(ITEM,o.value===value&&"bg-soft"),children:[jsxs7("span",{className:"flex-1 min-w-0 flex flex-col",children:[jsx7("span",{className:"font-bold truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted",children:o.meta})]}),o.value===value&&jsx7(Check2,{size:14,className:"text-brand-ink shrink-0","aria-hidden":"true"})]},o.value)),results.length===0&&jsx7("span",{className:"block px-3 py-6 text-center text-ui text-muted2",children:emptyText??ui.noResults})]})]})]})]})}function MultiSelect({label,values,onChange,options,placeholder,createLabel,onCreate,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const[query,setQuery]=useState4("");const ref=useDismiss(open,()=>setOpen(false));const results=useMemo2(()=>{const q=query.trim();if(!q)return options;return options.filter(o=>o.label.includes(q))},[options,query]);const exact=results.some(o=>o.label===query.trim());const canCreate=Boolean(onCreate&&query.trim()&&!exact);function toggle(v){onChange(values.includes(v)?values.filter(x=>x!==v):[...values,v])}return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsxs7("div",{className:"flex items-center justify-between gap-3",children:[jsx7(Label,{id,children:label}),values.length>0&&jsx7("button",{type:"button",onClick:()=>onChange([]),className:"text-caption font-bold text-muted cursor-pointer hover:text-ink transition-colors",children:ui.clearAll})]}),jsxs7("div",{ref,className:"relative",children:[jsxs7("div",{className:cn(TRIGGER,"h-auto min-h-10 py-1.5 flex-wrap cursor-default",open?"border-brand":"border-border hover:border-brand","has-[:focus-visible]:border-brand"),children:[values.map(v=>{const o=options.find(x=>x.value===v);return jsxs7("span",{className:"inline-flex items-center gap-1 h-7 ps-2.5 pe-1.5 rounded-full bg-soft text-brand-ink text-caption font-bold",children:[o?.label??v,jsx7("button",{type:"button","aria-label":`${ui.remove} ${o?.label??v}`,onClick:e=>{e.stopPropagation();toggle(v)},className:"flex text-brand-ink/60 hover:text-brand-ink cursor-pointer",children:jsx7(X2,{size:12,strokeWidth:2.5,"aria-hidden":"true"})})]},v)}),jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>setOpen(v=>!v),className:"flex-1 min-w-12 self-stretch flex items-center gap-2.5 text-start cursor-pointer outline-none",children:[values.length===0&&jsx7("span",{className:"text-muted2 flex-1 text-start",children:placeholder??ui.select}),jsx7(ChevronDown,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 ms-auto transition-transform",open&&"rotate-180")})]})]}),open&&jsxs7("div",{className:PANEL,children:[jsxs7("div",{className:"flex items-center gap-2.5 px-3 h-11 border-b border-line",children:[jsx7(Search,{size:15,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:ui.searchOrAdd,"aria-label":ui.searchOrAdd,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-ui text-ink placeholder:text-muted2"})]}),jsxs7("div",{role:"listbox","aria-multiselectable":true,className:"max-h-56 overflow-y-auto py-1",children:[results.map(o=>{const on=values.includes(o.value);return jsxs7("button",{type:"button",role:"option","aria-selected":on,onClick:()=>toggle(o.value),className:ITEM,children:[jsx7("span",{"aria-hidden":"true",className:cn("size-[18px] rounded-xs border-[1.5px] flex items-center justify-center shrink-0 transition-colors",on?"bg-brand border-brand":"bg-surface border-border"),children:jsx7(Check2,{size:11,strokeWidth:3,className:cn("text-white",!on&&"opacity-0")})}),jsx7("span",{className:"flex-1 min-w-0 truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted2 shrink-0",children:o.meta})]},o.value)}),canCreate&&jsxs7("button",{type:"button",onClick:()=>{onCreate?.(query.trim());setQuery("")},className:cn(ITEM,"text-brand-ink font-bold border-t border-line mt-1 pt-3"),children:[jsx7(Plus2,{size:14,"aria-hidden":"true",className:"shrink-0"}),createLabel?createLabel(query.trim()):`\u0623\u0636\u0641 \xAB${query.trim()}\xBB`]}),results.length===0&&!canCreate&&jsx7("span",{className:"block px-3 py-6 text-center text-ui text-muted2",children:ui.noResults})]})]})]})]})}function CommandPalette({open,onClose,items,placeholder,emptyText}){const ui=useUIText();const[query,setQuery]=useState4("");useEffect4(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);const groups=useMemo2(()=>{const q=query.trim();const hits=q?items.filter(i=>i.title.includes(q)||i.meta?.includes(q)):items;const out=new Map;for(const i of hits)out.set(i.group,[...out.get(i.group)??[],i]);return[...out.entries()]},[items,query]);if(!open)return null;return jsxs7("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] px-4",role:"dialog","aria-modal":"true",children:[jsx7("button",{type:"button","aria-label":ui.close,onClick:onClose,className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] cursor-default"}),jsxs7("div",{className:"relative w-full max-w-[560px] bg-surface border border-line rounded-lg shadow-modal overflow-clip animate-[fade-in_.16s_ease-out]",children:[jsxs7("div",{className:"flex items-center gap-3 px-4 h-14 border-b border-line",children:[jsx7(Search,{size:17,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:placeholder??ui.searchEverything,"aria-label":placeholder??ui.searchEverything,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-body text-ink placeholder:text-muted2"}),jsx7("kbd",{dir:"ltr",className:"shrink-0 px-1.5 py-0.5 rounded-xs bg-bg border border-line text-micro font-bold text-muted2",children:"Esc"})]}),jsxs7("div",{className:"max-h-[52vh] overflow-y-auto py-2",children:[groups.map(([group2,list])=>jsxs7("div",{className:"flex flex-col",children:[jsx7("span",{className:"px-4 pt-2 pb-1 text-micro font-extrabold text-muted2 tracking-wide",children:group2}),list.map(i=>jsxs7("button",{type:"button",onClick:()=>{i.onRun?.();onClose()},className:"px-4 py-2.5 flex items-center gap-3 text-start cursor-pointer transition-colors hover:bg-hover",children:[i.icon&&jsx7("span",{className:"text-muted shrink-0",children:i.icon}),jsx7("span",{className:"flex-1 min-w-0 text-body font-bold text-ink truncate",children:i.title}),i.meta&&jsx7("span",{className:"text-caption text-muted2 shrink-0",children:i.meta})]},i.id))]},group2)),groups.length===0&&jsx7("span",{className:"block px-4 py-10 text-center text-ui text-muted2",children:emptyText??ui.noResults})]})]})]})}import{useState as useState5}from"react";import{Check as Check3,ChevronDown as ChevronDown2}from"lucide-react";import{Fragment as Fragment2,jsx as jsx8,jsxs as jsxs8}from"react/jsx-runtime";function Accordion({items,mode="single",defaultOpen=[],className}){const[open,setOpen]=useState5(defaultOpen);function toggle(key){setOpen(prev=>{if(prev.includes(key))return prev.filter(k=>k!==key);return mode==="single"?[key]:[...prev,key]})}return jsx8("div",{className:cn("bg-surface border border-line rounded-card overflow-clip",className),children:items.map(it=>{const on=open.includes(it.key);return jsxs8("div",{className:"border-b border-line last:border-0",children:[jsxs8("button",{type:"button","aria-expanded":on,onClick:()=>toggle(it.key),className:"w-full px-4 py-3.5 flex items-center gap-3 text-start cursor-pointer transition-colors hover:bg-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",children:[it.icon&&jsx8("span",{"aria-hidden":"true",className:"size-8 rounded-sm bg-soft text-brand-ink flex items-center justify-center shrink-0",children:jsx8(it.icon,{size:15})}),jsxs8("span",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsx8("span",{className:"text-body font-extrabold text-ink",children:it.title}),it.description&&jsx8("span",{className:"text-caption text-muted",children:it.description})]}),jsx8(ChevronDown2,{size:16,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform duration-200",on&&"rotate-180")})]}),jsx8("div",{className:cn("grid transition-[grid-template-rows] duration-200 ease-out",on?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx8("div",{className:"min-h-0 overflow-clip",children:jsx8("div",{className:"px-4 pb-4 pt-0.5 text-ui leading-[1.85] text-ink2",children:it.children})})})]},it.key)})})}function Timeline({steps,current,nowLabel,className}){const ui=useUIText();return jsx8("ol",{className:cn("flex flex-col m-0 p-0 list-none",className),children:steps.map((s,i)=>{const done=i<current;const active=i===current;const last=i===steps.length-1;return jsxs8("li",{className:"flex gap-3",children:[jsxs8("span",{className:"flex flex-col items-center shrink-0",children:[jsx8("span",{"aria-hidden":"true",className:cn("size-7 rounded-full flex items-center justify-center border-2 transition-colors",done&&"bg-brand border-brand text-white",active&&"bg-surface border-brand text-brand-ink",!done&&!active&&"bg-surface border-border text-muted2"),children:done?jsx8(Check3,{size:14,strokeWidth:3}):jsx8("span",{className:cn("size-2 rounded-full",active?"bg-brand":"bg-border")})}),!last&&jsx8("span",{"aria-hidden":"true",className:cn("w-0.5 flex-1 min-h-8 transition-colors",done?"bg-brand":"bg-line")})]}),jsxs8("span",{className:cn("flex flex-col gap-0.5 min-w-0",last?"pb-0":"pb-5"),children:[jsxs8("span",{className:"flex items-center gap-2.5 flex-wrap",children:[jsx8("span",{className:cn("text-body font-extrabold",done||active?"text-ink":"text-muted2"),children:s.title}),s.time&&jsx8("span",{"data-num":true,className:"text-micro text-muted2",children:s.time}),active&&jsx8("span",{className:cn("px-2 py-0.5 rounded-full text-micro font-extrabold",TONE_SOFT[s.tone??"brand"]),children:nowLabel??ui.now})]}),s.note&&jsx8("span",{className:"text-caption leading-[1.7] text-muted",children:s.note})]})]},s.key)})})}function Stepper({steps,done,onPick,className}){return jsx8("ol",{className:cn("flex items-start gap-1 m-0 p-0 list-none",className),children:steps.map((s,i)=>{const on=done.includes(s.key);const isCurrent=!on&&steps.slice(0,i).every(x=>done.includes(x.key));const last=i===steps.length-1;const Tag=onPick?"button":"div";return jsxs8("li",{className:"flex-1 flex flex-col items-center gap-2 min-w-0",children:[jsxs8("span",{className:"w-full flex items-center gap-1",children:[jsx8("span",{"aria-hidden":"true",className:cn("h-0.5 flex-1 rounded-full",i===0?"bg-transparent":on?"bg-brand":"bg-line")}),jsx8(Tag,{...onPick?{type:"button",onClick:()=>onPick(s.key)}:{},"aria-current":isCurrent?"step":void 0,className:cn("size-8 rounded-full flex items-center justify-center shrink-0 border-2 transition-colors",on?"bg-brand border-brand text-white":"bg-surface border-border text-muted",onPick&&"cursor-pointer hover:border-brand"),children:on?jsxs8(Fragment2,{children:[jsx8(Check3,{size:15,strokeWidth:3,"aria-hidden":"true"}),jsx8("span",{className:"sr-only",children:"\u0645\u0643\u062A\u0645\u0644\u0629"})]}):jsx8("span",{"data-num":true,className:"text-caption font-extrabold",children:i+1})}),jsx8("span",{"aria-hidden":"true",className:cn("h-0.5 flex-1 rounded-full",last?"bg-transparent":on?"bg-brand":"bg-line")})]}),jsx8("span",{className:cn("text-caption font-bold text-center leading-tight [text-wrap:balance]",on?"text-ink":"text-muted"),children:s.title})]},s.key)})})}import{Star}from"lucide-react";import{jsx as jsx9,jsxs as jsxs9}from"react/jsx-runtime";var MAX=5;function Stars({value,size=13,className}){const n=Math.max(0,Math.min(MAX,Math.round(value)));return jsxs9("span",{className:cn("flex items-center gap-0.5 shrink-0",className),children:[jsx9("span",{className:"sr-only",children:`${n} / ${MAX}`}),Array.from({length:MAX},(_,i)=>jsx9(Star,{size,"aria-hidden":"true",className:cn("shrink-0",i<n?"fill-amber text-amber":"text-muted2")},i))]})}function RatingInput({value,onChange,disabled,hideValue,className}){const ui=useUIText();return jsxs9("span",{className:cn("flex items-center gap-1",className),children:[Array.from({length:MAX},(_,i)=>{const n=i+1;return jsx9("button",{type:"button",disabled,"aria-pressed":value===n,"aria-label":`${n} / ${MAX} \u2014 ${ui.rating}`,onClick:()=>onChange(n),className:cn("size-9 rounded-sm flex items-center justify-center transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",disabled?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-hover"),children:jsx9(Star,{size:22,"aria-hidden":"true",className:cn("shrink-0",n<=value?"fill-amber text-amber":"text-muted2")})},n)}),!hideValue&&value>0&&jsx9("span",{"data-numeric":true,className:"ms-2 text-caption font-bold text-muted",children:`${value}/${MAX}`})]})}import{useRef as useRef5,useState as useState6}from"react";import{AlertCircle,Check as Check4,Image as ImageIcon,Loader2 as Loader23,UploadCloud,X as X3}from"lucide-react";import{jsx as jsx10,jsxs as jsxs10}from"react/jsx-runtime";function formatBytes(bytes){if(bytes<1024)return`${bytes} \u0628\u0627\u064A\u062A`;if(bytes<1024*1024)return`${Math.round(bytes/1024)} \u0643.\u0628`;return`${(bytes/(1024*1024)).toFixed(1)} \u0645\u064A\u062C\u0627`}function Dropzone({onFiles,accept="image/*",multiple=true,disabled,title,hint,buttonLabel,className}){const ui=useUIText();const input=useRef5(null);const[over,setOver]=useState6(false);function take(list){if(!list||disabled)return;onFiles(Array.from(list))}function onDrop(e){e.preventDefault();setOver(false);take(e.dataTransfer.files)}return jsxs10("div",{onDragOver:e=>{e.preventDefault();if(!disabled)setOver(true)},onDragLeave:()=>setOver(false),onDrop,className:cn("flex flex-col items-center justify-center gap-2.5 px-5 py-9 rounded-card border-2 border-dashed transition-colors text-center",disabled&&"opacity-55 cursor-not-allowed border-border bg-bg",!disabled&&over&&"border-brand bg-soft",!disabled&&!over&&"border-border bg-bg hover:border-brand",className),children:[jsx10("span",{"aria-hidden":"true",className:cn("size-12 rounded-card flex items-center justify-center transition-colors",over?"bg-brand text-white":"bg-surface text-muted border border-line"),children:jsx10(UploadCloud,{size:22,strokeWidth:1.8})}),jsx10("span",{className:"text-body font-extrabold text-ink",children:title??ui.dropImages}),hint&&jsx10("span",{className:"text-caption leading-[1.7] text-muted max-w-note",children:hint}),jsx10("button",{type:"button",disabled,onClick:()=>input.current?.click(),className:"mt-1 h-9 px-4 rounded-sm bg-surface border border-border text-ui font-bold text-ink2 cursor-pointer transition-colors hover:border-brand hover:text-brand-ink disabled:cursor-not-allowed",children:buttonLabel??ui.chooseFromDevice}),jsx10("input",{ref:input,type:"file",accept,multiple,hidden:true,onChange:e=>{take(e.target.files);e.target.value=""}})]})}var STATE_STYLE={uploading:{box:"bg-soft text-brand-ink",icon:jsx10(Loader23,{size:13,className:"animate-spin","aria-hidden":"true"}),label:"\u062C\u0627\u0631\u064A \u0627\u0644\u0631\u0641\u0639"},done:{box:"bg-green-bg2 text-green",icon:jsx10(Check4,{size:13,"aria-hidden":"true"}),label:"\u062A\u0645 \u0627\u0644\u0631\u0641\u0639"},rejected:{box:"bg-red-bg text-red",icon:jsx10(AlertCircle,{size:13,"aria-hidden":"true"}),label:"\u0645\u0631\u0641\u0648\u0636"}};function FileRow({file,onRemove,coverLabel,isCover}){const s=STATE_STYLE[file.state];return jsxs10("div",{className:"flex items-center gap-3 p-2.5 rounded-card border border-line bg-surface",children:[jsxs10("span",{className:"relative size-11 rounded-sm overflow-clip bg-hover border border-line shrink-0",children:[file.preview?jsx10("img",{src:file.preview,alt:"",className:"w-full h-full object-cover"}):jsx10("span",{className:"w-full h-full flex items-center justify-center text-muted2",children:jsx10(ImageIcon,{size:17,"aria-hidden":"true"})}),isCover&&coverLabel&&jsx10("span",{className:"absolute inset-x-0 bottom-0 bg-brand/90 text-white text-micro font-extrabold text-center py-px",children:coverLabel})]}),jsxs10("span",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[jsxs10("span",{className:"flex items-center gap-2 min-w-0",children:[jsx10("span",{dir:"auto",className:"text-ui font-bold text-ink truncate",children:file.name}),jsxs10("span",{className:cn("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-micro font-extrabold shrink-0",s.box),children:[s.icon,s.label]})]}),file.state==="uploading"?jsx10("span",{className:"h-1 rounded-full bg-hover overflow-clip block",children:jsx10("span",{className:"block h-full rounded-full bg-brand transition-[width] duration-200",style:{width:`${file.progress??0}%`}})}):jsx10("span",{className:cn("text-caption",file.state==="rejected"?"text-red":"text-muted"),children:file.state==="rejected"?file.error:formatBytes(file.size)})]}),onRemove&&jsx10("button",{type:"button",onClick:onRemove,"aria-label":`\u0625\u0632\u0627\u0644\u0629 ${file.name}`,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted2 cursor-pointer transition-colors hover:bg-hover hover:text-red",children:jsx10(X3,{size:15,"aria-hidden":"true"})})]})}import{useCallback as useCallback2,useEffect as useEffect5,useLayoutEffect,useRef as useRef6,useState as useState7}from"react";import{jsx as jsx11}from"react/jsx-runtime";function reducedMotion(){return typeof window!=="undefined"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function useSortable({count,onMove,disabled,threshold=4,itemLabel}){const ui=useUIText();const nodes=useRef6([]);const rects=useRef6([]);const[dragging,setDragging]=useState7(null);const[over,setOver]=useState7(null);const[grabbed,setGrabbed]=useState7(null);const[message,setMessage]=useState7("");const run=useRef6({active:false,from:0,to:0,startY:0,dy:0,slot:0,raf:0,pointerId:-1});const overRef=useRef6(null);useEffect5(()=>{overRef.current=over},[over]);const detach=useRef6(null);const finishRef=useRef6(()=>{});const countRef=useRef6(count);useEffect5(()=>{countRef.current=count},[count]);const soft=!reducedMotion();const EASE="cubic-bezier(.2,.8,.2,1)";const measure=useCallback2(()=>{const list=nodes.current.slice(0,count);rects.current=list.map(el=>{const r=el?.getBoundingClientRect();return{top:r?.top??0,height:r?.height??0}});const gap=rects.current.length>1?Math.max(0,rects.current[1].top-(rects.current[0].top+rects.current[0].height)):0;return gap},[count]);const finish=useCallback2(()=>{const s=run.current;if(!s.active)return;s.active=false;cancelAnimationFrame(s.raf);detach.current?.();detach.current=null;const from=s.from;const to=overRef.current??from;const el=nodes.current[from];const settle=()=>{setDragging(null);setOver(null);overRef.current=null;if(el){el.style.transition="";el.style.removeProperty("--drag-y")}if(to!==from){onMove(from,to);setMessage(`${itemLabel?.(from)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0627\u0646\u062A\u0642\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0636\u0639 ${to+1} \u0645\u0646 ${count}.`)}};if(!el||!soft||to===from)return settle();const r=rects.current;const target=to>from?r[to].top+r[to].height-(r[from].top+r[from].height):r[to].top-r[from].top;el.style.transition=`transform 190ms ${EASE}`;el.style.setProperty("--drag-y",`${target}px`);window.setTimeout(settle,200)},[count,itemLabel,onMove,soft]);useEffect5(()=>{finishRef.current=finish},[finish]);const clamp2=useCallback2((dy,from)=>{const r=rects.current;const last=r[r.length-1];if(!r.length||!r[from]||!last)return dy;const min=r[0].top-r[from].top;const max=last.top+last.height-(r[from].top+r[from].height);return Math.min(Math.max(dy,min),max)},[]);const attach=useCallback2(()=>{function onPointerMove(e){const s=run.current;if(!s.active||e.pointerId!==s.pointerId)return;s.dy=e.clientY-s.startY;const r=rects.current;const n=countRef.current;const center=r[s.from].top+r[s.from].height/2+s.dy;let next=s.from;if(s.dy>0){for(let i=s.from+1;i<n;i++){if(center>r[i].top+r[i].height/2)next=i}}else{for(let i=s.from-1;i>=0;i--){if(center<r[i].top+r[i].height/2)next=i}}if(next!==overRef.current){overRef.current=next;setOver(next)}cancelAnimationFrame(s.raf);s.raf=requestAnimationFrame(()=>{nodes.current[s.from]?.style.setProperty("--drag-y",`${clamp2(s.dy,s.from)}px`)})}function onUp(e){if(e.pointerId!==run.current.pointerId)return;finishRef.current()}function onKey(e){if(e.key==="Escape"){overRef.current=run.current.from;finishRef.current()}}window.addEventListener("pointermove",onPointerMove,{passive:true});window.addEventListener("pointerup",onUp);window.addEventListener("pointercancel",onUp);window.addEventListener("keydown",onKey);detach.current=()=>{window.removeEventListener("pointermove",onPointerMove);window.removeEventListener("pointerup",onUp);window.removeEventListener("pointercancel",onUp);window.removeEventListener("keydown",onKey)}},[clamp2]);useEffect5(()=>()=>detach.current?.(),[]);useLayoutEffect(()=>{if(grabbed!==null)nodes.current[grabbed]?.focus()},[grabbed]);const item=useCallback2(index=>{const isDragged=dragging===index;const isGrabbed=grabbed===index;let shift=0;if(dragging!==null&&over!==null&&!isDragged){const slot=run.current.slot;if(over>dragging&&index>dragging&&index<=over)shift=-slot;else if(over<dragging&&index>=over&&index<dragging)shift=slot}const style=isDragged?{transform:"translate3d(0, var(--drag-y, 0px), 0)",position:"relative",zIndex:20,cursor:"grabbing",touchAction:"none",willChange:"transform"}:{transform:shift?`translate3d(0, ${shift}px, 0)`:void 0,transition:dragging!==null&&soft?`transform 160ms ${EASE}`:void 0,touchAction:disabled?void 0:"none"};return{ref:el=>{nodes.current[index]=el},style,tabIndex:disabled?-1:0,"aria-roledescription":ui.grabHint,"data-dragging":isDragged?"":void 0,"data-grabbed":isGrabbed?"":void 0,onPointerDown:e=>{if(disabled||e.button!==0)return;const startY=e.clientY;const el=e.currentTarget;const begin=ev=>{if(Math.abs(ev.clientY-startY)<threshold)return;window.removeEventListener("pointermove",begin);const gap=measure();const s=run.current;s.active=true;s.from=index;s.startY=startY;s.dy=ev.clientY-startY;s.slot=rects.current[index].height+gap;s.pointerId=ev.pointerId;el.setPointerCapture?.(ev.pointerId);el.style.setProperty("--drag-y",`${clamp2(s.dy,index)}px`);overRef.current=index;attach();setOver(index);setDragging(index);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0642\u064A\u062F \u0627\u0644\u062A\u062D\u0631\u064A\u0643.`)};const stop=()=>{window.removeEventListener("pointermove",begin);window.removeEventListener("pointerup",stop)};window.addEventListener("pointermove",begin);window.addEventListener("pointerup",stop)},onKeyDown:e=>{if(disabled)return;if(e.key===" "||e.key==="Enter"){e.preventDefault();if(grabbed===index){setGrabbed(null);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0627\u0633\u062A\u0642\u0631\u0651 \u0641\u064A \u0627\u0644\u0645\u0648\u0636\u0639 ${index+1}.`)}else{setGrabbed(index);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0645\u0645\u0633\u0648\u0643. \u062D\u0631\u0651\u0643\u0647 \u0628\u0627\u0644\u0623\u0633\u0647\u0645.`)}return}if(grabbed!==index)return;const dir=e.key==="ArrowUp"?-1:e.key==="ArrowDown"?1:0;if(dir){e.preventDefault();const to=index+dir;if(to<0||to>=count)return;onMove(index,to);setGrabbed(to);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0641\u064A \u0627\u0644\u0645\u0648\u0636\u0639 ${to+1} \u0645\u0646 ${count}.`)}if(e.key==="Escape"){e.preventDefault();setGrabbed(null);setMessage("\u0623\u064F\u0644\u063A\u064A \u0627\u0644\u062A\u062D\u0631\u064A\u0643.")}}}},[attach,clamp2,count,disabled,dragging,grabbed,itemLabel,measure,onMove,over,soft,threshold,ui.grabHint]);return{item,dragging,grabbed,over,message}}function SortableStatus({message}){return jsx11("span",{role:"status","aria-live":"polite",className:"sr-only",children:message})}import{Children,useCallback as useCallback3,useEffect as useEffect6,useRef as useRef7,useState as useState8}from"react";import{ChevronLeft,ChevronRight,Pause,Play,X as X4,ZoomIn}from"lucide-react";import{jsx as jsx12,jsxs as jsxs11}from"react/jsx-runtime";function axis(track){const rtl=getComputedStyle(track).direction==="rtl";return{rtl,start:r=>rtl?-r.right:r.left,end:r=>rtl?-r.left:r.right}}var EDGE=1;function readTrack(track){const slides=Array.from(track.children);if(slides.length===0)return{index:0,atStart:true,atEnd:true};const{start,end}=axis(track);const box=track.getBoundingClientRect();const from=start(box);let index=0;let best=Infinity;slides.forEach((el,i)=>{const d=start(el.getBoundingClientRect())-from;const score=d<0?-d:d;if(score<best){best=score;index=i}});return{index,atStart:start(slides[0].getBoundingClientRect())>=from-EDGE,atEnd:end(slides[slides.length-1].getBoundingClientRect())<=end(box)+EDGE}}function scrollToIndex(track,i,behavior){const el=track.children[i];if(!el)return;const{rtl}=axis(track);const box=track.getBoundingClientRect();const r=el.getBoundingClientRect();track.scrollBy({left:rtl?r.right-box.right:r.left-box.left,behavior})}function ease(){return typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}var BASIS="calc((100% - (var(--per) - 1) * var(--gap)) / var(--per))";function Carousel({label,children,perView,gap=12,arrows=true,dots=false,counter=false,autoplay,index,onIndexChange,className,trackClassName}){const en=useMoneyLang();const trackRef=useRef7(null);const[state,setState]=useState8({index:0,atStart:true,atEnd:true});const[paused,setPaused]=useState8(false);const[held,setHeld]=useState8(false);const slides=Children.toArray(children);const count=slides.length;const latest=useRef7(state);const notify=useRef7(onIndexChange);useEffect6(()=>{latest.current=state},[state]);useEffect6(()=>{notify.current=onIndexChange},[onIndexChange]);const measure=useCallback3(()=>{const track=trackRef.current;if(!track)return;const next=readTrack(track);setState(prev=>prev.index===next.index&&prev.atStart===next.atStart&&prev.atEnd===next.atEnd?prev:next)},[]);const target=useRef7(0);const go=useCallback3(to=>{const track=trackRef.current;if(!track)return;const i=Math.min(Math.max(to,0),track.children.length-1);target.current=i;scrollToIndex(track,i,ease())},[]);const first=useRef7(true);const told=useRef7(null);useEffect6(()=>{const track=trackRef.current;if(index==null||!track)return;if(index===told.current)return;target.current=index;scrollToIndex(track,index,first.current?"auto":ease())},[index]);useEffect6(()=>{const track=trackRef.current;if(!track)return;let frame=0;let idle;const onScroll=()=>{cancelAnimationFrame(frame);frame=requestAnimationFrame(measure);clearTimeout(idle);idle=setTimeout(()=>{const t=trackRef.current;if(t)target.current=readTrack(t).index},140)};track.addEventListener("scroll",onScroll,{passive:true});const ro=new ResizeObserver(onScroll);ro.observe(track);measure();first.current=false;return()=>{cancelAnimationFrame(frame);clearTimeout(idle);track.removeEventListener("scroll",onScroll);ro.disconnect()}},[measure,count]);useEffect6(()=>{if(told.current===state.index)return;const knew=told.current!==null;told.current=state.index;if(knew||state.index!==(index??0))notify.current?.(state.index)},[state.index,index]);useEffect6(()=>{if(!autoplay||paused||held||count<2)return;if(typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches){return}const id=setInterval(()=>{const track=trackRef.current;if(!track||document.hidden)return;const now=latest.current;scrollToIndex(track,now.atEnd?0:now.index+1,ease())},autoplay);return()=>clearInterval(id)},[autoplay,paused,held,count]);function onKeyDown(e){const track=trackRef.current;if(!track)return;const{rtl}=axis(track);const forward=rtl?"ArrowLeft":"ArrowRight";const back=rtl?"ArrowRight":"ArrowLeft";const to=e.key===forward?target.current+1:e.key===back?target.current-1:e.key==="Home"?0:e.key==="End"?count-1:null;if(to===null)return;e.preventDefault();go(to)}const many=count>1;const showArrows=arrows&&many;const showBar=many&&(dots||counter||Boolean(autoplay));const arrow=back=>jsx12("button",{type:"button",disabled:back?state.atStart:state.atEnd,"aria-label":back?en?"Previous":"\u0627\u0644\u0633\u0627\u0628\u0642":en?"Next":"\u0627\u0644\u062A\u0627\u0644\u064A",onClick:()=>go(back?target.current-1:target.current+1),className:cn("absolute top-1/2 -translate-y-1/2 z-10 size-9 rounded-full flex items-center justify-center","bg-surface/92 backdrop-blur border border-line shadow-pop text-ink2","transition-opacity cursor-pointer hover:text-brand-ink","disabled:opacity-0 disabled:pointer-events-none",back?"start-2":"end-2"),children:back?jsx12(ChevronRight,{size:17,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"}):jsx12(ChevronLeft,{size:17,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"})});return jsxs11("section",{"aria-roledescription":en?"carousel":"\u0639\u0627\u0631\u0636 \u0634\u0631\u0627\u0626\u062D","aria-label":label,onPointerEnter:()=>autoplay&&setHeld(true),onPointerLeave:()=>autoplay&&setHeld(false),onFocusCapture:()=>autoplay&&setHeld(true),onBlurCapture:()=>autoplay&&setHeld(false),className:cn("flex flex-col gap-3 [--per:1]",className),style:{"--gap":`${gap}px`,...perView===void 0?null:{"--per":String(perView)}},children:[jsxs11("div",{className:"relative",children:[jsx12("div",{ref:trackRef,tabIndex:0,role:"group","aria-label":en?"Slides":"\u0627\u0644\u0634\u0631\u0627\u0626\u062D",onKeyDown,className:cn("flex overflow-x-auto overscroll-x-contain snap-x snap-mandatory","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","rounded-card focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",trackClassName),style:{gap:"var(--gap)"},children:slides.map((slide,i)=>jsx12("div",{role:"group","aria-roledescription":en?"slide":"\u0634\u0631\u064A\u062D\u0629","aria-label":en?`${i+1} of ${count}`:`${i+1} \u0645\u0646 ${count}`,className:"snap-start shrink-0 grow-0 min-w-0 relative",style:{flexBasis:BASIS},children:slide},i))}),showArrows&&arrow(true),showArrows&&arrow(false)]}),showBar&&jsxs11("div",{className:"flex items-center justify-center gap-3",children:[autoplay&&jsx12("button",{type:"button",onClick:()=>setPaused(p=>!p),"aria-label":paused?en?"Start auto-rotation":"\u0634\u063A\u0651\u0644 \u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0627\u0644\u062A\u0644\u0642\u0627\u0626\u064A":en?"Stop auto-rotation":"\u0623\u0648\u0642\u0641 \u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0627\u0644\u062A\u0644\u0642\u0627\u0626\u064A",className:"size-7 rounded-full flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:paused?jsx12(Play,{size:13,"aria-hidden":"true"}):jsx12(Pause,{size:13,"aria-hidden":"true"})}),dots&&jsx12("span",{className:"flex items-center gap-1.5",children:slides.map((_,i)=>jsx12("button",{type:"button",onClick:()=>go(i),"aria-label":en?`Go to slide ${i+1}`:`\u0627\u0630\u0647\u0628 \u0644\u0644\u0634\u0631\u064A\u062D\u0629 ${i+1}`,"aria-current":i===state.index||void 0,className:cn("h-1.5 rounded-full transition-all duration-200 cursor-pointer","before:absolute before:-inset-2 relative",i===state.index?"w-5 bg-brand":"w-1.5 bg-border hover:bg-muted2")},i))}),counter&&jsxs11("span",{dir:"ltr","data-num":true,"aria-live":autoplay?void 0:"polite",className:"text-caption font-bold text-muted tabular-nums",children:[state.index+1," / ",count]})]})]})}function Gallery({label,images,ratio="4/3",fit="cover",thumbs=true,zoom=true,className}){const en=useMoneyLang();const[index,setIndex]=useState8(0);const[open,setOpen]=useState8(false);const activeThumb=useRef7(null);useEffect6(()=>{activeThumb.current?.scrollIntoView({inline:"nearest",block:"nearest",behavior:ease()})},[index]);if(images.length===0)return null;const frame={aspectRatio:ratio};const img=(im,decorative)=>jsx12("img",{src:im.src,alt:decorative?"":im.alt,loading:"lazy",decoding:"async",draggable:false,className:cn("w-full h-full",fit==="cover"?"object-cover":"object-contain")});return jsxs11("div",{className:cn("flex flex-col gap-2.5",className),children:[jsx12(Carousel,{label,index,onIndexChange:setIndex,counter:images.length>1,dots:!thumbs&&images.length>1,gap:8,children:images.map((im,i)=>zoom?jsxs11("button",{type:"button",onClick:()=>setOpen(true),"aria-label":`${im.alt} \u2014 ${en?"open viewer":"\u0641\u062A\u062D \u0627\u0644\u0639\u0627\u0631\u0636"}`,style:frame,className:"group relative block w-full overflow-clip rounded-card bg-hover cursor-zoom-in",children:[img(im,true),jsx12("span",{"aria-hidden":"true",className:"absolute top-2 end-2 size-7 rounded-full bg-black/45 backdrop-blur text-white flex items-center justify-center opacity-70 transition-opacity group-hover:opacity-100",children:jsx12(ZoomIn,{size:14})})]},i):jsx12("div",{style:frame,className:"overflow-clip rounded-card bg-hover",children:img(im,false)},i))}),thumbs&&images.length>1&&jsx12("div",{role:"group","aria-label":en?"Thumbnails":"\u0627\u0644\u0645\u0635\u063A\u0651\u0631\u0627\u062A",className:"flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:images.map((im,i)=>jsx12("button",{ref:i===index?activeThumb:void 0,type:"button",onClick:()=>setIndex(i),"aria-current":i===index||void 0,"aria-label":en?`Image ${i+1}`:`\u0627\u0644\u0635\u0648\u0631\u0629 ${i+1}`,className:cn("shrink-0 size-14 rounded-sm overflow-clip border-2 bg-hover cursor-pointer transition-colors",i===index?"border-brand":"border-line hover:border-border"),children:jsx12("img",{src:im.src,alt:"",loading:"lazy",decoding:"async",draggable:false,className:"w-full h-full object-cover"})},i))}),zoom&&jsx12(Lightbox,{open,images,index,onIndexChange:setIndex,onClose:()=>setOpen(false),label})]})}function Lightbox({open,images,index,onIndexChange,onClose,label,closeLabel}){const ui=useUIText();const en=useMoneyLang();const panel=useRef7(null);const count=images.length;useEffect6(()=>{if(!open)return;const from=document.activeElement;panel.current?.focus();return()=>from?.focus?.()},[open]);useEffect6(()=>{if(!open)return;function onKey(e){const rtl=getComputedStyle(document.documentElement).direction==="rtl";const forward=rtl?"ArrowLeft":"ArrowRight";const back=rtl?"ArrowRight":"ArrowLeft";if(e.key==="Escape")onClose();else if(e.key===forward)onIndexChange(Math.min(index+1,count-1));else if(e.key===back)onIndexChange(Math.max(index-1,0));else if(e.key==="Home")onIndexChange(0);else if(e.key==="End")onIndexChange(count-1)}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,index,count,onClose,onIndexChange]);if(!open||count===0)return null;const current=images[Math.min(Math.max(index,0),count-1)];const step=back=>jsx12("button",{type:"button",disabled:back?index===0:index>=count-1,onClick:()=>onIndexChange(back?index-1:index+1),"aria-label":back?en?"Previous":"\u0627\u0644\u0633\u0627\u0628\u0642":en?"Next":"\u0627\u0644\u062A\u0627\u0644\u064A",className:cn("absolute top-1/2 -translate-y-1/2 z-10 size-11 rounded-full flex items-center justify-center","bg-white/10 backdrop-blur text-white transition-opacity cursor-pointer hover:bg-white/20","disabled:opacity-0 disabled:pointer-events-none",back?"start-3":"end-3"),children:back?jsx12(ChevronRight,{size:20,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"}):jsx12(ChevronLeft,{size:20,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"})});return jsxs11("div",{ref:panel,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":label??(en?"Image viewer":"\u0639\u0627\u0631\u0636 \u0627\u0644\u0635\u0648\u0631"),className:"fixed inset-0 z-50 bg-night/95 flex flex-col animate-[fade-in_0.18s_ease-out] outline-none",children:[jsxs11("header",{className:"shrink-0 h-14 px-4 flex items-center justify-between gap-3",children:[jsxs11("span",{dir:"ltr","data-num":true,className:"text-caption font-bold text-white/70 tabular-nums",children:[index+1," / ",count]}),jsx12("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"size-9 rounded-full bg-white/10 backdrop-blur flex items-center justify-center text-white transition-colors cursor-pointer hover:bg-white/20",children:jsx12(X4,{size:18,"aria-hidden":"true"})})]}),jsxs11("div",{className:"relative flex-1 min-h-0 flex items-center justify-center p-4 pb-8",children:[jsx12("img",{src:current.src,alt:current.alt,decoding:"async",draggable:false,className:"max-w-full max-h-full object-contain rounded-card animate-qfade"},current.src),count>1&&step(true),count>1&&step(false)]})]})}import{useEffect as useEffect7,useLayoutEffect as useLayoutEffect2,useRef as useRef8,useState as useState9}from"react";import{ChevronLeft as ChevronLeft2,ChevronRight as ChevronRight2,Lock,RotateCw,Signal,Wifi}from"lucide-react";import{jsx as jsx13,jsxs as jsxs12}from"react/jsx-runtime";function BrowserFrame({url,device="desktop",tab,nav,loading,contentWidth,onScale,onReload,children,className}){const ui=useUIText();const mobile=device==="mobile";const viewport=useRef8(null);const[scale,setScale]=useState9(1);const[rtl,setRtl]=useState9(true);useLayoutEffect2(()=>{const box=viewport.current;if(!box||!contentWidth)return setScale(1);setRtl(getComputedStyle(box).direction==="rtl");const read=()=>{const w=box.clientWidth;setScale(w>0?Math.min(1,w/contentWidth):1)};read();const ro=new ResizeObserver(read);ro.observe(box);return()=>ro.disconnect()},[contentWidth]);useEffect7(()=>{onScale?.(scale)},[scale,onScale]);const control="shrink-0 size-6 rounded-full flex items-center justify-center transition-colors";return jsxs12("div",{className:cn("flex flex-col overflow-clip bg-surface border border-line shadow-panel",mobile?"rounded-[30px] border-[7px] border-night":"rounded-lg",className),children:[mobile&&jsxs12("div",{className:"shrink-0 h-7 px-5 flex items-center justify-between bg-bg","aria-hidden":"true",children:[jsxs12("span",{className:"flex items-center gap-1 text-muted2",children:[jsx13(Signal,{size:11}),jsx13(Wifi,{size:11}),jsx13("span",{className:"w-4 h-2 rounded-[2px] border border-muted2"})]}),jsx13("span",{className:"w-16 h-4 rounded-full bg-night"})]}),tab&&!mobile&&jsx13("div",{className:"shrink-0 flex items-end gap-1 px-2.5 pt-2 bg-bg border-b border-line",children:jsxs12("span",{className:"flex items-center gap-2 h-8 max-w-[220px] px-3 rounded-t-sm bg-surface border border-line border-b-0",children:[jsx13("span",{"aria-hidden":"true",className:"size-3 rounded-[3px] bg-soft2 shrink-0"}),jsx13("span",{className:"text-micro text-ink2 truncate",children:tab})]})}),jsxs12("div",{className:cn("relative shrink-0 flex items-center gap-2 bg-bg border-b border-line",mobile?"px-2.5 py-2":"px-3 py-2.5"),children:[!mobile&&!tab&&jsx13("span",{"aria-hidden":"true",className:"flex items-center gap-1.5 shrink-0 me-1",children:[0,1,2].map(i=>jsx13("span",{className:"size-2.5 rounded-full bg-line border border-border/40"},i))}),nav&&!mobile&&jsxs12("span",{className:"flex items-center gap-0.5 shrink-0 text-muted2/60",children:[jsx13("span",{className:cn(control,"cursor-not-allowed"),"aria-hidden":"true",children:jsx13(ChevronRight2,{size:13})}),jsx13("span",{className:cn(control,"cursor-not-allowed"),"aria-hidden":"true",children:jsx13(ChevronLeft2,{size:13})})]}),jsxs12("span",{className:cn("flex-1 min-w-0 flex items-center gap-1.5 rounded-full bg-surface border border-line",mobile?"h-6 px-2.5":"h-7 px-3"),children:[jsx13(Lock,{size:mobile?9:10,className:"text-green shrink-0","aria-hidden":"true"}),jsx13(TechnicalText,{className:cn("truncate text-muted",mobile?"text-[9.5px]":"text-micro"),children:url})]}),onReload&&!mobile&&jsx13("button",{type:"button",onClick:onReload,"aria-label":ui.reloadPreview,className:cn(control,"text-muted2 hover:bg-hover hover:text-ink cursor-pointer"),children:jsx13(RotateCw,{size:12,"aria-hidden":"true",className:cn(loading&&"animate-spin")})}),loading&&jsx13("span",{"aria-hidden":"true",className:"absolute bottom-0 inset-x-0 h-[2px] overflow-clip",children:jsx13("span",{className:"absolute top-0 h-full w-[35%] bg-brand animate-[qload_1.1s_ease-in-out_infinite]"})})]}),jsx13("div",{ref:viewport,className:"relative flex-1 min-h-0 overflow-clip bg-surface",children:contentWidth?jsx13("div",{style:{width:contentWidth,height:`${100/scale}%`,transform:`scale(${scale})`,transformOrigin:`top ${rtl?"right":"left"}`},children}):children}),mobile&&jsx13("span",{"aria-hidden":"true",className:"shrink-0 h-4 bg-bg flex items-center justify-center",children:jsx13("span",{className:"w-24 h-1 rounded-full bg-border/50"})})]})}import"react";import{jsx as jsx14,jsxs as jsxs13}from"react/jsx-runtime";var clamp=(v,lo=0,hi=100)=>Math.min(hi,Math.max(lo,v));var signedString=v=>(v<0?"\u2212":"")+String(Math.abs(v));function WaterfallChart({total,steps,totalLabel,netLabel,formatValue=signedString,className}){const ui=useUIText();const top=Math.max(1,total);const bars=steps.reduce((acc,s)=>{const from=acc.length?acc[acc.length-1].to:total;acc.push({...s,from,to:from+s.value});return acc},[]);const net=bars.length?bars[bars.length-1].to:total;const biggest=bars.reduce((acc,b,i)=>b.value<acc.v?{i,v:b.value}:acc,{i:-1,v:0});return jsxs13("div",{className:cn("flex flex-col",className),children:[jsx14(Line,{label:totalLabel??ui.totalSales,value:total,formatValue,strong:true,children:jsx14("span",{className:"block h-2.5 rounded-full bg-brand"})}),bars.map((b,i)=>{const drop=b.value<0;const lo=clamp(Math.min(b.from,b.to)/top*100);const span=clamp(Math.abs(b.value)/top*100);const worst=i===biggest.i;return jsx14(Line,{label:b.label,meta:b.meta,value:b.value,formatValue,flag:worst?"\u0623\u0643\u0628\u0631 \u062E\u0635\u0645":void 0,children:jsx14("span",{dir:"ltr",className:"relative block h-2.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:cn("absolute inset-y-0 rounded-full",drop?worst?"bg-danger":"bg-brand-100":"bg-green-solid"),style:{insetInlineStart:`${lo}%`,width:`${span}%`}})})},b.key)}),jsx14(Line,{label:netLabel??ui.netToYou,value:net,formatValue,strong:true,net:true,children:jsx14("span",{dir:"ltr",className:"block h-2.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:"block h-full rounded-full bg-green-solid",style:{width:`${clamp(net/top*100)}%`}})})})]})}function Line({label,meta,value,formatValue,flag,strong,net,children}){return jsxs13("div",{className:cn("flex flex-col gap-1.5 py-2.5",net&&"border-t border-line mt-1 pt-3.5"),children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[jsxs13("span",{className:"flex items-baseline gap-2 min-w-0",children:[jsx14("span",{className:cn("truncate",strong?"text-ui font-extrabold text-ink":"text-ui text-muted"),children:label}),flag&&jsx14("span",{className:"shrink-0 text-micro font-bold text-red bg-red-bg px-1.5 py-0.5 rounded-mark",children:flag})]}),jsx14("span",{"data-num":true,className:cn("shrink-0",strong?"text-body font-black text-ink":"text-ui font-bold text-ink2"),children:formatValue(value)})]}),children,meta&&jsx14("span",{className:"text-micro text-muted2",children:meta})]})}function GoalBar({value,goal,pace,label,formatValue=String,className}){const ui=useUIText();const top=Math.max(value,goal)*1.06;const pct=clamp(value/top*100);const goalAt=clamp(goal/top*100);const paceAt=pace===void 0?null:clamp(goalAt*clamp(pace,0,1));const behind=paceAt!==null&&pct<paceAt;return jsxs13("div",{className:cn("flex flex-col gap-2",className),children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[label&&jsx14("span",{className:"text-ui font-bold text-ink2 truncate",children:label}),jsxs13("span",{className:"flex items-baseline gap-1.5 shrink-0",children:[jsx14("span",{"data-num":true,className:"text-body font-black text-ink",children:formatValue(value)}),jsxs13("span",{className:"text-micro text-muted2",children:["\u0645\u0646 ",jsx14("span",{"data-num":true,children:formatValue(goal)})]})]})]}),jsxs13("span",{dir:"ltr",className:"relative block h-3 rounded-full bg-hover",children:[jsx14("span",{className:cn("absolute inset-y-0 start-0 rounded-full transition-[width] duration-500",behind?"bg-amber":"bg-brand"),style:{width:`${pct}%`}}),paceAt!==null&&jsx14("span",{"aria-hidden":"true",title:ui.shouldBeHere,className:"absolute -top-1 -bottom-1 w-0.5 bg-muted2 rounded-full",style:{insetInlineStart:`${paceAt}%`}}),jsx14("span",{"aria-hidden":"true",className:"absolute -top-1.5 -bottom-1.5 w-1 bg-ink rounded-full",style:{insetInlineStart:`${goalAt}%`}})]}),paceAt!==null&&jsx14("span",{className:cn("text-micro",behind?"text-amber-ink":"text-muted2"),children:behind?"\u0648\u0631\u0627 \u0627\u0644\u0625\u064A\u0642\u0627\u0639 \u0627\u0644\u0645\u0637\u0644\u0648\u0628":"\u0642\u062F\u0651\u0627\u0645 \u0627\u0644\u0625\u064A\u0642\u0627\u0639 \u0627\u0644\u0645\u0637\u0644\u0648\u0628"})]})}function ParetoChart({items,height=140,threshold=80,formatValue=String,className}){const sorted=[...items].sort((a,b)=>b.value-a.value);const sum=sorted.reduce((s,i)=>s+i.value,0)||1;const top=Math.max(1,sorted[0]?.value??1);const rows=sorted.reduce((out,it)=>{const acc=(out.length?out[out.length-1].cum*sum/100:0)+it.value;out.push({...it,cum:acc/sum*100});return out},[]);const vital=rows.findIndex(r=>r.cum>=threshold)+1;return jsxs13("div",{className:cn("flex flex-col gap-2.5",className),children:[jsxs13("span",{className:"text-caption text-muted [text-wrap:pretty]",children:[jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:vital})," ","\u0645\u0646"," ",jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:rows.length})," ","\u0628\u064A\u0639\u0645\u0644\u0648\u0627"," ",jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:threshold}),"\u066A \u0645\u0646 \u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A"]}),jsxs13("div",{className:"relative flex items-end gap-1.5",style:{height},children:[jsx14("span",{"aria-hidden":"true",className:"absolute inset-x-0 border-t border-dashed border-muted2",style:{top:`${100-threshold}%`}}),rows.map((r,i)=>jsx14("span",{className:"flex-1 min-w-0 flex flex-col justify-end items-center gap-1 h-full",children:jsx14("span",{title:`${String(r.label)} \xB7 ${formatValue(r.value)}`,className:cn("w-full rounded-t-mark transition-[height] duration-500",i<vital?"bg-brand":"bg-brand-100"),style:{height:`${clamp(r.value/top*100)}%`}})},r.key))]}),jsx14("div",{className:"flex items-center gap-1.5",children:rows.map((r,i)=>jsx14("span",{className:cn("flex-1 min-w-0 text-micro text-center truncate",i<vital?"text-ink2 font-bold":"text-muted2"),children:r.label},r.key))})]})}function StockRunway({items,urgentDays=7,horizonDays=30,className}){const rows=items.map(it=>({...it,days:it.perDay>0?it.stock/it.perDay:Infinity})).sort((a,b)=>a.days-b.days);return jsx14("div",{className:cn("flex flex-col gap-2.5",className),children:rows.map(r=>{const urgent=r.days<=urgentDays;const soon=!urgent&&r.days<=horizonDays/2;const pct=Number.isFinite(r.days)?clamp(r.days/horizonDays*100):100;return jsxs13("span",{className:"flex flex-col gap-1.5",children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[jsx14("span",{className:"text-ui text-ink2 truncate min-w-0",children:r.label}),jsxs13("span",{className:"flex items-baseline gap-2 shrink-0",children:[jsxs13("span",{"data-num":true,className:"text-micro text-muted2",children:[r.stock," \u0642\u0637\u0639\u0629"]}),jsx14("span",{"data-num":true,className:cn("text-ui font-extrabold",urgent?"text-red":soon?"text-amber-ink":"text-ink"),children:Number.isFinite(r.days)?`${Math.floor(r.days)} \u064A\u0648\u0645`:"\u2014"})]})]}),jsx14("span",{dir:"ltr",className:"block h-1.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:cn("block h-full rounded-full transition-[width] duration-500",urgent?"bg-danger":soon?"bg-amber":"bg-brand"),style:{width:`${pct}%`}})})]},r.key)})})}import{BadgeCheck}from"lucide-react";import{jsx as jsx15}from"react/jsx-runtime";var PROVIDER_LEVEL_LABEL={1:"\u0645\u0642\u062F\u0651\u0645 \u062C\u062F\u064A\u062F",2:"\u0645\u0642\u062F\u0651\u0645 \u0645\u062D\u062A\u0631\u0641",3:"\u0645\u0642\u062F\u0651\u0645 \u062E\u0628\u064A\u0631"};var PROVIDER_LEVEL_LABEL_EN={1:"New provider",2:"Pro provider",3:"Expert provider"};var CHEVRONS=[1.7,6,10.3];var DIM=.28;function ProviderMark({level,size=16,className}){return jsx15("svg",{width:size,height:size,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:cn("shrink-0",className),children:CHEVRONS.map((y,i)=>jsx15("path",{d:`M3.2 ${y+4}L8 ${y}L12.8 ${y+4}`,stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",opacity:i>=CHEVRONS.length-level?1:DIM},y))})}var LEVEL_TONE={1:"bg-hover text-ink2",2:"bg-soft text-brand-ink",3:TONE_SOLID.brand};var SIZES={sm:{box:"size-6",mark:14},md:{box:"size-7",mark:16}};function MarkChip({label,size,tone,className,children}){return jsx15(Tooltip,{content:label,children:jsx15("span",{role:"img","aria-label":label,tabIndex:0,className:cn("inline-flex items-center justify-center rounded-sm shrink-0 cursor-pointer","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",SIZES[size].box,tone,className),children})})}function ProviderBadge({level,size="sm",className}){const en=useMoneyLang();const label=en?PROVIDER_LEVEL_LABEL_EN[level]:PROVIDER_LEVEL_LABEL[level];return jsx15(MarkChip,{label,size,tone:LEVEL_TONE[level],className,children:jsx15(ProviderMark,{level,size:SIZES[size].mark})})}var VERIFIED_LABEL="\u062D\u0633\u0627\u0628 \u0645\u0648\u062B\u0651\u0642";var VERIFIED_LABEL_EN="Verified account";function VerifiedBadge({size="sm",className}){const en=useMoneyLang();return jsx15(MarkChip,{label:en?VERIFIED_LABEL_EN:VERIFIED_LABEL,size,tone:TONE_SOFT.green,className,children:jsx15(BadgeCheck,{size:SIZES[size].mark,strokeWidth:2,"aria-hidden":"true"})})}export{ANIMATE_SCALE,Accordion,Alert,AudioPlayer,Avatar,Badge,BarChart,BrowserFrame,Button,COLOR_SCALE,CONTAINER_SCALE,Calendar,Card,CardHeader,Carousel,Checkbox,ChoiceCards,Coach,CoachProvider,ColorField,Combobox,CommandPalette,Counter,DARK_TOKENS,DataTable,DateField,DateRangePicker,Drawer,Dropdown,Dropzone,EmptyState,FileRow,FilterChips,FunnelChart,Gallery,GoalBar,Heatmap,Input,Lightbox,LocaleCtx,Modal,Money,MoneyProvider,MultiSelect,NumberStepper,PROVIDER_LEVEL_LABEL,PROVIDER_LEVEL_LABEL_EN,PageHeader,ParetoChart,Phone,Picker,Product3DViewer,Progress,ProviderBadge,ProviderMark,RADIUS_SCALE,Radio,RadioGroup,RatingInput,SHADOW_SCALE,Scrubber,SearchInput,Select,ShareList,Sheet,Skeleton,SortableStatus,Sparkline,Stars,StatCard,Stepper,StockRunway,Switch,TEXT_SCALE,TOKENS,TONE_SOFT,TONE_SOLID,Tabs,TechnicalInput,TechnicalText,Textarea,Timeline,Toast,ToastHost,Tooltip,TrendChart,VerifiedBadge,VideoPlayer,WaterfallChart,WhatsAppIcon,buttonClasses,cn,coachSeconds,currencyName,currencySymbol,daysBetween,formatBytes,formatDate,formatRange,formatTime,isCurrency,normalizeHex,parsePhone,presets,toLatinDigits,useAudioLevel,useCoach,useCoachOptional,useCurrency,useCurrencySymbol,useMedia,useMoneyLang,useMoneyLocale,useSortable,useToasts,useUIText};
2
+ import{ToastHost,Tooltip,useToasts}from"./chunk-GCIOTDW6.js";import{BarChart,ChoiceCards,DataTable,FunnelChart,Heatmap,Money,MoneyProvider,ShareList,Sparkline,TrendChart,currencyName,currencySymbol,isCurrency,useCurrency,useCurrencySymbol}from"./chunk-ZG3I7YUW.js";import{Button,Calendar,Checkbox,DateField,DateRangePicker,Input,Radio,RadioGroup,SearchInput,Select,Switch,Textarea,daysBetween,formatDate,formatRange,presets}from"./chunk-XAQJL7FX.js";import{AudioPlayer,Avatar,Badge,Card,CardHeader,Coach,CoachProvider,Counter,PageHeader,Progress,Scrubber,Skeleton,StatCard,VideoPlayer,coachSeconds,formatTime,useAudioLevel,useCoach,useCoachOptional,useMedia}from"./chunk-TWZR3X5H.js";import{Alert,Drawer,EmptyState,Modal,Sheet,Toast}from"./chunk-ZYLYQZBE.js";import{ANIMATE_SCALE,COLOR_SCALE,CONTAINER_SCALE,DARK_TOKENS,LocaleCtx,RADIUS_SCALE,SHADOW_SCALE,TEXT_SCALE,TOKENS,TONE_SOFT,TONE_SOLID,buttonClasses,cn,toLatinDigits,useMoneyLang,useMoneyLocale,useUIText}from"./chunk-N6V3LTIS.js";import{useEffect,useRef,useState}from"react";import{Minus,Plus,Trash2}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";var ar=new Intl.NumberFormat("ar-EG");var BOX={sm:"h-8",md:"h-11",lg:"h-14"};var BTN={sm:"w-8",md:"w-11",lg:"w-14"};var NUM={sm:"text-ui w-10",md:"text-body w-14",lg:"text-h3 w-20"};var ICON={sm:14,md:16,lg:20};function NumberStepper({value,onChange,min=0,max=Infinity,step=1,size="md",unit,onRemove,disabled,label,className}){const[draft,setDraft]=useState(null);const timer=useRef(void 0);useEffect(()=>()=>clearTimeout(timer.current),[]);const atMin=value<=min;const atMax=value>=max;const showRemove=Boolean(onRemove)&&atMin;const bump=dir=>onChange(Math.min(max,Math.max(min,value+dir*step)));const latest=useRef(value);useEffect(()=>{latest.current=value},[value]);function hold(dir){let delay=400;const tick=()=>{const next=Math.min(max,Math.max(min,latest.current+dir*step));if(next===latest.current)return;onChange(next);delay=Math.max(60,delay*.72);timer.current=setTimeout(tick,delay)};timer.current=setTimeout(tick,delay)}const stop=()=>clearTimeout(timer.current);function commit(raw){setDraft(null);const n=Number(toLatinDigits(raw).replace(/[^\d.-]/g,""));if(Number.isNaN(n))return;onChange(Math.min(max,Math.max(min,n)))}const btn=dir=>{const off=disabled||(dir===1?atMax:atMin&&!showRemove);const Icon=dir===1?Plus:showRemove?Trash2:Minus;return jsx("button",{type:"button",disabled:off,"aria-label":dir===1?"\u0632\u064A\u0627\u062F\u0629":showRemove?"\u062D\u0630\u0641":"\u0646\u0642\u0635\u0627\u0646",onClick:()=>dir===-1&&showRemove?onRemove?.():bump(dir),onPointerDown:()=>!off&&!showRemove&&hold(dir),onPointerUp:stop,onPointerLeave:stop,className:cn("flex items-center justify-center shrink-0 self-stretch cursor-pointer select-none","transition-colors",BTN[size],off?"text-muted2/45 cursor-not-allowed":cn("text-ink2 hover:bg-hover active:bg-soft",showRemove&&dir===-1&&"text-danger hover:bg-red-bg")),children:jsx(Icon,{size:ICON[size],strokeWidth:2.4,"aria-hidden":"true"})})};return jsxs("div",{dir:"ltr",className:cn("inline-flex items-center rounded-field border border-line bg-surface overflow-clip","divide-x divide-line","hover:border-border","focus-within:border-brand focus-within:ring-2 focus-within:ring-brand/25","transition-[border-color,box-shadow]",BOX[size],disabled&&"opacity-60",className),children:[btn(-1),jsxs("span",{className:"flex items-center justify-center gap-1 px-1 self-stretch",children:[jsx("input",{"data-num":true,value:draft??ar.format(value),disabled,inputMode:"numeric","aria-label":label??"\u0627\u0644\u0642\u064A\u0645\u0629",onFocus:()=>setDraft(String(value)),onChange:e=>setDraft(toLatinDigits(e.target.value)),onBlur:e=>commit(e.target.value),onKeyDown:e=>e.key==="Enter"&&e.target.blur(),className:cn("bg-transparent outline-none text-center font-extrabold text-ink","disabled:text-muted2",NUM[size])}),unit&&jsx("span",{className:"text-micro text-muted2 select-none shrink-0",children:unit})]}),btn(1)]})}import{MessageSquare,Phone as PhoneIcon}from"lucide-react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function WhatsAppIcon({size=15,...rest}){return jsx2("svg",{viewBox:"0 0 24 24",width:size,height:size,fill:"currentColor","aria-hidden":"true",...rest,children:jsx2("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}var DIAL={"20":{groups:[3,3,4],name:"\u0645\u0635\u0631"},"966":{groups:[2,3,4],name:"\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629"},"971":{groups:[2,3,4],name:"\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A"},"965":{groups:[4,4],name:"\u0627\u0644\u0643\u0648\u064A\u062A"},"974":{groups:[4,4],name:"\u0642\u0637\u0631"},"973":{groups:[4,4],name:"\u0627\u0644\u0628\u062D\u0631\u064A\u0646"},"968":{groups:[4,4],name:"\u0639\u064F\u0645\u0627\u0646"},"962":{groups:[1,4,4],name:"\u0627\u0644\u0623\u0631\u062F\u0646"},"964":{groups:[3,3,4],name:"\u0627\u0644\u0639\u0631\u0627\u0642"},"961":{groups:[2,3,3],name:"\u0644\u0628\u0646\u0627\u0646"},"963":{groups:[3,3,3],name:"\u0633\u0648\u0631\u064A\u0627"},"970":{groups:[2,3,4],name:"\u0641\u0644\u0633\u0637\u064A\u0646"},"967":{groups:[3,3,3],name:"\u0627\u0644\u064A\u0645\u0646"},"249":{groups:[3,3,3],name:"\u0627\u0644\u0633\u0648\u062F\u0627\u0646"},"212":{groups:[3,3,3],name:"\u0627\u0644\u0645\u063A\u0631\u0628"},"213":{groups:[3,3,3],name:"\u0627\u0644\u062C\u0632\u0627\u0626\u0631"},"216":{groups:[2,3,3],name:"\u062A\u0648\u0646\u0633"},"218":{groups:[2,3,4],name:"\u0644\u064A\u0628\u064A\u0627"},"222":{groups:[2,2,2,2],name:"\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627"},"252":{groups:[2,3,4],name:"\u0627\u0644\u0635\u0648\u0645\u0627\u0644"},"253":{groups:[2,2,2,2],name:"\u062C\u064A\u0628\u0648\u062A\u064A"},"269":{groups:[3,4],name:"\u062C\u0632\u0631 \u0627\u0644\u0642\u0645\u0631"}};var DIALS=Object.keys(DIAL).sort((a,b)=>b.length-a.length);function parsePhone(raw,defaultDial="20"){const digits=raw.replace(/\D/g,"");let rest=digits;const intl=raw.trim().startsWith("+")||digits.startsWith("00");if(digits.startsWith("00"))rest=digits.slice(2);if(intl){for(const d of DIALS){if(rest.startsWith(d)){return{dial:d,local:rest.slice(d.length),country:DIAL[d].name}}}return{dial:"",local:rest}}const local=rest.replace(/^0/,"");return{dial:defaultDial,local,country:DIAL[defaultDial]?.name}}function join(parts,format){if(format==="spaces"||parts.length<2)return parts.join(" ");const[head,...tail]=parts;return`(${head}) ${tail.join("-")}`}function group(local,dial){const rule=DIAL[dial]?.groups;const out=[];let i=0;if(rule){for(const n of rule){if(i>=local.length)break;out.push(local.slice(i,i+n));i+=n}}while(i<local.length){out.push(local.slice(i,i+3));i+=3}return out.filter(Boolean)}var SIZE={inherit:"",sm:"text-caption",md:"text-ui"};function Phone({value,defaultDial="20",format="parens",mask,call,sms,whatsapp,size="md",className}){const{dial,local,country}=parsePhone(value,defaultDial);const e164=`+${dial}${local}`;const shown=mask?`\u2022\u2022\u2022 ${local.slice(-4)}`:dial?join(group(local,dial),format):`+${local}`;const bare=size==="inherit";return jsxs2("span",{className:cn("inline-flex items-center gap-2 min-w-0",className),children:[jsxs2("span",{dir:"ltr",className:cn("inline-flex items-baseline gap-1.5 whitespace-nowrap min-w-0",SIZE[size]),children:[dial&&!mask&&jsxs2("span",{className:cn("opacity-70",!bare&&"text-muted2 font-normal"),title:country,children:["+",dial]}),jsx2("span",{style:{unicodeBidi:"isolate",fontVariantNumeric:"tabular-nums"},className:cn("truncate",!bare&&"font-bold text-ink"),children:shown})]}),(call||sms||whatsapp)&&!mask&&jsxs2("span",{className:"inline-flex items-center gap-0.5 shrink-0",children:[call&&jsx2(Action,{href:`tel:${e164}`,label:`\u0627\u062A\u0635\u0627\u0644 \u0628\u0640${e164}`,children:jsx2(PhoneIcon,{size:14,"aria-hidden":"true"})}),sms&&jsx2(Action,{href:`sms:${e164}`,label:`\u0631\u0633\u0627\u0644\u0629 \u0646\u0635\u0651\u064A\u0629 \u0625\u0644\u0649 ${e164}`,children:jsx2(MessageSquare,{size:14,"aria-hidden":"true"})}),whatsapp&&jsx2(Action,{href:`https://wa.me/${dial}${local}`,label:`\u0648\u0627\u062A\u0633\u0627\u0628 ${e164}`,external:true,className:"hover:text-green",children:jsx2(WhatsAppIcon,{size:15})})]})]})}function Action({href,label,external,className,children}){return jsx2("a",{href,"aria-label":label,title:label,...external?{target:"_blank",rel:"noreferrer"}:{},className:cn("size-7 rounded-sm inline-flex items-center justify-center shrink-0","text-muted hover:text-brand-ink hover:bg-hover transition-colors no-underline",className),children})}import{forwardRef,useId}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";var LEAD={hex:"#",url:"/"};var TechnicalInput=forwardRef(function TechnicalInput2({kind="code",className,wrapperClassName,...rest},ref){return jsx3(Input,{ref,dir:"ltr",spellCheck:false,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",inputMode:kind==="url"?"url":"text",wrapperClassName:cn("[unicode-bidi:isolate]",wrapperClassName),className:cn("font-mono tracking-[.01em] [unicode-bidi:isolate] text-start [[dir=rtl]_&]:text-right",className),...rest})});function TechnicalText({children,className}){return jsx3("span",{dir:"ltr",className:cn("inline-block font-mono [unicode-bidi:isolate]",className),children})}function ColorField({label,note,value,onChange,disabled,id:idProp}){const auto=useId();const id=idProp??auto;return jsxs3("div",{className:"flex flex-col gap-1.5 min-w-0",children:[jsx3("label",{htmlFor:`${id}-hex`,className:"text-ui font-bold text-ink2",children:label}),note&&jsx3("span",{className:"text-caption leading-[1.6] text-muted",children:note}),jsxs3("div",{className:"flex items-center gap-2 min-w-0",children:[jsxs3("span",{className:"relative shrink-0 size-11",children:[jsx3("input",{id,type:"color",value:normalizeHex(value)??"#000000",disabled,onChange:e=>onChange(e.target.value.toUpperCase()),"aria-label":typeof label==="string"?label:void 0,className:"absolute inset-0 size-full opacity-0 cursor-pointer disabled:cursor-not-allowed"}),jsx3("span",{"aria-hidden":"true",className:"pointer-events-none block size-11 rounded-field border border-border",style:{background:normalizeHex(value)??"transparent"}})]}),jsx3(TechnicalInput,{id:`${id}-hex`,kind:"hex",hideLabel:true,size:"md",maxLength:7,disabled,value,onChange:e=>onChange(e.target.value),onBlur:()=>{const fixed=normalizeHex(value);if(fixed&&fixed!==value)onChange(fixed);else if(!fixed&&value&&!value.startsWith(LEAD.hex))onChange(`#${value}`)},wrapperClassName:"flex-1 min-w-0"})]})]})}function normalizeHex(input){const raw=input.trim().replace(/^#/,"");if(/^[0-9a-fA-F]{3}$/.test(raw)){return`#${raw.split("").map(c=>c+c).join("").toUpperCase()}`}if(/^[0-9a-fA-F]{6}$/.test(raw))return`#${raw.toUpperCase()}`;return null}import{useCallback,useEffect as useEffect2,useRef as useRef2,useState as useState2}from"react";import{Box,Loader2}from"lucide-react";import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";function detailOf(e){return e.detail??{}}function Product3DViewer({src,iosSrc,poster,alt,autoRotate=true,onLoad,onError,onARLaunch,className}){const en=useMoneyLang();const host=useRef2(null);const slot=useRef2(null);const viewer=useRef2(null);const[phase,setPhase]=useState2("idle");const[progress,setProgress]=useState2(0);const[canAR,setCanAR]=useState2(false);const cb=useRef2({onLoad,onError,onARLaunch});useEffect2(()=>{cb.current={onLoad,onError,onARLaunch}},[onLoad,onError,onARLaunch]);useEffect2(()=>{const mount=slot.current;const box=host.current;if(!mount||!box)return;let dead=false;let el=null;setPhase("idle");setProgress(0);setCanAR(false);async function build(target){try{await import("@google/model-viewer");await customElements.whenDefined("model-viewer");if(dead)return;el=document.createElement("model-viewer");viewer.current=el;el.setAttribute("src",src);if(iosSrc)el.setAttribute("ios-src",iosSrc);el.setAttribute("alt",alt);el.setAttribute("camera-controls","");el.setAttribute("touch-action","pan-y");el.setAttribute("shadow-intensity","1");el.setAttribute("ar","");el.setAttribute("ar-modes","webxr scene-viewer quick-look");el.setAttribute("loading","eager");el.style.width="100%";el.style.height="100%";el.style.backgroundColor="transparent";const silence=document.createElement("button");silence.slot="ar-button";silence.style.display="none";silence.tabIndex=-1;silence.setAttribute("aria-hidden","true");el.appendChild(silence);const reduce=typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches;if(autoRotate&&!reduce)el.setAttribute("auto-rotate","");el.addEventListener("progress",e=>{const total=detailOf(e).totalProgress??0;if(!dead)setProgress(total)});el.addEventListener("load",()=>{if(dead)return;setPhase("ready");setCanAR(Boolean(el?.canActivateAR));cb.current.onLoad?.()});el.addEventListener("error",e=>{if(dead)return;setPhase("error");cb.current.onError?.(detailOf(e).type??"load-failed")});target.appendChild(el);setPhase("loading")}catch{if(dead)return;setPhase("error");cb.current.onError?.("viewer-unavailable")}}const io=new IntersectionObserver(entries=>{if(entries.some(x=>x.isIntersecting)){io.disconnect();void build(mount)}},{rootMargin:"200px"});io.observe(box);return()=>{dead=true;io.disconnect();el?.remove();viewer.current=null}},[src,iosSrc,alt,autoRotate]);const launchAR=useCallback(()=>{cb.current.onARLaunch?.();void viewer.current?.activateAR().catch(()=>{})},[]);const pct=Math.round(progress*100);const showPoster=phase!=="ready";return jsxs4("div",{ref:host,className:cn("relative aspect-square w-full overflow-clip rounded-card bg-hover border border-line",className),children:[showPoster&&jsx4("img",{src:poster,alt,loading:"lazy",decoding:"async",draggable:false,className:"absolute inset-0 size-full object-contain"}),jsx4("div",{ref:slot,className:cn("absolute inset-0",showPoster&&"opacity-0"),"aria-hidden":showPoster}),phase==="loading"&&jsxs4("div",{className:"absolute inset-x-0 bottom-0 flex flex-col gap-1.5 p-3",children:[jsxs4("span",{className:"flex items-center gap-2 text-micro font-bold text-ink2",children:[jsx4(Loader2,{size:12,className:"animate-spin shrink-0","aria-hidden":"true"}),en?"Loading 3D model":"\u062C\u0627\u0631\u064A \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062C\u0633\u0651\u0645",jsxs4("span",{dir:"ltr","data-num":true,className:"ms-auto text-muted",children:[pct,"%"]})]}),jsx4("span",{role:"progressbar","aria-valuenow":pct,"aria-valuemin":0,"aria-valuemax":100,"aria-label":en?"Model loading progress":"\u062A\u0642\u062F\u0651\u0645 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062C\u0633\u0651\u0645",className:"h-1 w-full rounded-full bg-line overflow-clip",children:jsx4("span",{className:"block h-full rounded-full bg-brand transition-[width] duration-200",style:{width:`${pct}%`}})})]}),phase==="ready"&&canAR&&jsxs4("button",{type:"button",onClick:launchAR,className:cn("absolute bottom-3 end-3 inline-flex items-center gap-2 h-9 px-3.5 rounded-full","bg-surface/92 backdrop-blur border border-line shadow-pop","text-ui font-bold text-ink2 cursor-pointer transition-colors hover:text-brand-ink"),children:[jsx4(Box,{size:15,"aria-hidden":"true"}),en?"See it in your space":"\u0634\u0648\u0641\u0647 \u0641\u064A \u0645\u0643\u0627\u0646\u0643"]})]})}import{X}from"lucide-react";import{jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";function Tabs({items,value,onChange,variant="pill",label,className}){if(variant==="segmented"){return jsx5("div",{role:"tablist","aria-label":label,className:cn("flex flex-wrap gap-0.5 p-0.5 rounded-field bg-bg self-start","max-w-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",className),children:items.map(it=>{const on=it.key===value;return jsxs5("button",{role:"tab",type:"button","aria-selected":on,onClick:()=>onChange(it.key),className:cn("h-9 px-2 sm:px-3.5 rounded-sm inline-flex items-center gap-2 text-ui font-bold cursor-pointer transition-colors","shrink-0 whitespace-nowrap","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",on?"bg-surface text-ink shadow-raise":"text-muted hover:text-ink"),children:[it.icon&&jsx5(it.icon,{size:14}),it.label,typeof it.count==="number"&&jsx5("span",{"data-num":true,className:"opacity-60",children:it.count})]},it.key)})})}return jsx5("div",{role:"tablist","aria-label":label,className:cn("flex items-center gap-2.5 flex-wrap",className),children:items.map(it=>{const on=it.key===value;return jsxs5("button",{role:"tab",type:"button","aria-selected":on,onClick:()=>onChange(it.key),className:cn("h-10 px-3.5 rounded-field border inline-flex items-center gap-1.5 text-ui font-bold cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",on?"border-brand bg-soft text-brand-ink":"border-border bg-surface text-ink2 hover:border-brand"),children:[it.icon&&jsx5(it.icon,{size:14}),it.label,typeof it.count==="number"&&jsx5("span",{"data-num":true,className:"text-micro opacity-70",children:it.count})]},it.key)})})}function FilterChips({chips,onClearAll,label,clearAllLabel}){const ui=useUIText();if(chips.length===0)return null;return jsxs5("div",{className:"flex items-center gap-2 flex-wrap",children:[jsx5("span",{className:"text-caption text-muted",children:label??ui.activeFilters}),chips.map(c=>jsxs5("button",{type:"button",onClick:c.onClear,className:"inline-flex items-center gap-1.5 h-7 ps-3 pe-2 rounded-full bg-soft text-brand-ink text-caption font-bold cursor-pointer transition-colors hover:bg-soft2",children:[c.label,jsx5(X,{size:12,strokeWidth:2.5,"aria-hidden":"true"})]},c.label)),onClearAll&&jsx5("button",{type:"button",onClick:onClearAll,className:"text-caption font-bold text-muted cursor-pointer hover:text-ink transition-colors",children:clearAllLabel??ui.clearAll})]})}import{useEffect as useEffect3,useMemo,useRef as useRef3,useState as useState3}from"react";import{Check,ChevronDown,Loader2 as Loader22,Minus as Minus2,SlidersHorizontal}from"lucide-react";import{useInView}from"react-intersection-observer";import{Fragment,jsx as jsx6,jsxs as jsxs6}from"react/jsx-runtime";function leavesOf(item){if(!item.children?.length)return[item];return item.children.flatMap(leavesOf)}function Picker({open,onClose,title,description,closeLabel,items,icon,isLoading,isError,errorText,emptyIcon,emptyText,search,onSearch,searchPlaceholder,header,multiple=false,selected,onPick,closeOnPick=true,onConfirm,hintText,cancelLabel,confirmLabel,selectedCountText,itemsCountText,allTabLabel,selectedTabLabel,selectAllLabel,deselectAllLabel,hasMore,isLoadingMore,onLoadMore}){const ui=useUIText();const current=selected??[];const[tab,setTab]=useState3("all");const[saved,setSaved]=useState3(()=>new Set(current));const[pending,setPending]=useState3(()=>new Set);const[removed,setRemoved]=useState3(()=>new Set);const[wasOpen,setWasOpen]=useState3(open);if(wasOpen!==open){setWasOpen(open);if(open){setTab("all");setSaved(new Set(current));setPending(new Set);setRemoved(new Set)}}const total=saved.size-removed.size+pending.size;const tabbed=multiple;const visible=useMemo(()=>{if(!tabbed)return items;const keep=i=>tab==="selected"?saved.has(i.id):!saved.has(i.id);return items.map(item=>{if(!item.children?.length)return keep(item)?item:null;const kids=item.children.filter(keep);return kids.length>0?{...item,children:kids}:null}).filter(i=>i!==null)},[items,tabbed,tab,saved]);const[expanded,setExpanded]=useState3(()=>new Set);const rows=useMemo(()=>{const out=[];for(const item of visible){const kids=item.children??[];out.push({item,child:false});if(kids.length>0&&expanded.has(item.id))for(const kid of kids)out.push({item:kid,child:true})}return out},[visible,expanded]);function isChecked(id){if(!tabbed)return pending.has(id)||saved.has(id)&&!removed.has(id);if(tab==="selected")return!removed.has(id);return pending.has(id)}const[scroller,setScroller]=useState3(null);const{ref:sentinelRef,inView}=useInView({root:scroller,rootMargin:"160px"});const loadMore=useRef3(onLoadMore);useEffect3(()=>{loadMore.current=onLoadMore});useEffect3(()=>{if(inView&&hasMore&&!isLoadingMore)loadMore.current?.()},[inView,hasMore,isLoadingMore]);const anchor=useRef3(-1);function toggle(id){if(!tabbed){const item=items.flatMap(leavesOf).find(i=>i.id===id);if(item)onPick?.(item);if(closeOnPick)onClose();return}if(tab==="selected"){setRemoved(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next});return}setPending(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})}function clickRow(id,index,shiftKey){const row=rows[index];if(row?.item.children?.length){setExpanded(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next});return}if(tabbed&&shiftKey&&tab==="all"&&anchor.current>=0){const from=Math.min(anchor.current,index);const to=Math.max(anchor.current,index);setPending(prev=>{const next=new Set(prev);for(let i=from;i<=to;i++){const target=rows[i]?.item;if(target&&!target.disabled&&!target.children?.length)next.add(target.id)}return next})}else{toggle(id)}anchor.current=index}const pickable=visible.flatMap(leavesOf).filter(i=>!i.disabled);const allPicked=pickable.length>0&&pickable.every(i=>pending.has(i.id));function save(){const out=new Set([...saved,...pending]);for(const id of removed)out.delete(id);onConfirm?.([...out]);onClose()}return jsx6(Modal,{open,onClose,size:"lg",title:tabbed&&total>0?jsxs6("span",{className:"flex items-center gap-2 flex-wrap",children:[title,jsx6("span",{className:"text-caption font-bold px-2 py-0.5 rounded-full bg-soft text-brand-ink",children:selectedCountText?selectedCountText(total):jsxs6(Fragment,{children:[jsx6("span",{"data-num":true,children:total})," ",ui.selectedCount]})})]}):title,description,closeLabel:closeLabel??ui.close,footer:tabbed?jsxs6(Fragment,{children:[jsxs6("span",{className:"text-caption text-muted me-auto",children:[itemsCountText?itemsCountText(items.length):jsxs6(Fragment,{children:[jsx6("span",{"data-num":true,children:items.length})," ",ui.items]}),jsx6("span",{className:"text-muted2",children:" \xB7 Shift+Click"})]}),jsx6(Button,{variant:"ghost",size:"sm",onClick:onClose,children:cancelLabel??ui.cancel}),jsx6(Button,{size:"sm",onClick:save,children:confirmLabel??ui.save})]}):jsxs6(Fragment,{children:[jsx6("span",{className:"text-caption text-muted me-auto",children:hintText??ui.pickToSelect}),jsx6(Button,{variant:"ghost",size:"sm",onClick:onClose,children:cancelLabel??ui.cancel})]}),children:jsxs6("div",{className:"flex flex-col gap-3",children:[header,jsx6(SearchInput,{label:ui.search,hideLabel:true,size:"sm",value:search,onChange:e=>onSearch(e.target.value),placeholder:searchPlaceholder??ui.search}),tabbed&&jsxs6("div",{role:"tablist",className:"flex items-center gap-1.5",children:[jsx6(TabButton,{active:tab==="all",onClick:()=>setTab("all"),children:allTabLabel??ui.all}),jsxs6(TabButton,{active:tab==="selected",onClick:()=>setTab("selected"),children:[jsx6(SlidersHorizontal,{size:12,"aria-hidden":"true"}),selectedTabLabel??ui.selectedTab,saved.size>removed.size&&jsx6("span",{"data-num":true,className:"text-micro leading-none px-1.5 py-0.5 rounded-full bg-soft text-brand-ink",children:saved.size-removed.size})]})]}),jsx6("div",{ref:setScroller,className:"max-h-96 overflow-y-auto overscroll-contain [scrollbar-gutter:stable] -mx-1 px-1",children:isLoading?jsx6("div",{className:"flex flex-col gap-1.5",children:Array.from({length:6},(_,i)=>jsx6(Skeleton,{variant:"block",className:"h-13 rounded-sm"},i))}):isError?jsx6(Alert,{tone:"red",title:errorText??ui.somethingWentWrong}):visible.length===0?jsx6(EmptyState,{icon:emptyIcon,title:emptyText??ui.noResults}):jsxs6(Fragment,{children:[tabbed&&tab==="all"&&pickable.length>0&&jsxs6("button",{type:"button","aria-pressed":allPicked,onClick:()=>{if(allPicked)setPending(new Set);else setPending(prev=>new Set([...prev,...pickable.map(i=>i.id)]))},className:"w-full flex items-center gap-3 p-2 mb-1.5 rounded-sm border border-dashed border-line cursor-pointer text-start transition-colors hover:bg-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",children:[jsx6(Box2,{checked:allPicked,partial:!allPicked&&pending.size>0}),jsxs6("span",{className:"text-caption text-muted",children:[allPicked?deselectAllLabel??ui.deselectAll:selectAllLabel??ui.selectAll," ",jsxs6("span",{"data-num":true,children:["(",pickable.length,")"]})]})]}),jsx6("ul",{role:"listbox","aria-multiselectable":multiple,"aria-label":typeof title==="string"?title:void 0,className:"flex flex-col gap-1.5 list-none m-0 p-0",children:rows.map(({item,child},index)=>jsx6(Row,{item,icon,box:tabbed,child,expanded:item.children?.length?expanded.has(item.id):void 0,selected:isChecked(item.id),onPick:shiftKey=>clickRow(item.id,index,shiftKey)},item.id))}),hasMore&&(!tabbed||tab==="all")&&jsx6("div",{ref:sentinelRef,role:"status","aria-label":isLoadingMore?ui.loadingMore:void 0,className:"h-11 flex items-center justify-center",children:isLoadingMore&&jsx6(Loader22,{size:16,"aria-hidden":"true",className:"animate-spin text-muted"})})]})})]})})}function TabButton({active,onClick,children}){return jsx6("button",{type:"button",role:"tab","aria-selected":active,onClick,className:cn("flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-caption font-bold border cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",active?"border-line bg-surface text-ink":"border-transparent text-muted hover:text-ink hover:bg-hover"),children})}function Box2({checked,partial=false}){return jsx6("span",{"aria-hidden":"true",className:cn("shrink-0 size-5 rounded-xs border flex items-center justify-center transition-colors",checked||partial?"bg-brand border-brand text-white":"border-line bg-surface"),children:checked?jsx6(Check,{size:13,strokeWidth:3}):partial?jsx6(Minus2,{size:13,strokeWidth:3}):null})}function Row({item,icon,box,child=false,expanded,selected,onPick}){const[errored,setErrored]=useState3(false);const disabled=item.disabled??false;const parent=expanded!==void 0;const src=item.image?.trim();const showImage=Boolean(src)&&!errored;return jsx6("li",{role:"none",children:jsxs6("button",{type:"button",role:parent?void 0:"option","aria-selected":parent?void 0:selected,"aria-disabled":disabled||void 0,"aria-expanded":parent?expanded:void 0,title:disabled?item.disabledReason:void 0,onClick:e=>{if(!disabled)onPick(e.shiftKey)},className:cn("w-full flex items-center gap-3 p-2 rounded-sm text-start","border transition-colors",child&&"ps-11",disabled?"opacity-45 cursor-not-allowed border-transparent":"cursor-pointer",!disabled&&(selected?"border-brand bg-soft":"border-transparent hover:border-line hover:bg-hover"),"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand"),children:[box&&!parent&&jsx6(Box2,{checked:selected}),showImage?jsx6("img",{src,alt:"",loading:"lazy",onError:()=>setErrored(true),className:"size-9 rounded-sm border border-line object-cover shrink-0"}):jsx6("span",{"aria-hidden":"true",className:"size-9 shrink-0 inline-flex items-center justify-center [&>svg]:size-full",children:icon}),jsxs6("span",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsx6("span",{className:"text-caption font-bold text-ink truncate",children:jsx6("bdi",{children:item.title})}),item.sub&&jsx6("span",{className:"text-micro text-muted truncate",children:jsx6("bdi",{children:item.sub})})]}),parent&&jsx6(ChevronDown,{size:16,"aria-hidden":"true",className:cn("shrink-0 text-muted transition-transform",expanded&&"rotate-180")}),!box&&!parent&&selected&&jsx6("span",{"aria-hidden":"true",className:"shrink-0 size-5 rounded-full bg-brand text-white flex items-center justify-center",children:jsx6(Check,{size:12,strokeWidth:3})})]})})}import{useEffect as useEffect4,useId as useId2,useMemo as useMemo2,useRef as useRef4,useState as useState4}from"react";import{Check as Check2,ChevronDown as ChevronDown2,Plus as Plus2,Search,X as X2}from"lucide-react";import{jsx as jsx7,jsxs as jsxs7}from"react/jsx-runtime";function useDismiss(open,close){const ref=useRef4(null);useEffect4(()=>{if(!open)return;function onDown(e){if(ref.current&&!ref.current.contains(e.target))close()}function onKey(e){if(e.key==="Escape")close()}document.addEventListener("mousedown",onDown);document.addEventListener("keydown",onKey);return()=>{document.removeEventListener("mousedown",onDown);document.removeEventListener("keydown",onKey)}},[open,close]);return ref}var TRIGGER="w-full h-10 px-3.5 rounded-field border bg-surface flex items-center gap-2.5 text-body cursor-pointer transition-colors outline-none focus-visible:border-brand";var PANEL="absolute z-30 top-[calc(100%+6px)] inset-x-0 bg-surface border border-line rounded-card shadow-panel overflow-clip animate-[fade-in_.14s_ease-out]";var ITEM="w-full px-3 py-2.5 flex items-center gap-2.5 text-start text-ui cursor-pointer transition-colors hover:bg-hover disabled:opacity-45 disabled:cursor-not-allowed";function Label({id,children}){if(!children)return null;return jsx7("label",{htmlFor:id,className:"text-ui font-bold text-ink2",children})}function Dropdown({label,value,onChange,options,placeholder,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const ref=useDismiss(open,()=>setOpen(false));const current=options.find(o=>o.value===value);return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsx7(Label,{id,children:label}),jsxs7("div",{ref,className:"relative",children:[jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>setOpen(v=>!v),className:cn(TRIGGER,open?"border-brand":"border-border hover:border-brand"),children:[current?.icon,jsx7("span",{className:cn("flex-1 min-w-0 text-start truncate",!current&&"text-muted2"),children:current?.label??placeholder??ui.select}),current?.meta&&jsx7("span",{className:"text-caption text-muted shrink-0",children:current.meta}),jsx7(ChevronDown2,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform",open&&"rotate-180")})]}),open&&jsx7("div",{role:"listbox",className:cn(PANEL,"max-h-72 overflow-y-auto py-1"),children:options.map(o=>jsxs7("button",{type:"button",role:"option","aria-selected":o.value===value,disabled:o.disabled,onClick:()=>{onChange(o.value);setOpen(false)},className:cn(ITEM,o.value===value&&"bg-soft"),children:[o.icon,jsxs7("span",{className:"flex-1 min-w-0 flex flex-col",children:[jsx7("span",{className:"font-bold truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted",children:o.meta})]}),o.value===value&&jsx7(Check2,{size:14,className:"text-brand-ink shrink-0","aria-hidden":"true"})]},o.value))})]})]})}function Combobox({label,value,onChange,options,placeholder,searchPlaceholder,emptyText,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const[query,setQuery]=useState4("");const ref=useDismiss(open,()=>setOpen(false));const current=options.find(o=>o.value===value);const results=useMemo2(()=>{const q=query.trim();if(!q)return options;return options.filter(o=>o.label.includes(q)||o.meta?.includes(q))},[options,query]);return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsx7(Label,{id,children:label}),jsxs7("div",{ref,className:"relative",children:[jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>{setOpen(v=>!v);setQuery("")},className:cn(TRIGGER,open?"border-brand":"border-border hover:border-brand"),children:[jsx7("span",{className:cn("flex-1 min-w-0 text-start truncate",!current&&"text-muted2"),children:current?.label??placeholder??ui.select}),current?.meta&&jsx7("span",{className:"text-caption text-muted shrink-0",children:current.meta}),jsx7(ChevronDown2,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform",open&&"rotate-180")})]}),open&&jsxs7("div",{className:PANEL,children:[jsxs7("div",{className:"flex items-center gap-2.5 px-3 h-11 border-b border-line",children:[jsx7(Search,{size:15,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:searchPlaceholder??ui.search,"aria-label":searchPlaceholder??ui.search,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-ui text-ink placeholder:text-muted2"}),query&&jsx7("button",{type:"button",onClick:()=>setQuery(""),"aria-label":ui.clearSearch,className:"shrink-0 text-muted2 hover:text-ink cursor-pointer transition-colors",children:jsx7(X2,{size:14,"aria-hidden":"true"})}),jsx7("kbd",{dir:"ltr",className:"shrink-0 px-1.5 py-0.5 rounded-xs bg-bg border border-line text-micro font-bold text-muted2",children:"Esc"})]}),jsxs7("div",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:[results.map(o=>jsxs7("button",{type:"button",role:"option","aria-selected":o.value===value,onClick:()=>{onChange(o.value);setOpen(false)},className:cn(ITEM,o.value===value&&"bg-soft"),children:[jsxs7("span",{className:"flex-1 min-w-0 flex flex-col",children:[jsx7("span",{className:"font-bold truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted",children:o.meta})]}),o.value===value&&jsx7(Check2,{size:14,className:"text-brand-ink shrink-0","aria-hidden":"true"})]},o.value)),results.length===0&&jsx7("span",{className:"block px-3 py-6 text-center text-ui text-muted2",children:emptyText??ui.noResults})]})]})]})]})}function MultiSelect({label,values,onChange,options,placeholder,createLabel,onCreate,className}){const ui=useUIText();const id=useId2();const[open,setOpen]=useState4(false);const[query,setQuery]=useState4("");const ref=useDismiss(open,()=>setOpen(false));const results=useMemo2(()=>{const q=query.trim();if(!q)return options;return options.filter(o=>o.label.includes(q))},[options,query]);const exact=results.some(o=>o.label===query.trim());const canCreate=Boolean(onCreate&&query.trim()&&!exact);function toggle(v){onChange(values.includes(v)?values.filter(x=>x!==v):[...values,v])}return jsxs7("div",{className:cn("flex flex-col gap-1.5",className),children:[jsxs7("div",{className:"flex items-center justify-between gap-3",children:[jsx7(Label,{id,children:label}),values.length>0&&jsx7("button",{type:"button",onClick:()=>onChange([]),className:"text-caption font-bold text-muted cursor-pointer hover:text-ink transition-colors",children:ui.clearAll})]}),jsxs7("div",{ref,className:"relative",children:[jsxs7("div",{className:cn(TRIGGER,"h-auto min-h-10 py-1.5 flex-wrap cursor-default",open?"border-brand":"border-border hover:border-brand","has-[:focus-visible]:border-brand"),children:[values.map(v=>{const o=options.find(x=>x.value===v);return jsxs7("span",{className:"inline-flex items-center gap-1 h-7 ps-2.5 pe-1.5 rounded-full bg-soft text-brand-ink text-caption font-bold",children:[o?.label??v,jsx7("button",{type:"button","aria-label":`${ui.remove} ${o?.label??v}`,onClick:e=>{e.stopPropagation();toggle(v)},className:"flex text-brand-ink/60 hover:text-brand-ink cursor-pointer",children:jsx7(X2,{size:12,strokeWidth:2.5,"aria-hidden":"true"})})]},v)}),jsxs7("button",{id,type:"button","aria-haspopup":"listbox","aria-expanded":open,onClick:()=>setOpen(v=>!v),className:"flex-1 min-w-12 self-stretch flex items-center gap-2.5 text-start cursor-pointer outline-none",children:[values.length===0&&jsx7("span",{className:"text-muted2 flex-1 text-start",children:placeholder??ui.select}),jsx7(ChevronDown2,{size:15,"aria-hidden":"true",className:cn("text-muted2 shrink-0 ms-auto transition-transform",open&&"rotate-180")})]})]}),open&&jsxs7("div",{className:PANEL,children:[jsxs7("div",{className:"flex items-center gap-2.5 px-3 h-11 border-b border-line",children:[jsx7(Search,{size:15,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:ui.searchOrAdd,"aria-label":ui.searchOrAdd,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-ui text-ink placeholder:text-muted2"})]}),jsxs7("div",{role:"listbox","aria-multiselectable":true,className:"max-h-56 overflow-y-auto py-1",children:[results.map(o=>{const on=values.includes(o.value);return jsxs7("button",{type:"button",role:"option","aria-selected":on,onClick:()=>toggle(o.value),className:ITEM,children:[jsx7("span",{"aria-hidden":"true",className:cn("size-[18px] rounded-xs border-[1.5px] flex items-center justify-center shrink-0 transition-colors",on?"bg-brand border-brand":"bg-surface border-border"),children:jsx7(Check2,{size:11,strokeWidth:3,className:cn("text-white",!on&&"opacity-0")})}),jsx7("span",{className:"flex-1 min-w-0 truncate",children:o.label}),o.meta&&jsx7("span",{className:"text-caption text-muted2 shrink-0",children:o.meta})]},o.value)}),canCreate&&jsxs7("button",{type:"button",onClick:()=>{onCreate?.(query.trim());setQuery("")},className:cn(ITEM,"text-brand-ink font-bold border-t border-line mt-1 pt-3"),children:[jsx7(Plus2,{size:14,"aria-hidden":"true",className:"shrink-0"}),createLabel?createLabel(query.trim()):`\u0623\u0636\u0641 \xAB${query.trim()}\xBB`]}),results.length===0&&!canCreate&&jsx7("span",{className:"block px-3 py-6 text-center text-ui text-muted2",children:ui.noResults})]})]})]})]})}function CommandPalette({open,onClose,items,placeholder,emptyText}){const ui=useUIText();const[query,setQuery]=useState4("");useEffect4(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);const groups=useMemo2(()=>{const q=query.trim();const hits=q?items.filter(i=>i.title.includes(q)||i.meta?.includes(q)):items;const out=new Map;for(const i of hits)out.set(i.group,[...out.get(i.group)??[],i]);return[...out.entries()]},[items,query]);if(!open)return null;return jsxs7("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] px-4",role:"dialog","aria-modal":"true",children:[jsx7("button",{type:"button","aria-label":ui.close,onClick:onClose,className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] cursor-default"}),jsxs7("div",{className:"relative w-full max-w-[560px] bg-surface border border-line rounded-lg shadow-modal overflow-clip animate-[fade-in_.16s_ease-out]",children:[jsxs7("div",{className:"flex items-center gap-3 px-4 h-14 border-b border-line",children:[jsx7(Search,{size:17,className:"text-muted2 shrink-0","aria-hidden":"true"}),jsx7("input",{autoFocus:true,value:query,onChange:e=>setQuery(e.target.value),placeholder:placeholder??ui.searchEverything,"aria-label":placeholder??ui.searchEverything,className:"flex-1 min-w-0 bg-transparent border-none outline-none text-body text-ink placeholder:text-muted2"}),jsx7("kbd",{dir:"ltr",className:"shrink-0 px-1.5 py-0.5 rounded-xs bg-bg border border-line text-micro font-bold text-muted2",children:"Esc"})]}),jsxs7("div",{className:"max-h-[52vh] overflow-y-auto py-2",children:[groups.map(([group2,list])=>jsxs7("div",{className:"flex flex-col",children:[jsx7("span",{className:"px-4 pt-2 pb-1 text-micro font-extrabold text-muted2 tracking-wide",children:group2}),list.map(i=>jsxs7("button",{type:"button",onClick:()=>{i.onRun?.();onClose()},className:"px-4 py-2.5 flex items-center gap-3 text-start cursor-pointer transition-colors hover:bg-hover",children:[i.icon&&jsx7("span",{className:"text-muted shrink-0",children:i.icon}),jsx7("span",{className:"flex-1 min-w-0 text-body font-bold text-ink truncate",children:i.title}),i.meta&&jsx7("span",{className:"text-caption text-muted2 shrink-0",children:i.meta})]},i.id))]},group2)),groups.length===0&&jsx7("span",{className:"block px-4 py-10 text-center text-ui text-muted2",children:emptyText??ui.noResults})]})]})]})}import{useState as useState5}from"react";import{Check as Check3,ChevronDown as ChevronDown3}from"lucide-react";import{Fragment as Fragment2,jsx as jsx8,jsxs as jsxs8}from"react/jsx-runtime";function Accordion({items,mode="single",defaultOpen=[],className}){const[open,setOpen]=useState5(defaultOpen);function toggle(key){setOpen(prev=>{if(prev.includes(key))return prev.filter(k=>k!==key);return mode==="single"?[key]:[...prev,key]})}return jsx8("div",{className:cn("bg-surface border border-line rounded-card overflow-clip",className),children:items.map(it=>{const on=open.includes(it.key);return jsxs8("div",{className:"border-b border-line last:border-0",children:[jsxs8("button",{type:"button","aria-expanded":on,onClick:()=>toggle(it.key),className:"w-full px-4 py-3.5 flex items-center gap-3 text-start cursor-pointer transition-colors hover:bg-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",children:[it.icon&&jsx8("span",{"aria-hidden":"true",className:"size-8 rounded-sm bg-soft text-brand-ink flex items-center justify-center shrink-0",children:jsx8(it.icon,{size:15})}),jsxs8("span",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsx8("span",{className:"text-body font-extrabold text-ink",children:it.title}),it.description&&jsx8("span",{className:"text-caption text-muted",children:it.description})]}),jsx8(ChevronDown3,{size:16,"aria-hidden":"true",className:cn("text-muted2 shrink-0 transition-transform duration-200",on&&"rotate-180")})]}),jsx8("div",{className:cn("grid transition-[grid-template-rows] duration-200 ease-out",on?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx8("div",{className:"min-h-0 overflow-clip",children:jsx8("div",{className:"px-4 pb-4 pt-0.5 text-ui leading-[1.85] text-ink2",children:it.children})})})]},it.key)})})}function Timeline({steps,current,nowLabel,className}){const ui=useUIText();return jsx8("ol",{className:cn("flex flex-col m-0 p-0 list-none",className),children:steps.map((s,i)=>{const done=i<current;const active=i===current;const last=i===steps.length-1;return jsxs8("li",{className:"flex gap-3",children:[jsxs8("span",{className:"flex flex-col items-center shrink-0",children:[jsx8("span",{"aria-hidden":"true",className:cn("size-7 rounded-full flex items-center justify-center border-2 transition-colors",done&&"bg-brand border-brand text-white",active&&"bg-surface border-brand text-brand-ink",!done&&!active&&"bg-surface border-border text-muted2"),children:done?jsx8(Check3,{size:14,strokeWidth:3}):jsx8("span",{className:cn("size-2 rounded-full",active?"bg-brand":"bg-border")})}),!last&&jsx8("span",{"aria-hidden":"true",className:cn("w-0.5 flex-1 min-h-8 transition-colors",done?"bg-brand":"bg-line")})]}),jsxs8("span",{className:cn("flex flex-col gap-0.5 min-w-0",last?"pb-0":"pb-5"),children:[jsxs8("span",{className:"flex items-center gap-2.5 flex-wrap",children:[jsx8("span",{className:cn("text-body font-extrabold",done||active?"text-ink":"text-muted2"),children:s.title}),s.time&&jsx8("span",{"data-num":true,className:"text-micro text-muted2",children:s.time}),active&&jsx8("span",{className:cn("px-2 py-0.5 rounded-full text-micro font-extrabold",TONE_SOFT[s.tone??"brand"]),children:nowLabel??ui.now})]}),s.note&&jsx8("span",{className:"text-caption leading-[1.7] text-muted",children:s.note})]})]},s.key)})})}function Stepper({steps,done,onPick,className}){return jsx8("ol",{className:cn("flex items-start gap-1 m-0 p-0 list-none",className),children:steps.map((s,i)=>{const on=done.includes(s.key);const isCurrent=!on&&steps.slice(0,i).every(x=>done.includes(x.key));const last=i===steps.length-1;const Tag=onPick?"button":"div";return jsxs8("li",{className:"flex-1 flex flex-col items-center gap-2 min-w-0",children:[jsxs8("span",{className:"w-full flex items-center gap-1",children:[jsx8("span",{"aria-hidden":"true",className:cn("h-0.5 flex-1 rounded-full",i===0?"bg-transparent":on?"bg-brand":"bg-line")}),jsx8(Tag,{...onPick?{type:"button",onClick:()=>onPick(s.key)}:{},"aria-current":isCurrent?"step":void 0,className:cn("size-8 rounded-full flex items-center justify-center shrink-0 border-2 transition-colors",on?"bg-brand border-brand text-white":"bg-surface border-border text-muted",onPick&&"cursor-pointer hover:border-brand"),children:on?jsxs8(Fragment2,{children:[jsx8(Check3,{size:15,strokeWidth:3,"aria-hidden":"true"}),jsx8("span",{className:"sr-only",children:"\u0645\u0643\u062A\u0645\u0644\u0629"})]}):jsx8("span",{"data-num":true,className:"text-caption font-extrabold",children:i+1})}),jsx8("span",{"aria-hidden":"true",className:cn("h-0.5 flex-1 rounded-full",last?"bg-transparent":on?"bg-brand":"bg-line")})]}),jsx8("span",{className:cn("text-caption font-bold text-center leading-tight [text-wrap:balance]",on?"text-ink":"text-muted"),children:s.title})]},s.key)})})}import{Star}from"lucide-react";import{jsx as jsx9,jsxs as jsxs9}from"react/jsx-runtime";var MAX=5;function Stars({value,size=13,className}){const n=Math.max(0,Math.min(MAX,Math.round(value)));return jsxs9("span",{className:cn("flex items-center gap-0.5 shrink-0",className),children:[jsx9("span",{className:"sr-only",children:`${n} / ${MAX}`}),Array.from({length:MAX},(_,i)=>jsx9(Star,{size,"aria-hidden":"true",className:cn("shrink-0",i<n?"fill-amber text-amber":"text-muted2")},i))]})}function RatingInput({value,onChange,disabled,hideValue,className}){const ui=useUIText();return jsxs9("span",{className:cn("flex items-center gap-1",className),children:[Array.from({length:MAX},(_,i)=>{const n=i+1;return jsx9("button",{type:"button",disabled,"aria-pressed":value===n,"aria-label":`${n} / ${MAX} \u2014 ${ui.rating}`,onClick:()=>onChange(n),className:cn("size-9 rounded-sm flex items-center justify-center transition-colors","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",disabled?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-hover"),children:jsx9(Star,{size:22,"aria-hidden":"true",className:cn("shrink-0",n<=value?"fill-amber text-amber":"text-muted2")})},n)}),!hideValue&&value>0&&jsx9("span",{"data-numeric":true,className:"ms-2 text-caption font-bold text-muted",children:`${value}/${MAX}`})]})}import{useRef as useRef5,useState as useState6}from"react";import{AlertCircle,Check as Check4,Image as ImageIcon,Loader2 as Loader23,UploadCloud,X as X3}from"lucide-react";import{jsx as jsx10,jsxs as jsxs10}from"react/jsx-runtime";function formatBytes(bytes){if(bytes<1024)return`${bytes} \u0628\u0627\u064A\u062A`;if(bytes<1024*1024)return`${Math.round(bytes/1024)} \u0643.\u0628`;return`${(bytes/(1024*1024)).toFixed(1)} \u0645\u064A\u062C\u0627`}function Dropzone({onFiles,accept="image/*",multiple=true,disabled,title,hint,buttonLabel,className}){const ui=useUIText();const input=useRef5(null);const[over,setOver]=useState6(false);function take(list){if(!list||disabled)return;onFiles(Array.from(list))}function onDrop(e){e.preventDefault();setOver(false);take(e.dataTransfer.files)}return jsxs10("div",{onDragOver:e=>{e.preventDefault();if(!disabled)setOver(true)},onDragLeave:()=>setOver(false),onDrop,className:cn("flex flex-col items-center justify-center gap-2.5 px-5 py-9 rounded-card border-2 border-dashed transition-colors text-center",disabled&&"opacity-55 cursor-not-allowed border-border bg-bg",!disabled&&over&&"border-brand bg-soft",!disabled&&!over&&"border-border bg-bg hover:border-brand",className),children:[jsx10("span",{"aria-hidden":"true",className:cn("size-12 rounded-card flex items-center justify-center transition-colors",over?"bg-brand text-white":"bg-surface text-muted border border-line"),children:jsx10(UploadCloud,{size:22,strokeWidth:1.8})}),jsx10("span",{className:"text-body font-extrabold text-ink",children:title??ui.dropImages}),hint&&jsx10("span",{className:"text-caption leading-[1.7] text-muted max-w-note",children:hint}),jsx10("button",{type:"button",disabled,onClick:()=>input.current?.click(),className:"mt-1 h-9 px-4 rounded-sm bg-surface border border-border text-ui font-bold text-ink2 cursor-pointer transition-colors hover:border-brand hover:text-brand-ink disabled:cursor-not-allowed",children:buttonLabel??ui.chooseFromDevice}),jsx10("input",{ref:input,type:"file",accept,multiple,hidden:true,onChange:e=>{take(e.target.files);e.target.value=""}})]})}var STATE_STYLE={uploading:{box:"bg-soft text-brand-ink",icon:jsx10(Loader23,{size:13,className:"animate-spin","aria-hidden":"true"}),label:"\u062C\u0627\u0631\u064A \u0627\u0644\u0631\u0641\u0639"},done:{box:"bg-green-bg2 text-green",icon:jsx10(Check4,{size:13,"aria-hidden":"true"}),label:"\u062A\u0645 \u0627\u0644\u0631\u0641\u0639"},rejected:{box:"bg-red-bg text-red",icon:jsx10(AlertCircle,{size:13,"aria-hidden":"true"}),label:"\u0645\u0631\u0641\u0648\u0636"}};function FileRow({file,onRemove,coverLabel,isCover}){const s=STATE_STYLE[file.state];return jsxs10("div",{className:"flex items-center gap-3 p-2.5 rounded-card border border-line bg-surface",children:[jsxs10("span",{className:"relative size-11 rounded-sm overflow-clip bg-hover border border-line shrink-0",children:[file.preview?jsx10("img",{src:file.preview,alt:"",className:"w-full h-full object-cover"}):jsx10("span",{className:"w-full h-full flex items-center justify-center text-muted2",children:jsx10(ImageIcon,{size:17,"aria-hidden":"true"})}),isCover&&coverLabel&&jsx10("span",{className:"absolute inset-x-0 bottom-0 bg-brand/90 text-white text-micro font-extrabold text-center py-px",children:coverLabel})]}),jsxs10("span",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[jsxs10("span",{className:"flex items-center gap-2 min-w-0",children:[jsx10("span",{dir:"auto",className:"text-ui font-bold text-ink truncate",children:file.name}),jsxs10("span",{className:cn("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-micro font-extrabold shrink-0",s.box),children:[s.icon,s.label]})]}),file.state==="uploading"?jsx10("span",{className:"h-1 rounded-full bg-hover overflow-clip block",children:jsx10("span",{className:"block h-full rounded-full bg-brand transition-[width] duration-200",style:{width:`${file.progress??0}%`}})}):jsx10("span",{className:cn("text-caption",file.state==="rejected"?"text-red":"text-muted"),children:file.state==="rejected"?file.error:formatBytes(file.size)})]}),onRemove&&jsx10("button",{type:"button",onClick:onRemove,"aria-label":`\u0625\u0632\u0627\u0644\u0629 ${file.name}`,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted2 cursor-pointer transition-colors hover:bg-hover hover:text-red",children:jsx10(X3,{size:15,"aria-hidden":"true"})})]})}import{useCallback as useCallback2,useEffect as useEffect5,useLayoutEffect,useRef as useRef6,useState as useState7}from"react";import{jsx as jsx11}from"react/jsx-runtime";function reducedMotion(){return typeof window!=="undefined"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function useSortable({count,onMove,disabled,threshold=4,itemLabel}){const ui=useUIText();const nodes=useRef6([]);const rects=useRef6([]);const[dragging,setDragging]=useState7(null);const[over,setOver]=useState7(null);const[grabbed,setGrabbed]=useState7(null);const[message,setMessage]=useState7("");const run=useRef6({active:false,from:0,to:0,startY:0,dy:0,slot:0,raf:0,pointerId:-1});const overRef=useRef6(null);useEffect5(()=>{overRef.current=over},[over]);const detach=useRef6(null);const finishRef=useRef6(()=>{});const countRef=useRef6(count);useEffect5(()=>{countRef.current=count},[count]);const soft=!reducedMotion();const EASE="cubic-bezier(.2,.8,.2,1)";const measure=useCallback2(()=>{const list=nodes.current.slice(0,count);rects.current=list.map(el=>{const r=el?.getBoundingClientRect();return{top:r?.top??0,height:r?.height??0}});const gap=rects.current.length>1?Math.max(0,rects.current[1].top-(rects.current[0].top+rects.current[0].height)):0;return gap},[count]);const finish=useCallback2(()=>{const s=run.current;if(!s.active)return;s.active=false;cancelAnimationFrame(s.raf);detach.current?.();detach.current=null;const from=s.from;const to=overRef.current??from;const el=nodes.current[from];const settle=()=>{setDragging(null);setOver(null);overRef.current=null;if(el){el.style.transition="";el.style.removeProperty("--drag-y")}if(to!==from){onMove(from,to);setMessage(`${itemLabel?.(from)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0627\u0646\u062A\u0642\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0636\u0639 ${to+1} \u0645\u0646 ${count}.`)}};if(!el||!soft||to===from)return settle();const r=rects.current;const target=to>from?r[to].top+r[to].height-(r[from].top+r[from].height):r[to].top-r[from].top;el.style.transition=`transform 190ms ${EASE}`;el.style.setProperty("--drag-y",`${target}px`);window.setTimeout(settle,200)},[count,itemLabel,onMove,soft]);useEffect5(()=>{finishRef.current=finish},[finish]);const clamp2=useCallback2((dy,from)=>{const r=rects.current;const last=r[r.length-1];if(!r.length||!r[from]||!last)return dy;const min=r[0].top-r[from].top;const max=last.top+last.height-(r[from].top+r[from].height);return Math.min(Math.max(dy,min),max)},[]);const attach=useCallback2(()=>{function onPointerMove(e){const s=run.current;if(!s.active||e.pointerId!==s.pointerId)return;s.dy=e.clientY-s.startY;const r=rects.current;const n=countRef.current;const center=r[s.from].top+r[s.from].height/2+s.dy;let next=s.from;if(s.dy>0){for(let i=s.from+1;i<n;i++){if(center>r[i].top+r[i].height/2)next=i}}else{for(let i=s.from-1;i>=0;i--){if(center<r[i].top+r[i].height/2)next=i}}if(next!==overRef.current){overRef.current=next;setOver(next)}cancelAnimationFrame(s.raf);s.raf=requestAnimationFrame(()=>{nodes.current[s.from]?.style.setProperty("--drag-y",`${clamp2(s.dy,s.from)}px`)})}function onUp(e){if(e.pointerId!==run.current.pointerId)return;finishRef.current()}function onKey(e){if(e.key==="Escape"){overRef.current=run.current.from;finishRef.current()}}window.addEventListener("pointermove",onPointerMove,{passive:true});window.addEventListener("pointerup",onUp);window.addEventListener("pointercancel",onUp);window.addEventListener("keydown",onKey);detach.current=()=>{window.removeEventListener("pointermove",onPointerMove);window.removeEventListener("pointerup",onUp);window.removeEventListener("pointercancel",onUp);window.removeEventListener("keydown",onKey)}},[clamp2]);useEffect5(()=>()=>detach.current?.(),[]);useLayoutEffect(()=>{if(grabbed!==null)nodes.current[grabbed]?.focus()},[grabbed]);const item=useCallback2(index=>{const isDragged=dragging===index;const isGrabbed=grabbed===index;let shift=0;if(dragging!==null&&over!==null&&!isDragged){const slot=run.current.slot;if(over>dragging&&index>dragging&&index<=over)shift=-slot;else if(over<dragging&&index>=over&&index<dragging)shift=slot}const style=isDragged?{transform:"translate3d(0, var(--drag-y, 0px), 0)",position:"relative",zIndex:20,cursor:"grabbing",touchAction:"none",willChange:"transform"}:{transform:shift?`translate3d(0, ${shift}px, 0)`:void 0,transition:dragging!==null&&soft?`transform 160ms ${EASE}`:void 0,touchAction:disabled?void 0:"none"};return{ref:el=>{nodes.current[index]=el},style,tabIndex:disabled?-1:0,"aria-roledescription":ui.grabHint,"data-dragging":isDragged?"":void 0,"data-grabbed":isGrabbed?"":void 0,onPointerDown:e=>{if(disabled||e.button!==0)return;const startY=e.clientY;const el=e.currentTarget;const begin=ev=>{if(Math.abs(ev.clientY-startY)<threshold)return;window.removeEventListener("pointermove",begin);const gap=measure();const s=run.current;s.active=true;s.from=index;s.startY=startY;s.dy=ev.clientY-startY;s.slot=rects.current[index].height+gap;s.pointerId=ev.pointerId;el.setPointerCapture?.(ev.pointerId);el.style.setProperty("--drag-y",`${clamp2(s.dy,index)}px`);overRef.current=index;attach();setOver(index);setDragging(index);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0642\u064A\u062F \u0627\u0644\u062A\u062D\u0631\u064A\u0643.`)};const stop=()=>{window.removeEventListener("pointermove",begin);window.removeEventListener("pointerup",stop)};window.addEventListener("pointermove",begin);window.addEventListener("pointerup",stop)},onKeyDown:e=>{if(disabled)return;if(e.key===" "||e.key==="Enter"){e.preventDefault();if(grabbed===index){setGrabbed(null);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0627\u0633\u062A\u0642\u0631\u0651 \u0641\u064A \u0627\u0644\u0645\u0648\u0636\u0639 ${index+1}.`)}else{setGrabbed(index);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0645\u0645\u0633\u0648\u0643. \u062D\u0631\u0651\u0643\u0647 \u0628\u0627\u0644\u0623\u0633\u0647\u0645.`)}return}if(grabbed!==index)return;const dir=e.key==="ArrowUp"?-1:e.key==="ArrowDown"?1:0;if(dir){e.preventDefault();const to=index+dir;if(to<0||to>=count)return;onMove(index,to);setGrabbed(to);setMessage(`${itemLabel?.(index)??"\u0627\u0644\u0639\u0646\u0635\u0631"} \u0641\u064A \u0627\u0644\u0645\u0648\u0636\u0639 ${to+1} \u0645\u0646 ${count}.`)}if(e.key==="Escape"){e.preventDefault();setGrabbed(null);setMessage("\u0623\u064F\u0644\u063A\u064A \u0627\u0644\u062A\u062D\u0631\u064A\u0643.")}}}},[attach,clamp2,count,disabled,dragging,grabbed,itemLabel,measure,onMove,over,soft,threshold,ui.grabHint]);return{item,dragging,grabbed,over,message}}function SortableStatus({message}){return jsx11("span",{role:"status","aria-live":"polite",className:"sr-only",children:message})}import{Children,useCallback as useCallback3,useEffect as useEffect6,useRef as useRef7,useState as useState8}from"react";import{ChevronLeft,ChevronRight,Pause,Play,X as X4,ZoomIn}from"lucide-react";import{jsx as jsx12,jsxs as jsxs11}from"react/jsx-runtime";function axis(track){const rtl=getComputedStyle(track).direction==="rtl";return{rtl,start:r=>rtl?-r.right:r.left,end:r=>rtl?-r.left:r.right}}var EDGE=1;function readTrack(track){const slides=Array.from(track.children);if(slides.length===0)return{index:0,atStart:true,atEnd:true};const{start,end}=axis(track);const box=track.getBoundingClientRect();const from=start(box);let index=0;let best=Infinity;slides.forEach((el,i)=>{const d=start(el.getBoundingClientRect())-from;const score=d<0?-d:d;if(score<best){best=score;index=i}});return{index,atStart:start(slides[0].getBoundingClientRect())>=from-EDGE,atEnd:end(slides[slides.length-1].getBoundingClientRect())<=end(box)+EDGE}}function scrollToIndex(track,i,behavior){const el=track.children[i];if(!el)return;const{rtl}=axis(track);const box=track.getBoundingClientRect();const r=el.getBoundingClientRect();track.scrollBy({left:rtl?r.right-box.right:r.left-box.left,behavior})}function ease(){return typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}var BASIS="calc((100% - (var(--per) - 1) * var(--gap)) / var(--per))";function Carousel({label,children,perView,gap=12,arrows=true,dots=false,counter=false,autoplay,index,onIndexChange,className,trackClassName}){const en=useMoneyLang();const trackRef=useRef7(null);const[state,setState]=useState8({index:0,atStart:true,atEnd:true});const[paused,setPaused]=useState8(false);const[held,setHeld]=useState8(false);const slides=Children.toArray(children);const count=slides.length;const latest=useRef7(state);const notify=useRef7(onIndexChange);useEffect6(()=>{latest.current=state},[state]);useEffect6(()=>{notify.current=onIndexChange},[onIndexChange]);const measure=useCallback3(()=>{const track=trackRef.current;if(!track)return;const next=readTrack(track);setState(prev=>prev.index===next.index&&prev.atStart===next.atStart&&prev.atEnd===next.atEnd?prev:next)},[]);const target=useRef7(0);const go=useCallback3(to=>{const track=trackRef.current;if(!track)return;const i=Math.min(Math.max(to,0),track.children.length-1);target.current=i;scrollToIndex(track,i,ease())},[]);const first=useRef7(true);const told=useRef7(null);useEffect6(()=>{const track=trackRef.current;if(index==null||!track)return;if(index===told.current)return;target.current=index;scrollToIndex(track,index,first.current?"auto":ease())},[index]);useEffect6(()=>{const track=trackRef.current;if(!track)return;let frame=0;let idle;const onScroll=()=>{cancelAnimationFrame(frame);frame=requestAnimationFrame(measure);clearTimeout(idle);idle=setTimeout(()=>{const t=trackRef.current;if(t)target.current=readTrack(t).index},140)};track.addEventListener("scroll",onScroll,{passive:true});const ro=new ResizeObserver(onScroll);ro.observe(track);measure();first.current=false;return()=>{cancelAnimationFrame(frame);clearTimeout(idle);track.removeEventListener("scroll",onScroll);ro.disconnect()}},[measure,count]);useEffect6(()=>{if(told.current===state.index)return;const knew=told.current!==null;told.current=state.index;if(knew||state.index!==(index??0))notify.current?.(state.index)},[state.index,index]);useEffect6(()=>{if(!autoplay||paused||held||count<2)return;if(typeof matchMedia!=="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches){return}const id=setInterval(()=>{const track=trackRef.current;if(!track||document.hidden)return;const now=latest.current;scrollToIndex(track,now.atEnd?0:now.index+1,ease())},autoplay);return()=>clearInterval(id)},[autoplay,paused,held,count]);function onKeyDown(e){const track=trackRef.current;if(!track)return;const{rtl}=axis(track);const forward=rtl?"ArrowLeft":"ArrowRight";const back=rtl?"ArrowRight":"ArrowLeft";const to=e.key===forward?target.current+1:e.key===back?target.current-1:e.key==="Home"?0:e.key==="End"?count-1:null;if(to===null)return;e.preventDefault();go(to)}const many=count>1;const showArrows=arrows&&many;const showBar=many&&(dots||counter||Boolean(autoplay));const arrow=back=>jsx12("button",{type:"button",disabled:back?state.atStart:state.atEnd,"aria-label":back?en?"Previous":"\u0627\u0644\u0633\u0627\u0628\u0642":en?"Next":"\u0627\u0644\u062A\u0627\u0644\u064A",onClick:()=>go(back?target.current-1:target.current+1),className:cn("absolute top-1/2 -translate-y-1/2 z-10 size-9 rounded-full flex items-center justify-center","bg-surface/92 backdrop-blur border border-line shadow-pop text-ink2","transition-opacity cursor-pointer hover:text-brand-ink","disabled:opacity-0 disabled:pointer-events-none",back?"start-2":"end-2"),children:back?jsx12(ChevronRight,{size:17,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"}):jsx12(ChevronLeft,{size:17,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"})});return jsxs11("section",{"aria-roledescription":en?"carousel":"\u0639\u0627\u0631\u0636 \u0634\u0631\u0627\u0626\u062D","aria-label":label,onPointerEnter:()=>autoplay&&setHeld(true),onPointerLeave:()=>autoplay&&setHeld(false),onFocusCapture:()=>autoplay&&setHeld(true),onBlurCapture:()=>autoplay&&setHeld(false),className:cn("flex flex-col gap-3 [--per:1]",className),style:{"--gap":`${gap}px`,...perView===void 0?null:{"--per":String(perView)}},children:[jsxs11("div",{className:"relative",children:[jsx12("div",{ref:trackRef,tabIndex:0,role:"group","aria-label":en?"Slides":"\u0627\u0644\u0634\u0631\u0627\u0626\u062D",onKeyDown,className:cn("flex overflow-x-auto overscroll-x-contain snap-x snap-mandatory","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","rounded-card focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",trackClassName),style:{gap:"var(--gap)"},children:slides.map((slide,i)=>jsx12("div",{role:"group","aria-roledescription":en?"slide":"\u0634\u0631\u064A\u062D\u0629","aria-label":en?`${i+1} of ${count}`:`${i+1} \u0645\u0646 ${count}`,className:"snap-start shrink-0 grow-0 min-w-0 relative",style:{flexBasis:BASIS},children:slide},i))}),showArrows&&arrow(true),showArrows&&arrow(false)]}),showBar&&jsxs11("div",{className:"flex items-center justify-center gap-3",children:[autoplay&&jsx12("button",{type:"button",onClick:()=>setPaused(p=>!p),"aria-label":paused?en?"Start auto-rotation":"\u0634\u063A\u0651\u0644 \u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0627\u0644\u062A\u0644\u0642\u0627\u0626\u064A":en?"Stop auto-rotation":"\u0623\u0648\u0642\u0641 \u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0627\u0644\u062A\u0644\u0642\u0627\u0626\u064A",className:"size-7 rounded-full flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:paused?jsx12(Play,{size:13,"aria-hidden":"true"}):jsx12(Pause,{size:13,"aria-hidden":"true"})}),dots&&jsx12("span",{className:"flex items-center gap-1.5",children:slides.map((_,i)=>jsx12("button",{type:"button",onClick:()=>go(i),"aria-label":en?`Go to slide ${i+1}`:`\u0627\u0630\u0647\u0628 \u0644\u0644\u0634\u0631\u064A\u062D\u0629 ${i+1}`,"aria-current":i===state.index||void 0,className:cn("h-1.5 rounded-full transition-all duration-200 cursor-pointer","before:absolute before:-inset-2 relative",i===state.index?"w-5 bg-brand":"w-1.5 bg-border hover:bg-muted2")},i))}),counter&&jsxs11("span",{dir:"ltr","data-num":true,"aria-live":autoplay?void 0:"polite",className:"text-caption font-bold text-muted tabular-nums",children:[state.index+1," / ",count]})]})]})}function Gallery({label,images,ratio="4/3",fit="cover",thumbs=true,zoom=true,className}){const en=useMoneyLang();const[index,setIndex]=useState8(0);const[open,setOpen]=useState8(false);const activeThumb=useRef7(null);useEffect6(()=>{activeThumb.current?.scrollIntoView({inline:"nearest",block:"nearest",behavior:ease()})},[index]);if(images.length===0)return null;const frame={aspectRatio:ratio};const img=(im,decorative)=>jsx12("img",{src:im.src,alt:decorative?"":im.alt,loading:"lazy",decoding:"async",draggable:false,className:cn("w-full h-full",fit==="cover"?"object-cover":"object-contain")});return jsxs11("div",{className:cn("flex flex-col gap-2.5",className),children:[jsx12(Carousel,{label,index,onIndexChange:setIndex,counter:images.length>1,dots:!thumbs&&images.length>1,gap:8,children:images.map((im,i)=>zoom?jsxs11("button",{type:"button",onClick:()=>setOpen(true),"aria-label":`${im.alt} \u2014 ${en?"open viewer":"\u0641\u062A\u062D \u0627\u0644\u0639\u0627\u0631\u0636"}`,style:frame,className:"group relative block w-full overflow-clip rounded-card bg-hover cursor-zoom-in",children:[img(im,true),jsx12("span",{"aria-hidden":"true",className:"absolute top-2 end-2 size-7 rounded-full bg-black/45 backdrop-blur text-white flex items-center justify-center opacity-70 transition-opacity group-hover:opacity-100",children:jsx12(ZoomIn,{size:14})})]},i):jsx12("div",{style:frame,className:"overflow-clip rounded-card bg-hover",children:img(im,false)},i))}),thumbs&&images.length>1&&jsx12("div",{role:"group","aria-label":en?"Thumbnails":"\u0627\u0644\u0645\u0635\u063A\u0651\u0631\u0627\u062A",className:"flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:images.map((im,i)=>jsx12("button",{ref:i===index?activeThumb:void 0,type:"button",onClick:()=>setIndex(i),"aria-current":i===index||void 0,"aria-label":en?`Image ${i+1}`:`\u0627\u0644\u0635\u0648\u0631\u0629 ${i+1}`,className:cn("shrink-0 size-14 rounded-sm overflow-clip border-2 bg-hover cursor-pointer transition-colors",i===index?"border-brand":"border-line hover:border-border"),children:jsx12("img",{src:im.src,alt:"",loading:"lazy",decoding:"async",draggable:false,className:"w-full h-full object-cover"})},i))}),zoom&&jsx12(Lightbox,{open,images,index,onIndexChange:setIndex,onClose:()=>setOpen(false),label})]})}function Lightbox({open,images,index,onIndexChange,onClose,label,closeLabel}){const ui=useUIText();const en=useMoneyLang();const panel=useRef7(null);const count=images.length;useEffect6(()=>{if(!open)return;const from=document.activeElement;panel.current?.focus();return()=>from?.focus?.()},[open]);useEffect6(()=>{if(!open)return;function onKey(e){const rtl=getComputedStyle(document.documentElement).direction==="rtl";const forward=rtl?"ArrowLeft":"ArrowRight";const back=rtl?"ArrowRight":"ArrowLeft";if(e.key==="Escape")onClose();else if(e.key===forward)onIndexChange(Math.min(index+1,count-1));else if(e.key===back)onIndexChange(Math.max(index-1,0));else if(e.key==="Home")onIndexChange(0);else if(e.key==="End")onIndexChange(count-1)}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,index,count,onClose,onIndexChange]);if(!open||count===0)return null;const current=images[Math.min(Math.max(index,0),count-1)];const step=back=>jsx12("button",{type:"button",disabled:back?index===0:index>=count-1,onClick:()=>onIndexChange(back?index-1:index+1),"aria-label":back?en?"Previous":"\u0627\u0644\u0633\u0627\u0628\u0642":en?"Next":"\u0627\u0644\u062A\u0627\u0644\u064A",className:cn("absolute top-1/2 -translate-y-1/2 z-10 size-11 rounded-full flex items-center justify-center","bg-white/10 backdrop-blur text-white transition-opacity cursor-pointer hover:bg-white/20","disabled:opacity-0 disabled:pointer-events-none",back?"start-3":"end-3"),children:back?jsx12(ChevronRight,{size:20,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"}):jsx12(ChevronLeft,{size:20,className:"rtl:rotate-0 ltr:rotate-180","aria-hidden":"true"})});return jsxs11("div",{ref:panel,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":label??(en?"Image viewer":"\u0639\u0627\u0631\u0636 \u0627\u0644\u0635\u0648\u0631"),className:"fixed inset-0 z-50 bg-night/95 flex flex-col animate-[fade-in_0.18s_ease-out] outline-none",children:[jsxs11("header",{className:"shrink-0 h-14 px-4 flex items-center justify-between gap-3",children:[jsxs11("span",{dir:"ltr","data-num":true,className:"text-caption font-bold text-white/70 tabular-nums",children:[index+1," / ",count]}),jsx12("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"size-9 rounded-full bg-white/10 backdrop-blur flex items-center justify-center text-white transition-colors cursor-pointer hover:bg-white/20",children:jsx12(X4,{size:18,"aria-hidden":"true"})})]}),jsxs11("div",{className:"relative flex-1 min-h-0 flex items-center justify-center p-4 pb-8",children:[jsx12("img",{src:current.src,alt:current.alt,decoding:"async",draggable:false,className:"max-w-full max-h-full object-contain rounded-card animate-qfade"},current.src),count>1&&step(true),count>1&&step(false)]})]})}import{useEffect as useEffect7,useLayoutEffect as useLayoutEffect2,useRef as useRef8,useState as useState9}from"react";import{ChevronLeft as ChevronLeft2,ChevronRight as ChevronRight2,Lock,RotateCw,Signal,Wifi}from"lucide-react";import{jsx as jsx13,jsxs as jsxs12}from"react/jsx-runtime";function BrowserFrame({url,device="desktop",tab,nav,loading,contentWidth,onScale,onReload,children,className}){const ui=useUIText();const mobile=device==="mobile";const viewport=useRef8(null);const[scale,setScale]=useState9(1);const[rtl,setRtl]=useState9(true);useLayoutEffect2(()=>{const box=viewport.current;if(!box||!contentWidth)return setScale(1);setRtl(getComputedStyle(box).direction==="rtl");const read=()=>{const w=box.clientWidth;setScale(w>0?Math.min(1,w/contentWidth):1)};read();const ro=new ResizeObserver(read);ro.observe(box);return()=>ro.disconnect()},[contentWidth]);useEffect7(()=>{onScale?.(scale)},[scale,onScale]);const control="shrink-0 size-6 rounded-full flex items-center justify-center transition-colors";return jsxs12("div",{className:cn("flex flex-col overflow-clip bg-surface border border-line shadow-panel",mobile?"rounded-[30px] border-[7px] border-night":"rounded-lg",className),children:[mobile&&jsxs12("div",{className:"shrink-0 h-7 px-5 flex items-center justify-between bg-bg","aria-hidden":"true",children:[jsxs12("span",{className:"flex items-center gap-1 text-muted2",children:[jsx13(Signal,{size:11}),jsx13(Wifi,{size:11}),jsx13("span",{className:"w-4 h-2 rounded-[2px] border border-muted2"})]}),jsx13("span",{className:"w-16 h-4 rounded-full bg-night"})]}),tab&&!mobile&&jsx13("div",{className:"shrink-0 flex items-end gap-1 px-2.5 pt-2 bg-bg border-b border-line",children:jsxs12("span",{className:"flex items-center gap-2 h-8 max-w-[220px] px-3 rounded-t-sm bg-surface border border-line border-b-0",children:[jsx13("span",{"aria-hidden":"true",className:"size-3 rounded-[3px] bg-soft2 shrink-0"}),jsx13("span",{className:"text-micro text-ink2 truncate",children:tab})]})}),jsxs12("div",{className:cn("relative shrink-0 flex items-center gap-2 bg-bg border-b border-line",mobile?"px-2.5 py-2":"px-3 py-2.5"),children:[!mobile&&!tab&&jsx13("span",{"aria-hidden":"true",className:"flex items-center gap-1.5 shrink-0 me-1",children:[0,1,2].map(i=>jsx13("span",{className:"size-2.5 rounded-full bg-line border border-border/40"},i))}),nav&&!mobile&&jsxs12("span",{className:"flex items-center gap-0.5 shrink-0 text-muted2/60",children:[jsx13("span",{className:cn(control,"cursor-not-allowed"),"aria-hidden":"true",children:jsx13(ChevronRight2,{size:13})}),jsx13("span",{className:cn(control,"cursor-not-allowed"),"aria-hidden":"true",children:jsx13(ChevronLeft2,{size:13})})]}),jsxs12("span",{className:cn("flex-1 min-w-0 flex items-center gap-1.5 rounded-full bg-surface border border-line",mobile?"h-6 px-2.5":"h-7 px-3"),children:[jsx13(Lock,{size:mobile?9:10,className:"text-green shrink-0","aria-hidden":"true"}),jsx13(TechnicalText,{className:cn("truncate text-muted",mobile?"text-[9.5px]":"text-micro"),children:url})]}),onReload&&!mobile&&jsx13("button",{type:"button",onClick:onReload,"aria-label":ui.reloadPreview,className:cn(control,"text-muted2 hover:bg-hover hover:text-ink cursor-pointer"),children:jsx13(RotateCw,{size:12,"aria-hidden":"true",className:cn(loading&&"animate-spin")})}),loading&&jsx13("span",{"aria-hidden":"true",className:"absolute bottom-0 inset-x-0 h-[2px] overflow-clip",children:jsx13("span",{className:"absolute top-0 h-full w-[35%] bg-brand animate-[qload_1.1s_ease-in-out_infinite]"})})]}),jsx13("div",{ref:viewport,className:"relative flex-1 min-h-0 overflow-clip bg-surface",children:contentWidth?jsx13("div",{style:{width:contentWidth,height:`${100/scale}%`,transform:`scale(${scale})`,transformOrigin:`top ${rtl?"right":"left"}`},children}):children}),mobile&&jsx13("span",{"aria-hidden":"true",className:"shrink-0 h-4 bg-bg flex items-center justify-center",children:jsx13("span",{className:"w-24 h-1 rounded-full bg-border/50"})})]})}import"react";import{jsx as jsx14,jsxs as jsxs13}from"react/jsx-runtime";var clamp=(v,lo=0,hi=100)=>Math.min(hi,Math.max(lo,v));var signedString=v=>(v<0?"\u2212":"")+String(Math.abs(v));function WaterfallChart({total,steps,totalLabel,netLabel,formatValue=signedString,className}){const ui=useUIText();const top=Math.max(1,total);const bars=steps.reduce((acc,s)=>{const from=acc.length?acc[acc.length-1].to:total;acc.push({...s,from,to:from+s.value});return acc},[]);const net=bars.length?bars[bars.length-1].to:total;const biggest=bars.reduce((acc,b,i)=>b.value<acc.v?{i,v:b.value}:acc,{i:-1,v:0});return jsxs13("div",{className:cn("flex flex-col",className),children:[jsx14(Line,{label:totalLabel??ui.totalSales,value:total,formatValue,strong:true,children:jsx14("span",{className:"block h-2.5 rounded-full bg-brand"})}),bars.map((b,i)=>{const drop=b.value<0;const lo=clamp(Math.min(b.from,b.to)/top*100);const span=clamp(Math.abs(b.value)/top*100);const worst=i===biggest.i;return jsx14(Line,{label:b.label,meta:b.meta,value:b.value,formatValue,flag:worst?"\u0623\u0643\u0628\u0631 \u062E\u0635\u0645":void 0,children:jsx14("span",{dir:"ltr",className:"relative block h-2.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:cn("absolute inset-y-0 rounded-full",drop?worst?"bg-danger":"bg-brand-100":"bg-green-solid"),style:{insetInlineStart:`${lo}%`,width:`${span}%`}})})},b.key)}),jsx14(Line,{label:netLabel??ui.netToYou,value:net,formatValue,strong:true,net:true,children:jsx14("span",{dir:"ltr",className:"block h-2.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:"block h-full rounded-full bg-green-solid",style:{width:`${clamp(net/top*100)}%`}})})})]})}function Line({label,meta,value,formatValue,flag,strong,net,children}){return jsxs13("div",{className:cn("flex flex-col gap-1.5 py-2.5",net&&"border-t border-line mt-1 pt-3.5"),children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[jsxs13("span",{className:"flex items-baseline gap-2 min-w-0",children:[jsx14("span",{className:cn("truncate",strong?"text-ui font-extrabold text-ink":"text-ui text-muted"),children:label}),flag&&jsx14("span",{className:"shrink-0 text-micro font-bold text-red bg-red-bg px-1.5 py-0.5 rounded-mark",children:flag})]}),jsx14("span",{"data-num":true,className:cn("shrink-0",strong?"text-body font-black text-ink":"text-ui font-bold text-ink2"),children:formatValue(value)})]}),children,meta&&jsx14("span",{className:"text-micro text-muted2",children:meta})]})}function GoalBar({value,goal,pace,label,formatValue=String,className}){const ui=useUIText();const top=Math.max(value,goal)*1.06;const pct=clamp(value/top*100);const goalAt=clamp(goal/top*100);const paceAt=pace===void 0?null:clamp(goalAt*clamp(pace,0,1));const behind=paceAt!==null&&pct<paceAt;return jsxs13("div",{className:cn("flex flex-col gap-2",className),children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[label&&jsx14("span",{className:"text-ui font-bold text-ink2 truncate",children:label}),jsxs13("span",{className:"flex items-baseline gap-1.5 shrink-0",children:[jsx14("span",{"data-num":true,className:"text-body font-black text-ink",children:formatValue(value)}),jsxs13("span",{className:"text-micro text-muted2",children:["\u0645\u0646 ",jsx14("span",{"data-num":true,children:formatValue(goal)})]})]})]}),jsxs13("span",{dir:"ltr",className:"relative block h-3 rounded-full bg-hover",children:[jsx14("span",{className:cn("absolute inset-y-0 start-0 rounded-full transition-[width] duration-500",behind?"bg-amber":"bg-brand"),style:{width:`${pct}%`}}),paceAt!==null&&jsx14("span",{"aria-hidden":"true",title:ui.shouldBeHere,className:"absolute -top-1 -bottom-1 w-0.5 bg-muted2 rounded-full",style:{insetInlineStart:`${paceAt}%`}}),jsx14("span",{"aria-hidden":"true",className:"absolute -top-1.5 -bottom-1.5 w-1 bg-ink rounded-full",style:{insetInlineStart:`${goalAt}%`}})]}),paceAt!==null&&jsx14("span",{className:cn("text-micro",behind?"text-amber-ink":"text-muted2"),children:behind?"\u0648\u0631\u0627 \u0627\u0644\u0625\u064A\u0642\u0627\u0639 \u0627\u0644\u0645\u0637\u0644\u0648\u0628":"\u0642\u062F\u0651\u0627\u0645 \u0627\u0644\u0625\u064A\u0642\u0627\u0639 \u0627\u0644\u0645\u0637\u0644\u0648\u0628"})]})}function ParetoChart({items,height=140,threshold=80,formatValue=String,className}){const sorted=[...items].sort((a,b)=>b.value-a.value);const sum=sorted.reduce((s,i)=>s+i.value,0)||1;const top=Math.max(1,sorted[0]?.value??1);const rows=sorted.reduce((out,it)=>{const acc=(out.length?out[out.length-1].cum*sum/100:0)+it.value;out.push({...it,cum:acc/sum*100});return out},[]);const vital=rows.findIndex(r=>r.cum>=threshold)+1;return jsxs13("div",{className:cn("flex flex-col gap-2.5",className),children:[jsxs13("span",{className:"text-caption text-muted [text-wrap:pretty]",children:[jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:vital})," ","\u0645\u0646"," ",jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:rows.length})," ","\u0628\u064A\u0639\u0645\u0644\u0648\u0627"," ",jsx14("span",{"data-num":true,className:"font-extrabold text-ink",children:threshold}),"\u066A \u0645\u0646 \u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A"]}),jsxs13("div",{className:"relative flex items-end gap-1.5",style:{height},children:[jsx14("span",{"aria-hidden":"true",className:"absolute inset-x-0 border-t border-dashed border-muted2",style:{top:`${100-threshold}%`}}),rows.map((r,i)=>jsx14("span",{className:"flex-1 min-w-0 flex flex-col justify-end items-center gap-1 h-full",children:jsx14("span",{title:`${String(r.label)} \xB7 ${formatValue(r.value)}`,className:cn("w-full rounded-t-mark transition-[height] duration-500",i<vital?"bg-brand":"bg-brand-100"),style:{height:`${clamp(r.value/top*100)}%`}})},r.key))]}),jsx14("div",{className:"flex items-center gap-1.5",children:rows.map((r,i)=>jsx14("span",{className:cn("flex-1 min-w-0 text-micro text-center truncate",i<vital?"text-ink2 font-bold":"text-muted2"),children:r.label},r.key))})]})}function StockRunway({items,urgentDays=7,horizonDays=30,className}){const rows=items.map(it=>({...it,days:it.perDay>0?it.stock/it.perDay:Infinity})).sort((a,b)=>a.days-b.days);return jsx14("div",{className:cn("flex flex-col gap-2.5",className),children:rows.map(r=>{const urgent=r.days<=urgentDays;const soon=!urgent&&r.days<=horizonDays/2;const pct=Number.isFinite(r.days)?clamp(r.days/horizonDays*100):100;return jsxs13("span",{className:"flex flex-col gap-1.5",children:[jsxs13("span",{className:"flex items-baseline justify-between gap-3",children:[jsx14("span",{className:"text-ui text-ink2 truncate min-w-0",children:r.label}),jsxs13("span",{className:"flex items-baseline gap-2 shrink-0",children:[jsxs13("span",{"data-num":true,className:"text-micro text-muted2",children:[r.stock," \u0642\u0637\u0639\u0629"]}),jsx14("span",{"data-num":true,className:cn("text-ui font-extrabold",urgent?"text-red":soon?"text-amber-ink":"text-ink"),children:Number.isFinite(r.days)?`${Math.floor(r.days)} \u064A\u0648\u0645`:"\u2014"})]})]}),jsx14("span",{dir:"ltr",className:"block h-1.5 rounded-full bg-hover overflow-clip",children:jsx14("span",{className:cn("block h-full rounded-full transition-[width] duration-500",urgent?"bg-danger":soon?"bg-amber":"bg-brand"),style:{width:`${pct}%`}})})]},r.key)})})}import{BadgeCheck}from"lucide-react";import{jsx as jsx15}from"react/jsx-runtime";var PROVIDER_LEVEL_LABEL={1:"\u0645\u0642\u062F\u0651\u0645 \u062C\u062F\u064A\u062F",2:"\u0645\u0642\u062F\u0651\u0645 \u0645\u062D\u062A\u0631\u0641",3:"\u0645\u0642\u062F\u0651\u0645 \u062E\u0628\u064A\u0631"};var PROVIDER_LEVEL_LABEL_EN={1:"New provider",2:"Pro provider",3:"Expert provider"};var CHEVRONS=[1.7,6,10.3];var DIM=.28;function ProviderMark({level,size=16,className}){return jsx15("svg",{width:size,height:size,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:cn("shrink-0",className),children:CHEVRONS.map((y,i)=>jsx15("path",{d:`M3.2 ${y+4}L8 ${y}L12.8 ${y+4}`,stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",opacity:i>=CHEVRONS.length-level?1:DIM},y))})}var LEVEL_TONE={1:"bg-hover text-ink2",2:"bg-soft text-brand-ink",3:TONE_SOLID.brand};var SIZES={sm:{box:"size-6",mark:14},md:{box:"size-7",mark:16}};function MarkChip({label,size,tone,className,children}){return jsx15(Tooltip,{content:label,children:jsx15("span",{role:"img","aria-label":label,tabIndex:0,className:cn("inline-flex items-center justify-center rounded-sm shrink-0 cursor-pointer","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",SIZES[size].box,tone,className),children})})}function ProviderBadge({level,size="sm",className}){const en=useMoneyLang();const label=en?PROVIDER_LEVEL_LABEL_EN[level]:PROVIDER_LEVEL_LABEL[level];return jsx15(MarkChip,{label,size,tone:LEVEL_TONE[level],className,children:jsx15(ProviderMark,{level,size:SIZES[size].mark})})}var VERIFIED_LABEL="\u062D\u0633\u0627\u0628 \u0645\u0648\u062B\u0651\u0642";var VERIFIED_LABEL_EN="Verified account";function VerifiedBadge({size="sm",className}){const en=useMoneyLang();return jsx15(MarkChip,{label:en?VERIFIED_LABEL_EN:VERIFIED_LABEL,size,tone:TONE_SOFT.green,className,children:jsx15(BadgeCheck,{size:SIZES[size].mark,strokeWidth:2,"aria-hidden":"true"})})}export{ANIMATE_SCALE,Accordion,Alert,AudioPlayer,Avatar,Badge,BarChart,BrowserFrame,Button,COLOR_SCALE,CONTAINER_SCALE,Calendar,Card,CardHeader,Carousel,Checkbox,ChoiceCards,Coach,CoachProvider,ColorField,Combobox,CommandPalette,Counter,DARK_TOKENS,DataTable,DateField,DateRangePicker,Drawer,Dropdown,Dropzone,EmptyState,FileRow,FilterChips,FunnelChart,Gallery,GoalBar,Heatmap,Input,Lightbox,LocaleCtx,Modal,Money,MoneyProvider,MultiSelect,NumberStepper,PROVIDER_LEVEL_LABEL,PROVIDER_LEVEL_LABEL_EN,PageHeader,ParetoChart,Phone,Picker,Product3DViewer,Progress,ProviderBadge,ProviderMark,RADIUS_SCALE,Radio,RadioGroup,RatingInput,SHADOW_SCALE,Scrubber,SearchInput,Select,ShareList,Sheet,Skeleton,SortableStatus,Sparkline,Stars,StatCard,Stepper,StockRunway,Switch,TEXT_SCALE,TOKENS,TONE_SOFT,TONE_SOLID,Tabs,TechnicalInput,TechnicalText,Textarea,Timeline,Toast,ToastHost,Tooltip,TrendChart,VerifiedBadge,VideoPlayer,WaterfallChart,WhatsAppIcon,buttonClasses,cn,coachSeconds,currencyName,currencySymbol,daysBetween,formatBytes,formatDate,formatRange,formatTime,isCurrency,normalizeHex,parsePhone,presets,toLatinDigits,useAudioLevel,useCoach,useCoachOptional,useCurrency,useCurrencySymbol,useMedia,useMoneyLang,useMoneyLocale,useSortable,useToasts,useUIText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qumra/fanar",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "Qumra's Arabic-first component library and design tokens. Tailwind 4, RSC-safe.",
6
6
  "license": "UNLICENSED",