@ug666/ui-react 0.3.0-beta.3 → 0.3.0-beta.4
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/RELEASE_PROVENANCE.json +2 -2
- package/dist/ai/SKILL.md +5 -2
- package/dist/ai/manifest.json +5 -1
- package/dist/ai/references/components/accordion.md +1 -1
- package/dist/ai/references/components/admin-shell.md +1 -1
- package/dist/ai/references/components/alert.md +1 -1
- package/dist/ai/references/components/app-tabs.md +1 -1
- package/dist/ai/references/components/attachment-list.md +1 -1
- package/dist/ai/references/components/autocomplete.md +1 -1
- package/dist/ai/references/components/avatar-group.md +1 -1
- package/dist/ai/references/components/avatar.md +1 -1
- package/dist/ai/references/components/backtop.md +1 -1
- package/dist/ai/references/components/badge.md +1 -1
- package/dist/ai/references/components/bar-chart.md +1 -1
- package/dist/ai/references/components/breadcrumb.md +1 -1
- package/dist/ai/references/components/button.md +1 -1
- package/dist/ai/references/components/calendar.md +1 -1
- package/dist/ai/references/components/card.md +1 -1
- package/dist/ai/references/components/carousel.md +1 -1
- package/dist/ai/references/components/cascader.md +1 -1
- package/dist/ai/references/components/checkbox.md +1 -1
- package/dist/ai/references/components/collapse.md +1 -1
- package/dist/ai/references/components/color-picker.md +1 -1
- package/dist/ai/references/components/config-provider.md +1 -1
- package/dist/ai/references/components/confirm-dialog.md +1 -1
- package/dist/ai/references/components/container.md +1 -1
- package/dist/ai/references/components/context-menu.md +1 -1
- package/dist/ai/references/components/conversation-list.md +1 -1
- package/dist/ai/references/components/copy-field.md +1 -1
- package/dist/ai/references/components/data-panel.md +1 -1
- package/dist/ai/references/components/data-table-identity.md +1 -1
- package/dist/ai/references/components/data-table-toolbar.md +1 -1
- package/dist/ai/references/components/data-table.md +1 -1
- package/dist/ai/references/components/date-picker.md +1 -1
- package/dist/ai/references/components/date-range-picker.md +1 -1
- package/dist/ai/references/components/date-time-picker.md +1 -1
- package/dist/ai/references/components/descriptions.md +1 -1
- package/dist/ai/references/components/dialog.md +1 -1
- package/dist/ai/references/components/dock.md +1 -1
- package/dist/ai/references/components/donut-chart.md +1 -1
- package/dist/ai/references/components/drawer.md +1 -1
- package/dist/ai/references/components/dropdown.md +1 -1
- package/dist/ai/references/components/empty-state.md +1 -1
- package/dist/ai/references/components/fab.md +1 -1
- package/dist/ai/references/components/feature-grid.md +1 -1
- package/dist/ai/references/components/fieldset.md +1 -1
- package/dist/ai/references/components/file-input.md +1 -1
- package/dist/ai/references/components/form.md +1 -1
- package/dist/ai/references/components/gauge-chart.md +1 -1
- package/dist/ai/references/components/heatmap-chart.md +1 -1
- package/dist/ai/references/components/icon.md +1 -1
- package/dist/ai/references/components/image.md +1 -1
- package/dist/ai/references/components/index.md +1 -1
- package/dist/ai/references/components/indicator.md +1 -1
- package/dist/ai/references/components/infinite-scroll.md +1 -1
- package/dist/ai/references/components/input.md +1 -1
- package/dist/ai/references/components/join.md +1 -1
- package/dist/ai/references/components/kbd.md +1 -1
- package/dist/ai/references/components/label.md +1 -1
- package/dist/ai/references/components/landing-hero.md +1 -1
- package/dist/ai/references/components/layout.md +1 -1
- package/dist/ai/references/components/link.md +1 -1
- package/dist/ai/references/components/list.md +1 -1
- package/dist/ai/references/components/loading.md +1 -1
- package/dist/ai/references/components/message.md +1 -1
- package/dist/ai/references/components/modal.md +1 -1
- package/dist/ai/references/components/navbar.md +1 -1
- package/dist/ai/references/components/navigation-menu.md +1 -1
- package/dist/ai/references/components/notification.md +1 -1
- package/dist/ai/references/components/number-input.md +1 -1
- package/dist/ai/references/components/otp-input.md +1 -1
- package/dist/ai/references/components/page-header.md +1 -1
- package/dist/ai/references/components/pagination.md +1 -1
- package/dist/ai/references/components/popconfirm.md +1 -1
- package/dist/ai/references/components/popover.md +1 -1
- package/dist/ai/references/components/progress.md +1 -1
- package/dist/ai/references/components/prompt-composer.md +1 -1
- package/dist/ai/references/components/quick-access.md +1 -1
- package/dist/ai/references/components/radar-chart.md +1 -1
- package/dist/ai/references/components/radial-progress.md +1 -1
- package/dist/ai/references/components/radio.md +1 -1
- package/dist/ai/references/components/ranking-list.md +1 -1
- package/dist/ai/references/components/rating.md +1 -1
- package/dist/ai/references/components/result.md +1 -1
- package/dist/ai/references/components/scrollbar.md +1 -1
- package/dist/ai/references/components/select.md +1 -1
- package/dist/ai/references/components/selection-list.md +1 -1
- package/dist/ai/references/components/separator.md +1 -1
- package/dist/ai/references/components/sheet.md +1 -1
- package/dist/ai/references/components/sidebar.md +1 -1
- package/dist/ai/references/components/skeleton.md +1 -1
- package/dist/ai/references/components/slider.md +1 -1
- package/dist/ai/references/components/space.md +1 -1
- package/dist/ai/references/components/spinner.md +1 -1
- package/dist/ai/references/components/splitter.md +1 -1
- package/dist/ai/references/components/stack.md +1 -1
- package/dist/ai/references/components/stacked-bar-chart.md +1 -1
- package/dist/ai/references/components/statistic-card.md +1 -1
- package/dist/ai/references/components/statistic.md +1 -1
- package/dist/ai/references/components/steps.md +1 -1
- package/dist/ai/references/components/switch.md +1 -1
- package/dist/ai/references/components/table.md +1 -1
- package/dist/ai/references/components/tabs.md +1 -1
- package/dist/ai/references/components/tag.md +1 -1
- package/dist/ai/references/components/text.md +1 -1
- package/dist/ai/references/components/textarea.md +1 -1
- package/dist/ai/references/components/theme-configurator-dialog.md +1 -1
- package/dist/ai/references/components/theme-configurator.md +1 -1
- package/dist/ai/references/components/theme-controller.md +1 -1
- package/dist/ai/references/components/time-picker.md +1 -1
- package/dist/ai/references/components/time-range-picker.md +1 -1
- package/dist/ai/references/components/time-select.md +1 -1
- package/dist/ai/references/components/timeline.md +1 -1
- package/dist/ai/references/components/toast.md +1 -1
- package/dist/ai/references/components/tooltip.md +1 -1
- package/dist/ai/references/components/transfer.md +1 -1
- package/dist/ai/references/components/tree-select.md +1 -1
- package/dist/ai/references/components/tree-table.md +1 -1
- package/dist/ai/references/components/tree.md +1 -1
- package/dist/ai/references/components/trend-chart.md +1 -1
- package/dist/ai/references/components/upload.md +1 -1
- package/dist/ai/references/release.md +3 -2
- package/dist/ai/ui-react.zip +0 -0
- package/dist/blocks/index.cjs +1 -1
- package/dist/blocks/index.js +1 -1
- package/dist/{chunk-AQJWS45G.js → chunk-36XR4DWY.js} +1 -1
- package/dist/{chunk-AQJWS45G.js.map → chunk-36XR4DWY.js.map} +1 -1
- package/dist/chunk-3G4F4FBP.js +1 -0
- package/dist/chunk-3G4F4FBP.js.map +1 -0
- package/dist/chunk-6CAP3PTC.cjs +1 -0
- package/dist/chunk-6CAP3PTC.cjs.map +1 -0
- package/dist/chunk-EZEVLBUH.cjs +1 -0
- package/dist/chunk-EZEVLBUH.cjs.map +1 -0
- package/dist/chunk-G7UYIR6Z.js +1 -0
- package/dist/chunk-G7UYIR6Z.js.map +1 -0
- package/dist/{chunk-HCGUPREG.cjs → chunk-JJA2B3JL.cjs} +1 -1
- package/dist/{chunk-HCGUPREG.cjs.map → chunk-JJA2B3JL.cjs.map} +1 -1
- package/dist/chunk-LNVPMWCL.cjs +1 -0
- package/dist/chunk-LNVPMWCL.cjs.map +1 -0
- package/dist/{chunk-3LSTRFSY.js → chunk-NIQAVPSL.js} +1 -1
- package/dist/chunk-PGJ5O3CM.cjs +1 -0
- package/dist/chunk-PGJ5O3CM.cjs.map +1 -0
- package/dist/chunk-RLPW73WX.js +1 -0
- package/dist/chunk-RLPW73WX.js.map +1 -0
- package/dist/chunk-RZSNVJZO.cjs +1 -0
- package/dist/chunk-RZSNVJZO.cjs.map +1 -0
- package/dist/chunk-Z4MRC4LZ.js +1 -0
- package/dist/chunk-Z4MRC4LZ.js.map +1 -0
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/input.d.ts +2 -0
- package/dist/components/input.d.ts.map +1 -1
- package/dist/components/select.d.ts +4 -0
- package/dist/components/select.d.ts.map +1 -1
- package/dist/components/sidebar.d.ts +17 -8
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.d.ts.map +1 -1
- package/dist/essentials.cjs +1 -1
- package/dist/essentials.css +1 -1
- package/dist/essentials.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/navigation/sidebar-navigation.d.ts.map +1 -1
- package/dist/patterns/admin-shell.d.ts +4 -0
- package/dist/patterns/admin-shell.d.ts.map +1 -1
- package/dist/patterns/data-table.d.ts +18 -7
- package/dist/patterns/data-table.d.ts.map +1 -1
- package/dist/patterns/index.cjs +1 -1
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.js +1 -1
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/page-header.d.ts +4 -0
- package/dist/patterns/page-header.d.ts.map +1 -1
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/themes/dense.css +1 -0
- package/dist/tokens.css +1 -1
- package/package.json +10 -5
- package/dist/chunk-3A5O2NHW.cjs +0 -1
- package/dist/chunk-3A5O2NHW.cjs.map +0 -1
- package/dist/chunk-DJDACMBD.js +0 -1
- package/dist/chunk-DJDACMBD.js.map +0 -1
- package/dist/chunk-EYSM2SU5.cjs +0 -1
- package/dist/chunk-EYSM2SU5.cjs.map +0 -1
- package/dist/chunk-IOUGF444.cjs +0 -1
- package/dist/chunk-IOUGF444.cjs.map +0 -1
- package/dist/chunk-JJQENNZW.cjs +0 -1
- package/dist/chunk-JJQENNZW.cjs.map +0 -1
- package/dist/chunk-KNWHIFJE.js +0 -1
- package/dist/chunk-KNWHIFJE.js.map +0 -1
- package/dist/chunk-TWOBEV2L.js +0 -1
- package/dist/chunk-TWOBEV2L.js.map +0 -1
- package/dist/chunk-V4VCVCOX.js +0 -1
- package/dist/chunk-V4VCVCOX.js.map +0 -1
- package/dist/chunk-YI5JDPI2.cjs +0 -1
- package/dist/chunk-YI5JDPI2.cjs.map +0 -1
- /package/dist/{chunk-3LSTRFSY.js.map → chunk-NIQAVPSL.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _nullishCoalesce(e,a){return null!=e?e:a()}function _optionalChain(e){let a,t=e[0],o=1;for(;o<e.length;){const l=e[o],r=e[o+1];if(o+=2,("optionalAccess"===l||"optionalCall"===l)&&null==t)return;"access"===l||"optionalAccess"===l?(a=t,t=r(t)):"call"!==l&&"optionalCall"!==l||(t=r((...e)=>t.call(a,...e)),a=void 0)}return t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./chunk-
|
|
1
|
+
"use strict";function _nullishCoalesce(e,a){return null!=e?e:a()}function _optionalChain(e){let a,t=e[0],o=1;for(;o<e.length;){const l=e[o],r=e[o+1];if(o+=2,("optionalAccess"===l||"optionalCall"===l)&&null==t)return;"access"===l||"optionalAccess"===l?(a=t,t=r(t)):"call"!==l&&"optionalCall"!==l||(t=r((...e)=>t.call(a,...e)),a=void 0)}return t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./chunk-RZSNVJZO.cjs"),a=require("react"),t=require("lucide-react"),o=require("@ug666/ui-core"),l=require("react/jsx-runtime"),r={sm:"min-h-[calc(var(--control-height-sm)*2)] px-[var(--control-padding-x-sm)] py-1.5 text-xs",default:"min-h-[calc(var(--control-height-md)*2)] px-[var(--control-padding-x-md)] py-2 text-sm",lg:"min-h-[calc(var(--control-height-lg)*2)] px-[var(--control-padding-x-lg)] py-2.5 text-base"},i={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"};function normalizeValue(e){return null==e?"":Array.isArray(e)?e.join(","):String(e)}function resizeTextarea(e,a,t){if(!a)return;const o="object"==typeof a?a:{},l=getComputedStyle(e),r=Number.parseFloat(l.lineHeight)||1.5*Number.parseFloat(l.fontSize),i=Number.parseFloat(l.paddingTop)+Number.parseFloat(l.paddingBottom)+Number.parseFloat(l.borderTopWidth)+Number.parseFloat(l.borderBottomWidth),n=Math.max(1,_nullishCoalesce(o.minRows,()=>t)),s=o.maxRows?Math.max(n,o.maxRows):void 0,c=r*n+i,d=s?r*s+i:Number.POSITIVE_INFINITY;e.style.height="auto";const u=Math.min(d,Math.max(c,e.scrollHeight));e.style.height=`${u}px`,e.style.overflowY=e.scrollHeight>d?"auto":"hidden"}var n=a.forwardRef.call(void 0,({autosize:n=!1,className:s,clearable:c=!1,clearIcon:d,countCharacters:u,defaultValue:v,disabled:m,error:h,helperText:p,id:x,label:f,maxLength:g,onChange:b,onClear:C,onCompositionEnd:y,onCompositionStart:w,onValueChange:z,readOnly:T=!1,resize:N="vertical",rows:_=3,showWordLimit:j=!1,size:R,value:S,wordLimitPosition:V="inside","aria-describedby":E,"aria-invalid":I,...B},F)=>{const A=e.useUIConfig.call(void 0),L=a.useId.call(void 0),M=_nullishCoalesce(x,()=>L),q=`${M}-message`,O=a.useRef.call(void 0,null),[k,P]=a.useState.call(void 0,()=>normalizeValue(v)),[H,W]=a.useState.call(void 0,!1),Y=e.resolveDisabled.call(void 0,m,A.disabled),Z=e.resolveControlSize.call(void 0,R,A.size),$=Boolean(h)||e.isAriaInvalid.call(void 0,I),D=n?"object"==typeof n?Math.max(1,_nullishCoalesce(n.minRows,()=>1)):1:_,J=void 0===S?k:normalizeValue(S),U=Boolean(h||p||j&&g),X=o.countTextCharacters.call(void 0,J,u),G=c&&J.length>0&&!Y&&!T,K=Boolean(j&&g&&"inside"===V),Q=!n&&"none"!==N,ee=[$&&"invalid",Y&&"disabled",T&&"readonly"].filter(Boolean).join(" ")||"default",ae=a.useRef.call(void 0,{defaultValue:v,value:S,autosize:n,resolvedRows:D});return ae.current={defaultValue:v,value:S,autosize:n,resolvedRows:D},a.useEffect.call(void 0,()=>{const e=_optionalChain([O,"access",e=>e.current,"optionalAccess",e=>e.form]);if(!e)return;const a=new Set;function handleReset(t){const o=setTimeout(()=>{a.delete(o);const l=O.current;if(t.defaultPrevented||!l||l.form!==e)return;const r=ae.current,i=normalizeValue(void 0===r.value?r.defaultValue:r.value);W(!1),void 0===r.value&&P(i),l.value=i,resizeTextarea(l,r.autosize,r.resolvedRows)},0);a.add(o)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of a)clearTimeout(e)}},[B.form]),a.useLayoutEffect.call(void 0,()=>{O.current&&resizeTextarea(O.current,n,D)},[n,J,D]),l.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-col gap-1","data-size":Z,"data-state":ee,"data-ug":"textarea","data-ug-slot":"root","data-variant":n?"autosize":N,children:[f?l.jsx.call(void 0,"label",{className:"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"label",htmlFor:M,children:f}):null,l.jsxs.call(void 0,"div",{className:"relative min-w-0","data-ug-slot":"wrapper",children:[l.jsx.call(void 0,"textarea",{...B,ref:function setTextareaRef(e){O.current=e,function assignRef(e,a){"function"==typeof e?e(a):e&&(e.current=a)}(F,e)},"aria-describedby":_nullishCoalesce(E,()=>U?q:void 0),"aria-invalid":_nullishCoalesce(I,()=>!!h||void 0),className:e.cn.call(void 0,"block w-full border bg-surface-1 text-text-primary placeholder:text-text-tertiary [border-radius:var(--radius-control)]",r[Z],n?"resize-none":i[N],K&&(Q?"pb-11":"pb-7"),G&&"pr-9","transition-[background,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50",T&&"bg-surface-2",$?"border-danger focus-visible:ring-danger/30":"border-border-base hover:border-border-strong focus-visible:border-primary focus-visible:ring-ring/30",s),"data-ug-slot":"control","data-clearable":G?"true":void 0,disabled:Y,id:M,maxLength:u?void 0:g,onChange:function handleChange(e){const a=e.currentTarget.value,t=H||e.nativeEvent.isComposing?a:o.limitTextByCount.call(void 0,a,g,u);t!==e.currentTarget.value&&(e.currentTarget.value=t),P(t),_optionalChain([z,"optionalCall",e=>e(t)]),resizeTextarea(e.currentTarget,n,_),_optionalChain([b,"optionalCall",a=>a(e)])},onCompositionEnd:function handleCompositionEnd(e){W(!1);const a=o.limitTextByCount.call(void 0,e.currentTarget.value,g,u);a!==e.currentTarget.value&&(e.currentTarget.value=a),P(a),_optionalChain([z,"optionalCall",e=>e(a)]),resizeTextarea(e.currentTarget,n,_),_optionalChain([y,"optionalCall",a=>a(e)])},onCompositionStart:function handleCompositionStart(e){W(!0),_optionalChain([w,"optionalCall",a=>a(e)])},readOnly:T,rows:D,value:J}),G?l.jsx.call(void 0,"button",{"aria-label":"清空输入","aria-controls":M,className:"absolute right-2 top-2 inline-flex size-7 items-center justify-center rounded-[var(--radius-control)] text-text-secondary hover:bg-surface-2 hover:text-text-primary","data-ug-slot":"clear",onClick:function handleClear(){P(""),_optionalChain([z,"optionalCall",e=>e("")]),_optionalChain([C,"optionalCall",e=>e()]),_optionalChain([O,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e()])},type:"button",children:_nullishCoalesce(d,()=>l.jsx.call(void 0,t.X,{"aria-hidden":"true",size:14}))}):null,K?l.jsxs.call(void 0,"span",{"aria-hidden":"true",className:e.cn.call(void 0,"pointer-events-none absolute right-3 text-xs tabular-nums text-text-tertiary",Q?"bottom-6":"bottom-2"),"data-ug-slot":"count",children:[X,"/",g]}):null]}),j&&g&&"outside"===V?l.jsxs.call(void 0,"span",{"aria-hidden":"true",className:"self-end text-xs tabular-nums text-text-tertiary","data-ug-slot":"count",children:[X,"/",g]}):null,h?l.jsx.call(void 0,"p",{id:q,className:"min-w-0 text-xs text-danger [overflow-wrap:anywhere]","data-ug-slot":"message",children:h}):null,!h&&p?l.jsx.call(void 0,"p",{id:q,className:"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"message",children:p}):null]})});n.displayName="Textarea",exports.Textarea=n;//# sourceMappingURL=chunk-JJA2B3JL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-HCGUPREG.cjs","../src/components/textarea.tsx"],"names":[],"mappings":"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","file":"/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-HCGUPREG.cjs","sourcesContent":[null,"import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CompositionEvent,\n type Ref,\n} from 'react'\nimport { X } from 'lucide-react'\nimport { countTextCharacters, limitTextByCount, type TextCountFunction } from '@ug666/ui-core'\nimport { cn } from '../internal/cn'\nimport { isAriaInvalid, resolveControlSize, resolveDisabled, useUIConfig, type ControlSize } from './config-provider'\n\nexport type TextareaResize = 'none' | 'both' | 'horizontal' | 'vertical'\n\nexport interface TextareaAutosizeOptions {\n minRows?: number\n maxRows?: number\n}\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: React.ReactNode\n error?: React.ReactNode\n helperText?: React.ReactNode\n rows?: number\n size?: ControlSize\n resize?: TextareaResize\n autosize?: boolean | TextareaAutosizeOptions\n clearable?: boolean\n clearIcon?: React.ReactNode\n showWordLimit?: boolean\n wordLimitPosition?: 'inside' | 'outside'\n countCharacters?: TextCountFunction\n onClear?: () => void\n onValueChange?: (value: string) => void\n}\n\nconst textareaSizeClasses: Record<ControlSize, string> = {\n sm: 'min-h-[calc(var(--control-height-sm)*2)] px-[var(--control-padding-x-sm)] py-1.5 text-xs',\n default: 'min-h-[calc(var(--control-height-md)*2)] px-[var(--control-padding-x-md)] py-2 text-sm',\n lg: 'min-h-[calc(var(--control-height-lg)*2)] px-[var(--control-padding-x-lg)] py-2.5 text-base',\n}\n\nconst resizeClasses: Record<TextareaResize, string> = {\n none: 'resize-none',\n both: 'resize',\n horizontal: 'resize-x',\n vertical: 'resize-y',\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') ref(value)\n else if (ref) ref.current = value\n}\n\nfunction normalizeValue(value: TextareaProps['value'] | TextareaProps['defaultValue']) {\n if (value === undefined || value === null) return ''\n return Array.isArray(value) ? value.join(',') : String(value)\n}\n\nfunction resizeTextarea(element: HTMLTextAreaElement, autosize: TextareaProps['autosize'], rows: number) {\n if (!autosize) return\n const options = typeof autosize === 'object' ? autosize : {}\n const styles = getComputedStyle(element)\n const lineHeight = Number.parseFloat(styles.lineHeight) || Number.parseFloat(styles.fontSize) * 1.5\n const verticalExtras =\n Number.parseFloat(styles.paddingTop) +\n Number.parseFloat(styles.paddingBottom) +\n Number.parseFloat(styles.borderTopWidth) +\n Number.parseFloat(styles.borderBottomWidth)\n const minRows = Math.max(1, options.minRows ?? rows)\n const maxRows = options.maxRows ? Math.max(minRows, options.maxRows) : undefined\n const minHeight = lineHeight * minRows + verticalExtras\n const maxHeight = maxRows ? lineHeight * maxRows + verticalExtras : Number.POSITIVE_INFINITY\n\n element.style.height = 'auto'\n const nextHeight = Math.min(maxHeight, Math.max(minHeight, element.scrollHeight))\n element.style.height = `${nextHeight}px`\n element.style.overflowY = element.scrollHeight > maxHeight ? 'auto' : 'hidden'\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n autosize = false,\n className,\n clearable = false,\n clearIcon,\n countCharacters,\n defaultValue,\n disabled,\n error,\n helperText,\n id,\n label,\n maxLength,\n onChange,\n onClear,\n onCompositionEnd,\n onCompositionStart,\n onValueChange,\n readOnly = false,\n resize = 'vertical',\n rows = 3,\n showWordLimit = false,\n size,\n value,\n wordLimitPosition = 'inside',\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n },\n forwardedRef,\n ) => {\n const config = useUIConfig()\n const generatedId = useId()\n const textareaId = id ?? generatedId\n const messageId = `${textareaId}-message`\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [uncontrolledValue, setUncontrolledValue] = useState(() => normalizeValue(defaultValue))\n const [composing, setComposing] = useState(false)\n const resolvedDisabled = resolveDisabled(disabled, config.disabled)\n const resolvedSize = resolveControlSize(size, config.size)\n const resolvedInvalid = Boolean(error) || isAriaInvalid(invalid)\n const resolvedRows = autosize ? (typeof autosize === 'object' ? Math.max(1, autosize.minRows ?? 1) : 1) : rows\n const rawValue = value === undefined ? uncontrolledValue : normalizeValue(value)\n const hasMessage = Boolean(error || helperText || (showWordLimit && maxLength))\n const characterCount = countTextCharacters(rawValue, countCharacters)\n const canClear = clearable && rawValue.length > 0 && !resolvedDisabled && !readOnly\n const hasInsideCount = Boolean(showWordLimit && maxLength && wordLimitPosition === 'inside')\n const hasResizeHandle = !autosize && resize !== 'none'\n const state =\n [resolvedInvalid && 'invalid', resolvedDisabled && 'disabled', readOnly && 'readonly']\n .filter(Boolean)\n .join(' ') || 'default'\n\n const resetStateRef = useRef({ defaultValue, value, autosize, resolvedRows })\n resetStateRef.current = { defaultValue, value, autosize, resolvedRows }\n useEffect(() => {\n const ownerForm = textareaRef.current?.form\n if (!ownerForm) return\n const tasks = new Set<ReturnType<typeof setTimeout>>()\n function handleReset(event: Event) {\n const task = setTimeout(() => {\n tasks.delete(task)\n const textarea = textareaRef.current\n if (event.defaultPrevented || !textarea || textarea.form !== ownerForm) return\n const current = resetStateRef.current\n const nextValue = normalizeValue(current.value === undefined ? current.defaultValue : current.value)\n setComposing(false)\n if (current.value === undefined) setUncontrolledValue(nextValue)\n textarea.value = nextValue\n resizeTextarea(textarea, current.autosize, current.resolvedRows)\n }, 0)\n tasks.add(task)\n }\n ownerForm.addEventListener('reset', handleReset)\n return () => {\n ownerForm.removeEventListener('reset', handleReset)\n for (const task of tasks) clearTimeout(task)\n }\n }, [props.form])\n\n useLayoutEffect(() => {\n if (textareaRef.current) resizeTextarea(textareaRef.current, autosize, resolvedRows)\n }, [autosize, rawValue, resolvedRows])\n\n function setTextareaRef(node: HTMLTextAreaElement | null) {\n textareaRef.current = node\n assignRef(forwardedRef, node)\n }\n\n function handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n const inputValue = event.currentTarget.value\n const isComposing = composing || (event.nativeEvent as InputEvent).isComposing\n const nextValue = isComposing ? inputValue : limitTextByCount(inputValue, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onChange?.(event)\n }\n\n function handleCompositionStart(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(true)\n onCompositionStart?.(event)\n }\n\n function handleCompositionEnd(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(false)\n const nextValue = limitTextByCount(event.currentTarget.value, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onCompositionEnd?.(event)\n }\n\n function handleClear() {\n setUncontrolledValue('')\n onValueChange?.('')\n onClear?.()\n textareaRef.current?.focus()\n }\n\n return (\n <div\n className=\"flex min-w-0 flex-col gap-1\"\n data-size={resolvedSize}\n data-state={state}\n data-ug=\"textarea\"\n data-ug-slot=\"root\"\n data-variant={autosize ? 'autosize' : resize}\n >\n {label ? (\n <label\n className=\"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]\"\n data-ug-slot=\"label\"\n htmlFor={textareaId}\n >\n {label}\n </label>\n ) : null}\n <div className=\"relative min-w-0\" data-ug-slot=\"wrapper\">\n <textarea\n {...props}\n ref={setTextareaRef}\n aria-describedby={describedBy ?? (hasMessage ? messageId : undefined)}\n aria-invalid={invalid ?? (error ? true : undefined)}\n className={cn(\n 'block w-full border bg-surface-1 text-text-primary placeholder:text-text-tertiary [border-radius:var(--radius-control)]',\n textareaSizeClasses[resolvedSize],\n autosize ? 'resize-none' : resizeClasses[resize],\n hasInsideCount && (hasResizeHandle ? 'pb-11' : 'pb-7'),\n canClear && 'pr-9',\n 'transition-[background,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n readOnly && 'bg-surface-2',\n resolvedInvalid\n ? 'border-danger focus-visible:ring-danger/30'\n : 'border-border-base hover:border-border-strong focus-visible:border-primary focus-visible:ring-ring/30',\n className,\n )}\n data-ug-slot=\"control\"\n data-clearable={canClear ? 'true' : undefined}\n disabled={resolvedDisabled}\n id={textareaId}\n maxLength={countCharacters ? undefined : maxLength}\n onChange={handleChange}\n onCompositionEnd={handleCompositionEnd}\n onCompositionStart={handleCompositionStart}\n readOnly={readOnly}\n rows={resolvedRows}\n value={rawValue}\n />\n {canClear ? (\n <button\n aria-label=\"清空输入\"\n aria-controls={textareaId}\n className=\"absolute right-2 top-2 inline-flex size-7 items-center justify-center rounded-[var(--radius-control)] text-text-secondary hover:bg-surface-2 hover:text-text-primary\"\n data-ug-slot=\"clear\"\n onClick={handleClear}\n type=\"button\"\n >\n {clearIcon ?? <X aria-hidden=\"true\" size={14} />}\n </button>\n ) : null}\n {hasInsideCount ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute right-3 text-xs tabular-nums text-text-tertiary',\n hasResizeHandle ? 'bottom-6' : 'bottom-2',\n )}\n data-ug-slot=\"count\"\n >\n {characterCount}/{maxLength}\n </span>\n ) : null}\n </div>\n {showWordLimit && maxLength && wordLimitPosition === 'outside' ? (\n <span aria-hidden=\"true\" className=\"self-end text-xs tabular-nums text-text-tertiary\" data-ug-slot=\"count\">\n {characterCount}/{maxLength}\n </span>\n ) : null}\n {error ? (\n <p id={messageId} className=\"min-w-0 text-xs text-danger [overflow-wrap:anywhere]\" data-ug-slot=\"message\">\n {error}\n </p>\n ) : null}\n {!error && helperText ? (\n <p\n id={messageId}\n className=\"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]\"\n data-ug-slot=\"message\"\n >\n {helperText}\n </p>\n ) : null}\n </div>\n )\n },\n)\n\nTextarea.displayName = 'Textarea'\n\nexport { Textarea }\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-JJA2B3JL.cjs","../src/components/textarea.tsx"],"names":[],"mappings":"AAAA;AACA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA;AACE;AACA;AACA;AACA;AACA;AACA;AAAA,8BAIK;AACP,2CAAkB;AAClB,wCAA8E;AA8MpE,+CAAA;AAlLV,IAAM,oBAAA,EAAmD;AAAA,EACvD,EAAA,EAAI,0FAAA;AAAA,EACJ,OAAA,EAAS,wFAAA;AAAA,EACT,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,cAAA,EAAgD;AAAA,EACpD,IAAA,EAAM,aAAA;AAAA,EACN,IAAA,EAAM,QAAA;AAAA,EACN,UAAA,EAAY,UAAA;AAAA,EACZ,QAAA,EAAU;AACZ,CAAA;AAEA,SAAS,SAAA,CAAa,GAAA,EAAyB,KAAA,EAAiB;AAC9D,EAAA,GAAA,CAAI,OAAO,IAAA,IAAQ,UAAA,EAAY,GAAA,CAAI,KAAK,CAAA;AAAA,EAAA,KAAA,GAAA,CAC/B,GAAA,EAAK,GAAA,CAAI,QAAA,EAAU,KAAA;AAC9B;AAEA,SAAS,cAAA,CAAe,KAAA,EAA+D;AACrF,EAAA,GAAA,CAAI,MAAA,IAAU,KAAA,EAAA,GAAa,MAAA,IAAU,IAAA,EAAM,OAAO,EAAA;AAClD,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,EAAA,EAAI,KAAA,CAAM,IAAA,CAAK,GAAG,EAAA,EAAI,MAAA,CAAO,KAAK,CAAA;AAC9D;AAEA,SAAS,cAAA,CAAe,OAAA,EAA8B,QAAA,EAAqC,IAAA,EAAc;AACvG,EAAA,GAAA,CAAI,CAAC,QAAA,EAAU,MAAA;AACf,EAAA,MAAM,QAAA,EAAU,OAAO,SAAA,IAAa,SAAA,EAAW,SAAA,EAAW,CAAC,CAAA;AAC3D,EAAA,MAAM,OAAA,EAAS,gBAAA,CAAiB,OAAO,CAAA;AACvC,EAAA,MAAM,WAAA,EAAa,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,UAAU,EAAA,GAAK,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,QAAQ,EAAA,EAAI,GAAA;AAChG,EAAA,MAAM,eAAA,EACJ,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,UAAU,EAAA,EACnC,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,aAAa,EAAA,EACtC,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,cAAc,EAAA,EACvC,MAAA,CAAO,UAAA,CAAW,MAAA,CAAO,iBAAiB,CAAA;AAC5C,EAAA,MAAM,QAAA,EAAU,IAAA,CAAK,GAAA,CAAI,CAAA,mBAAG,OAAA,CAAQ,OAAA,UAAW,MAAI,CAAA;AACnD,EAAA,MAAM,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAU,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,OAAA,CAAQ,OAAO,EAAA,EAAI,KAAA,CAAA;AACvE,EAAA,MAAM,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,cAAA;AACzC,EAAA,MAAM,UAAA,EAAY,QAAA,EAAU,WAAA,EAAa,QAAA,EAAU,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAE3E,EAAA,OAAA,CAAQ,KAAA,CAAM,OAAA,EAAS,MAAA;AACvB,EAAA,MAAM,WAAA,EAAa,IAAA,CAAK,GAAA,CAAI,SAAA,EAAW,IAAA,CAAK,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,YAAY,CAAC,CAAA;AAChF,EAAA,OAAA,CAAQ,KAAA,CAAM,OAAA,EAAS,CAAA,EAAA;AACT,EAAA;AAChB;AAEiB;AAEb,EAAA;AACa,IAAA;AACX,IAAA;AACY,IAAA;AACZ,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACW,IAAA;AACF,IAAA;AACF,IAAA;AACS,IAAA;AAChB,IAAA;AACA,IAAA;AACoB,IAAA;AACA,IAAA;AACJ,IAAA;AACb,IAAA;AAGF,EAAA;AACY,IAAA;AACK,IAAA;AACD,IAAA;AACE,IAAA;AACD,IAAA;AACb,IAAA;AACW,IAAA;AACZ,IAAA;AACe,IAAA;AACf,IAAA;AACe,IAAA;AACJ,IAAA;AACE,IAAA;AACb,IAAA;AACW,IAAA;AACX,IAAA;AACA,IAAA;AAEH,IAAA;AAImB,IAAA;AACR,IAAA;AACE,IAAA;AACI,MAAA;AACF,MAAA;AACF,MAAA;AACL,MAAA;AACM,QAAA;AACE,UAAA;AACP,UAAA;AACI,UAAA;AACM,UAAA;AACV,UAAA;AACO,UAAA;AACD,UAAA;AACH,UAAA;AACM,UAAA;AACb,QAAA;AACU,QAAA;AAChB,MAAA;AACU,MAAA;AACG,MAAA;AACD,QAAA;AACC,QAAA;AACb,MAAA;AACa,IAAA;AAEO,IAAA;AACJ,MAAA;AACJ,IAAA;AAEL,IAAA;AACK,MAAA;AACF,MAAA;AACZ,IAAA;AAEsB,IAAA;AACD,MAAA;AACC,MAAA;AACF,MAAA;AACA,MAAA;AAClB,MAAA;AACgB,sBAAA;AACD,MAAA;AACC,sBAAA;AAClB,IAAA;AAES,IAAA;AACU,MAAA;AACjB,sBAAA;AACF,IAAA;AAES,IAAA;AACW,MAAA;AACA,MAAA;AACA,MAAA;AAClB,MAAA;AACgB,sBAAA;AACD,MAAA;AACI,sBAAA;AACrB,IAAA;AAES,IAAA;AACP,MAAA;AACkB,sBAAA;AACR,sBAAA;AACE,sBAAA;AACd,IAAA;AAGE,IAAA;AAAC,MAAA;AAAA,MAAA;AACW,QAAA;AACC,QAAA;AACC,QAAA;AACJ,QAAA;AACK,QAAA;AACC,QAAA;AAEb,QAAA;AACC,UAAA;AAAC,YAAA;AAAA,YAAA;AACW,cAAA;AACV,cAAA;AACS,cAAA;AAER,cAAA;AAAA,YAAA;AAED,UAAA;AACJ,0BAAA;AACE,4BAAA;AAAC,cAAA;AAAA,cAAA;AACK,gBAAA;AACC,gBAAA;AACL,gBAAA;AACA,gBAAA;AACA,gBAAA;AACE,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AAGA,kBAAA;AACF,gBAAA;AACA,gBAAA;AACA,gBAAA;AACU,gBAAA;AACN,gBAAA;AACJ,gBAAA;AACU,gBAAA;AACV,gBAAA;AACA,gBAAA;AACA,gBAAA;AACM,gBAAA;AACC,gBAAA;AAAA,cAAA;AACT,YAAA;AAEE,YAAA;AAAC,cAAA;AAAA,cAAA;AACC,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACS,gBAAA;AACJ,gBAAA;AAEJ,gBAAA;AAA6C,cAAA;AAE9C,YAAA;AACH,YAAA;AACE,cAAA;AAAA,cAAA;AACC,gBAAA;AACA,gBAAA;AACE,kBAAA;AACA,kBAAA;AACF,gBAAA;AACA,gBAAA;AAEC,gBAAA;AAAA,kBAAA;AAAe,kBAAA;AAAE,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAElB,YAAA;AACN,UAAA;AACC,UAAA;AAEI,YAAA;AAAe,YAAA;AAAE,YAAA;AAElB,UAAA;AAEF,UAAA;AAIS,UAAA;AACR,YAAA;AAAA,YAAA;AACK,cAAA;AACM,cAAA;AACV,cAAA;AAEC,cAAA;AAAA,YAAA;AAED,UAAA;AAAA,QAAA;AAAA,MAAA;AACN,IAAA;AAEJ,EAAA;AACF;AAEuB;ADxCG;AACA;AACA;AACA","file":"/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-JJA2B3JL.cjs","sourcesContent":[null,"import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CompositionEvent,\n type Ref,\n} from 'react'\nimport { X } from 'lucide-react'\nimport { countTextCharacters, limitTextByCount, type TextCountFunction } from '@ug666/ui-core'\nimport { cn } from '../internal/cn'\nimport { isAriaInvalid, resolveControlSize, resolveDisabled, useUIConfig, type ControlSize } from './config-provider'\n\nexport type TextareaResize = 'none' | 'both' | 'horizontal' | 'vertical'\n\nexport interface TextareaAutosizeOptions {\n minRows?: number\n maxRows?: number\n}\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: React.ReactNode\n error?: React.ReactNode\n helperText?: React.ReactNode\n rows?: number\n size?: ControlSize\n resize?: TextareaResize\n autosize?: boolean | TextareaAutosizeOptions\n clearable?: boolean\n clearIcon?: React.ReactNode\n showWordLimit?: boolean\n wordLimitPosition?: 'inside' | 'outside'\n countCharacters?: TextCountFunction\n onClear?: () => void\n onValueChange?: (value: string) => void\n}\n\nconst textareaSizeClasses: Record<ControlSize, string> = {\n sm: 'min-h-[calc(var(--control-height-sm)*2)] px-[var(--control-padding-x-sm)] py-1.5 text-xs',\n default: 'min-h-[calc(var(--control-height-md)*2)] px-[var(--control-padding-x-md)] py-2 text-sm',\n lg: 'min-h-[calc(var(--control-height-lg)*2)] px-[var(--control-padding-x-lg)] py-2.5 text-base',\n}\n\nconst resizeClasses: Record<TextareaResize, string> = {\n none: 'resize-none',\n both: 'resize',\n horizontal: 'resize-x',\n vertical: 'resize-y',\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') ref(value)\n else if (ref) ref.current = value\n}\n\nfunction normalizeValue(value: TextareaProps['value'] | TextareaProps['defaultValue']) {\n if (value === undefined || value === null) return ''\n return Array.isArray(value) ? value.join(',') : String(value)\n}\n\nfunction resizeTextarea(element: HTMLTextAreaElement, autosize: TextareaProps['autosize'], rows: number) {\n if (!autosize) return\n const options = typeof autosize === 'object' ? autosize : {}\n const styles = getComputedStyle(element)\n const lineHeight = Number.parseFloat(styles.lineHeight) || Number.parseFloat(styles.fontSize) * 1.5\n const verticalExtras =\n Number.parseFloat(styles.paddingTop) +\n Number.parseFloat(styles.paddingBottom) +\n Number.parseFloat(styles.borderTopWidth) +\n Number.parseFloat(styles.borderBottomWidth)\n const minRows = Math.max(1, options.minRows ?? rows)\n const maxRows = options.maxRows ? Math.max(minRows, options.maxRows) : undefined\n const minHeight = lineHeight * minRows + verticalExtras\n const maxHeight = maxRows ? lineHeight * maxRows + verticalExtras : Number.POSITIVE_INFINITY\n\n element.style.height = 'auto'\n const nextHeight = Math.min(maxHeight, Math.max(minHeight, element.scrollHeight))\n element.style.height = `${nextHeight}px`\n element.style.overflowY = element.scrollHeight > maxHeight ? 'auto' : 'hidden'\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n autosize = false,\n className,\n clearable = false,\n clearIcon,\n countCharacters,\n defaultValue,\n disabled,\n error,\n helperText,\n id,\n label,\n maxLength,\n onChange,\n onClear,\n onCompositionEnd,\n onCompositionStart,\n onValueChange,\n readOnly = false,\n resize = 'vertical',\n rows = 3,\n showWordLimit = false,\n size,\n value,\n wordLimitPosition = 'inside',\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n },\n forwardedRef,\n ) => {\n const config = useUIConfig()\n const generatedId = useId()\n const textareaId = id ?? generatedId\n const messageId = `${textareaId}-message`\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [uncontrolledValue, setUncontrolledValue] = useState(() => normalizeValue(defaultValue))\n const [composing, setComposing] = useState(false)\n const resolvedDisabled = resolveDisabled(disabled, config.disabled)\n const resolvedSize = resolveControlSize(size, config.size)\n const resolvedInvalid = Boolean(error) || isAriaInvalid(invalid)\n const resolvedRows = autosize ? (typeof autosize === 'object' ? Math.max(1, autosize.minRows ?? 1) : 1) : rows\n const rawValue = value === undefined ? uncontrolledValue : normalizeValue(value)\n const hasMessage = Boolean(error || helperText || (showWordLimit && maxLength))\n const characterCount = countTextCharacters(rawValue, countCharacters)\n const canClear = clearable && rawValue.length > 0 && !resolvedDisabled && !readOnly\n const hasInsideCount = Boolean(showWordLimit && maxLength && wordLimitPosition === 'inside')\n const hasResizeHandle = !autosize && resize !== 'none'\n const state =\n [resolvedInvalid && 'invalid', resolvedDisabled && 'disabled', readOnly && 'readonly']\n .filter(Boolean)\n .join(' ') || 'default'\n\n const resetStateRef = useRef({ defaultValue, value, autosize, resolvedRows })\n resetStateRef.current = { defaultValue, value, autosize, resolvedRows }\n useEffect(() => {\n const ownerForm = textareaRef.current?.form\n if (!ownerForm) return\n const tasks = new Set<ReturnType<typeof setTimeout>>()\n function handleReset(event: Event) {\n const task = setTimeout(() => {\n tasks.delete(task)\n const textarea = textareaRef.current\n if (event.defaultPrevented || !textarea || textarea.form !== ownerForm) return\n const current = resetStateRef.current\n const nextValue = normalizeValue(current.value === undefined ? current.defaultValue : current.value)\n setComposing(false)\n if (current.value === undefined) setUncontrolledValue(nextValue)\n textarea.value = nextValue\n resizeTextarea(textarea, current.autosize, current.resolvedRows)\n }, 0)\n tasks.add(task)\n }\n ownerForm.addEventListener('reset', handleReset)\n return () => {\n ownerForm.removeEventListener('reset', handleReset)\n for (const task of tasks) clearTimeout(task)\n }\n }, [props.form])\n\n useLayoutEffect(() => {\n if (textareaRef.current) resizeTextarea(textareaRef.current, autosize, resolvedRows)\n }, [autosize, rawValue, resolvedRows])\n\n function setTextareaRef(node: HTMLTextAreaElement | null) {\n textareaRef.current = node\n assignRef(forwardedRef, node)\n }\n\n function handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n const inputValue = event.currentTarget.value\n const isComposing = composing || (event.nativeEvent as InputEvent).isComposing\n const nextValue = isComposing ? inputValue : limitTextByCount(inputValue, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onChange?.(event)\n }\n\n function handleCompositionStart(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(true)\n onCompositionStart?.(event)\n }\n\n function handleCompositionEnd(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(false)\n const nextValue = limitTextByCount(event.currentTarget.value, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onCompositionEnd?.(event)\n }\n\n function handleClear() {\n setUncontrolledValue('')\n onValueChange?.('')\n onClear?.()\n textareaRef.current?.focus()\n }\n\n return (\n <div\n className=\"flex min-w-0 flex-col gap-1\"\n data-size={resolvedSize}\n data-state={state}\n data-ug=\"textarea\"\n data-ug-slot=\"root\"\n data-variant={autosize ? 'autosize' : resize}\n >\n {label ? (\n <label\n className=\"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]\"\n data-ug-slot=\"label\"\n htmlFor={textareaId}\n >\n {label}\n </label>\n ) : null}\n <div className=\"relative min-w-0\" data-ug-slot=\"wrapper\">\n <textarea\n {...props}\n ref={setTextareaRef}\n aria-describedby={describedBy ?? (hasMessage ? messageId : undefined)}\n aria-invalid={invalid ?? (error ? true : undefined)}\n className={cn(\n 'block w-full border bg-surface-1 text-text-primary placeholder:text-text-tertiary [border-radius:var(--radius-control)]',\n textareaSizeClasses[resolvedSize],\n autosize ? 'resize-none' : resizeClasses[resize],\n hasInsideCount && (hasResizeHandle ? 'pb-11' : 'pb-7'),\n canClear && 'pr-9',\n 'transition-[background,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n readOnly && 'bg-surface-2',\n resolvedInvalid\n ? 'border-danger focus-visible:ring-danger/30'\n : 'border-border-base hover:border-border-strong focus-visible:border-primary focus-visible:ring-ring/30',\n className,\n )}\n data-ug-slot=\"control\"\n data-clearable={canClear ? 'true' : undefined}\n disabled={resolvedDisabled}\n id={textareaId}\n maxLength={countCharacters ? undefined : maxLength}\n onChange={handleChange}\n onCompositionEnd={handleCompositionEnd}\n onCompositionStart={handleCompositionStart}\n readOnly={readOnly}\n rows={resolvedRows}\n value={rawValue}\n />\n {canClear ? (\n <button\n aria-label=\"清空输入\"\n aria-controls={textareaId}\n className=\"absolute right-2 top-2 inline-flex size-7 items-center justify-center rounded-[var(--radius-control)] text-text-secondary hover:bg-surface-2 hover:text-text-primary\"\n data-ug-slot=\"clear\"\n onClick={handleClear}\n type=\"button\"\n >\n {clearIcon ?? <X aria-hidden=\"true\" size={14} />}\n </button>\n ) : null}\n {hasInsideCount ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute right-3 text-xs tabular-nums text-text-tertiary',\n hasResizeHandle ? 'bottom-6' : 'bottom-2',\n )}\n data-ug-slot=\"count\"\n >\n {characterCount}/{maxLength}\n </span>\n ) : null}\n </div>\n {showWordLimit && maxLength && wordLimitPosition === 'outside' ? (\n <span aria-hidden=\"true\" className=\"self-end text-xs tabular-nums text-text-tertiary\" data-ug-slot=\"count\">\n {characterCount}/{maxLength}\n </span>\n ) : null}\n {error ? (\n <p id={messageId} className=\"min-w-0 text-xs text-danger [overflow-wrap:anywhere]\" data-ug-slot=\"message\">\n {error}\n </p>\n ) : null}\n {!error && helperText ? (\n <p\n id={messageId}\n className=\"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]\"\n data-ug-slot=\"message\"\n >\n {helperText}\n </p>\n ) : null}\n </div>\n )\n },\n)\n\nTextarea.displayName = 'Textarea'\n\nexport { Textarea }\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _nullishCoalesce(e,a){return null!=e?e:a()}function _optionalChain(e){let a,l=e[0],t=1;for(;t<e.length;){const o=e[t],i=e[t+1];if(t+=2,("optionalAccess"===o||"optionalCall"===o)&&null==l)return;"access"===o||"optionalAccess"===o?(a=l,l=i(l)):"call"!==o&&"optionalCall"!==o||(l=i((...e)=>l.call(a,...e)),a=void 0)}return l}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./chunk-2EJWWTLH.cjs"),a=require("./chunk-X4EMYHLY.cjs"),l=require("./chunk-PGJ5O3CM.cjs"),t=require("./chunk-RZSNVJZO.cjs"),o=require("react"),i=require("lucide-react"),n=require("class-variance-authority"),r=o.createContext.call(void 0,null);var s=require("react/jsx-runtime"),c=n.cva.call(void 0,"peer inline-flex shrink-0 items-center justify-center rounded-[var(--radius-control)] border shadow-sm peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{size:{sm:"h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)]",default:"h-[calc(var(--control-height-md)*0.45)] w-[calc(var(--control-height-md)*0.45)]",lg:"h-[calc(var(--control-height-lg)*0.45)] w-[calc(var(--control-height-lg)*0.45)]"},state:{unchecked:"border-border-strong bg-surface-1 text-transparent hover:border-primary/70 hover:bg-surface-2",checked:"border-[color:var(--ug-checkbox-selected-bg)] bg-[var(--ug-checkbox-selected-bg)] text-[color:var(--ug-checkbox-selected-fg)]",indeterminate:"border-[color:var(--ug-checkbox-selected-bg)] bg-[var(--ug-checkbox-selected-bg)] text-[color:var(--ug-checkbox-selected-fg)]"}},defaultVariants:{size:"default",state:"unchecked"}}),d=o.forwardRef.call(void 0,({className:e,size:a,checked:l,defaultChecked:n,indeterminate:d=!1,disabled:u,label:v,labelClassName:p,onChange:h,onCheckedChange:f,id:m,form:g,name:b,value:x,"aria-invalid":y,...C},w)=>{const N=t.useUIConfig.call(void 0),j=function useCheckboxGroupContext(){return o.useContext.call(void 0,r)}(),k=o.useRef.call(void 0,null),[_,S]=o.useState.call(void 0,Boolean(n)),R=o.useId.call(void 0),E=_nullishCoalesce(m,()=>R),z=j&&void 0!==x?j.values.includes(x):void 0,T=_nullishCoalesce(_nullishCoalesce(z,()=>l),()=>_),A=void 0!==z||void 0!==l,M=o.useRef.call(void 0,{checked:T,indeterminate:d});M.current={checked:T,indeterminate:d};const I=_nullishCoalesce(_optionalChain([j,"optionalAccess",e=>e.form]),()=>g),F=_nullishCoalesce(_optionalChain([j,"optionalAccess",e=>e.name]),()=>b);o.useEffect.call(void 0,()=>{k.current&&(k.current.indeterminate=d)},[d]),o.useEffect.call(void 0,()=>{const e=k.current,a=_optionalChain([e,"optionalAccess",e=>e.form]);if(!e||!a)return;const l=new Set;function handleReset(a){const t=setTimeout(()=>{if(l.delete(t),!e||a.defaultPrevented||k.current!==e)return;const o=A?M.current.checked:Boolean(n);A||S(o),e.checked=o,e.indeterminate=M.current.indeterminate},0);l.add(t)}return a.addEventListener("reset",handleReset),()=>{a.removeEventListener("reset",handleReset),l.forEach(clearTimeout)}},[A,n,I]);const L=d?"indeterminate":T?"checked":"unchecked",P=t.resolveControlSize.call(void 0,_nullishCoalesce(a,()=>_optionalChain([j,"optionalAccess",e=>e.size])),N.size),D=j&&void 0!==x?j.isOptionDisabled(x,T,u):t.resolveDisabled.call(void 0,u,N.disabled),O=Boolean(j&&void 0!==x&&T&&D&&!j.disabled&&!u&&F)?s.jsx.call(void 0,"input",{type:"hidden",name:F,form:I,value:x}):null,B=t.isAriaInvalid.call(void 0,y),V=[L,B?"invalid":void 0,D?"disabled":void 0].filter(Boolean).join(" "),K=t.cn.call(void 0,"shrink-0","sm"===P?"h-[calc(var(--control-height-sm)*0.35)] w-[calc(var(--control-height-sm)*0.35)]":"lg"===P?"h-[calc(var(--control-height-lg)*0.3)] w-[calc(var(--control-height-lg)*0.3)]":"h-[calc(var(--control-height-md)*0.3)] w-[calc(var(--control-height-md)*0.3)]"),$=s.jsxs.call(void 0,"span",{className:"relative inline-flex","data-ug-slot":"control",children:[s.jsx.call(void 0,"input",{ref:e=>{k.current=e,"function"==typeof w?w(e):w&&(w.current=e)},id:E,type:"checkbox",form:I,name:F,value:x,className:"peer sr-only",checked:T,"aria-checked":d?"mixed":T,"aria-invalid":y,disabled:D,onChange:e=>{j&&void 0!==x?j.toggleValue(x,e.target.checked):void 0===l&&S(e.target.checked),e.currentTarget.indeterminate=d,_optionalChain([h,"optionalCall",a=>a(e)]),_optionalChain([f,"optionalCall",a=>a(e.target.checked)])},"data-ug-slot":"input",...C}),s.jsx.call(void 0,"span",{"aria-hidden":"true",className:t.cn.call(void 0,c({size:P,state:L}),B&&"border-danger peer-focus-visible:ring-danger/35",e),"data-ug-slot":"indicator",children:d?s.jsx.call(void 0,i.Minus,{className:K,"data-ug-slot":"icon"}):T?s.jsx.call(void 0,i.Check,{className:K,"data-ug-slot":"icon"}):null})]});return null==v?s.jsxs.call(void 0,"label",{className:t.cn.call(void 0,"inline-flex cursor-pointer",D&&"cursor-not-allowed opacity-60"),"data-ug":"checkbox","data-state":V,"data-variant":"default","data-size":P,htmlFor:E,children:[$,O]}):s.jsxs.call(void 0,"label",{htmlFor:E,className:t.cn.call(void 0,"inline-flex min-h-[var(--control-height-sm)] max-w-full min-w-0 cursor-pointer items-start gap-2.5 text-sm leading-5 text-text-primary select-none",D&&"cursor-not-allowed opacity-60",p),"data-ug":"checkbox","data-state":V,"data-variant":"default","data-size":P,children:[$,O,s.jsx.call(void 0,"span",{className:"min-w-0 pt-px [overflow-wrap:anywhere]","data-ug-slot":"label",children:v})]})});d.displayName="Checkbox";var u=require("react-dom"),v=require("@ug666/ui-core"),p=require("@ug666/ui-web"),h=require("@ug666/ui-web/overlay");function useFloatingLayoutObserver(e,a,l,t){o.useEffect.call(void 0,()=>{if(e)return h.observeFloatingLayout.call(void 0,[l.current,_optionalChain([t,"optionalAccess",e=>e.current])],a)},[e,l,t,a])}function usePresence(e){const[a,l]=o.useState.call(void 0,e),[t,i]=o.useState.call(void 0,e?"open":"closed"),n=o.useRef.call(void 0,void 0),r=o.useCallback.call(void 0,()=>{n.current&&clearTimeout(n.current),n.current=void 0},[]),s=o.useCallback.call(void 0,()=>{r(),l(!1)},[r]);o.useEffect.call(void 0,()=>r,[r]),o.useEffect.call(void 0,()=>{if(r(),e)return l(!0),void i("open");a&&(i("closed"),n.current=setTimeout(s,function readExitDuration(){if("undefined"==typeof document)return 0;const e=getComputedStyle(document.documentElement).getPropertyValue("--motion-duration-exit").trim();return e?e.endsWith("ms")?Number.parseFloat(e)||250:e.endsWith("s")?1e3*(Number.parseFloat(e)||0):250:250}()+50))},[r,s,e,a]);const c=o.useCallback.call(void 0,e=>{"closed"===t&&e.animationName.endsWith("-out")&&s()},[s,t]);return{present:e||a,state:e?"open":t,handleAnimationEnd:c}}function usePortalContainer(){const[e,a]=o.useState.call(void 0,!1);return o.useEffect.call(void 0,()=>{"undefined"!=typeof document&&a(!0)},[]),e&&"undefined"!=typeof document?document.body:null}var f={sm:"min-h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)]",default:"min-h-[var(--control-height-md)] px-[var(--control-padding-x-md)]",lg:"min-h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)]"},m="undefined"==typeof window?o.useEffect:o.useLayoutEffect,g=o.forwardRef.call(void 0,(a,l)=>{const{className:n,label:r,error:c,helperText:d,options:g,placeholder:b="请选择",id:x,value:y,defaultValue:C,onChange:w,onValueChange:N,onOpenChange:j,onClear:k,disabled:_,size:S,focusRingWidth:R,pressMotion:E="color",name:z,required:T,multiple:A=!1,multipleLimit:M=0,clearable:I=!1,filterable:F=!1,filterMethod:L,remote:P=!1,remoteMethod:D,remoteDebounce:O=300,loading:B=!1,loadingText:V="加载中",reserveKeyword:K=!1,allowCreate:$=!1,defaultFirstOption:q=!1,collapseTags:H=!1,maxCollapseTags:W=1,collapseTagsTooltip:U=!1,noDataText:G="暂无选项",noMatchText:X="没有匹配项",teleported:J=!0,appendTo:Y,"aria-label":Z,"aria-labelledby":Q,"aria-describedby":ee,"aria-invalid":ae,onBlur:le,onFocus:te,...oe}=a,ie=t.useUIConfig.call(void 0),ne=o.useId.call(void 0),re=_nullishCoalesce(x,()=>ne),se=`${re}-label`,ce=`${re}-listbox`,de=`${re}-message`,ue=t.resolveDisabled.call(void 0,_,ie.disabled),ve=t.resolveControlSize.call(void 0,S,ie.size),pe=Boolean(c)||t.isAriaInvalid.call(void 0,ae),he=o.useRef.call(void 0,null),fe=o.useRef.call(void 0,null),me=o.useRef.call(void 0,null),ge=o.useRef.call(void 0,null),be=usePortalContainer(),xe=e.useUGThemePortalAttributes.call(void 0),ye=o.useRef.call(void 0,""),Ce=o.useRef.call(void 0,null),we=o.useRef.call(void 0,null),Ne="value"in a,[je,ke]=o.useState.call(void 0,_nullishCoalesce(C,()=>A?[]:void 0)),[_e,Se]=o.useState.call(void 0,!1),{present:Re,state:Ee,handleAnimationEnd:ze}=usePresence(_e),[Te,Ae]=o.useState.call(void 0),Me=o.useRef.call(void 0,""),Ie=o.useRef.call(void 0,!1),[Fe,Le]=o.useState.call(void 0,""),[Pe,De]=o.useState.call(void 0,!1),[Oe,Be]=o.useState.call(void 0,[]),[Ve,Ke]=o.useState.call(void 0,{top:0,left:0,width:0,zIndex:70,side:"bottom"}),$e=be,qe=o.useMemo.call(void 0,()=>J&&"undefined"!=typeof document?_nullishCoalesce("string"==typeof Y?document.querySelector(Y):Y,()=>$e):null,[Y,$e,J]),He=Ne?y:je,We=o.useRef.call(void 0,{isControlled:Ne,currentValue:He,defaultValue:C,multiple:A});We.current={isControlled:Ne,currentValue:He,defaultValue:C,multiple:A};const Ue=o.useMemo.call(void 0,()=>{const e=new Set(g.map(e=>v.encodeSelectValue.call(void 0,e.value)));return[...g,...Oe.filter(a=>!e.has(v.encodeSelectValue.call(void 0,a.value)))]},[Oe,g]),Ge=o.useMemo.call(void 0,()=>v.normalizeSelectKeys.call(void 0,He),[He]),Xe=o.useMemo.call(void 0,()=>new Set(Ge),[Ge]),Je=o.useMemo.call(void 0,()=>Ue.filter(e=>Xe.has(v.encodeSelectValue.call(void 0,e.value))),[Ue,Xe]),Ye=o.useMemo.call(void 0,()=>{const e=Fe.trim().toLocaleLowerCase();return!P&&F&&e?Ue.filter(a=>L?L(Fe,a):a.label.toLocaleLowerCase().includes(e)):Ue},[Ue,L,F,Fe,P]),Ze=o.useMemo.call(void 0,()=>{const e=Fe.trim();if(!$||!F||!e)return;return Ue.some(a=>a.label.toLocaleLowerCase()===e.toLocaleLowerCase()||v.encodeSelectValue.call(void 0,a.value)===v.encodeSelectValue.call(void 0,e))?void 0:{label:e,value:e}},[$,Ue,F,Fe]),Qe=o.useMemo.call(void 0,()=>Ze?[Ze,...Ye]:Ye,[Ze,Ye]),ea=o.useMemo.call(void 0,()=>B?[]:Qe.flatMap((e,a)=>e.disabled||A&&M>0&&Ge.length>=M&&!Xe.has(v.encodeSelectValue.call(void 0,e.value))?[]:[a]),[B,A,M,Xe,Ge.length,Qe]),aa=Qe.findIndex(e=>v.encodeSelectValue.call(void 0,e.value)===Te);function setActiveIndex(e){const a=Qe[e];Ae(a?v.encodeSelectValue.call(void 0,a.value):void 0)}const la=[_e?"open":void 0,ue?"disabled":void 0,pe?"invalid":void 0,B?"loading":void 0].filter(Boolean).join(" ")||"default";function setMenuOpen(e){ue&&e||_e!==e&&(Se(e),_optionalChain([j,"optionalCall",a=>a(e)]),e&&(Me.current=Fe,setActiveIndex(function getInitialActiveIndex(){return _nullishCoalesce(ea.find(e=>Xe.has(v.encodeSelectValue.call(void 0,Qe[e].value))),()=>F&&Fe&&!q?-1:_nullishCoalesce(ea[0],()=>-1))}())))}function commitKeys(e,a=Ue){const l=a.filter(a=>e.includes(v.encodeSelectValue.call(void 0,a.value))),t=A?l.map(e=>e.value):_optionalChain([l,"access",e=>e[0],"optionalAccess",e=>e.value]);Ne||ke(t),function syncNativeSelection(e){const a=fe.current;a&&(Array.from(a.options).forEach(a=>{a.selected=e.includes(_nullishCoalesce(a.dataset.ugKey,()=>""))}),_optionalChain([w,"optionalCall",e=>e({target:a,currentTarget:a})]))}(e),_optionalChain([N,"optionalCall",e=>e(t)])}function handleSelect(e){if(ue||B||e.disabled)return;const a=v.encodeSelectValue.call(void 0,e.value),l=!Ue.some(e=>v.encodeSelectValue.call(void 0,e.value)===a),t=l?[...Ue,e]:Ue;if(l&&Be(a=>[...a,e]),A){const e=Xe.has(a);if(!e&&M>0&&Ge.length>=M)return;return commitKeys(e?Ge.filter(e=>e!==a):[...Ge,a],t),void(K||Le(""))}commitKeys([a],t),setMenuOpen(!1),_optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})])}const ta=o.useCallback.call(void 0,()=>{if(!J||!me.current||!ge.current)return;const e=me.current.getBoundingClientRect(),a=Math.min(Math.max(0,e.width),Math.max(0,window.innerWidth-16)),l=ge.current.offsetHeight,t=h.resolveFloatingPosition.call(void 0,e,{width:a,height:l},{width:window.innerWidth,height:window.innerHeight},{side:"bottom",align:"start",offset:4,collisionPadding:8});Ke({top:t.top,left:t.left,width:a,zIndex:h.resolveFloatingZIndex.call(void 0,me.current),side:t.side})},[J]);function handleTriggerKeyDown(e){if(!ue&&!p.isControlComposing.call(void 0,e.nativeEvent,Ie.current)){if("ArrowDown"===e.key||"ArrowUp"===e.key){if(e.preventDefault(),!_e)return void setMenuOpen(!0);const a="ArrowDown"===e.key?1:-1;return void setActiveIndex(p.getNextEnabledSelectIndex.call(void 0,ea,aa,a))}if("Home"===e.key||"End"===e.key)return e.preventDefault(),_e||setMenuOpen(!0),void setActiveIndex(p.getNextEnabledSelectIndex.call(void 0,ea,-1,"Home"===e.key?1:-1));if("Enter"===e.key||!F&&" "===e.key){if(e.preventDefault(),!_e)return void setMenuOpen(!0);const a=Qe[aa];return void(a&&handleSelect(a))}if("Tab"===e.key&&_e){setMenuOpen(!1),_optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})]);const a=_optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.closest,"call",e=>e('[role="dialog"][aria-modal="true"]')]);return void(h.trapTabKey.call(void 0,e,_nullishCoalesce(a,()=>null))&&e.stopPropagation())}if("Escape"===e.key&&_e)return e.stopPropagation(),e.preventDefault(),setMenuOpen(!1),void _optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})]);if("Backspace"===e.key&&A&&""===Fe&&Ge.length>0)return e.preventDefault(),void commitKeys(Ge.slice(0,-1));if(!(F||1!==e.key.length||e.altKey||e.ctrlKey||e.metaKey)){ye.current+=e.key.toLocaleLowerCase(),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>{ye.current="",Ce.current=null},500);const a=Qe.findIndex((e,a)=>ea.includes(a)&&e.label.toLocaleLowerCase().startsWith(ye.current));a>=0&&(setMenuOpen(!0),setActiveIndex(a))}}}o.useEffect.call(void 0,()=>{if(!_e)return;function handlePointerDown(e){const a=e.target;_optionalChain([he,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||_optionalChain([ge,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||setMenuOpen(!1)}document.addEventListener("pointerdown",handlePointerDown);const e=h.registerEscapeKeyHandler.call(void 0,e=>{p.isControlComposing.call(void 0,e,Ie.current)||(e.preventDefault(),setMenuOpen(!1),_optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})]))},()=>ge.current);return()=>{document.removeEventListener("pointerdown",handlePointerDown),e()}},[_e]),m(()=>{_e&&J&&qe&&ta()},[_e,qe,J,ta,Qe]),useFloatingLayoutObserver(_e&&J&&Boolean(qe),ta,me,ge),o.useEffect.call(void 0,()=>{if(P&&D&&!Pe)return we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{Promise.resolve(D(Fe)).catch(()=>{}),we.current=null},Math.max(0,O)),()=>{we.current&&clearTimeout(we.current)}},[Fe,Pe,P,O,D]),o.useEffect.call(void 0,()=>{if(!_e)return;const e=Me.current!==Fe;Me.current=Fe,Ae(a=>{const l=Qe.findIndex(e=>v.encodeSelectValue.call(void 0,e.value)===a);if(!e&&ea.includes(l))return a;const t=e&&F?q?_nullishCoalesce(ea[0],()=>-1):-1:_nullishCoalesce(ea.find(e=>Xe.has(v.encodeSelectValue.call(void 0,Qe[e].value))),()=>F&&Fe&&!q?-1:_nullishCoalesce(ea[0],()=>-1)),o=Qe[t];return o?v.encodeSelectValue.call(void 0,o.value):void 0})},[q,ea,F,_e,Fe,Xe,Qe]),o.useEffect.call(void 0,()=>{ue&&_e&&setMenuOpen(!1)},[ue,_e]),o.useEffect.call(void 0,()=>{if(!_e||aa<0||"undefined"==typeof document)return;const e=document.getElementById(`${ce}-option-${aa}`);h.revealFloatingItem.call(void 0,ge.current,e)},[aa,ce,_e,Qe]),o.useEffect.call(void 0,()=>{const e=_optionalChain([fe,"access",e=>e.current,"optionalAccess",e=>e.form]);if(!e)return;const a=new Set;function handleReset(e){const l=setTimeout(()=>{if(a.delete(l),e.defaultPrevented)return;const t=We.current,o=t.isControlled?t.currentValue:_nullishCoalesce(t.defaultValue,()=>t.multiple?[]:void 0);t.isControlled||(ke(o),Be([])),Se(!1),Le("");const i=v.normalizeSelectKeys.call(void 0,o);if(fe.current)for(const e of fe.current.options)e.selected=i.includes(_nullishCoalesce(e.dataset.ugKey,()=>""))||!t.multiple&&0===i.length&&""===e.value},0);a.add(l)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset),a.forEach(e=>clearTimeout(e))}},[oe.form]),o.useEffect.call(void 0,()=>()=>{Ce.current&&clearTimeout(Ce.current),we.current&&clearTimeout(we.current)},[]),o.useEffect.call(void 0,()=>{_e||Re||A&&K||Le("")},[Re,A,_e,K]);const oa=Je.length>0,ia=Math.max(1,Math.trunc(W)||1),na=A&&H?Je.slice(0,ia):Je,ra=Je.length-na.length,sa=Je.slice(ia).map(e=>e.label).join("、"),ca=A?na.map(e=>e.label).join("、"):_optionalChain([Je,"access",e=>e[0],"optionalAccess",e=>e.label]),da=Re?s.jsx.call(void 0,"div",{ref:ge,id:ce,role:"listbox","aria-multiselectable":A||void 0,"aria-hidden":"closed"===Ee||void 0,inert:"closed"===Ee||void 0,className:t.cn.call(void 0,"z-[70] max-h-[calc(var(--control-height-md)*7)] overflow-auto rounded-[var(--radius-panel)] border border-border-strong bg-[var(--ug-overlay-surface)] p-[calc(var(--content-gap)*0.25)] shadow-lg",J?"fixed":"absolute left-0 right-0 top-full mt-[calc(var(--content-gap)*0.25)]"),style:J?{top:Ve.top,left:Ve.left,width:Ve.width,zIndex:Ve.zIndex}:void 0,...xe,"data-ug":"select","data-ug-slot":"content","data-state":Ee,"data-side":Ve.side,"data-variant":A?"multiple":"single","data-size":ve,onAnimationEnd:ze,onBlurCapture:e=>{const a=e.relatedTarget;_optionalChain([he,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||e.currentTarget.contains(a)||setMenuOpen(!1)},children:B?s.jsx.call(void 0,"div",{className:"px-[var(--control-padding-x-sm)] py-[var(--content-gap)] text-center text-sm text-text-tertiary","data-ug-slot":"loading",children:V}):0===Qe.length?s.jsx.call(void 0,"div",{className:"px-[var(--control-padding-x-sm)] py-[var(--content-gap)] text-center text-sm text-text-tertiary","data-ug-slot":"empty",children:0===Ue.length?G:X}):Qe.map((e,a)=>{const l=v.encodeSelectValue.call(void 0,e.value),o=Xe.has(l),n=_optionalChain([Qe,"access",e=>e[a-1],"optionalAccess",e=>e.group]),r=A&&!o&&M>0&&Ge.length>=M;return s.jsxs.call(void 0,"div",{children:[e.group&&e.group!==n?s.jsx.call(void 0,"div",{className:"px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.375)] text-xs font-medium text-text-tertiary","data-ug-slot":"group",children:e.group}):null,s.jsxs.call(void 0,"button",{id:`${ce}-option-${a}`,type:"button",role:"option",tabIndex:-1,disabled:e.disabled||r,"aria-disabled":e.disabled||r||void 0,"aria-selected":o,"data-ug-slot":"item","data-active":aa===a,"data-state":e.disabled||r?"disabled":o?"selected":"default",className:t.cn.call(void 0,"flex w-full items-center gap-2 rounded-[var(--radius-control)] px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-left text-sm text-text-primary",o?"bg-primary-soft text-primary-soft-fg":"hover:bg-[var(--ug-overlay-surface-hover)]",aa===a&&!o&&"bg-[var(--ug-overlay-surface-hover)]",(e.disabled||r)&&"cursor-not-allowed opacity-50 hover:bg-transparent"),onClick:()=>handleSelect(e),onPointerEnter:()=>!e.disabled&&!r&&setActiveIndex(a),children:[s.jsx.call(void 0,"span",{className:"min-w-0 flex-1 truncate",children:e.label}),o?s.jsx.call(void 0,i.Check,{"aria-hidden":"true",className:"size-4 shrink-0","data-ug-slot":"check"}):null]})]},l)})}):null;return s.jsxs.call(void 0,"div",{ref:he,className:"relative flex min-w-0 flex-col gap-1.5","data-ug":"select","data-state":la,"data-variant":A?"multiple":"single","data-size":ve,"data-filterable":F,onBlurCapture:e=>{const a=e.relatedTarget;e.currentTarget.contains(a)||_optionalChain([ge,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||setMenuOpen(!1)},children:[r?s.jsx.call(void 0,"label",{id:se,htmlFor:re,className:"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"label",children:r}):null,s.jsxs.call(void 0,"select",{ref:function setSelectRef(e){fe.current=e,"function"==typeof l?l(e):l&&(l.current=e)},id:`${re}-native`,name:z,value:A?Je.map(e=>String(e.value)):Je[0]?String(Je[0].value):"",multiple:A,required:T,disabled:ue,tabIndex:-1,"aria-hidden":"true",className:"sr-only","data-ug-slot":"native",onChange:e=>_optionalChain([w,"optionalCall",a=>a(e)]),...oe,children:[A?null:s.jsx.call(void 0,"option",{value:"",children:b}),Ue.map(e=>s.jsx.call(void 0,"option",{"data-ug-key":v.encodeSelectValue.call(void 0,e.value),value:String(e.value),disabled:e.disabled,children:e.label},v.encodeSelectValue.call(void 0,e.value)))]}),s.jsxs.call(void 0,"div",{className:"relative min-w-0","data-ug-slot":"control","data-has-value":oa,"data-clearable":I&&oa&&!ue&&!B,children:[F?s.jsx.call(void 0,"input",{ref:me,type:"text",id:re,disabled:ue,"aria-label":Z,"aria-labelledby":_nullishCoalesce(Q,()=>!Z&&r?se:void 0),"aria-describedby":_nullishCoalesce(ee,()=>c||d?de:void 0),"aria-invalid":_nullishCoalesce(ae,()=>!!c||void 0),role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-expanded":_e,"aria-controls":ce,"aria-required":T||void 0,"aria-activedescendant":_e&&aa>=0?`${ce}-option-${aa}`:void 0,value:_e?Fe:_nullishCoalesce(ca,()=>""),placeholder:_e&&ca||b,className:t.cn.call(void 0,"block w-full min-w-0 text-left",f[ve],n),onClick:()=>setMenuOpen(!0),onChange:e=>{Le(e.target.value),setMenuOpen(!0)},onCompositionEnd:e=>{Ie.current=!1,De(!1),Le(e.currentTarget.value)},onCompositionStart:()=>{Ie.current=!0,De(!0)},onBlur:le,onFocus:te,onKeyDown:handleTriggerKeyDown,"data-ug-slot":"trigger","data-press-motion":E,"data-focus-ring-width":R,"data-state":la,"data-variant":A?"multiple":"single","data-size":ve}):s.jsxs.call(void 0,"button",{ref:me,type:"button",id:re,disabled:ue,"aria-label":Z,"aria-labelledby":_nullishCoalesce(Q,()=>!Z&&r?se:void 0),"aria-describedby":_nullishCoalesce(ee,()=>c||d?de:void 0),"aria-invalid":_nullishCoalesce(ae,()=>!!c||void 0),role:"combobox","aria-haspopup":"listbox","aria-expanded":_e,"aria-controls":ce,"aria-required":T||void 0,"aria-activedescendant":_e&&aa>=0?`${ce}-option-${aa}`:void 0,className:t.cn.call(void 0,"flex w-full min-w-0 items-center gap-2 py-0 text-left",f[ve],n),onClick:()=>setMenuOpen(!_e),onBlur:le,onFocus:te,onKeyDown:handleTriggerKeyDown,"data-ug-slot":"trigger","data-press-motion":E,"data-focus-ring-width":R,"data-state":la,"data-variant":A?"multiple":"single","data-size":ve,children:[s.jsx.call(void 0,"span",{className:"min-w-0 flex-1 truncate","data-ug-slot":"value",children:ca||b}),A&&H&&ra>0?s.jsxs.call(void 0,"span",{className:"shrink-0 text-xs text-text-secondary","data-ug-slot":"count",title:U?sa:void 0,children:["+",ra]}):null]}),s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"indicator",children:B?s.jsx.call(void 0,i.LoaderCircle,{className:"size-4 animate-spin text-text-tertiary motion-reduce:animate-none","data-ug-slot":"loading"}):s.jsx.call(void 0,i.ChevronDown,{className:t.cn.call(void 0,"size-4 text-text-tertiary transition-transform duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none",_e&&"rotate-180"),"data-ug-slot":"icon"})}),I&&oa&&!ue&&!B?s.jsx.call(void 0,"button",{type:"button","aria-label":"清空选择",className:"absolute right-[var(--control-padding-x-sm)] top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-[var(--radius-control)] text-text-tertiary hover:bg-surface-2 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",onClick:function clearSelection(e){_optionalChain([e,"optionalAccess",e=>e.stopPropagation,"call",e=>e()]),ue||0===Ge.length||(commitKeys([]),_optionalChain([k,"optionalCall",e=>e()]),Le(""),_optionalChain([me,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})]))},"data-ug-slot":"clear",children:s.jsx.call(void 0,i.X,{"aria-hidden":"true",className:"size-3.5"})}):null]}),J&&qe&&da?u.createPortal.call(void 0,da,qe):da,c?s.jsx.call(void 0,"p",{id:de,className:"min-w-0 text-xs text-danger [overflow-wrap:anywhere]","data-ug-slot":"message",children:c}):null,!c&&d?s.jsx.call(void 0,"p",{id:de,className:"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"message",children:d}):null]})});function useEscapeKey(e,a,l=e,t){const i=o.useRef.call(void 0,a);i.current=a,o.useEffect.call(void 0,()=>{if(!l||"undefined"==typeof document)return;const e=h.acquireBodyScrollLock.call(void 0);return()=>{e()}},[l]),o.useEffect.call(void 0,()=>{if(e&&"undefined"!=typeof document)return h.registerEscapeKeyHandler.call(void 0,e=>{e.isComposing||i.current()},t?()=>t.current:void 0)},[e,t])}g.displayName="Select";var b=o.createContext.call(void 0,null);function useOverlayFocus(e,a,l){const t=o.useRef.call(void 0,null),i=o.useContext.call(void 0,b);return o.useEffect.call(void 0,()=>{if(!e||"undefined"==typeof document)return;t.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const o=a.current;_optionalChain([o,"optionalAccess",e=>e.closest,"call",e=>e('[inert], [aria-hidden="true"]')])||h.focusFirstElement.call(void 0,o,l);const n=h.acquireModalBackgroundIsolation.call(void 0,o,()=>_nullishCoalesce(_optionalChain([i,"optionalAccess",e=>e.current]),()=>null));_optionalChain([o,"optionalAccess",e=>e.closest,"call",e=>e('[inert], [aria-hidden="true"]')])||_optionalChain([o,"optionalAccess",e=>e.contains,"call",e=>e(document.activeElement)])||h.focusFirstElement.call(void 0,o,l);const r=h.observeInitialFocusTarget.call(void 0,o,l);return()=>{r(),n(),h.restoreModalFocus.call(void 0,t.current),t.current=null}},[a,l,e,i]),o.useCallback.call(void 0,e=>{e.defaultPrevented||h.trapTabKey.call(void 0,e,a.current)},[a])}var x=o.createContext.call(void 0,null);function useModalContext(){const e=o.useContext.call(void 0,x);if(!e)throw new Error("Modal 子组件必须在 <Modal> 内使用");return e}var y=o.forwardRef.call(void 0,({open:a,onClose:l,children:i,className:n,ariaLabel:r="对话框",size:c="md",width:d,placement:v="center",topOffset:p="6vh",closeOnOverlay:h=!0,closeOnEsc:f=!0,initialFocusSelector:m},g)=>{const{present:y,state:C,handleAnimationEnd:w}=usePresence(a),N=o.useRef.call(void 0,null);useEscapeKey(a,()=>{f&&l()},y,N);const j=usePortalContainer(),k=`ug-modal-title-${o.useId.call(void 0).replace(/:/g,"")}`,_=useOverlayFocus(y&&Boolean(j),N,m),S=e.useUGThemePortalAttributes.call(void 0);return y&&j?u.createPortal.call(void 0,s.jsx.call(void 0,b.Provider,{value:N,children:s.jsx.call(void 0,x.Provider,{value:{onClose:l,titleId:k,size:c,width:d},children:s.jsxs.call(void 0,"div",{ref:e=>{N.current=e,"function"==typeof g?g(e):g&&(g.current=e)},...S,className:t.cn.call(void 0,"fixed inset-0 z-[80] flex justify-center p-[var(--content-gap)]","top"===v?"items-start":"items-center",n),role:"dialog",style:"top"===v?{paddingBlockStart:p}:void 0,"aria-modal":"true","aria-label":r,"aria-labelledby":k,tabIndex:-1,onKeyDown:_,onAnimationEnd:w,"data-ug":"modal","data-state":C,"data-variant":"default","data-size":c,children:[s.jsx.call(void 0,"div",{className:"absolute inset-0 bg-overlay",onClick:h?l:void 0,"aria-hidden":"true","data-ug-slot":"overlay"}),s.jsx.call(void 0,"div",{className:"relative z-10 flex w-full max-w-full justify-center",children:i})]})})}),j):null}),C=o.forwardRef.call(void 0,({className:e,maxWidth:a,children:l,style:o,...i},n)=>{const{size:r,width:c}=useModalContext();return s.jsx.call(void 0,"div",{ref:n,...i,style:{maxInlineSize:c,...o},className:t.cn.call(void 0,"flex max-h-[85vh] w-full flex-col rounded-[var(--radius-overlay)] border-[length:var(--ug-modal-border-width)] border-border-base bg-[var(--ug-overlay-surface)] p-[var(--ug-modal-padding)] shadow-xl",a,e),"data-ug-slot":"content","data-size":r,children:l})}),w=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"div",{ref:l,...a,className:t.cn.call(void 0,"flex shrink-0 items-center justify-between border-b-[length:var(--ug-modal-divider-width)] border-border-base p-[var(--ug-modal-section-padding)] pb-[var(--ug-modal-header-gap)]",e),"data-ug-slot":"header"})),N=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"div",{ref:l,...a,className:t.cn.call(void 0,"min-h-[0] flex-1 overflow-y-auto p-[var(--ug-modal-section-padding)]",e),"data-ug-slot":"body"})),j=o.forwardRef.call(void 0,({className:e,...a},l)=>{const{titleId:o}=useModalContext();return s.jsx.call(void 0,"h2",{ref:l,...a,id:o,className:t.cn.call(void 0,"m-0 text-lg font-[var(--ug-modal-title-weight)] leading-[var(--ug-modal-title-line-height)] text-text-primary",e),"data-ug-slot":"title"})}),k=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"div",{ref:l,...a,className:t.cn.call(void 0,"flex shrink-0 items-center justify-end gap-2 border-t-[length:var(--ug-modal-divider-width)] border-border-base p-[var(--ug-modal-section-padding)] pt-[var(--ug-modal-footer-gap)]",e),"data-ug-slot":"footer"})),_=o.forwardRef.call(void 0,({onClick:e,className:a,type:l="button",...o},n)=>{const{onClose:r}=useModalContext();return s.jsx.call(void 0,"button",{ref:n,type:l,onClick:a=>{_optionalChain([e,"optionalCall",e=>e(a)]),a.defaultPrevented||r()},className:t.cn.call(void 0,"inline-flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)] border-0 bg-transparent text-text-tertiary hover:bg-surface-3 hover:text-text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",a),"aria-label":"关闭","data-ug-slot":"close","data-size":"md",...o,children:s.jsx.call(void 0,i.X,{"aria-hidden":"true",focusable:"false",size:18})})});y.displayName="Modal",C.displayName="ModalContent",w.displayName="ModalHeader",N.displayName="ModalBody",j.displayName="ModalTitle",k.displayName="ModalFooter",_.displayName="ModalCloseButton";var S={sm:"gap-[calc(var(--content-gap)*0.75)] p-[calc(var(--content-gap)*0.875)]",md:"gap-[var(--content-gap)] p-[calc(var(--content-gap)*1.25)]",lg:"gap-[calc(var(--content-gap)*1.25)] p-[calc(var(--content-gap)*1.5)]"},R=o.forwardRef.call(void 0,({className:e,children:a,disabled:l,size:o="md",variant:i="plain",...n},r)=>s.jsx.call(void 0,"fieldset",{ref:r,className:t.cn.call(void 0,"m-0 grid min-w-0 border-0 text-text-primary","card"===i&&"border border-border-base bg-surface-1 [border-radius:var(--radius-panel)]","card"===i?S[o]:"gap-[var(--content-gap)] p-0",l&&"opacity-60",e),disabled:l,"data-ug":"fieldset","data-state":l?"disabled":"default","data-size":o,"data-variant":i,...n,children:a}));R.displayName="Fieldset";var E=o.forwardRef.call(void 0,({className:e,children:a,...l},o)=>s.jsx.call(void 0,"legend",{ref:o,className:t.cn.call(void 0,"max-w-full [padding-inline:0] text-sm font-medium leading-5 text-text-primary [overflow-wrap:anywhere]",e),"data-ug-slot":"legend",...l,children:a}));E.displayName="FieldsetLegend";var z=o.forwardRef.call(void 0,({className:e,children:a,...l},o)=>s.jsx.call(void 0,"p",{ref:o,className:t.cn.call(void 0,"m-0 text-xs leading-5 text-text-secondary [overflow-wrap:anywhere]",e),"data-ug-slot":"description",...l,children:a}));z.displayName="FieldsetDescription";var T={sm:20,md:28,lg:32},A=o.forwardRef.call(void 0,({icon:e,title:a,description:l,action:i,size:n="md",className:r,role:c="status","aria-label":d,"aria-labelledby":u,"aria-describedby":v,...p},h)=>{const f=o.useId.call(void 0),m=`${f}-title`,g=`${f}-description`;return s.jsxs.call(void 0,"div",{ref:h,...p,className:t.cn.call(void 0,"flex min-w-0 flex-col items-center justify-center text-center",r),role:c,"aria-label":d,"aria-labelledby":_nullishCoalesce(u,()=>d?void 0:m),"aria-describedby":_nullishCoalesce(v,()=>l?g:void 0),"data-ug":"empty-state","data-state":"default","data-variant":"default","data-size":n,children:[e&&s.jsx.call(void 0,"div",{className:"flex items-center justify-center bg-surface-2 [border-radius:calc(var(--radius-overlay)*999)]","data-ug-slot":"icon",children:s.jsx.call(void 0,e,{size:T[n],className:"text-text-tertiary","aria-hidden":"true"})}),s.jsxs.call(void 0,"div",{className:"flex min-w-0 max-w-full flex-col gap-1","data-ug-slot":"content",children:[s.jsx.call(void 0,"p",{id:m,className:"font-semibold text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"title",children:a}),l&&s.jsx.call(void 0,"p",{id:g,className:"text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"description",children:l})]}),i&&s.jsx.call(void 0,"div",{className:"mt-1","data-ug-slot":"action",children:i})]})});A.displayName="EmptyState";var M=o.forwardRef.call(void 0,({className:e,scrollRegionLabel:a="数据表格滚动区域",scrollRegionTabIndex:l=0,size:o="md",bordered:i=!1,striped:n=!1,hoverable:r=!0,...c},d)=>{const u=["default",i?"bordered":void 0,n?"striped":void 0,r?"hoverable":void 0].filter(Boolean).join(" ")||"default";return s.jsx.call(void 0,"div",{className:"w-full overflow-auto",role:"region","aria-label":a,tabIndex:l,"data-ug":"table","data-state":u,"data-variant":i?"bordered":"default","data-size":o,children:s.jsx.call(void 0,"table",{ref:d,className:t.cn.call(void 0,"w-full caption-bottom",e),"data-ug-slot":"table",...c})})}),I=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"thead",{ref:l,className:e,"data-ug-slot":"header",...a})),F=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"tbody",{ref:l,className:e,"data-ug-slot":"body",...a})),L=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"tr",{ref:l,className:t.cn.call(void 0,e),"data-ug-slot":"row","data-state":"default",...a})),P=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"th",{ref:l,className:t.cn.call(void 0,"text-left align-middle font-medium",e),"data-ug-slot":"head",...a})),D=o.forwardRef.call(void 0,({className:e,...a},l)=>s.jsx.call(void 0,"td",{ref:l,className:t.cn.call(void 0,"align-middle text-text-primary",e),"data-ug-slot":"cell",...a}));M.displayName="Table",I.displayName="TableHeader",F.displayName="TableBody",L.displayName="TableRow",P.displayName="TableHead",D.displayName="TableCell";var O=require("@ug666/ui-web/sidebar"),B=o.createContext.call(void 0,null),V="undefined"==typeof window?o.useEffect:o.useLayoutEffect;function assignRef(e,a){"function"!=typeof e?e&&(e.current=a):e(a)}function useTooltipContext(){const e=o.useContext.call(void 0,B);if(!e)throw new Error("Tooltip 子组件必须在 <Tooltip> 内使用");return e}var K=o.forwardRef.call(void 0,({children:e,delayDuration:a=200,className:l},i)=>{const[n,r]=o.useState.call(void 0,!1),c=o.useRef.call(void 0,null),d=o.useRef.call(void 0,null),u=`ug-tooltip-${o.useId.call(void 0).replace(/:/g,"")}`,v=Number.isFinite(a)?Math.max(0,Math.round(a)):200;return o.useEffect.call(void 0,()=>()=>{d.current&&clearTimeout(d.current)},[]),s.jsx.call(void 0,B.Provider,{value:{open:n,setOpen:r,triggerRef:c,delayRef:d,delayDuration:v,contentId:u},children:s.jsx.call(void 0,"span",{ref:i,className:t.cn.call(void 0,"relative inline-flex",l),"data-ug":"tooltip","data-state":n?"open":"default","data-variant":"default","data-size":"md",children:e})})}),$=o.forwardRef.call(void 0,({children:e,className:a},l)=>{const{open:i,setOpen:n,triggerRef:r,delayRef:c,delayDuration:d,contentId:u}=useTooltipContext(),v=o.useCallback.call(void 0,e=>{r.current=e,assignRef(l,e)},[l,r]);return o.useEffect.call(void 0,()=>{if(i)return h.bindOwnedDescriptionToken.call(void 0,r.current,u)},[u,i,r]),s.jsx.call(void 0,"span",{ref:v,className:t.cn.call(void 0,"inline-flex",a),onMouseEnter:function handleMouseEnter(){c.current&&clearTimeout(c.current),0!==d?c.current=setTimeout(()=>n(!0),d):n(!0)},onMouseLeave:function handleMouseLeave(){c.current&&clearTimeout(c.current),_optionalChain([r,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(document.activeElement)])||n(!1)},onFocus:()=>n(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||n(!1)},onKeyDown:e=>{"Escape"===e.key&&i&&(e.preventDefault(),n(!1))},"data-ug-slot":"trigger","data-state":i?"open":"default",children:e})}),q={top:"after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-text-primary",bottom:"after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-b-text-primary",left:"after:absolute after:left-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-l-text-primary",right:"after:absolute after:right-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-r-text-primary"},H=o.forwardRef.call(void 0,({children:a,side:l="top",className:i,style:n,...r},c)=>{const{open:d,triggerRef:v,contentId:p}=useTooltipContext(),f="sidebar"===r["data-ug-context"],m=o.useRef.call(void 0,null),g=usePortalContainer(),b=e.useUGThemePortalAttributes.call(void 0),{present:x,state:y,handleAnimationEnd:C}=usePresence(d),[w,N]=o.useState.call(void 0,{top:0,left:0,side:l,zIndex:50}),j=o.useCallback.call(void 0,e=>{m.current=e,assignRef(c,e)},[c]),k=o.useCallback.call(void 0,()=>{if(!v.current||!m.current)return;const e=v.current.getBoundingClientRect(),a=h.resolveFloatingPosition.call(void 0,e,{width:m.current.offsetWidth,height:m.current.offsetHeight},{width:window.innerWidth,height:window.innerHeight},{side:l,align:"center",offset:f?O.SIDEBAR_OVERLAY_OFFSET:8});N({...a,zIndex:h.resolveFloatingZIndex.call(void 0,v.current,50)})},[f,l,v]);return V(()=>{d&&k()},[d,k]),useFloatingLayoutObserver(d,k,v,m),x&&g?u.createPortal.call(void 0,s.jsxs.call(void 0,"div",{ref:j,id:p,role:"tooltip",...b,...r,style:{...n,top:w.top,left:w.left,zIndex:_nullishCoalesce(_optionalChain([n,"optionalAccess",e=>e.zIndex]),()=>w.zIndex)},className:t.cn.call(void 0,"fixed z-50 max-w-[min(20rem,calc(100vw-1rem))] [overflow-wrap:anywhere]",f?null:"rounded-[var(--radius-control)] bg-text-primary px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.375)] text-xs text-surface-1 shadow-md",!f&&q[w.side],i),"aria-hidden":"closed"===y||void 0,inert:"closed"===y||void 0,"data-ug":"tooltip","data-ug-slot":"content","data-state":y,"data-side":w.side,"data-variant":"default","data-size":"md",onAnimationEnd:C,children:[f?s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"arrow"}):null,a]}),g):null});function SidebarNavList({items:e,depth:a=0,parentKey:l="root",listId:n,renderChildren:r=!0,...c}){const[d,u]=o.useState.call(void 0,r);return r&&!d&&u(!0),s.jsx.call(void 0,"ul",{id:n,"data-depth":a,"data-ug-slot":"list",children:(d||r)&&e.map((e,o)=>{const n=O.getSidebarItemKey.call(void 0,e,o,l),r=Boolean(_optionalChain([e,"access",e=>e.children,"optionalAccess",e=>e.length])),d=`${c.instanceId}-list-${encodeURIComponent(n)}`,u=Boolean(e.active),v=c.activeBranches.has(e),p=r&&(c.normalizedQuery.length>0||_nullishCoalesce(c.expandedOverrides.get(n),()=>u||v)),h=!c.collapsed&&p,f=c.collapsed?c.collapsedFlyoutKey===n:p,m=s.jsxs.call(void 0,s.Fragment,{children:[s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"flex shrink-0 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",c.styles.icon),"data-ug-slot":"icon",children:s.jsx.call(void 0,e.icon,{"aria-hidden":"true",size:16})}),s.jsx.call(void 0,"span",{"aria-hidden":c.collapsed,className:"min-w-0 flex-1 truncate text-left","data-state":c.collapsed?"hidden":"visible","data-ug-slot":"label",children:e.label}),void 0!==e.badge?s.jsx.call(void 0,"span",{"aria-hidden":c.collapsed,className:t.cn.call(void 0,"shrink-0 rounded-full px-[calc(var(--control-padding-x-sm)*0.75)] py-0.5 text-xs font-semibold leading-none",c.styles.badge),"data-state":c.collapsed?"hidden":"visible","data-ug-slot":"badge",children:e.badge}):null]}),g=r?c.collapsed?s.jsx.call(void 0,i.ChevronRight,{"aria-hidden":"true",className:t.cn.call(void 0,"shrink-0",c.styles.chevron),"data-state":f?"open":"closed","data-ug-slot":"collapsed-chevron",size:11}):s.jsx.call(void 0,i.ChevronDown,{"aria-hidden":"true",className:t.cn.call(void 0,"shrink-0 transition-transform duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none",c.styles.chevron,p&&"rotate-180"),"data-state":"visible","data-ug-slot":"chevron",size:15}):null,b=t.cn.call(void 0,"group relative flex w-full min-w-0 items-center gap-[calc(var(--control-padding-x-sm)*0.5)] overflow-hidden px-[var(--control-padding-x-sm)] text-sm font-normal no-underline outline-none [border-radius:var(--radius-control)] focus-visible:ring-2",c.styles.focusRing,"compact"===c.density?a>0?"min-h-[var(--ug-sidebar-subitem-height-compact)] py-0":"min-h-[var(--ug-sidebar-item-height-compact)] py-0":a>0?"min-h-[var(--ug-sidebar-subitem-height)] py-[calc(var(--control-height-sm)*0.125)]":"min-h-[var(--ug-sidebar-item-height)] py-[calc(var(--control-height-sm)*0.125)]",u?t.cn.call(void 0,c.styles.active,"indicator"===c.activeStyle?c.styles.activeIndicator:c.styles.activeHighlight):v?c.styles.branchActive:c.styles.inactive),x=s.jsx.call(void 0,"a",{"aria-current":e.active?"page":void 0,"aria-label":c.collapsed?e.label:void 0,className:b,href:_nullishCoalesce(e.href,()=>"#"),onClick:c.onNavigate,onFocus:a=>O.syncSidebarOverflowTitle.call(void 0,a.currentTarget,e.label,c.collapsed),onMouseEnter:a=>O.syncSidebarOverflowTitle.call(void 0,a.currentTarget,e.label,c.collapsed),children:m});return s.jsxs.call(void 0,"li",{"data-depth":a,"data-state":u?"active":v?"contains-active":"default","data-ug-slot":"item",children:[r?s.jsxs.call(void 0,"button",{"aria-controls":c.collapsed?`${c.instanceId}-flyout`:d,"aria-expanded":f,"aria-haspopup":c.collapsed?"menu":void 0,"aria-label":`${f?"收起":"展开"}${e.label}${c.collapsed||void 0===e.badge?"":` ${e.badge}`}菜单`,className:t.cn.call(void 0,"m-0 w-full cursor-pointer appearance-none border-0 bg-transparent p-0 text-left",b),onClick:a=>{if(c.collapsed)return c.onOpenCollapsedFlyout(e,n,a.currentTarget),void(0===a.detail&&c.onFocusFlyoutItem("first"));c.onToggle(n,p)},onFocus:a=>{O.syncSidebarOverflowTitle.call(void 0,a.currentTarget,e.label,c.collapsed),c.onOpenCollapsedFlyout(e,n,a.currentTarget)},onKeyDown:a=>{if("Escape"===a.key&&c.collapsedFlyoutKey)return a.preventDefault(),a.stopPropagation(),void c.onCloseFlyout();!c.collapsed||"ArrowRight"!==a.key&&"ArrowDown"!==a.key||(a.preventDefault(),c.onOpenCollapsedFlyout(e,n,a.currentTarget),c.onFocusFlyoutItem("first"))},onMouseEnter:a=>{O.syncSidebarOverflowTitle.call(void 0,a.currentTarget,e.label,c.collapsed),c.onOpenCollapsedFlyout(e,n,a.currentTarget,"hover")},onMouseLeave:c.onScheduleFlyoutClose,type:"button",children:[m,g]}):c.collapsed?s.jsxs.call(void 0,K,{className:"flex",delayDuration:0,children:[s.jsx.call(void 0,$,{className:"flex",children:x}),s.jsx.call(void 0,H,{"data-custom-colors":c.customColors?"true":"false","data-navigation-variant":c.variant,"data-ug-context":"sidebar",side:"right",style:c.navigationColorStyle,children:e.label})]}):x,r&&e.children?s.jsx.call(void 0,"div",{"aria-hidden":!h,"data-state":h?"open":"closed","data-ug-slot":"submenu",inert:!h||void 0,children:s.jsx.call(void 0,"div",{"data-ug-slot":"submenu-clip",children:s.jsx.call(void 0,SidebarNavList,{...c,depth:a+1,items:e.children,listId:d,parentKey:n,renderChildren:h})})}):null]},n)})})}function SidebarCollapsedFlyoutItems({items:e,parentKey:a,depth:l=0,groupLabel:o,...i}){return s.jsx.call(void 0,"ul",{"aria-label":o,"data-depth":l,"data-ug-slot":0===l?"flyout-list":"flyout-group",role:0===l?"none":"group",children:e.map((e,o)=>{const n=O.getSidebarItemKey.call(void 0,e,o,a),r=Boolean(_optionalChain([e,"access",e=>e.children,"optionalAccess",e=>e.length])),c=Boolean(e.active),d=i.activeBranches.has(e),u=s.jsxs.call(void 0,s.Fragment,{children:[s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"flex shrink-0 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",i.styles.icon),"data-ug-slot":"icon",children:s.jsx.call(void 0,e.icon,{"aria-hidden":"true",size:16})}),s.jsx.call(void 0,"span",{className:"min-w-0 flex-1 truncate",children:e.label}),void 0!==e.badge?s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"shrink-0 rounded-full px-[calc(var(--control-padding-x-sm)*0.75)] py-0.5 text-xs font-semibold leading-none",i.styles.badge),children:e.badge}):null]});return r&&e.children?s.jsxs.call(void 0,"li",{role:"none",children:[s.jsx.call(void 0,"div",{"data-depth":l,"data-state":d?"contains-active":"default","data-ug-slot":"flyout-group-label",role:"presentation",children:u}),s.jsx.call(void 0,SidebarCollapsedFlyoutItems,{...i,depth:l+1,groupLabel:e.label,items:e.children,parentKey:n})]},n):s.jsx.call(void 0,"li",{role:"none",children:s.jsx.call(void 0,"a",{"aria-current":c?"page":void 0,className:t.cn.call(void 0,"focus-visible:ring-2",i.styles.focusRing,c?t.cn.call(void 0,i.styles.active,"indicator"===i.activeStyle?i.styles.activeIndicator:i.styles.activeHighlight):i.styles.inactive),"data-depth":l,"data-state":c?"active":"default","data-ug-slot":"flyout-item",href:_nullishCoalesce(e.href,()=>"#"),onClick:i.onNavigate,role:"menuitem",children:u})},n)})})}K.displayName="Tooltip",$.displayName="TooltipTrigger",H.displayName="TooltipContent";var W="undefined"==typeof window?o.useEffect:o.useLayoutEffect,U=o.forwardRef.call(void 0,({items:l,variant:n="primary",activeStyle:r="highlight",density:c="comfortable",itemHeight:d,subItemHeight:v,colors:p,collapsed:f,defaultCollapsed:m=!1,onCollapsedChange:g,collapsible:b=!1,bottomCollapsible:x=!1,resizable:y=!1,width:C,defaultWidth:w=256,minWidth:N=208,maxWidth:j=480,onWidthChange:k,searchable:_=!1,searchPlaceholder:S="搜索菜单...",responsive:R=!1,mobileOpen:E=!1,onMobileOpenChange:z,header:T,headerAlign:A="start",headerDivider:M=!0,collapsedHeader:I,contextSwitcher:F,contextSwitcherVisible:L=!1,contextSwitcherDividers:P=!1,contextSwitcherPlacement:D="after-search",scrollActiveItemIntoView:B=!0,footer:V,searchDividers:K=!0,className:$,style:q,...H},U)=>{const G=O.resolveSidebarStyles.call(void 0,n,Boolean(p)),X=`ug-sidebar-${o.useId.call(void 0).replace(/:/g,"")}`,J=`${X}-search`,[Y,Z]=o.useState.call(void 0,m),[Q,ee]=o.useState.call(void 0,()=>new Map),[ae,le]=o.useState.call(void 0,""),te=o.useMemo.call(void 0,()=>O.normalizeSidebarRange.call(void 0,N,j),[j,N]),[oe,ie]=o.useState.call(void 0,()=>O.clampSidebarWidth.call(void 0,w,te.min,te.max)),[ne,re]=o.useState.call(void 0,!1),se=o.useRef.call(void 0,null),ce=o.useRef.call(void 0,null),de=o.useRef.call(void 0,null),ue=o.useRef.call(void 0,null),ve=o.useRef.call(void 0,null),pe=o.useRef.call(void 0,!1),he=o.useRef.call(void 0,!1),fe=o.useRef.call(void 0,null),me=o.useRef.call(void 0,null),ge=o.useRef.call(void 0,null),be=o.useRef.call(void 0,null),[xe,ye]=o.useState.call(void 0,null),[Ce,we]=o.useState.call(void 0,{top:0,left:0,side:"right",arrowOffset:0}),Ne=usePortalContainer(),je=e.useUGThemePortalAttributes.call(void 0),ke=_nullishCoalesce(f,()=>Y),_e=R&&E,Se=ke&&!_e,Re=a.useMediaQuery.call(void 0,"(max-width: 767px)"),Ee=R&&Re&&!E,ze=O.clampSidebarWidth.call(void 0,_nullishCoalesce(C,()=>oe),te.min,te.max),Te=O.normalizeSidebarSearch.call(void 0,ae),Ae=o.useMemo.call(void 0,()=>O.filterSidebarItems.call(void 0,l,Te),[l,Te]),Me=o.useMemo.call(void 0,()=>O.createSidebarTreeMeta.call(void 0,l),[l]),Ie=o.useMemo.call(void 0,()=>Ae===l?Me:O.createSidebarTreeMeta.call(void 0,Ae),[l,Me,Ae]),Fe=o.useMemo.call(void 0,()=>p?O.getSidebarNavigationStyle.call(void 0,p):void 0,[p]);function cancelFlyoutClose(){ge.current&&(clearTimeout(ge.current),ge.current=null)}function scheduleFlyoutClose(){cancelFlyoutClose(),ge.current=setTimeout(()=>ye(null),80)}W(()=>{0!==Me.activeBranchKeys.length&&ee(e=>{let a=e;return Me.activeBranchKeys.forEach(l=>{a.has(l)||(a===e&&(a=new Map(e)),a.set(l,!0))}),a})},[Me.activeBranchSignal]),o.useEffect.call(void 0,()=>{if(!B||Se||Te)return;const e=window.requestAnimationFrame(()=>{const e=me.current,a=_optionalChain([e,"optionalAccess",e=>e.querySelector,"call",e=>e('[aria-current="page"]')]);if(!e||!a||0===e.clientHeight)return;const l=e.getBoundingClientRect(),t=a.getBoundingClientRect();(t.top<l.top+24||t.bottom>l.bottom-24)&&(e.scrollTop+=t.top-l.top-e.clientHeight/2+t.height/2)});return()=>window.cancelAnimationFrame(e)},[Te,Se,B,Ie.activeItemSignal]);const Le=o.useCallback.call(void 0,()=>{if(!ue.current||!ve.current)return;const e=ue.current.getBoundingClientRect(),a=h.resolveFloatingPosition.call(void 0,e,{width:ve.current.offsetWidth,height:ve.current.offsetHeight},{width:window.innerWidth,height:window.innerHeight},{side:"right",align:"start",offset:O.SIDEBAR_OVERLAY_OFFSET});we({...a,arrowOffset:e.top+e.height/2-a.top})},[]),Pe=o.useCallback.call(void 0,()=>{null===be.current&&(be.current=window.requestAnimationFrame(()=>{be.current=null,Le()}))},[Le]);function setCollapsedState(e){Z(e),_optionalChain([g,"optionalCall",a=>a(e)])}W(()=>{xe&&Le()},[xe,Le]),useFloatingLayoutObserver(Boolean(xe),Pe,ue,ve),o.useEffect.call(void 0,()=>{Se?le(""):ye(null)},[Se]),o.useEffect.call(void 0,()=>{if(xe&&"undefined"!=typeof document)return document.addEventListener("pointerdown",handleDocumentPointerDown,!0),()=>{document.removeEventListener("pointerdown",handleDocumentPointerDown,!0)};function handleDocumentPointerDown(e){const a=e.target;a instanceof Node&&(_optionalChain([fe,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||_optionalChain([ve,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)])||function closeFlyout(){ge.current&&(clearTimeout(ge.current),ge.current=null),ye(null)}())}},[xe]),o.useEffect.call(void 0,()=>{if("undefined"==typeof document)return;function handleResize(){pe.current=!0,ge.current&&(clearTimeout(ge.current),ge.current=null),ye(null)}const releaseHoverSuppression=()=>{pe.current=!1};return window.addEventListener("resize",handleResize),document.addEventListener("pointermove",releaseHoverSuppression,!0),document.addEventListener("pointerdown",releaseHoverSuppression,!0),()=>{window.removeEventListener("resize",handleResize),document.removeEventListener("pointermove",releaseHoverSuppression,!0),document.removeEventListener("pointerdown",releaseHoverSuppression,!0)}},[]),useEscapeKey(_e,closeMobile),o.useEffect.call(void 0,()=>{if(!_e||"undefined"==typeof document)return;const e=document.activeElement instanceof HTMLElement?document.activeElement:null,a=window.requestAnimationFrame(()=>h.focusFirstElement.call(void 0,fe.current));return()=>{window.cancelAnimationFrame(a),_optionalChain([e,"optionalAccess",e=>e.isConnected])&&e.focus({preventScroll:!0})}},[_e]),o.useEffect.call(void 0,()=>()=>{ge.current&&clearTimeout(ge.current),null!==be.current&&window.cancelAnimationFrame(be.current)},[]);const De=o.useCallback.call(void 0,e=>{const a=O.clampSidebarWidth.call(void 0,e,te.min,te.max);void 0===C&&ie(a),_optionalChain([k,"optionalCall",e=>e(a)])},[k,C,te.max,te.min]);function closeMobile(){_optionalChain([z,"optionalCall",e=>e(!1)])}function closeFlyoutAndRestoreFocus(){ye(null),he.current=!0,_optionalChain([ue,"access",e=>e.current,"optionalAccess",e=>e.focus,"call",e=>e({preventScroll:!0})]),he.current=!1}o.useEffect.call(void 0,()=>{if(!ne||!Ne)return;const e=Ne.style.cursor,a=Ne.style.userSelect;function handlePointerMove(e){const a=se.current;a&&(de.current=a.width+e.clientX-a.x,null===ce.current&&(ce.current=window.requestAnimationFrame(()=>{ce.current=null;const e=de.current;de.current=null,null!==e&&De(e)})))}function stopResizing(){null!==ce.current&&window.cancelAnimationFrame(ce.current),ce.current=null;const e=de.current;de.current=null,null!==e&&De(e),se.current=null,re(!1)}return Ne.style.cursor="col-resize",Ne.style.userSelect="none",window.addEventListener("pointermove",handlePointerMove),window.addEventListener("pointerup",stopResizing),window.addEventListener("pointercancel",stopResizing),()=>{window.removeEventListener("pointermove",handlePointerMove),window.removeEventListener("pointerup",stopResizing),window.removeEventListener("pointercancel",stopResizing),null!==ce.current&&window.cancelAnimationFrame(ce.current),ce.current=null,de.current=null,Ne.style.cursor=e,Ne.style.userSelect=a}},[ne,Ne,De]);const Oe=L&&Boolean(F),Be=_&&Oe,utilityRegionClassName=e=>O.getSidebarUtilityRegionClass.call(void 0,e,Be,D),Ve=Oe?s.jsx.call(void 0,"div",{"aria-hidden":Se,className:t.cn.call(void 0,"shrink-0",utilityRegionClassName("context-switcher"),P&&"border-y",G.divider),"data-dividers":P?"visible":"hidden","data-state":Se?"closed":"open","data-ug-slot":"context-switcher",inert:!!Se||void 0,children:F},"context-switcher"):null,Ke=_?s.jsxs.call(void 0,"div",{"aria-hidden":Se,className:t.cn.call(void 0,utilityRegionClassName("search"),K&&"border-y",G.divider),"data-dividers":K?"visible":"hidden","data-state":Se?"closed":"open","data-ug-slot":"search",inert:!!Se||void 0,children:[s.jsx.call(void 0,"label",{className:"sr-only",htmlFor:J,children:"搜索菜单"}),s.jsxs.call(void 0,"div",{className:"relative",children:[s.jsx.call(void 0,i.Search,{className:t.cn.call(void 0,"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 [height:calc(var(--control-height-sm)*0.5)] [width:calc(var(--control-height-sm)*0.5)]",G.searchIcon),"aria-hidden":"true"}),s.jsx.call(void 0,"input",{id:J,value:ae,onChange:e=>le(e.target.value),placeholder:S,autoComplete:"off",className:t.cn.call(void 0,"w-full border px-[var(--control-padding-x-sm)] pl-9 pr-9 text-sm outline-none [height:var(--control-height-md)] [border-radius:var(--radius-control)] focus:ring-2",G.searchInput),type:"text",role:"searchbox"}),ae?s.jsx.call(void 0,"button",{type:"button",className:t.cn.call(void 0,"absolute right-1 top-1/2 flex -translate-y-1/2 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",G.clear),"aria-label":"清空搜索","data-ug-slot":"clear",onClick:()=>le(""),children:s.jsx.call(void 0,i.X,{size:14})}):null]})]},"search"):null,$e="before-search"===D?[Ve,Ke]:[Ke,Ve];const qe=s.jsxs.call(void 0,"aside",{ref:e=>{fe.current=e,"function"==typeof U?U(e):U&&(U.current=e)},...H,"aria-hidden":!!Ee||void 0,"aria-label":_nullishCoalesce(H["aria-label"],()=>"主导航"),"aria-modal":!!_e||void 0,className:t.cn.call(void 0,"relative flex flex-col overflow-hidden",G.container,R&&["fixed inset-y-0 left-0 z-50 md:relative md:inset-auto md:z-auto",E?"translate-x-0":"-translate-x-full md:translate-x-0"],$),"data-ug":"sidebar","data-state":[Se?"collapsed":"expanded",R&&E?"mobile-open":null].filter(Boolean).join(" "),"data-variant":n,"data-active-style":r,"data-density":c,"data-size":"md","data-resizable":y?"true":"false","data-resizing":ne?"true":"false",inert:!!Ee||void 0,onKeyDown:function handleSidebarKeyDown(e){_e&&h.trapTabKey.call(void 0,e,fe.current),_optionalChain([H,"access",e=>e.onKeyDown,"optionalCall",a=>a(e)])},role:_e?"dialog":H.role,style:{...q,...Fe,width:Se?72:ze,...void 0===d?null:{"--ug-sidebar-item-height":"number"==typeof d?`${d}px`:d},...void 0===v?null:{"--ug-sidebar-subitem-height":"number"==typeof v?`${v}px`:v}},tabIndex:_e?-1:H.tabIndex,children:[(T||I||b||R&&E)&&s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"relative flex min-h-[var(--ug-sidebar-header-height)] items-center gap-2 px-[var(--control-padding-x-sm)]",M&&"border-b",G.divider),"data-align":A,"data-divider":M?"visible":"hidden","data-ug-slot":"header",children:[T?s.jsx.call(void 0,"div",{"aria-hidden":Se,className:t.cn.call(void 0,"flex min-w-0 flex-1","center"===A?"justify-center":"justify-start"),"data-state":Se?"hidden":"visible","data-ug-slot":"header-content",inert:!!Se||void 0,children:T}):null,I&&!b?s.jsx.call(void 0,"div",{"aria-hidden":!Se,className:"flex min-w-0 items-center justify-center","data-state":Se?"visible":"hidden","data-ug-slot":"collapsed-header",inert:!Se||void 0,children:I}):null,Se||T?null:s.jsx.call(void 0,"div",{className:"flex-1"}),b&&s.jsx.call(void 0,"button",{type:"button",className:t.cn.call(void 0,"shrink-0 items-center justify-center border [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)]",R?"hidden md:flex":"flex",G.control),"aria-label":ke?"展开侧边栏":"折叠侧边栏","data-ug-slot":"toggle",onClick:()=>setCollapsedState(!ke),children:ke?s.jsx.call(void 0,i.PanelLeftOpen,{size:17}):s.jsx.call(void 0,i.PanelLeftClose,{size:17})}),R&&s.jsx.call(void 0,"button",{type:"button",className:t.cn.call(void 0,"flex shrink-0 items-center justify-center border [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)] md:hidden",G.control),"aria-label":"关闭侧边栏","data-ug-slot":"close",onClick:closeMobile,children:s.jsx.call(void 0,i.X,{size:17})})]}),$e,s.jsx.call(void 0,"nav",{ref:me,className:t.cn.call(void 0,"flex-1 overflow-x-hidden overflow-y-auto overscroll-contain","compact"===c?!_&&!Oe||Se?"pb-3 pt-2":"pb-3 pt-0.5":!_&&!Oe||Se?"pb-5 pt-3":"pb-5 pt-0.5"),"data-ug-slot":"nav",children:Ae.length>0?s.jsx.call(void 0,SidebarNavList,{activeBranches:Ie.activeBranches,activeStyle:r,collapsed:Se,collapsedFlyoutKey:_optionalChain([xe,"optionalAccess",e=>e.key]),customColors:Boolean(p),density:c,expandedOverrides:Q,instanceId:X,items:Ae,navigationColorStyle:Fe,normalizedQuery:Te,onCloseFlyout:closeFlyoutAndRestoreFocus,onFocusFlyoutItem:function focusFlyoutItem(e="first"){window.requestAnimationFrame(()=>{O.focusSidebarMenuBoundary.call(void 0,ve.current,e)})},onNavigate:closeMobile,onOpenCollapsedFlyout:function openCollapsedFlyout(e,a,l,t="interaction"){Se&&("hover"===t&&pe.current||he.current||(cancelFlyoutClose(),ue.current=l,ye(l=>_optionalChain([l,"optionalAccess",e=>e.key])===a?l:{item:e,key:a})))},onScheduleFlyoutClose:scheduleFlyoutClose,onToggle:function toggleExpanded(e,a){ee(l=>{const t=new Map(l);return t.set(e,!a),t})},styles:G,variant:n}):s.jsx.call(void 0,"p",{className:t.cn.call(void 0,"mx-3 border border-dashed px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.75)] text-sm [border-radius:var(--radius-panel)]",G.empty),"data-ug-slot":"empty",children:"没有匹配的菜单"})}),V&&s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"border-t px-[calc(var(--control-padding-x-sm)*0.8)] py-[calc(var(--content-gap)*0.75)]",G.divider,Se&&"flex justify-center"),"data-ug-slot":"footer",children:V}),x?s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"shrink-0 border-t p-2",R?"hidden md:block":"block",G.divider),"data-ug-slot":"bottom-toggle",children:s.jsx.call(void 0,"button",{type:"button",className:t.cn.call(void 0,"flex w-full items-center justify-center border-0 bg-transparent [height:var(--control-height-md)] [border-radius:var(--radius-control)]",G.inactive),"aria-label":ke?"展开侧边栏":"折叠侧边栏","data-ug-slot":"toggle",onClick:()=>setCollapsedState(!ke),children:ke?s.jsx.call(void 0,i.ChevronRight,{"aria-hidden":"true",size:17}):s.jsx.call(void 0,i.ChevronLeft,{"aria-hidden":"true",size:17})})}):null,y&&!Se?s.jsxs.call(void 0,"div",{"aria-label":"调整侧边栏宽度","aria-orientation":"vertical","aria-valuemax":te.max,"aria-valuemin":te.min,"aria-valuenow":ze,className:"group absolute inset-y-0 -right-1 z-20 hidden w-4 cursor-col-resize touch-none outline-none md:block","data-ug-slot":"resize-handle",title:"拖动调整侧边栏宽度,双击恢复默认",onDoubleClick:()=>De(w),onKeyDown:function handleResizeKeyDown(e){const a=e.shiftKey?16:8;let l;"ArrowLeft"===e.key&&(l=ze-a),"ArrowRight"===e.key&&(l=ze+a),"Home"===e.key&&(l=te.min),"End"===e.key&&(l=te.max),void 0!==l&&(e.preventDefault(),De(l))},onPointerDown:e=>{0===e.button&&(e.preventDefault(),se.current={x:e.clientX,width:ze},re(!0))},role:"separator",tabIndex:0,children:[s.jsx.call(void 0,"span",{"aria-hidden":"true",className:t.cn.call(void 0,"absolute inset-y-0 right-1 w-px group-hover:w-0.5 group-focus-visible:w-0.5",G.resizeHandle)}),s.jsxs.call(void 0,"span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col gap-[3px] opacity-45 transition-[opacity] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none","data-ug-slot":"resize-grip",children:[s.jsx.call(void 0,"span",{className:"block size-[3px] rounded-full bg-border-strong group-hover:bg-primary group-focus-visible:bg-primary"}),s.jsx.call(void 0,"span",{className:"block size-[3px] rounded-full bg-border-strong group-hover:bg-primary group-focus-visible:bg-primary"}),s.jsx.call(void 0,"span",{className:"block size-[3px] rounded-full bg-border-strong group-hover:bg-primary group-focus-visible:bg-primary"})]})]}):null]});return s.jsxs.call(void 0,s.Fragment,{children:[R&&E?s.jsx.call(void 0,"button",{type:"button",className:"fixed inset-0 z-40 bg-overlay md:hidden","aria-label":"关闭侧边栏遮罩","data-ug-slot":"overlay",onClick:closeMobile,tabIndex:-1}):null,qe,Se&&xe&&Ne?u.createPortal.call(void 0,s.jsxs.call(void 0,"div",{...je,"aria-label":`${xe.item.label}菜单`,"data-active-style":r,"data-custom-colors":p?"true":"false","data-density":c,"data-side":Ce.side,"data-state":"open","data-ug":"sidebar-flyout","data-ug-slot":"content","data-variant":n,id:`${X}-flyout`,onBlur:e=>{const a=e.relatedTarget;a instanceof Node&&(e.currentTarget.contains(a)||_optionalChain([ue,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",e=>e(a)]))||ye(null)},onKeyDown:function handleFlyoutKeyDown(e){if("Escape"===e.key||"ArrowLeft"===e.key)return e.preventDefault(),e.stopPropagation(),void closeFlyoutAndRestoreFocus();O.moveSidebarMenuFocus.call(void 0,e.currentTarget,e.key)&&e.preventDefault()},onMouseEnter:cancelFlyoutClose,onMouseLeave:scheduleFlyoutClose,ref:ve,role:"menu",style:{...Fe,"--ug-sidebar-flyout-arrow-offset":`${Ce.arrowOffset}px`,top:Ce.top,left:Ce.left},children:[s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"arrow"}),s.jsxs.call(void 0,"div",{"data-ug-slot":"panel",children:[s.jsxs.call(void 0,"div",{"data-ug-slot":"title",children:[s.jsx.call(void 0,"span",{"data-ug-slot":"title-icon",children:s.jsx.call(void 0,xe.item.icon,{"aria-hidden":"true",size:16})}),s.jsx.call(void 0,"span",{"data-ug-slot":"title-label",children:xe.item.label})]}),s.jsx.call(void 0,SidebarCollapsedFlyoutItems,{activeBranches:Ie.activeBranches,activeStyle:r,items:_nullishCoalesce(xe.item.children,()=>[]),onNavigate:()=>{ye(null),closeMobile()},parentKey:xe.key,styles:G})]})]}),Ne):null]})});U.displayName="Sidebar";var integer=(e,a)=>"number"==typeof e&&Number.isFinite(e)?Math.floor(e):a;function pageNumbers(e,a){return a<=5?Array.from({length:a},(e,a)=>a+1):e<=3?[1,2,3,"...",a]:e>=a-2?[1,"...",a-2,a-1,a]:[1,"...",e,"...",a]}var G=o.forwardRef.call(void 0,function Pagination2({page:e,totalPages:a,total:n,pageSize:r,defaultPageSize:c=10,pageSizeOptions:d,onPageChange:u,onPageSizeChange:v,showTotal:p=!1,showJumper:h=!1,hideOnSingle:f=!1,disabled:m,size:b,className:x,...y},C){const w=t.useUIConfig.call(void 0),N=t.resolveDisabled.call(void 0,m,w.disabled),j=_nullishCoalesce(b,()=>"small"===w.size?"sm":"large"===w.size?"lg":"md"),k="md"===j?"default":j,[_,S]=o.useState.call(void 0,Math.max(1,integer(c,10))),R=Math.max(1,integer(_nullishCoalesce(r,()=>_),10)),E=Math.max(0,integer(n,0)),z=void 0!==a?Math.max(0,integer(a,0)):Math.ceil(E/R),T=0===z?0:Math.min(z,Math.max(1,integer(e,1))),[A,M]=o.useState.call(void 0,String(T||1)),I=o.useRef.call(void 0,void 0);o.useEffect.call(void 0,()=>{M(String(T||1)),I.current=void 0},[T]);const F=[...new Set([..._nullishCoalesce(d,()=>[]),R].filter(Number.isFinite).map(Math.floor).filter(e=>e>0))];function changePage(e){if(N||0===z)return;const a=Math.min(z,Math.max(1,integer(e,T)));a!==T&&u(a)}function jump(){const e=Number(A),a=Number.isFinite(e)&&A.trim()?Math.min(z,Math.max(1,Math.floor(e))):T;M(String(a||1)),a!==I.current&&(I.current=a,changePage(a))}return f&&z<=1?null:s.jsxs.call(void 0,"nav",{...y,ref:C,"aria-label":_nullishCoalesce(y["aria-label"],()=>"分页导航"),className:x,"data-ug":"pagination","data-state":N?"disabled":"default","data-variant":"default","data-size":j,"data-layout":p||d||h?"full":"simple",children:[p&&s.jsxs.call(void 0,"span",{"data-ug-slot":"total",children:["共 ",E," 条"]}),d&&s.jsx.call(void 0,"span",{"data-ug-slot":"sizes",children:s.jsx.call(void 0,g,{"aria-label":"每页条数",size:k,disabled:N,value:R,options:F.map(e=>({value:e,label:`每页 ${e} 条`})),onValueChange:e=>"number"==typeof e&&function changeSize(e){N||e===R||!Number.isFinite(e)||e<=0||(void 0===r&&S(Math.floor(e)),_optionalChain([v,"optionalCall",a=>a(Math.floor(e))]),1!==T&&u(1),M("1"))}(e)})}),s.jsxs.call(void 0,"span",{"data-ug-slot":"pages",children:[s.jsx.call(void 0,"button",{type:"button",disabled:N||T<=1,onClick:()=>changePage(T-1),"aria-label":"上一页","data-ug-slot":"prev","data-state":N||T<=1?"disabled":"default",children:s.jsx.call(void 0,i.ChevronLeft,{size:16,"aria-hidden":"true"})}),pageNumbers(T,z).map((e,a)=>"..."===e?s.jsx.call(void 0,"span",{"data-ug-slot":"ellipsis",children:"…"},`ellipsis-${a}`):s.jsx.call(void 0,"button",{type:"button",disabled:N,onClick:()=>changePage(e),"aria-label":`第 ${e} 页`,"aria-current":e===T?"page":void 0,"data-ug-slot":"item","data-state":N?"disabled":e===T?"active":"default",children:e},e)),s.jsx.call(void 0,"button",{type:"button",disabled:N||0===z||T>=z,onClick:()=>changePage(T+1),"aria-label":"下一页","data-ug-slot":"next","data-state":N||0===z||T>=z?"disabled":"default",children:s.jsx.call(void 0,i.ChevronRight,{size:16,"aria-hidden":"true"})})]}),h&&s.jsxs.call(void 0,"label",{"data-ug-slot":"jumper",children:["前往",s.jsx.call(void 0,l.Input,{"aria-label":"跳转页码",type:"number",min:1,max:z||1,step:1,size:k,disabled:N||0===z,value:A,onChange:e=>{I.current=void 0,M(e.target.value)},onBlur:jump,onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),jump())}}),"页"]})]})});G.displayName="Pagination";var X=o.forwardRef.call(void 0,({children:e,className:a,defaultValue:l=[],disabled:i,form:n,max:c,min:d=0,name:u,onValueChange:v,orientation:p="horizontal",size:h,value:f,...m},g)=>{const b=t.useUIConfig.call(void 0),x=o.useRef.call(void 0,null),[y,C]=o.useState.call(void 0,[...l]),w=void 0===f?y:f,N=t.resolveDisabled.call(void 0,i,b.disabled),j=t.resolveControlSize.call(void 0,h,b.size),k=Math.max(0,d),_=void 0===c?void 0:Math.max(k,c),S=o.useRef.call(void 0,{value:f,defaultValue:l});S.current={value:f,defaultValue:l},o.useEffect.call(void 0,()=>{const e=n?document.getElementById(n):_nullishCoalesce(_optionalChain([x,"access",e=>e.current,"optionalAccess",e=>e.closest,"call",e=>e("form")]),()=>null);if(!e)return;const a=new Set;function handleReset(e){const l=setTimeout(()=>{a.delete(l);const t=S.current;e.defaultPrevented||void 0!==t.value||C([...t.defaultValue])},0);a.add(l)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset),a.forEach(clearTimeout)}},[n]);const R=o.useMemo.call(void 0,()=>({values:w,form:n,name:u,size:j,disabled:N,isOptionDisabled:(e,a,l=!1)=>!(!N&&!l)||(a?w.length<=k:void 0!==_&&w.length>=_&&!w.includes(e)),toggleValue(e,a){const l=a?w.includes(e)?[...w]:[...w,e]:w.filter(a=>a!==e);l.length<k||void 0!==_&&l.length>_||(void 0===f&&C(l),_optionalChain([v,"optionalCall",e=>e(l)]))}}),[u,n,_,k,v,N,j,f,w]);return s.jsx.call(void 0,r.Provider,{value:R,children:s.jsx.call(void 0,"div",{...m,ref:e=>{x.current=e,function assignRef2(e,a){"function"==typeof e?e(a):e&&(e.current=a)}(g,e)},className:t.cn.call(void 0,"flex","vertical"===p?"flex-col items-start gap-2":"flex-row flex-wrap items-center gap-x-5 gap-y-2",a),"data-size":j,"data-state":N?"disabled":"default","data-ug":"checkbox-group","data-ug-slot":"root","data-variant":p,role:"group","aria-disabled":N||void 0,children:e})})});X.displayName="CheckboxGroup";var J=o.createContext.call(void 0,null);function assignRef3(e,a){"function"==typeof e?e(a):e&&(e.current=a)}var Y=n.cva.call(void 0,"relative inline-flex shrink-0 items-center justify-center rounded-[var(--ug-radio-radius)] border shadow-sm peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{size:{sm:"h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)]",default:"h-[calc(var(--control-height-md)*0.45)] w-[calc(var(--control-height-md)*0.45)]",lg:"h-[calc(var(--control-height-lg)*0.45)] w-[calc(var(--control-height-lg)*0.45)]"},checked:{true:"border-primary bg-surface-1",false:"border-border-strong bg-surface-1 hover:border-primary/70 hover:bg-surface-2"}},defaultVariants:{size:"default",checked:!1}}),Z=o.forwardRef.call(void 0,({className:e,size:a,value:l,checked:i,defaultChecked:n=!1,disabled:r,label:c,variant:d="default",labelClassName:u,controlClassName:v,name:p,form:h,required:f,onChange:m,id:g,"aria-invalid":b,...x},y)=>{const C=function useRadioGroupContext(){return o.useContext.call(void 0,J)}(),w=t.useUIConfig.call(void 0),N=o.useId.call(void 0),j=o.useRef.call(void 0,null),k=_nullishCoalesce(g,()=>N),[_,S]=o.useState.call(void 0,Boolean(n)),R=C?C.value===l:_nullishCoalesce(i,()=>_),E=C?C.disabled||Boolean(r):t.resolveDisabled.call(void 0,r,w.disabled),z=C?C.name:p,T=_nullishCoalesce(_optionalChain([C,"optionalAccess",e=>e.form]),()=>h),A=_nullishCoalesce(_optionalChain([C,"optionalAccess",e=>e.required]),()=>Boolean(f)),M=o.useRef.call(void 0,{checkedProp:i,defaultChecked:n});M.current={checkedProp:i,defaultChecked:n},o.useEffect.call(void 0,()=>{const e=_optionalChain([j,"access",e=>e.current,"optionalAccess",e=>e.form]);if(!e||C)return;const a=new Set;function handleReset(l){const t=setTimeout(()=>{a.delete(t);const o=j.current;if(l.defaultPrevented||!o||o.form!==e)return;const i=M.current,n=Boolean(_nullishCoalesce(i.checkedProp,()=>i.defaultChecked));void 0===i.checkedProp&&S(n),o.checked=n},0);a.add(t)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of a)clearTimeout(e)}},[Boolean(C),T]);const I=t.resolveControlSize.call(void 0,_nullishCoalesce(a,()=>_optionalChain([C,"optionalAccess",e=>e.size])),w.size),F=t.isAriaInvalid.call(void 0,b),L=[R?"checked":"unchecked",F?"invalid":void 0,E?"disabled":void 0].filter(Boolean).join(" "),P="sm"===I?"h-[calc(var(--control-height-sm)*0.2)] w-[calc(var(--control-height-sm)*0.2)]":"lg"===I?"h-[calc(var(--control-height-lg)*0.22)] w-[calc(var(--control-height-lg)*0.22)]":"h-[calc(var(--control-height-md)*0.2)] w-[calc(var(--control-height-md)*0.2)]",D=s.jsxs.call(void 0,"span",{className:"relative inline-flex","data-ug-slot":"control",children:[s.jsx.call(void 0,"input",{ref:e=>{j.current=e,assignRef3(y,e)},id:k,type:"radio",className:"peer sr-only",value:l,checked:R,"aria-invalid":b,disabled:E,name:z,form:T,required:A,onChange:function handleChange(){C?C.onValueChange(l):(void 0===i&&S(!0),_optionalChain([m,"optionalCall",e=>e(l)]))},"data-ug-slot":"input",...x,"data-ug-value-type":typeof l}),s.jsx.call(void 0,"span",{"aria-hidden":"true",className:t.cn.call(void 0,Y({size:I,checked:R}),F&&"border-danger peer-focus-visible:ring-danger/35",e),"data-ug-slot":"indicator",children:R&&s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"rounded-[var(--ug-radio-radius)] bg-primary",P),"data-ug-slot":"dot"})})]});return null==c?s.jsx.call(void 0,"span",{"data-ug":"radio","data-state":L,"data-variant":"default","data-size":I,children:D}):s.jsxs.call(void 0,"label",{htmlFor:k,className:t.cn.call(void 0,"card"===d?"flex min-h-[calc(var(--control-height-lg)*1.75)] w-full cursor-pointer select-none items-start gap-3 rounded-[var(--radius-panel)] border border-border-base bg-surface-1 p-[var(--content-gap)] text-sm leading-5 text-text-primary shadow-xs hover:border-border-strong hover:bg-surface-2 focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/30":"segmented"===d?"inline-flex w-full min-w-0 cursor-pointer select-none items-center justify-center gap-0 rounded-[calc(var(--radius-control)*0.75)] border border-transparent bg-transparent text-center leading-5 text-text-secondary shadow-none transition-[background-color,border-color,box-shadow,color] duration-[var(--motion-duration-state)] hover:bg-surface-3 hover:text-text-primary focus-within:z-10 focus-within:outline-none focus-within:ring-2 focus-within:ring-ring/30":"inline-flex min-h-[var(--control-height-sm)] max-w-full min-w-0 cursor-pointer items-start gap-2.5 text-sm leading-5 text-text-primary select-none","segmented"===d&&("sm"===I?"min-h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] text-sm":"lg"===I?"min-h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] text-base":"min-h-[var(--control-height-md)] px-[var(--control-padding-x-md)] text-sm"),"card"===d&&R&&"border-primary bg-primary-soft shadow-sm","segmented"===d&&R&&"border-primary/25 bg-surface-1 text-primary-soft-fg shadow-xs","card"===d&&F&&"border-danger focus-within:ring-danger/30","segmented"===d&&F&&"border-danger focus-within:ring-danger/30",E&&"cursor-not-allowed opacity-60",u),"data-ug":"radio","data-state":L,"data-variant":d,"data-size":I,children:[s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"card"===d&&"mt-0.5","segmented"===d&&"sr-only",v),"data-ug-slot":"control",children:D}),s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"min-w-0 pt-px [overflow-wrap:anywhere]","card"===d&&"flex-1"),"data-ug-slot":"label",children:c})]})});Z.displayName="Radio";var Q=o.forwardRef.call(void 0,({className:e,value:a,defaultValue:l,onValueChange:i,disabled:n,size:r,name:c,form:d,required:u=!1,orientation:v="vertical",presentation:p="default",sizing:h="fill",children:f,...m},g)=>{const b=t.useUIConfig.call(void 0),x=o.useRef.call(void 0,null),y=o.useId.call(void 0),[C,w]=o.useState.call(void 0,l),N=void 0!==a,j=N?a:C,k=t.resolveDisabled.call(void 0,n,b.disabled),_=t.resolveControlSize.call(void 0,r,b.size),S=o.useRef.call(void 0,{defaultValue:l,currentValue:j,isControlled:N});return S.current={defaultValue:l,currentValue:j,isControlled:N},o.useEffect.call(void 0,()=>{const e=d?document.getElementById(d):_nullishCoalesce(_optionalChain([x,"access",e=>e.current,"optionalAccess",e=>e.closest,"call",e=>e("form")]),()=>null);if(!e)return;const a=new Set;function handleReset(l){const t=setTimeout(()=>{if(a.delete(t),l.defaultPrevented||!x.current)return;const o=S.current,i=o.isControlled?o.currentValue:o.defaultValue;o.isControlled||w(i);for(const a of x.current.querySelectorAll('input[type="radio"]'))a.form===e&&a.closest('[data-ug="radio-group"]')===x.current&&(a.checked=a.dataset.ugValueType===typeof i&&("number"==typeof i?Number(a.value)===i:a.value===i))},0);a.add(t)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of a)clearTimeout(e)}},[d]),s.jsx.call(void 0,J.Provider,{value:{value:j,onValueChange:function handleValueChange(e){N||w(e),_optionalChain([i,"optionalCall",a=>a(e)])},name:_nullishCoalesce(c,()=>`ug-radio-${y}`),form:d,required:u,disabled:k,size:_},children:s.jsx.call(void 0,"div",{ref:e=>{x.current=e,assignRef3(g,e)},role:"radiogroup","aria-disabled":k||void 0,"aria-required":u||void 0,className:t.cn.call(void 0,"segmented"===p?t.cn.call(void 0,"grid max-w-full grid-flow-col auto-cols-fr gap-1 rounded-[var(--radius-control)] border border-border-base bg-surface-2 p-1","content"===h?"w-fit":"w-full"):t.cn.call(void 0,"flex","vertical"===v?"flex-col gap-2.5":"flex-row flex-wrap gap-x-5 gap-y-2.5"),e),...m,"data-ug":"radio-group","data-state":k?"disabled":"default","data-variant":v,"data-presentation":p,"data-sizing":h,"data-size":_,children:f})})});Q.displayName="RadioGroup";var ee=o.createContext.call(void 0,null),ae=o.createContext.call(void 0,null);function useTabsContext(){const e=o.useContext.call(void 0,ee);if(!e)throw new Error("Tabs 子组件必须在 <Tabs> 内使用");return e}function getTabsPartId(e,a,l){return`${e}-${l}-${encodeURIComponent(a)}`}var le=(()=>{const e=o.forwardRef.call(void 0,({value:e,onValueChange:a,children:l,className:i,size:n="md",variant:r="default",onClose:c,onAdd:d,addLabel:u="添加标签",...v},p)=>{const h=`ug-tabs-${o.useId.call(void 0).replace(/:/g,"")}`;return s.jsx.call(void 0,ee.Provider,{value:{value:e,onValueChange:a,baseId:h,size:n,variant:r,onClose:c,onAdd:d,addLabel:u},children:s.jsx.call(void 0,"div",{ref:p,className:t.cn.call(void 0,"w-full",i),...v,"data-ug":"tabs","data-state":"default","data-variant":r,"data-size":n,children:l})})});return e.displayName="Tabs",e})(),te=(()=>{const e=o.forwardRef.call(void 0,({className:e,children:a,orientation:l="horizontal",...n},r)=>{const{variant:c,size:d,onAdd:u,addLabel:v}=useTabsContext(),p=o.useRef.call(void 0,null),h=o.useCallback.call(void 0,e=>{p.current=e,"function"==typeof r?r(e):r&&(r.current=e)},[r]),[f,m]=o.useState.call(void 0,null),[g,b]=o.useState.call(void 0,!0);return o.useLayoutEffect.call(void 0,()=>{const e=p.current;if(!e)return;const update=()=>b(Boolean(e.querySelector('[role="tab"]')));update();const a=new MutationObserver(update);return a.observe(e,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),s.jsx.call(void 0,ae.Provider,{value:{listRef:p,host:f},children:s.jsxs.call(void 0,"div",{"data-ug-slot":"list-frame","data-orientation":l,children:[s.jsxs.call(void 0,"div",{"data-ug-slot":"list-viewport",children:[s.jsx.call(void 0,"div",{ref:h,role:g?"tablist":void 0,"aria-orientation":g?l:void 0,tabIndex:-1,className:t.cn.call(void 0,"flex w-full min-w-0 items-center overflow-x-auto","rail"===c&&"flex-col items-stretch gap-1 overflow-visible p-0",e),...n,"data-ug-slot":"list","data-variant":c,"data-size":d,children:a}),s.jsx.call(void 0,"div",{ref:m,"data-ug-slot":"edit-actions"})]}),u&&s.jsx.call(void 0,"button",{type:"button",onClick:u,"aria-label":v,"data-ug-slot":"add",children:s.jsx.call(void 0,i.Plus,{size:14,"aria-hidden":"true"})})]})})});return e.displayName="TabsList",e})(),oe=(()=>{const a=o.forwardRef.call(void 0,({value:a,className:l,children:n,disabled:r,onClick:c,onKeyDown:d,id:v,closable:p=!1,closeLabel:h,"aria-controls":f,...m},g)=>{const{value:b,onValueChange:x,baseId:y,size:C,variant:w,onClose:N}=useTabsContext(),j=o.useContext.call(void 0,ae),k=o.useRef.call(void 0,null),_=function useClosePosition(e,a,l){const[t,i]=o.useState.call(void 0);return o.useLayoutEffect.call(void 0,()=>{const t=e.current,o=_optionalChain([a,"optionalAccess",e=>e.host]),n=_nullishCoalesce(_optionalChain([a,"optionalAccess",e=>e.listRef,"access",e=>e.current]),()=>_optionalChain([t,"optionalAccess",e=>e.closest,"call",e=>e('[data-ug-slot="list"]')]));if(!(l&&t&&o&&n))return;function update(){const e=t.getBoundingClientRect(),a=o.getBoundingClientRect(),l={left:e.right-a.left-e.height,top:e.top-a.top,width:e.height,height:e.height};i(e=>e&&Object.keys(l).every(a=>e[a]===l[a])?e:l)}update();const r="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(update);_optionalChain([r,"optionalAccess",e=>e.observe,"call",e=>e(t)]),_optionalChain([r,"optionalAccess",e=>e.observe,"call",e=>e(o)]),_optionalChain([r,"optionalAccess",e=>e.observe,"call",e=>e(n)]);const s=new MutationObserver(update);return s.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("scroll",update,{passive:!0}),window.addEventListener("resize",update),()=>{_optionalChain([r,"optionalAccess",e=>e.disconnect,"call",e=>e()]),s.disconnect(),n.removeEventListener("scroll",update),window.removeEventListener("resize",update)}},[a,l,e]),t}(k,j,p),S=usePortalContainer(),R=e.useUGThemePortalAttributes.call(void 0),E=b===a,z=getTabsPartId(y,a,"trigger"),T=getTabsPartId(y,a,"panel"),A=[E?"selected":void 0,r?"disabled":void 0].filter(Boolean).join(" ")||"default";function closeTab(e){if(r||!N)return;const l=_nullishCoalesce(_optionalChain([j,"optionalAccess",e=>e.listRef,"access",e=>e.current]),()=>e.closest('[role="tablist"]')),t=Array.from(_nullishCoalesce(_optionalChain([l,"optionalAccess",e=>e.querySelectorAll,"call",e=>e('[role="tab"]:not(:disabled)')]),()=>[])),o=t.find(e=>e.id===_nullishCoalesce(v,()=>z)),i=o?t.indexOf(o):-1,n=_nullishCoalesce(t[i+1],()=>t[i-1]);N(a),E&&_optionalChain([n,"optionalAccess",e=>e.dataset,"access",e=>e.value])&&x(n.dataset.value),setTimeout(()=>{if(_optionalChain([n,"optionalAccess",e=>e.isConnected]))n.focus();else{const e=_optionalChain([l,"optionalAccess",e=>e.closest,"call",e=>e('[data-ug-slot="list-frame"]')]),a=_optionalChain([e,"optionalAccess",e=>e.querySelector,"call",e=>e('[data-ug-slot="add"]')]);_optionalChain([_nullishCoalesce(a,()=>l),"optionalAccess",e=>e.focus,"call",e=>e()])}},0)}const M=s.jsx.call(void 0,"button",{ref:e=>{k.current=e,"function"==typeof g?g(e):g&&(g.current=e)},type:"button",role:"tab",id:_nullishCoalesce(v,()=>z),"aria-controls":_nullishCoalesce(f,()=>T),"aria-selected":E,tabIndex:E?0:-1,disabled:r,onClick:e=>{r||(x(a),_optionalChain([c,"optionalCall",a=>a(e)]))},onKeyDown:e=>{_optionalChain([d,"optionalCall",a=>a(e)]);const a=e.currentTarget.closest('[role="tablist"]'),l=_nullishCoalesce(_optionalChain([a,"optionalAccess",e=>e.getAttribute,"call",e=>e("aria-orientation")]),()=>"horizontal"),t="vertical"===l?"ArrowUp":"ArrowLeft",o="vertical"===l?"ArrowDown":"ArrowRight";if(!e.defaultPrevented&&p&&"Delete"===e.key)return e.preventDefault(),void closeTab(e.currentTarget);if(e.defaultPrevented||![t,o,"Home","End"].includes(e.key))return;const i=Array.from(_nullishCoalesce(_optionalChain([a,"optionalAccess",e=>e.querySelectorAll,"call",e=>e('[role="tab"]:not(:disabled)')]),()=>[])),n=i.indexOf(e.currentTarget);if(n<0||0===i.length)return;e.preventDefault();const r="Home"===e.key?0:"End"===e.key?i.length-1:(n+(e.key===o?1:-1)+i.length)%i.length;_optionalChain([i,"access",e=>e[r],"optionalAccess",e=>e.focus,"call",e=>e()]),_optionalChain([i,"access",e=>e[r],"optionalAccess",e=>e.click,"call",e=>e()])},className:t.cn.call(void 0,"relative shrink-0 whitespace-nowrap border-0 bg-transparent font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50","rail"===w&&"flex w-full items-center justify-start rounded-[var(--radius-control)] border border-transparent text-left text-text-secondary shadow-none hover:bg-surface-3 hover:text-text-primary data-[state=selected]:border-primary/25 data-[state=selected]:bg-primary-soft data-[state=selected]:text-primary-soft-fg","rail"===w&&("sm"===C?"px-[var(--control-padding-x-sm)] text-sm":"lg"===C?"px-[var(--control-padding-x-lg)] text-base":"px-[var(--control-padding-x-md)] text-sm"),l),...m,"data-closable":p||void 0,"data-value":a,"data-ug-slot":"trigger","data-state":A,"data-variant":w,"data-size":C,children:n});return s.jsxs.call(void 0,s.Fragment,{children:[M,p&&S&&_optionalChain([j,"optionalAccess",e=>e.host])&&u.createPortal.call(void 0,s.jsx.call(void 0,"button",{...R,type:"button",disabled:r,style:_,"aria-label":_nullishCoalesce(h,()=>`关闭 ${"string"==typeof n?n:a}`),"data-ug-slot":"close",onFocus:function revealClose(){const e=k.current,a=_optionalChain([j,"optionalAccess",e=>e.listRef,"access",e=>e.current]);if(!e||!a)return;const l=e.getBoundingClientRect(),t=a.getBoundingClientRect();l.left<t.left?a.scrollLeft-=t.left-l.left:l.right>t.right&&(a.scrollLeft+=l.right-t.right),l.top<t.top?a.scrollTop-=t.top-l.top:l.bottom>t.bottom&&(a.scrollTop+=l.bottom-t.bottom),a.dispatchEvent(new Event("scroll"))},onClick:e=>closeTab(e.currentTarget),children:s.jsx.call(void 0,i.X,{size:12,"aria-hidden":"true"})}),j.host)]})});return a.displayName="TabsTrigger",a})(),ie=(()=>{const e=o.forwardRef.call(void 0,({value:e,className:a,children:l,id:o,style:i,"aria-labelledby":n,...r},c)=>{const{value:d,baseId:u}=useTabsContext(),v=d===e;return s.jsx.call(void 0,"div",{ref:c,role:"tabpanel",id:_nullishCoalesce(o,()=>getTabsPartId(u,e,"panel")),"aria-labelledby":_nullishCoalesce(n,()=>getTabsPartId(u,e,"trigger")),hidden:!v,tabIndex:v?0:-1,style:v?i:{...i,display:"none"},className:t.cn.call(void 0,"focus-visible:outline-none",a),...r,"data-ug-slot":"content","data-state":v?"selected":"inactive",children:l})});return e.displayName="TabsContent",e})(),ne=o.createContext.call(void 0,null);function useNavigationMenuContext(){const e=o.useContext.call(void 0,ne);if(!e)throw new Error("NavigationMenu 子组件必须在 <NavigationMenu> 内使用");return e}var re=o.createContext.call(void 0,null);function useNavigationMenuItemContext(){const e=o.useContext.call(void 0,re);if(!e)throw new Error("NavigationMenuTrigger/Content 必须在 <NavigationMenuItem> 内使用");return e}var se=(()=>{const e=o.forwardRef.call(void 0,({activation:e="hover",tone:a="default",orientation:l="horizontal",collapsed:i=!1,onNavigate:n,className:r,children:c,...d},u)=>{const[v,p]=o.useState.call(void 0,null),h=o.useRef.call(void 0,null);return o.useEffect.call(void 0,()=>{if("click"===e&&v)return document.addEventListener("pointerdown",handlePointerDown,!0),()=>document.removeEventListener("pointerdown",handlePointerDown,!0);function handlePointerDown(e){_optionalChain([h,"access",e=>e.current,"optionalAccess",e=>e.contains,"call",a=>a(e.target)])||p(null)}},[e,v]),s.jsx.call(void 0,ne.Provider,{value:{activation:e,activeItem:v,setActiveItem:p,tone:a,orientation:l,collapsed:i&&"vertical"===l,onNavigate:n},children:s.jsx.call(void 0,"nav",{ref:e=>{h.current=e,function assignRef4(e,a){"function"==typeof e?e(a):e&&(e.current=a)}(u,e)},"aria-label":"主导航",className:t.cn.call(void 0,"relative flex gap-1","vertical"===l?"w-full flex-col items-stretch":"items-center",r),"data-ug":"navigation-menu","data-state":"default","data-variant":"default","data-size":"md","data-activation":e,"data-tone":a,"data-orientation":l,"data-collapsed":i&&"vertical"===l||void 0,...d,children:c})})});return e.displayName="NavigationMenu",e})(),ce=(()=>{const e=o.forwardRef.call(void 0,({className:e,children:a,onMouseEnter:l,onMouseLeave:i,onBlur:n,...r},c)=>{const d=`ug-navigation-item-${o.useId.call(void 0).replace(/:/g,"")}`,{activation:u,activeItem:v,setActiveItem:p}=useNavigationMenuContext(),h=v===d,f=o.useRef.call(void 0,!1),m=o.useCallback.call(void 0,e=>{"hover"===u?(f.current=!h,p(d),_optionalChain([l,"optionalCall",a=>a(e)])):_optionalChain([l,"optionalCall",a=>a(e)])},[u,h,d,l,p]),g=o.useCallback.call(void 0,e=>{"hover"===u?(f.current=!1,p(null),_optionalChain([i,"optionalCall",a=>a(e)])):_optionalChain([i,"optionalCall",a=>a(e)])},[u,i,p]);return s.jsx.call(void 0,re.Provider,{value:{itemId:d,hoverOpened:f},children:s.jsx.call(void 0,"div",{ref:c,className:t.cn.call(void 0,"relative",e),onMouseEnter:m,onMouseLeave:g,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p(null),_optionalChain([n,"optionalCall",a=>a(e)])},"data-ug-slot":"item","data-state":h?"open":"closed",...r,children:a})})});return e.displayName="NavigationMenuItem",e})(),de=(()=>{const e=o.forwardRef.call(void 0,({className:e,active:a=!1,children:l,onClick:o,icon:i,collapsedLabel:n,...r},c)=>{const{setActiveItem:d,tone:u,collapsed:v,onNavigate:p}=useNavigationMenuContext();return s.jsxs.call(void 0,"a",{ref:c,className:t.cn.call(void 0,"inline-flex items-center px-[var(--control-padding-x-sm)] py-[calc(var(--control-height-sm)*0.2)] text-sm font-medium [border-radius:var(--radius-control)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1","default"===u?a?"bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] text-text-primary":"text-text-secondary hover:bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] hover:text-text-primary":void 0,e),"data-ug-slot":"link","data-state":a?"active":"default","aria-current":a?"page":void 0,title:v?n:r.title,"aria-label":v?_nullishCoalesce(n,()=>r["aria-label"]):r["aria-label"],onClick:e=>{d(null),_optionalChain([o,"optionalCall",a=>a(e)]),e.defaultPrevented||_optionalChain([p,"optionalCall",a=>a(r.href,e)])},...r,children:[(i||v)&&s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"icon",children:_nullishCoalesce(i,()=>_nullishCoalesce(n,()=>"string"==typeof l?l:"…").slice(0,1))}),s.jsx.call(void 0,"span",{"data-ug-slot":"label",children:l})]})});return e.displayName="NavigationMenuLink",e})(),ue=(()=>{const e=o.forwardRef.call(void 0,({active:e=!1,className:a,children:l,id:o,onClick:n,onKeyDown:r,icon:c,collapsedLabel:d,"aria-controls":u,...v},p)=>{const{activeItem:h,setActiveItem:f,tone:m,collapsed:g}=useNavigationMenuContext(),{itemId:b,hoverOpened:x}=useNavigationMenuItemContext(),y=h===b,C=`${b}-trigger`,w=`${b}-content`;return s.jsxs.call(void 0,"button",{ref:p,type:"button",id:_nullishCoalesce(o,()=>C),"aria-controls":_nullishCoalesce(u,()=>w),"aria-expanded":y,title:g?d:v.title,"aria-label":g?_nullishCoalesce(d,()=>v["aria-label"]):v["aria-label"],onClick:e=>{x.current?(x.current=!1,f(b)):f(y?null:b),_optionalChain([n,"optionalCall",a=>a(e)])},onKeyDown:e=>{_optionalChain([r,"optionalCall",a=>a(e)]),e.defaultPrevented||("Escape"===e.key?(e.preventDefault(),f(null)):"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),f(b),function focusContent(e){requestAnimationFrame(()=>{const a=Array.from(_nullishCoalesce(_optionalChain([document,"access",e=>e.getElementById,"call",e=>e(w),"optionalAccess",e=>e.querySelectorAll,"call",e=>e('a[href], button:not(:disabled), [tabindex]:not([tabindex="-1"])')]),()=>[]));_optionalChain(["first"===e?a[0]:a.at(-1),"optionalAccess",e=>e.focus,"call",e=>e()])})}("ArrowDown"===e.key?"first":"last")))},className:t.cn.call(void 0,"inline-flex items-center gap-1 border-0 bg-transparent px-[var(--control-padding-x-sm)] py-[calc(var(--control-height-sm)*0.2)] text-sm font-medium [border-radius:var(--radius-control)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1","default"===m?y||e?"bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] text-text-primary":"text-text-secondary hover:bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] hover:text-text-primary":void 0,a),"data-ug-slot":"trigger","data-state":y?"open":"closed","data-active":e?"true":"false",...v,children:[(c||g)&&s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"icon",children:_nullishCoalesce(c,()=>_nullishCoalesce(d,()=>"string"==typeof l?l:"…").slice(0,1))}),s.jsx.call(void 0,"span",{"data-ug-slot":"label",children:l}),s.jsx.call(void 0,i.ChevronDown,{"aria-hidden":"true",focusable:"false",size:14,className:void 0,"data-ug-slot":"indicator"})]})});return e.displayName="NavigationMenuTrigger",e})(),ve=(()=>{const e=o.forwardRef.call(void 0,({className:e,children:a,id:l,onKeyDown:o,onAnimationEnd:i,role:n="region","aria-labelledby":r,...c},d)=>{const u=useNavigationMenuContext(),{activeItem:v,setActiveItem:p}=u,{itemId:h}=useNavigationMenuItemContext(),f=v===h,{present:m,state:g,handleAnimationEnd:b}=usePresence(f),x="horizontal"===u.orientation||u.collapsed;return m?s.jsx.call(void 0,ne.Provider,{value:{...u,collapsed:!1},children:s.jsx.call(void 0,"div",{ref:d,id:_nullishCoalesce(l,()=>`${h}-content`),role:n,"aria-labelledby":_nullishCoalesce(r,()=>`${h}-trigger`),onKeyDown:e=>{_optionalChain([o,"optionalCall",a=>a(e)]),e.defaultPrevented||"Escape"!==e.key||(e.preventDefault(),p(null),_optionalChain([document,"access",e=>e.getElementById,"call",e=>e(`${h}-trigger`),"optionalAccess",e=>e.focus,"call",e=>e()]))},onAnimationEnd:e=>{b(e),_optionalChain([i,"optionalCall",a=>a(e)])},className:t.cn.call(void 0,"py-[calc(var(--content-gap)*0.25)] [border-radius:var(--radius-panel)]",x?"absolute left-0 top-full z-50 mt-1 min-w-40 border border-border-base shadow-lg":"static m-0 min-w-0 border-0 shadow-none",x&&"default"===u.tone?"bg-[var(--ug-overlay-surface)]":"bg-surface-1",e),"data-ug-slot":"content","data-state":g,...c,children:a})}):null});return e.displayName="NavigationMenuContent",e})();var pe=n.cva.call(void 0,"animate-pulse bg-surface-3 motion-reduce:animate-none",{variants:{variant:{text:"w-full [height:calc(var(--control-height-sm)*0.5)] [border-radius:calc(var(--radius-control)*0.5)]",circle:"[border-radius:calc(var(--radius-overlay)*999)]",rect:"[border-radius:var(--radius-panel)]"}},defaultVariants:{variant:"rect"}}),he=o.forwardRef.call(void 0,({variant:e,className:a,...l},o)=>{const i=_nullishCoalesce(e,()=>"rect");return s.jsx.call(void 0,"div",{ref:o,...l,className:t.cn.call(void 0,pe({variant:e}),a),"aria-hidden":"true","data-ug":"skeleton","data-ug-slot":"placeholder","data-state":"loading","data-variant":i,"data-size":"md"})});he.displayName="Skeleton",exports.useFloatingLayoutObserver=useFloatingLayoutObserver,exports.usePresence=usePresence,exports.usePortalContainer=usePortalContainer,exports.checkboxVariants=c,exports.Checkbox=d,exports.Select=g,exports.useEscapeKey=useEscapeKey,exports.OverlayFocusScope=b,exports.useOverlayFocus=useOverlayFocus,exports.Modal=y,exports.ModalContent=C,exports.ModalHeader=w,exports.ModalBody=N,exports.ModalTitle=j,exports.ModalFooter=k,exports.ModalCloseButton=_,exports.Fieldset=R,exports.FieldsetLegend=E,exports.FieldsetDescription=z,exports.EmptyState=A,exports.Table=M,exports.TableHeader=I,exports.TableBody=F,exports.TableRow=L,exports.TableHead=P,exports.TableCell=D,exports.Tooltip=K,exports.TooltipTrigger=$,exports.TooltipContent=H,exports.Sidebar=U,exports.Pagination=G,exports.CheckboxGroup=X,exports.Radio=Z,exports.RadioGroup=Q,exports.Tabs=le,exports.TabsList=te,exports.TabsTrigger=oe,exports.TabsContent=ie,exports.NavigationMenu=se,exports.NavigationMenuItem=ce,exports.NavigationMenuLink=de,exports.NavigationMenuTrigger=ue,exports.NavigationMenuContent=ve,exports.Skeleton=he;//# sourceMappingURL=chunk-LNVPMWCL.cjs.map
|