@nice2dev/ui 1.4.4 → 1.4.5
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/CHANGELOG.md +28 -0
- package/dist/NiceSavedQueryPanel-U1-yaw-Q.cjs +587 -0
- package/dist/data/NiceTreeGrid.mjs +519 -458
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +20 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +20 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/NiceSavedQueryPanel-BPGpKWN2.cjs +0 -587
package/dist/data.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-mrnaLHQk.cjs"),e=require("./NiceSavedQueryPanel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-mrnaLHQk.cjs"),e=require("./NiceSavedQueryPanel-U1-yaw-Q.cjs"),r=require("./NicePivotGrid-Cnkr9WkC.cjs");exports.NiceDataGrid=i.NiceDataGrid;exports.applyColumnOrder=i.applyColumnOrder;exports.buildColumnGroupSegments=i.buildColumnGroupSegments;exports.buildGridState=i.buildGridState;exports.computeAggregate=i.computeAggregate;exports.escapeCsvField=i.escapeCsvField;exports.formatNumberPattern=i.formatNumberPattern;exports.measureColumnContentWidth=i.measureColumnContentWidth;exports.readStoredGridState=i.readStoredGridState;exports.writeStoredGridState=i.writeStoredGridState;exports.NiceDataGridAI=e.NiceDataGridAI;exports.NiceKanbanBoard=e.NiceKanbanBoard;exports.NiceList=e.NiceList;exports.NiceModuleGrid=e.NiceModuleGrid;exports.NiceReconciliationView=e.NiceReconciliationView;exports.NiceSavedQueryPanel=e.NiceSavedQueryPanel;exports.NiceSpreadsheet=e.NiceSpreadsheet;exports.NiceTable=e.NiceTable;exports.NiceTileView=e.NiceTileView;exports.NiceTreeGrid=e.NiceTreeGrid;exports.NiceTreeList=e.NiceTreeList;exports.NiceTreeView=e.NiceTreeView;exports.NicePivotGrid=r.NicePivotGrid;exports.NicePivotGridFieldChooser=r.NicePivotGridFieldChooser;
|
package/dist/data.d.ts
CHANGED
|
@@ -1691,7 +1691,7 @@ declare interface NiceTreeContextMenuItem {
|
|
|
1691
1691
|
disabled?: boolean;
|
|
1692
1692
|
}
|
|
1693
1693
|
|
|
1694
|
-
export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
|
|
1694
|
+
export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, contextMenuItems, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
|
|
1695
1695
|
|
|
1696
1696
|
/** What a `checkedSummary` function of {@link NiceTreeGrid} gets. */
|
|
1697
1697
|
export declare interface NiceTreeGridCheckedSummaryInfo<T = NiceTreeGridNode> {
|
|
@@ -1720,6 +1720,19 @@ export declare interface NiceTreeGridCheckInfo<T = NiceTreeGridNode> {
|
|
|
1720
1720
|
halfCheckedKeys: string[];
|
|
1721
1721
|
}
|
|
1722
1722
|
|
|
1723
|
+
/** An entry of a {@link NiceTreeGridProps.contextMenuItems} menu (1.4.5). */
|
|
1724
|
+
export declare interface NiceTreeGridMenuItem {
|
|
1725
|
+
id: string;
|
|
1726
|
+
label?: default_2.ReactNode;
|
|
1727
|
+
/** NiceIcon name. */
|
|
1728
|
+
icon?: string;
|
|
1729
|
+
disabled?: boolean;
|
|
1730
|
+
danger?: boolean;
|
|
1731
|
+
/** A line between entries instead of an entry. */
|
|
1732
|
+
divider?: boolean;
|
|
1733
|
+
onSelect?: () => void;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1723
1736
|
/** A row node in the {@link NiceTreeGrid} (supports index-signature for dynamic fields). */
|
|
1724
1737
|
export declare interface NiceTreeGridNode {
|
|
1725
1738
|
[field: string]: unknown;
|
|
@@ -1887,6 +1900,12 @@ export declare interface NiceTreeGridProps<T extends NiceTreeGridNode = NiceTree
|
|
|
1887
1900
|
toolbar?: default_2.ReactNode;
|
|
1888
1901
|
/** Called when a row is clicked. */
|
|
1889
1902
|
onRowClick?: (row: T) => void;
|
|
1903
|
+
/**
|
|
1904
|
+
* A row's context menu (1.4.5): opened by a right click, Shift+F10 or the Menu key on the row;
|
|
1905
|
+
* the arrows move in it, Enter picks, Escape closes it and gives focus back to the row. No items,
|
|
1906
|
+
* no menu.
|
|
1907
|
+
*/
|
|
1908
|
+
contextMenuItems?: (row: T) => NiceTreeGridMenuItem[] | undefined;
|
|
1890
1909
|
}
|
|
1891
1910
|
|
|
1892
1911
|
/** A built-in button in the rows of {@link NiceTreeGrid}. */
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@nice2dev/ui-core"),Vt=require("./core-lBFqvT0V.cjs"),s=require("react"),Ge=require("./no-code-B3BHeyG-.cjs"),rt=require("./NiceForm-O3sv-DNX.cjs"),Ft=require("./NiceSelect-BNPXs6FQ.cjs"),Ut=require("./pickerCommons-CwcCc8Qi.cjs"),pn=require("./NiceColorPicker-BLwYNSXJ.cjs"),et=require("./NiceMention-tgJKS8PH.cjs"),tl=require("./NiceHtmlEditor-C1OVtLQ6.cjs"),as=require("./NiceCodeEditor-DhdjnDLV.cjs"),Oe=require("./NiceModuleLifecyclePanel-DKlqKPy2.cjs"),Le=require("./NiceButton-DzCqkG5a.cjs"),Rt=require("./NiceScheduler-Boo-D1S-.cjs"),zt=require("./NicePivotGrid-Cnkr9WkC.cjs"),e=require("react/jsx-runtime"),cr=require("react-dom"),Nt=require("./NiceSavedQueryPanel-BPGpKWN2.cjs"),xt=require("./devops-cgRBnZVX.cjs"),St=require("./NiceLoginForm-C2-WgRn0.cjs"),Ii=require("./NiceModal-BRVzjuUN.cjs"),lr=require("./NicePagination-D7XxeNFz.cjs"),Bn=require("./NiceDataGrid-mrnaLHQk.cjs"),nt=require("./charts-BzlvCCg9.cjs"),jt=require("./NiceWindow-BklnkBpu.cjs"),nl=require("./NiceGantt-BygumlaY.cjs"),wn=require("./injectStyleOnce-DeWaxcdf.cjs"),dr=require("@nice2dev/i18n"),sm=require("./NiceDocumentViewer-CDXAmPp7.cjs"),kn=require("./core-lazy-C_qnVGxE.cjs"),Pi=require("./data-branching-7rpktFJ-.cjs");function il({className:t="",size:n="md",showTooltip:i=!0,showLabel:a=!0,onClick:r,label:o,tooltipPosition:l="bottom"}){const{t:d}=c.useNiceTranslation(),{badgeInfo:p,isLoading:m}=Vt.useTracelessPolicySafe(),[g,u]=s.useState(!1),x={sm:"nice-traceless-badge--sm",md:"nice-traceless-badge--md",lg:"nice-traceless-badge--lg"},b=o||p.label;return s.createElement("div",{className:`nice-traceless-badge ${p.cssClass} ${x[n]} ${t}`.trim(),onClick:r,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),role:r?"button":"status",tabIndex:r?0:void 0,onKeyDown:r?f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r())}:void 0,"aria-label":d("traceless.badgeAria","Privacy mode: {mode}").replace("{mode}",b),style:{display:"inline-flex",alignItems:"center",gap:"0.375rem",padding:n==="sm"?"0.25rem 0.5rem":n==="lg"?"0.5rem 1rem":"0.375rem 0.75rem",borderRadius:"9999px",fontSize:n==="sm"?"0.75rem":n==="lg"?"1rem":"0.875rem",fontWeight:500,backgroundColor:`${p.color}20`,color:p.color,border:`1px solid ${p.color}40`,cursor:r?"pointer":"default",transition:"all 0.2s ease",position:"relative",userSelect:"none"}},s.createElement("span",{"aria-hidden":!0},s.createElement(c.NiceIcon,{name:m?"clock":p.icon,size:14})),a&&s.createElement("span",null,b),i&&g&&s.createElement("div",{role:"tooltip",style:{position:"absolute",[l==="top"?"bottom":l==="bottom"?"top":l==="left"?"right":"left"]:"100%",[l==="top"||l==="bottom"?"left":"top"]:"50%",transform:l==="top"||l==="bottom"?"translateX(-50%)":"translateY(-50%)",marginTop:l==="bottom"?"0.5rem":void 0,marginBottom:l==="top"?"0.5rem":void 0,marginLeft:l==="right"?"0.5rem":void 0,marginRight:l==="left"?"0.5rem":void 0,padding:"0.5rem 0.75rem",backgroundColor:"var(--nice-text-primary, #1f2937)",color:"var(--nice-text-inverse, #fff)",borderRadius:"0.375rem",fontSize:"0.75rem",whiteSpace:"nowrap",zIndex:50,boxShadow:"0 4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",maxWidth:"280px",textAlign:"left"}},p.tooltip))}function rm({className:t="",showReport:n=!0,showAudit:i=!0,showModeSelector:a=!0,availableModes:r=["traceless","ephemeral","private"],onModeChange:o}){const{t:l}=c.useNiceTranslation(),{policy:d,badgeInfo:p,setUserPreference:m,generateReport:g}=Vt.useTracelessPolicySafe(),{result:u,run:x}=Vt.useStorageAudit(),[b,f]=s.useState(null),h=s.useCallback(j=>{m({preferredMode:j}),o?.(j)},[m,o]),y=s.useCallback(()=>{f(g())},[g]),v={traceless:l("traceless.mode.traceless","Traceless"),ephemeral:l("traceless.mode.ephemeral","Ephemeral"),private:l("traceless.mode.private","Private"),balanced:l("traceless.mode.balanced","Balanced"),full:l("traceless.mode.full","Full"),custom:l("traceless.mode.custom","Custom")},S={traceless:l("traceless.modeDesc.traceless","Zero storage. Maximum privacy. Data resets on every page load."),ephemeral:l("traceless.modeDesc.ephemeral","Session-only. Data clears when you close the tab."),private:l("traceless.modeDesc.private","Minimal storage with secure authentication."),balanced:l("traceless.modeDesc.balanced","Local preferences saved. No tracking cookies."),full:l("traceless.modeDesc.full","All storage enabled with consent controls."),custom:l("traceless.modeDesc.custom","Custom configuration.")};return s.createElement("div",{className:`nice-traceless-panel ${t}`.trim(),style:{padding:"1.5rem",backgroundColor:"var(--nice-bg-secondary, #f9fafb)",borderRadius:"0.75rem",border:"1px solid var(--nice-border-color, #e5e7eb)"}},s.createElement("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1.5rem"}},s.createElement(il,{size:"lg",showTooltip:!1}),s.createElement("div",null,s.createElement("h3",{style:{margin:0,fontSize:"1.125rem",fontWeight:600}},l("traceless.title","Privacy Settings")),s.createElement("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--nice-text-muted, #6b7280)"}},S[d.effectiveMode]))),a&&s.createElement("div",{style:{marginBottom:"1.5rem"}},s.createElement("label",{style:{display:"block",marginBottom:"0.5rem",fontWeight:500}},l("traceless.level","Privacy Level")),s.createElement("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"}},r.map(j=>s.createElement("button",{key:j,onClick:()=>h(j),style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:d.effectiveMode===j?"2px solid var(--nice-primary, #3b82f6)":"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:d.effectiveMode===j?"var(--nice-info-bg, #eff6ff)":"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:d.effectiveMode===j?600:400}},v[j])))),s.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"1rem",marginBottom:"1.5rem"}},s.createElement(us,{title:l("traceless.cookies","Cookies"),allowed:d.cookiesAllowed,icon:s.createElement(c.NiceIcon,{name:"file",size:24})}),s.createElement(us,{title:"localStorage",allowed:d.localStorageAllowed,icon:s.createElement(c.NiceIcon,{name:"save",size:24})}),s.createElement(us,{title:"sessionStorage",allowed:d.sessionStorageAllowed,icon:s.createElement(c.NiceIcon,{name:"clipboard",size:24})})),s.createElement("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap"}},i&&s.createElement("button",{onClick:x,style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:"search",size:16}),l("traceless.runAudit","Run Audit")),n&&s.createElement("button",{onClick:y,style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:"file",size:16}),l("traceless.generateReport","Generate Report"))),u&&s.createElement("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:u.compliant?"var(--nice-success-bg, #ecfdf5)":"var(--nice-danger-bg, #fef2f2)",borderRadius:"0.5rem",border:`1px solid ${u.compliant?"var(--nice-color-success, #10b981)":"var(--nice-color-error, #ef4444)"}`}},s.createElement("p",{style:{margin:0,fontWeight:500,color:u.compliant?"var(--nice-success, #059669)":"var(--nice-color-error, #dc2626)",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:u.compliant?"check":"close",size:16}),u.compliant?l("traceless.compliant","Compliant"):l("traceless.violations","Violations Found")),!u.compliant&&u.violations.map((j,T)=>s.createElement("p",{key:T,style:{margin:"0.5rem 0 0",fontSize:"0.875rem"}},`• ${j.message}`))),b&&s.createElement("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)"}},s.createElement("h4",{style:{margin:"0 0 0.5rem",fontSize:"0.875rem",fontWeight:600}},l("traceless.statement","Compliance Statement")),s.createElement("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--nice-text-secondary, #4b5563)"}},b.statement)))}function us({title:t,allowed:n,icon:i}){const{t:a}=c.useNiceTranslation();return s.createElement("div",{style:{padding:"0.75rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #e5e7eb)",textAlign:"center"}},s.createElement("div",{style:{fontSize:"1.5rem",marginBottom:"0.25rem"}},i),s.createElement("div",{style:{fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem"}},t),s.createElement("div",{style:{fontSize:"0.75rem",color:n?"var(--nice-color-success, #10b981)":"var(--nice-text-muted, #6b7280)",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"0.25rem"}},s.createElement(c.NiceIcon,{name:n?"check":"close",size:12}),n?a("enabled","Enabled"):a("disabled","Disabled")))}function om({className:t="",position:n="bottom",onAccept:i,onDecline:a,onCustomize:r,privacyPolicyUrl:o,acceptText:l,declineText:d}){const{t:p}=c.useNiceTranslation(),{shouldShow:m,mode:g,dismiss:u}=Vt.useCookieBannerVisibility(),x=s.useCallback(()=>{i?.(),u()},[i,u]),b=s.useCallback(()=>{a?.(),u()},[a,u]);if(!m)return null;const f=n==="top"?{top:0,borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"}:{bottom:0,borderTop:"1px solid var(--nice-border-color, #e5e7eb)"};return s.createElement("div",{className:`nice-consent-banner ${t}`.trim(),role:"dialog","aria-label":p("cookie.title","Cookie consent"),style:{position:"fixed",left:0,right:0,padding:"1rem 1.5rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",boxShadow:"0 -4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap",...f}},s.createElement("div",{style:{flex:1,minWidth:"200px"}},s.createElement("p",{style:{margin:0,fontSize:"0.875rem"}},`${p("cookie.message","This site uses cookies to improve your experience.")} `,o&&s.createElement("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--nice-color-primary, #3b82f6)"}},p("cookie.learnMore","Learn more")))),s.createElement("div",{style:{display:"flex",gap:"0.5rem",flexShrink:0}},r&&s.createElement("button",{onClick:r,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"}},p("cookie.customize","Customize")),s.createElement("button",{onClick:b,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"}},d??p("cookie.reject","Reject all")),s.createElement("button",{onClick:x,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"none",backgroundColor:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500}},l??p("cookie.accept","Accept all"))))}function cm({useCase:t,className:n="",message:i,variant:a="inline",dismissible:r=!1,onDismiss:o}){const{t:l}=c.useNiceTranslation(),{warningMessage:d}=Vt.useTracelessPolicySafe().policy.effectiveMode==="traceless"?{warningMessage:i||l("traceless.limitedFeature","This feature has limited functionality in Traceless mode.")}:{warningMessage:void 0},[p,m]=s.useState(!1),g=s.useCallback(()=>{m(!0),o?.()},[o]);if(!d||p)return null;const u={inline:{padding:"0.5rem 0.75rem",backgroundColor:"var(--nice-warning-bg, #fef3c7)",border:"1px solid var(--nice-warning-light, #fbbf24)",borderRadius:"0.375rem",fontSize:"0.875rem"},banner:{padding:"0.75rem 1rem",backgroundColor:"var(--nice-warning-bg, #fef3c7)",borderBottom:"1px solid var(--nice-warning-light, #fbbf24)",fontSize:"0.875rem"},toast:{padding:"0.75rem 1rem",backgroundColor:"var(--nice-text-primary, #1f2937)",color:"var(--nice-text-inverse, #fff)",borderRadius:"0.5rem",boxShadow:"0 4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",fontSize:"0.875rem"}};return s.createElement("div",{className:`nice-traceless-warning nice-traceless-warning--${a} ${n}`.trim(),role:"alert",style:{display:"flex",alignItems:"center",gap:"0.5rem",...u[a]}},s.createElement("span",{"aria-hidden":!0},s.createElement(c.NiceIcon,{name:"warning",size:16})),s.createElement("span",{style:{flex:1}},d),r&&s.createElement("button",{onClick:g,"aria-label":l("traceless.dismissWarning","Dismiss warning"),style:{background:"none",border:"none",cursor:"pointer",padding:"0.25rem",opacity:.7}},s.createElement(c.NiceIcon,{name:"close",size:14})))}const al=s.createContext(null);function lm(){const t=s.useContext(al);return t||{isActive:!1,trackEvent:()=>{},trackPageView:()=>{},setUserProperties:()=>{},mode:"traceless",provider:"custom"}}function dm({children:t,provider:n,trackingId:i,endpoint:a,customHandler:r,cookies:o=!0,localStorage:l=!1,minMode:d="balanced",autoTrackPageViews:p=!0,respectDoNotTrack:m=!0,debug:g=!1,domain:u,scriptUrl:x,anonymizeIp:b=!0,cookieless:f=!1}){const{policy:h,mode:y}=Vt.useTracelessPolicySafe(),v=s.useMemo(()=>{if(m&&typeof navigator<"u"){const k=navigator.doNotTrack||window.doNotTrack;if(k==="1"||k==="yes")return g&&En("Disabled: Do Not Track is set"),!1}const N=["traceless","ephemeral","private","balanced","full"],_=N.indexOf(y),w=N.indexOf(d);return _<w?(g&&En(`Disabled: mode ${y} < minMode ${d}`),!1):o&&!h.cookiesAllowed&&!f?(g&&En("Disabled: cookies required but not allowed"),!1):l&&!h.localStorageAllowed?(g&&En("Disabled: localStorage required but not allowed"),!1):!0},[y,d,h,o,l,f,m,g]);s.useEffect(()=>{if(v){if(n==="custom"&&r){r.init();return}switch(n){case"plausible":Vi(x||"https://plausible.io/js/script.js",{"data-domain":i||u});break;case"simple-analytics":Vi(x||"https://scripts.simpleanalyticscdn.com/latest.js");break;case"umami":Vi(x||a||"",{"data-website-id":i});break;case"fathom":Vi(x||"https://cdn.usefathom.com/script.js",{"data-site":i});break;case"matomo":mm(a||"",i||"",b);break;case"google-analytics":f||(Vi(`https://www.googletagmanager.com/gtag/js?id=${i}`),um(i||"",b));break;case"google-tag-manager":f||pm(i||"");break;default:g&&console.warn(`[NiceAnalyticsTracker] Unknown provider: ${n}`)}g&&En(`Initialized: ${n}`)}},[v,n,i,a,x,u,b,f,r,g]);const S=s.useCallback(N=>{if(v){if(g&&En("trackPageView:",N),n==="custom"&&r){r.trackPageView(N);return}switch(n){case"plausible":window.plausible?.("pageview");break;case"umami":window.umami?.track();break;case"fathom":window.fathom?.trackPageview();break;case"matomo":window._paq?.push(["trackPageView"]);break;case"google-analytics":window.gtag?.("event","page_view",{page_path:N.path,page_title:N.title});break}}},[v,n,r,g]);s.useEffect(()=>{if(!v||!p)return;S({path:typeof window<"u"?window.location.pathname:"/",title:typeof document<"u"?document.title:""});const N=()=>{S({path:window.location.pathname,title:document.title})};return window.addEventListener("popstate",N),()=>window.removeEventListener("popstate",N)},[v,p,S]);const j=s.useCallback(N=>{if(v){if(g&&En("trackEvent:",N),n==="custom"&&r){r.trackEvent(N);return}switch(n){case"plausible":window.plausible?.(N.name,{props:N.properties});break;case"umami":window.umami?.track(N.name,N.properties);break;case"fathom":window.fathom?.trackGoal(N.name,N.value??0);break;case"matomo":window._paq?.push(["trackEvent",N.category,N.name,N.label,N.value]);break;case"google-analytics":window.gtag?.("event",N.name,{event_category:N.category,event_label:N.label,value:N.value,...N.properties});break}}},[v,n,r,g]),T=s.useCallback(N=>{if(v){if(g&&En("setUserProperties:",N),n==="custom"&&r?.setUserProperties){r.setUserProperties(N);return}switch(n){case"google-analytics":window.gtag?.("set","user_properties",N);break;case"matomo":Object.entries(N).forEach(([_,w])=>{window._paq?.push(["setCustomVariable",_,String(w)])});break}}},[v,n,r,g]),C=s.useMemo(()=>({isActive:v,trackEvent:j,trackPageView:S,setUserProperties:T,mode:y,provider:n}),[v,j,S,T,y,n]);return s.createElement(al.Provider,{value:C},t)}function En(...t){console.log("[NiceAnalyticsTracker]",...t)}function Vi(t,n){if(typeof document>"u"||!t||document.querySelector(`script[src="${t}"]`))return;const a=document.createElement("script");a.src=t,a.async=!0,a.defer=!0,n&&Object.entries(n).forEach(([r,o])=>{o!==void 0&&a.setAttribute(r,o)}),document.head.appendChild(a)}function um(t,n){if(typeof window>"u")return;window.dataLayer=window.dataLayer||[];function i(...a){window.dataLayer.push(arguments)}window.gtag=i,i("js",new Date),i("config",t,{anonymize_ip:n})}function pm(t){if(typeof window>"u")return;window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":new Date().getTime(),event:"gtm.js"});const n=document.createElement("script");n.async=!0,n.src=`https://www.googletagmanager.com/gtm.js?id=${t}`,document.head.appendChild(n)}function mm(t,n,i){if(typeof window>"u"||!t)return;window._paq=window._paq||[];const a=window._paq;i&&a.push(["setAnonymizeIp",!0]),a.push(["trackPageView"]),a.push(["enableLinkTracking"]),a.push(["setTrackerUrl",`${t}/matomo.php`]),a.push(["setSiteId",n]);const r=document.createElement("script");r.async=!0,r.src=`${t}/matomo.js`,document.head.appendChild(r)}function yn(t,n=2){return String(t).padStart(n,"0")}function ps(t){return yn(t.getUTCFullYear(),4)+yn(t.getUTCMonth()+1)+yn(t.getUTCDate())+"T"+yn(t.getUTCHours())+yn(t.getUTCMinutes())+yn(t.getUTCSeconds())+"Z"}function vo(t){return yn(t.getFullYear(),4)+yn(t.getMonth()+1)+yn(t.getDate())}function qi(t){return t.replace(/\\/g,"\\\\").replace(/;/g,"\\;").replace(/,/g,"\\,").replace(/\r?\n/g,"\\n")}function hm(t){if(t.length<=75)return t;const n=[];let i=0;for(;i<t.length;)n.push(t.slice(i,i+75)),i+=75;return n.join(`\r
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@nice2dev/ui-core"),Vt=require("./core-lBFqvT0V.cjs"),s=require("react"),Ge=require("./no-code-B3BHeyG-.cjs"),rt=require("./NiceForm-O3sv-DNX.cjs"),Ft=require("./NiceSelect-BNPXs6FQ.cjs"),Ut=require("./pickerCommons-CwcCc8Qi.cjs"),pn=require("./NiceColorPicker-BLwYNSXJ.cjs"),et=require("./NiceMention-tgJKS8PH.cjs"),tl=require("./NiceHtmlEditor-C1OVtLQ6.cjs"),as=require("./NiceCodeEditor-DhdjnDLV.cjs"),Oe=require("./NiceModuleLifecyclePanel-DKlqKPy2.cjs"),Le=require("./NiceButton-DzCqkG5a.cjs"),Rt=require("./NiceScheduler-Boo-D1S-.cjs"),zt=require("./NicePivotGrid-Cnkr9WkC.cjs"),e=require("react/jsx-runtime"),cr=require("react-dom"),Nt=require("./NiceSavedQueryPanel-U1-yaw-Q.cjs"),xt=require("./devops-cgRBnZVX.cjs"),St=require("./NiceLoginForm-C2-WgRn0.cjs"),Ii=require("./NiceModal-BRVzjuUN.cjs"),lr=require("./NicePagination-D7XxeNFz.cjs"),Bn=require("./NiceDataGrid-mrnaLHQk.cjs"),nt=require("./charts-BzlvCCg9.cjs"),jt=require("./NiceWindow-BklnkBpu.cjs"),nl=require("./NiceGantt-BygumlaY.cjs"),wn=require("./injectStyleOnce-DeWaxcdf.cjs"),dr=require("@nice2dev/i18n"),sm=require("./NiceDocumentViewer-CDXAmPp7.cjs"),kn=require("./core-lazy-C_qnVGxE.cjs"),Pi=require("./data-branching-7rpktFJ-.cjs");function il({className:t="",size:n="md",showTooltip:i=!0,showLabel:a=!0,onClick:r,label:o,tooltipPosition:l="bottom"}){const{t:d}=c.useNiceTranslation(),{badgeInfo:p,isLoading:m}=Vt.useTracelessPolicySafe(),[g,u]=s.useState(!1),x={sm:"nice-traceless-badge--sm",md:"nice-traceless-badge--md",lg:"nice-traceless-badge--lg"},b=o||p.label;return s.createElement("div",{className:`nice-traceless-badge ${p.cssClass} ${x[n]} ${t}`.trim(),onClick:r,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),role:r?"button":"status",tabIndex:r?0:void 0,onKeyDown:r?f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r())}:void 0,"aria-label":d("traceless.badgeAria","Privacy mode: {mode}").replace("{mode}",b),style:{display:"inline-flex",alignItems:"center",gap:"0.375rem",padding:n==="sm"?"0.25rem 0.5rem":n==="lg"?"0.5rem 1rem":"0.375rem 0.75rem",borderRadius:"9999px",fontSize:n==="sm"?"0.75rem":n==="lg"?"1rem":"0.875rem",fontWeight:500,backgroundColor:`${p.color}20`,color:p.color,border:`1px solid ${p.color}40`,cursor:r?"pointer":"default",transition:"all 0.2s ease",position:"relative",userSelect:"none"}},s.createElement("span",{"aria-hidden":!0},s.createElement(c.NiceIcon,{name:m?"clock":p.icon,size:14})),a&&s.createElement("span",null,b),i&&g&&s.createElement("div",{role:"tooltip",style:{position:"absolute",[l==="top"?"bottom":l==="bottom"?"top":l==="left"?"right":"left"]:"100%",[l==="top"||l==="bottom"?"left":"top"]:"50%",transform:l==="top"||l==="bottom"?"translateX(-50%)":"translateY(-50%)",marginTop:l==="bottom"?"0.5rem":void 0,marginBottom:l==="top"?"0.5rem":void 0,marginLeft:l==="right"?"0.5rem":void 0,marginRight:l==="left"?"0.5rem":void 0,padding:"0.5rem 0.75rem",backgroundColor:"var(--nice-text-primary, #1f2937)",color:"var(--nice-text-inverse, #fff)",borderRadius:"0.375rem",fontSize:"0.75rem",whiteSpace:"nowrap",zIndex:50,boxShadow:"0 4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",maxWidth:"280px",textAlign:"left"}},p.tooltip))}function rm({className:t="",showReport:n=!0,showAudit:i=!0,showModeSelector:a=!0,availableModes:r=["traceless","ephemeral","private"],onModeChange:o}){const{t:l}=c.useNiceTranslation(),{policy:d,badgeInfo:p,setUserPreference:m,generateReport:g}=Vt.useTracelessPolicySafe(),{result:u,run:x}=Vt.useStorageAudit(),[b,f]=s.useState(null),h=s.useCallback(j=>{m({preferredMode:j}),o?.(j)},[m,o]),y=s.useCallback(()=>{f(g())},[g]),v={traceless:l("traceless.mode.traceless","Traceless"),ephemeral:l("traceless.mode.ephemeral","Ephemeral"),private:l("traceless.mode.private","Private"),balanced:l("traceless.mode.balanced","Balanced"),full:l("traceless.mode.full","Full"),custom:l("traceless.mode.custom","Custom")},S={traceless:l("traceless.modeDesc.traceless","Zero storage. Maximum privacy. Data resets on every page load."),ephemeral:l("traceless.modeDesc.ephemeral","Session-only. Data clears when you close the tab."),private:l("traceless.modeDesc.private","Minimal storage with secure authentication."),balanced:l("traceless.modeDesc.balanced","Local preferences saved. No tracking cookies."),full:l("traceless.modeDesc.full","All storage enabled with consent controls."),custom:l("traceless.modeDesc.custom","Custom configuration.")};return s.createElement("div",{className:`nice-traceless-panel ${t}`.trim(),style:{padding:"1.5rem",backgroundColor:"var(--nice-bg-secondary, #f9fafb)",borderRadius:"0.75rem",border:"1px solid var(--nice-border-color, #e5e7eb)"}},s.createElement("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1.5rem"}},s.createElement(il,{size:"lg",showTooltip:!1}),s.createElement("div",null,s.createElement("h3",{style:{margin:0,fontSize:"1.125rem",fontWeight:600}},l("traceless.title","Privacy Settings")),s.createElement("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--nice-text-muted, #6b7280)"}},S[d.effectiveMode]))),a&&s.createElement("div",{style:{marginBottom:"1.5rem"}},s.createElement("label",{style:{display:"block",marginBottom:"0.5rem",fontWeight:500}},l("traceless.level","Privacy Level")),s.createElement("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"}},r.map(j=>s.createElement("button",{key:j,onClick:()=>h(j),style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:d.effectiveMode===j?"2px solid var(--nice-primary, #3b82f6)":"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:d.effectiveMode===j?"var(--nice-info-bg, #eff6ff)":"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:d.effectiveMode===j?600:400}},v[j])))),s.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"1rem",marginBottom:"1.5rem"}},s.createElement(us,{title:l("traceless.cookies","Cookies"),allowed:d.cookiesAllowed,icon:s.createElement(c.NiceIcon,{name:"file",size:24})}),s.createElement(us,{title:"localStorage",allowed:d.localStorageAllowed,icon:s.createElement(c.NiceIcon,{name:"save",size:24})}),s.createElement(us,{title:"sessionStorage",allowed:d.sessionStorageAllowed,icon:s.createElement(c.NiceIcon,{name:"clipboard",size:24})})),s.createElement("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap"}},i&&s.createElement("button",{onClick:x,style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:"search",size:16}),l("traceless.runAudit","Run Audit")),n&&s.createElement("button",{onClick:y,style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:"file",size:16}),l("traceless.generateReport","Generate Report"))),u&&s.createElement("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:u.compliant?"var(--nice-success-bg, #ecfdf5)":"var(--nice-danger-bg, #fef2f2)",borderRadius:"0.5rem",border:`1px solid ${u.compliant?"var(--nice-color-success, #10b981)":"var(--nice-color-error, #ef4444)"}`}},s.createElement("p",{style:{margin:0,fontWeight:500,color:u.compliant?"var(--nice-success, #059669)":"var(--nice-color-error, #dc2626)",display:"inline-flex",alignItems:"center",gap:"0.375rem"}},s.createElement(c.NiceIcon,{name:u.compliant?"check":"close",size:16}),u.compliant?l("traceless.compliant","Compliant"):l("traceless.violations","Violations Found")),!u.compliant&&u.violations.map((j,T)=>s.createElement("p",{key:T,style:{margin:"0.5rem 0 0",fontSize:"0.875rem"}},`• ${j.message}`))),b&&s.createElement("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #d1d5db)"}},s.createElement("h4",{style:{margin:"0 0 0.5rem",fontSize:"0.875rem",fontWeight:600}},l("traceless.statement","Compliance Statement")),s.createElement("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--nice-text-secondary, #4b5563)"}},b.statement)))}function us({title:t,allowed:n,icon:i}){const{t:a}=c.useNiceTranslation();return s.createElement("div",{style:{padding:"0.75rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",borderRadius:"0.5rem",border:"1px solid var(--nice-border-color, #e5e7eb)",textAlign:"center"}},s.createElement("div",{style:{fontSize:"1.5rem",marginBottom:"0.25rem"}},i),s.createElement("div",{style:{fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem"}},t),s.createElement("div",{style:{fontSize:"0.75rem",color:n?"var(--nice-color-success, #10b981)":"var(--nice-text-muted, #6b7280)",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"0.25rem"}},s.createElement(c.NiceIcon,{name:n?"check":"close",size:12}),n?a("enabled","Enabled"):a("disabled","Disabled")))}function om({className:t="",position:n="bottom",onAccept:i,onDecline:a,onCustomize:r,privacyPolicyUrl:o,acceptText:l,declineText:d}){const{t:p}=c.useNiceTranslation(),{shouldShow:m,mode:g,dismiss:u}=Vt.useCookieBannerVisibility(),x=s.useCallback(()=>{i?.(),u()},[i,u]),b=s.useCallback(()=>{a?.(),u()},[a,u]);if(!m)return null;const f=n==="top"?{top:0,borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"}:{bottom:0,borderTop:"1px solid var(--nice-border-color, #e5e7eb)"};return s.createElement("div",{className:`nice-consent-banner ${t}`.trim(),role:"dialog","aria-label":p("cookie.title","Cookie consent"),style:{position:"fixed",left:0,right:0,padding:"1rem 1.5rem",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",boxShadow:"0 -4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap",...f}},s.createElement("div",{style:{flex:1,minWidth:"200px"}},s.createElement("p",{style:{margin:0,fontSize:"0.875rem"}},`${p("cookie.message","This site uses cookies to improve your experience.")} `,o&&s.createElement("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--nice-color-primary, #3b82f6)"}},p("cookie.learnMore","Learn more")))),s.createElement("div",{style:{display:"flex",gap:"0.5rem",flexShrink:0}},r&&s.createElement("button",{onClick:r,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"}},p("cookie.customize","Customize")),s.createElement("button",{onClick:b,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"1px solid var(--nice-border-color, #d1d5db)",backgroundColor:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"}},d??p("cookie.reject","Reject all")),s.createElement("button",{onClick:x,style:{padding:"0.5rem 1rem",borderRadius:"0.375rem",border:"none",backgroundColor:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500}},l??p("cookie.accept","Accept all"))))}function cm({useCase:t,className:n="",message:i,variant:a="inline",dismissible:r=!1,onDismiss:o}){const{t:l}=c.useNiceTranslation(),{warningMessage:d}=Vt.useTracelessPolicySafe().policy.effectiveMode==="traceless"?{warningMessage:i||l("traceless.limitedFeature","This feature has limited functionality in Traceless mode.")}:{warningMessage:void 0},[p,m]=s.useState(!1),g=s.useCallback(()=>{m(!0),o?.()},[o]);if(!d||p)return null;const u={inline:{padding:"0.5rem 0.75rem",backgroundColor:"var(--nice-warning-bg, #fef3c7)",border:"1px solid var(--nice-warning-light, #fbbf24)",borderRadius:"0.375rem",fontSize:"0.875rem"},banner:{padding:"0.75rem 1rem",backgroundColor:"var(--nice-warning-bg, #fef3c7)",borderBottom:"1px solid var(--nice-warning-light, #fbbf24)",fontSize:"0.875rem"},toast:{padding:"0.75rem 1rem",backgroundColor:"var(--nice-text-primary, #1f2937)",color:"var(--nice-text-inverse, #fff)",borderRadius:"0.5rem",boxShadow:"0 4px 6px -1px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",fontSize:"0.875rem"}};return s.createElement("div",{className:`nice-traceless-warning nice-traceless-warning--${a} ${n}`.trim(),role:"alert",style:{display:"flex",alignItems:"center",gap:"0.5rem",...u[a]}},s.createElement("span",{"aria-hidden":!0},s.createElement(c.NiceIcon,{name:"warning",size:16})),s.createElement("span",{style:{flex:1}},d),r&&s.createElement("button",{onClick:g,"aria-label":l("traceless.dismissWarning","Dismiss warning"),style:{background:"none",border:"none",cursor:"pointer",padding:"0.25rem",opacity:.7}},s.createElement(c.NiceIcon,{name:"close",size:14})))}const al=s.createContext(null);function lm(){const t=s.useContext(al);return t||{isActive:!1,trackEvent:()=>{},trackPageView:()=>{},setUserProperties:()=>{},mode:"traceless",provider:"custom"}}function dm({children:t,provider:n,trackingId:i,endpoint:a,customHandler:r,cookies:o=!0,localStorage:l=!1,minMode:d="balanced",autoTrackPageViews:p=!0,respectDoNotTrack:m=!0,debug:g=!1,domain:u,scriptUrl:x,anonymizeIp:b=!0,cookieless:f=!1}){const{policy:h,mode:y}=Vt.useTracelessPolicySafe(),v=s.useMemo(()=>{if(m&&typeof navigator<"u"){const k=navigator.doNotTrack||window.doNotTrack;if(k==="1"||k==="yes")return g&&En("Disabled: Do Not Track is set"),!1}const N=["traceless","ephemeral","private","balanced","full"],_=N.indexOf(y),w=N.indexOf(d);return _<w?(g&&En(`Disabled: mode ${y} < minMode ${d}`),!1):o&&!h.cookiesAllowed&&!f?(g&&En("Disabled: cookies required but not allowed"),!1):l&&!h.localStorageAllowed?(g&&En("Disabled: localStorage required but not allowed"),!1):!0},[y,d,h,o,l,f,m,g]);s.useEffect(()=>{if(v){if(n==="custom"&&r){r.init();return}switch(n){case"plausible":Vi(x||"https://plausible.io/js/script.js",{"data-domain":i||u});break;case"simple-analytics":Vi(x||"https://scripts.simpleanalyticscdn.com/latest.js");break;case"umami":Vi(x||a||"",{"data-website-id":i});break;case"fathom":Vi(x||"https://cdn.usefathom.com/script.js",{"data-site":i});break;case"matomo":mm(a||"",i||"",b);break;case"google-analytics":f||(Vi(`https://www.googletagmanager.com/gtag/js?id=${i}`),um(i||"",b));break;case"google-tag-manager":f||pm(i||"");break;default:g&&console.warn(`[NiceAnalyticsTracker] Unknown provider: ${n}`)}g&&En(`Initialized: ${n}`)}},[v,n,i,a,x,u,b,f,r,g]);const S=s.useCallback(N=>{if(v){if(g&&En("trackPageView:",N),n==="custom"&&r){r.trackPageView(N);return}switch(n){case"plausible":window.plausible?.("pageview");break;case"umami":window.umami?.track();break;case"fathom":window.fathom?.trackPageview();break;case"matomo":window._paq?.push(["trackPageView"]);break;case"google-analytics":window.gtag?.("event","page_view",{page_path:N.path,page_title:N.title});break}}},[v,n,r,g]);s.useEffect(()=>{if(!v||!p)return;S({path:typeof window<"u"?window.location.pathname:"/",title:typeof document<"u"?document.title:""});const N=()=>{S({path:window.location.pathname,title:document.title})};return window.addEventListener("popstate",N),()=>window.removeEventListener("popstate",N)},[v,p,S]);const j=s.useCallback(N=>{if(v){if(g&&En("trackEvent:",N),n==="custom"&&r){r.trackEvent(N);return}switch(n){case"plausible":window.plausible?.(N.name,{props:N.properties});break;case"umami":window.umami?.track(N.name,N.properties);break;case"fathom":window.fathom?.trackGoal(N.name,N.value??0);break;case"matomo":window._paq?.push(["trackEvent",N.category,N.name,N.label,N.value]);break;case"google-analytics":window.gtag?.("event",N.name,{event_category:N.category,event_label:N.label,value:N.value,...N.properties});break}}},[v,n,r,g]),T=s.useCallback(N=>{if(v){if(g&&En("setUserProperties:",N),n==="custom"&&r?.setUserProperties){r.setUserProperties(N);return}switch(n){case"google-analytics":window.gtag?.("set","user_properties",N);break;case"matomo":Object.entries(N).forEach(([_,w])=>{window._paq?.push(["setCustomVariable",_,String(w)])});break}}},[v,n,r,g]),C=s.useMemo(()=>({isActive:v,trackEvent:j,trackPageView:S,setUserProperties:T,mode:y,provider:n}),[v,j,S,T,y,n]);return s.createElement(al.Provider,{value:C},t)}function En(...t){console.log("[NiceAnalyticsTracker]",...t)}function Vi(t,n){if(typeof document>"u"||!t||document.querySelector(`script[src="${t}"]`))return;const a=document.createElement("script");a.src=t,a.async=!0,a.defer=!0,n&&Object.entries(n).forEach(([r,o])=>{o!==void 0&&a.setAttribute(r,o)}),document.head.appendChild(a)}function um(t,n){if(typeof window>"u")return;window.dataLayer=window.dataLayer||[];function i(...a){window.dataLayer.push(arguments)}window.gtag=i,i("js",new Date),i("config",t,{anonymize_ip:n})}function pm(t){if(typeof window>"u")return;window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":new Date().getTime(),event:"gtm.js"});const n=document.createElement("script");n.async=!0,n.src=`https://www.googletagmanager.com/gtm.js?id=${t}`,document.head.appendChild(n)}function mm(t,n,i){if(typeof window>"u"||!t)return;window._paq=window._paq||[];const a=window._paq;i&&a.push(["setAnonymizeIp",!0]),a.push(["trackPageView"]),a.push(["enableLinkTracking"]),a.push(["setTrackerUrl",`${t}/matomo.php`]),a.push(["setSiteId",n]);const r=document.createElement("script");r.async=!0,r.src=`${t}/matomo.js`,document.head.appendChild(r)}function yn(t,n=2){return String(t).padStart(n,"0")}function ps(t){return yn(t.getUTCFullYear(),4)+yn(t.getUTCMonth()+1)+yn(t.getUTCDate())+"T"+yn(t.getUTCHours())+yn(t.getUTCMinutes())+yn(t.getUTCSeconds())+"Z"}function vo(t){return yn(t.getFullYear(),4)+yn(t.getMonth()+1)+yn(t.getDate())}function qi(t){return t.replace(/\\/g,"\\\\").replace(/;/g,"\\;").replace(/,/g,"\\,").replace(/\r?\n/g,"\\n")}function hm(t){if(t.length<=75)return t;const n=[];let i=0;for(;i<t.length;)n.push(t.slice(i,i+75)),i+=75;return n.join(`\r
|
|
2
2
|
`)}function sl(t,n={}){const{prodId:i="-//nice2dev//NiceToDev.UI//EN",calendarName:a,method:r}=n,o=["BEGIN:VCALENDAR","VERSION:2.0",`PRODID:${i}`,"CALSCALE:GREGORIAN"];r&&o.push(`METHOD:${r}`),a&&o.push(`X-WR-CALNAME:${qi(a)}`);const l=ps(new Date);for(const d of t)o.push("BEGIN:VEVENT"),o.push(`UID:${d.uid}`),o.push(`DTSTAMP:${l}`),d.allDay?(o.push(`DTSTART;VALUE=DATE:${vo(d.start)}`),d.end&&o.push(`DTEND;VALUE=DATE:${vo(d.end)}`)):(o.push(`DTSTART:${ps(d.start)}`),d.end&&o.push(`DTEND:${ps(d.end)}`)),o.push(`SUMMARY:${qi(d.summary)}`),d.description&&o.push(`DESCRIPTION:${qi(d.description)}`),d.location&&o.push(`LOCATION:${qi(d.location)}`),d.url&&o.push(`URL:${d.url}`),d.status&&o.push(`STATUS:${d.status}`),d.rrule&&o.push(`RRULE:${d.rrule}`),d.categories&&d.categories.length>0&&o.push(`CATEGORIES:${d.categories.map(qi).join(",")}`),o.push("END:VEVENT");return o.push("END:VCALENDAR"),o.map(hm).join(`\r
|
|
3
3
|
`)}function rl(t,n={}){const i=sl(t,n);return new Blob([i],{type:"text/calendar;charset=utf-8"})}function gm(t,n="calendar.ics",i={}){if(typeof window>"u"||typeof URL.createObjectURL!="function")return;const a=rl(t,i),r=URL.createObjectURL(a),o=document.createElement("a");o.href=r,o.download=n,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(r)}const bm=[];function fm(t){const n=t?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");if(!n)return"";const i=n.getAttribute("data-theme");return i==="dark"||n.classList.contains("nice-dark")||n.classList.contains("dark")?"nice-dark":i==="light"||n.classList.contains("nice-light")?"nice-light":""}const ol=({icon:t,items:n=bm,direction:i="right",position:a={bottom:24,right:24},disabled:r=!1,className:o,style:l,id:d,"data-testid":p})=>{const[m,g]=s.useState(!1),u=m&&!r,x=s.useRef(null),b=s.useRef(null),[f,h]=s.useState(null),[y,v]=s.useState(""),S=s.useRef(null);c.useMenuButton(b,S,{open:u,onOpenChange:g,orientation:i==="up"||i==="down"?"vertical":"horizontal"}),s.useLayoutEffect(()=>{if(!u||!b.current)return;const T=b.current,C=()=>h(T.getBoundingClientRect());return C(),v(fm(x.current)),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[u]);const j=e.jsx("div",{className:"nice-speed-dial__items",role:"menu",ref:S,children:n.map(T=>e.jsx("button",{type:"button",role:"menuitem",className:"nice-speed-dial__item nice-btn nice-btn--secondary",onClick:()=>{T.onClick?.(),g(!1)},title:T.label,"aria-label":T.label,children:T.icon},T.key))});return e.jsxs("div",{ref:x,id:d,"data-testid":p,className:["nice-speed-dial",`nice-speed-dial--${i}`,u?"nice-speed-dial--open":"",r?"nice-speed-dial--disabled":"",o||""].filter(Boolean).join(" "),style:{...a,...l},children:[e.jsx("button",{ref:b,type:"button",className:"nice-speed-dial__trigger nice-btn nice-btn--primary",onClick:()=>g(T=>!T),"aria-expanded":u,"aria-haspopup":"menu",disabled:r,children:e.jsx("span",{className:"nice-speed-dial__trigger-icon",children:t??e.jsx(c.NiceIcon,{name:"plus",size:24})})}),u&&f&&typeof document<"u"&&cr.createPortal(e.jsx("div",{className:["nice-speed-dial","nice-speed-dial--portal",`nice-speed-dial--${i}`,"nice-speed-dial--open",y].filter(Boolean).join(" "),"data-theme":y==="nice-dark"?"dark":y==="nice-light"?"light":void 0,style:{position:"fixed",left:f.left,top:f.top,width:f.width,height:f.height,right:"auto",bottom:"auto",margin:0},children:j}),document.body)]})},Yt=({children:t,variant:n="primary",size:i="md",dot:a,outline:r,subtle:o,pulse:l,icon:d,removable:p,onRemove:m,className:g,style:u,displayStyle:x,testId:b,"data-testid":f})=>{const{t:h}=c.useNiceTranslation(),y=c.useComponentDisplayStyle("badge",x),v=c.useComponentDisplayClass("badge",x),S={...y};for(const j of["fontSize","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","paddingInline","paddingBlock"])delete S[j];if(n!=="primary"||r||o)for(const j of["background","backgroundColor","color"])delete S[j];if(r||o)for(const j of["border","borderColor","borderWidth","borderStyle","boxShadow"])delete S[j];return e.jsxs("span",{className:`nice-badge nice-badge--${n} nice-badge--${i} nice-badge--ds-${v} ${a?"nice-badge--dot":""} ${r?"nice-badge--outline":""} ${o?"nice-badge--subtle":""} ${l?"nice-badge--pulse":""} ${p?"nice-badge--removable":""} ${g||""}`,style:{...S,...u},"data-testid":f??b,children:[d&&e.jsx("span",{className:"nice-badge__icon",children:d}),t,p&&e.jsx("button",{type:"button",className:"nice-badge__remove",onClick:m,"aria-label":h("badge.remove","Remove"),children:e.jsx(c.NiceIcon,{name:"close",size:14})})]})},Ua=({children:t,selected:n,removable:i,onClick:a,onRemove:r,color:o,size:l="md",className:d,style:p,testId:m,"data-testid":g})=>{const{t:u}=c.useNiceTranslation(),x=typeof t=="string"||typeof t=="number"?`${u("tag.remove","Remove")}: ${t}`:u("tag.remove","Remove");return e.jsxs("span",{className:`nice-tag nice-tag--${l} ${a?"nice-tag--clickable":""} ${n?"nice-tag--selected":""} ${d||""}`,style:{...p,...o&&!n?{borderColor:o,color:o}:{}},"data-testid":g??m,...a&&{onClick:a,role:"button",tabIndex:0,"aria-pressed":n,onKeyDown:b=>{b.target===b.currentTarget&&(b.key==="Enter"||b.key===" "?(b.preventDefault(),a()):i&&(b.key==="Delete"||b.key==="Backspace")&&(b.preventDefault(),r?.()))}},children:[t,i&&e.jsx("button",{type:"button",className:"nice-tag__remove",onClick:b=>{b.stopPropagation(),r?.()},"aria-label":x,children:e.jsx(c.NiceIcon,{name:"close",size:14})})]})};function vm(t){return t.split(" ").map(n=>n[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}const Ht=({src:t,alt:n,name:i,size:a="md",square:r,color:o,badge:l,badgePosition:d="bottom-right",className:p,style:m,testId:g,"data-testid":u})=>{const x=e.jsx("div",{className:`nice-avatar nice-avatar--${a} ${r?"nice-avatar--square":""} ${l==null&&p||""}`,style:l==null?{...m,...o?{background:o}:{}}:o?{background:o}:void 0,"aria-label":n||i,"data-testid":l==null?u??g:void 0,children:t?e.jsx("img",{src:t,alt:n||i||""}):i?vm(i):e.jsx(c.NiceIcon,{name:"user",size:"md",className:"nice-avatar__fallback-icon"})});return l==null?x:e.jsxs("span",{className:`nice-avatar-wrap ${p||""}`,style:m,"data-testid":u??g,children:[x,e.jsx("span",{className:`nice-avatar__badge nice-avatar__badge--${d}`,children:l})]})};function xm(t){return t?t.trim().split(/\s+/).map(n=>n[0]).join("").slice(0,2).toUpperCase():""}const ur=({children:t,items:n,max:i,size:a="md",className:r,style:o,testId:l,"data-testid":d})=>{const p=`nice-avatar nice-avatar--${a}`;let m,g;if(n&&n.length>0)g=n.length,m=(i?n.slice(0,i):n).map((b,f)=>{const h=b.src?e.jsx("img",{src:b.src,alt:b.name??""}):e.jsx("span",{children:xm(b.name)});return b.href?e.jsx("a",{className:p,href:b.href,title:b.name,onClick:b.onClick,children:h},f):b.onClick?e.jsx("button",{type:"button",className:p,title:b.name,onClick:b.onClick,children:h},f):e.jsx("span",{className:p,title:b.name,children:h},f)});else{const x=s.Children.toArray(t);g=x.length,m=(i?x.slice(0,i):x).map(f=>s.isValidElement(f)&&f.props.size==null?s.cloneElement(f,{size:a}):f)}const u=i?Math.max(0,g-i):0;return e.jsxs("div",{className:`nice-avatar-group nice-avatar-group--${a} ${r||""}`,style:o,"data-testid":d??l,children:[m,u>0&&e.jsxs("div",{className:p,style:{background:"var(--nice-text-muted)"},children:["+",u]})]})},ym={xxs:4,xs:6,sm:8,md:12,lg:16,xl:20,xxl:28},cl=Object.assign(s.forwardRef(({children:t,items:n,renderCard:i,searchable:a,searchField:r="text",searchPlaceholder:o,emptyText:l,onCardClick:d,size:p="md",minColumnWidth:m=240,columns:g,gap:u,align:x="stretch",equalHeight:b=!1,value:f,onChange:h,name:y,disabled:v,readOnly:S,loading:j,error:T,errorText:C,className:N,style:_,testId:w,"data-testid":k},I)=>{const{t:M}=c.useNiceTranslation(),[L,A]=s.useState(""),D=g?`repeat(${g}, minmax(0, 1fr))`:`repeat(auto-fill, minmax(${m}px, 1fr))`,E=u??ym[p]??12,R=typeof T=="string"?T.length>0:!!T,O=typeof T=="string"?T:T?C??"":"",F=n!=null&&i!=null,G=s.useMemo(()=>{if(!F||!L)return n??[];const se=L.toLowerCase();return(n??[]).filter(ce=>String(ce[r]??"").toLowerCase().includes(se))},[F,n,L,r]),ae=h!=null||f!=null,B=s.useMemo(()=>({value:f,onChange:se=>{!v&&!S&&h?.(se)},name:y}),[f,h,y,v,S]),W=b?"stretch":x,re=b?"1fr":void 0,J=`nice-card-group nice-card-group--${p}${b?" nice-card-group--equal":""}${v?" nice-card-group--disabled":""}${S?" nice-card-group--readonly":""}${j?" nice-card-group--loading":""}${R?" nice-card-group--error":""}${N?` ${N}`:""}`;if(F)return e.jsx(Oe.NiceCardGroupSizeContext.Provider,{value:p,children:e.jsxs("div",{ref:I,className:J,style:{position:"relative",..._},"aria-disabled":v||void 0,"aria-busy":j||void 0,"data-testid":k??w,children:[a&&e.jsx("div",{className:"nice-card-group__search",children:e.jsx("input",{type:"text",value:L,onChange:se=>A(se.target.value),placeholder:o||M("controls.search","Search...")})}),j?e.jsx("div",{className:"nice-card-group__empty",children:e.jsx("span",{className:"nice-spinner nice-spinner--md"})}):G.length===0?e.jsx("div",{className:"nice-card-group__empty",children:l||M("controls.noData","No data available")}):e.jsx("div",{className:"nice-card-group__grid",style:{display:"grid",gridTemplateColumns:D,gridAutoRows:re,gap:E,alignItems:W},children:G.map(se=>e.jsx("div",{className:"nice-card-group__data-card",onClick:d?()=>d(se):void 0,onKeyDown:d?ce=>{ce.target===ce.currentTarget&&(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),d(se))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,style:d?{cursor:"pointer"}:void 0,children:i(se)},se.key))}),O&&e.jsx("div",{className:"nice-card-group__error",role:"alert",children:O})]})});const oe=e.jsxs("div",{ref:I,className:J,style:{display:"grid",gridTemplateColumns:D,gridAutoRows:re,gap:E,alignItems:W,position:j?"relative":void 0,..._},role:ae?"radiogroup":void 0,"aria-label":ae?y:void 0,"aria-disabled":v||void 0,"aria-busy":j||void 0,"data-testid":k??w,children:[t,j&&e.jsx("span",{className:"nice-card-group__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),O&&!b&&e.jsx("div",{className:"nice-card-group__error",role:"alert",style:{gridColumn:"1 / -1"},children:O})]}),V=O&&b&&e.jsx("div",{className:"nice-card-group__error",role:"alert",children:O});return e.jsxs(Oe.NiceCardGroupSizeContext.Provider,{value:p,children:[ae?e.jsx(Oe.NiceCardRadioContext.Provider,{value:B,children:oe}):oe,V]})}),{displayName:"NiceCardGroup"}),Nm={color:!0,description:!0,volume:!0,gain:!0},pr=s.forwardRef(function(n,i){const{t:a}=c.useNiceTranslation(),{children:r,name:o,description:l,defaultDescription:d,onDescriptionChange:p,labelPlacement:m="bottom",number:g,color:u="transparent",onColorChange:x,volume:b,defaultVolume:f,onVolumeChange:h,gain:y,defaultGain:v,onGainChange:S,contextMenu:j=!0,quickControls:T,onOpenConfig:C,fullConfigLabel:N=a("deviceTile.fullConfiguration","Full configuration"),selected:_,onClick:w,focusId:k,className:I,style:M,title:L,"data-testid":A}=n,D={...Nm,...T},E=s.useRef(null),R=Y=>{E.current=Y,typeof i=="function"?i(Y):i&&(i.current=Y)},O=E;c.useSpatialFocusable(O,{id:k??"",onActivate:w,disabled:!k});const[F,G]=c.useControllableState({value:l,defaultValue:d,fallbackValue:"",onChange:p,componentName:"NiceDeviceTile"}),[ae,B]=c.useControllableState({value:b,defaultValue:f,fallbackValue:80,onChange:h,componentName:"NiceDeviceTile"}),[W,re]=c.useControllableState({value:y,defaultValue:v,fallbackValue:50,onChange:S,componentName:"NiceDeviceTile"}),J=c.useSpatialNavOptional(),[oe,V]=s.useState(null),se=s.useRef(null);c.useClickOutside(se,()=>V(null)),s.useEffect(()=>{if(oe)return J?.pauseNavigation(),()=>{J?.resumeNavigation()}},[oe,J]),c.useOverlayFocus(se,{open:oe!=null,modal:!1,onClose:()=>V(null)});const ce=Y=>{if(!j)return;Y.preventDefault();let{clientX:pe,clientY:ke}=Y;if(pe===0&&ke===0){const q=Y.currentTarget.getBoundingClientRect();pe=q.left,ke=q.bottom}const he=Math.min(pe,window.innerWidth-256),z=Math.min(ke,window.innerHeight-320);V({x:Math.max(8,he),y:Math.max(8,z)})},le=u!=="transparent"&&u!=="";return e.jsxs("div",{ref:R,className:["nice-device-tile",`nice-device-tile--label-${m}`,_?"nice-device-tile--selected":"",le?"nice-device-tile--colored":"",I??""].filter(Boolean).join(" "),style:{...M,"--device-color":u},title:L,"data-testid":A,onClick:w,onKeyDown:w?Y=>{Y.target===Y.currentTarget&&(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),Y.currentTarget.click())}:void 0,onContextMenu:ce,role:w?"button":void 0,tabIndex:k||w?0:void 0,children:[e.jsxs("div",{className:"nice-device-tile__device",children:[g!=null&&e.jsx("span",{className:"nice-device-tile__badge",children:g}),r]}),(o||F)&&e.jsxs("div",{className:"nice-device-tile__caption",children:[o&&e.jsx("span",{className:"nice-device-tile__name",children:o}),F&&e.jsx("span",{className:"nice-device-tile__description",children:F})]}),oe&&e.jsx("div",{ref:se,className:"nice-device-tile__menu",style:{position:"fixed",left:oe.x,top:oe.y},role:"dialog","aria-label":o,children:e.jsxs("div",{style:{display:"contents"},onClick:Y=>Y.stopPropagation(),onKeyDown:Y=>{Y.key!=="Escape"&&Y.stopPropagation()},children:[o&&e.jsx("div",{className:"nice-device-tile__menu-title",children:o}),D.color&&e.jsxs("div",{className:"nice-device-tile__menu-row",children:[e.jsx("span",{className:"nice-device-tile__menu-label",children:a("deviceTile.color","Color")}),e.jsx(pn.NiceColorPicker,{compact:!0,value:le?u:"#3b82f6",onChange:Y=>x?.(Y)})]}),D.description&&e.jsxs("div",{className:"nice-device-tile__menu-row nice-device-tile__menu-row--stack",children:[e.jsx("span",{className:"nice-device-tile__menu-label",children:a("deviceTile.description","Description")}),e.jsx(Ge.NiceTextInput,{value:F,onChange:Y=>G(Y),size:"sm"})]}),D.volume&&e.jsxs("div",{className:"nice-device-tile__menu-row",children:[e.jsx("span",{className:"nice-device-tile__menu-label",children:a("deviceTile.volume","Volume")}),e.jsx(rt.NiceSlider,{value:ae,onChange:Y=>B(Y),min:0,max:100})]}),D.gain&&e.jsxs("div",{className:"nice-device-tile__menu-row",children:[e.jsx("span",{className:"nice-device-tile__menu-label",children:a("deviceTile.gain","Gain")}),e.jsx(rt.NiceSlider,{value:W,onChange:Y=>re(Y),min:0,max:100})]}),C&&e.jsx(Le.NiceButton,{size:"sm",variant:"outline",className:"nice-device-tile__menu-config",onClick:()=>{V(null),C()},children:N})]})})]})}),_m={xxs:20,xs:24,sm:32,md:40,lg:56,xl:72,xxl:96},ya=15,hi=18,Na=6,Hi=30,ll=({level:t=0,size:n="md",muted:i=!1,...a})=>{const{t:r}=c.useNiceTranslation(),l=`nice-mic-clip-${c.useControlId()}`,d=typeof n=="number"?n:_m[n]??40,p=Math.max(0,Math.min(1,t)),m=Na+(1-p)*Hi,g=p*Hi;return e.jsx(pr,{...a,children:e.jsxs("svg",{className:`nice-microphone${i?" nice-microphone--muted":""}`,width:d,height:d*(64/48),viewBox:"0 0 48 64",role:"img","aria-label":a.name?r("microphone.microphone","Microphone: {name}").replace("{name}",String(a.name)):r("microphone.microphone2","Microphone"),children:[e.jsx("defs",{children:e.jsx("clipPath",{id:l,children:e.jsx("rect",{x:ya,y:Na,width:hi,height:Hi,rx:hi/2})})}),e.jsxs("g",{clipPath:`url(#${l})`,children:[e.jsx("rect",{x:ya,y:Na,width:hi,height:Hi,className:"nice-microphone__body"}),g>0&&e.jsx("rect",{x:ya,y:m,width:hi,height:g,className:"nice-microphone__level"})]}),e.jsx("rect",{x:ya,y:Na,width:hi,height:Hi,rx:hi/2,className:"nice-microphone__outline"}),e.jsx("path",{d:"M10 30 a14 14 0 0 0 28 0",className:"nice-microphone__stand"}),e.jsx("line",{x1:"24",y1:"44",x2:"24",y2:"56",className:"nice-microphone__stand"}),e.jsx("line",{x1:"16",y1:"56",x2:"32",y2:"56",className:"nice-microphone__stand"}),i&&e.jsx("line",{x1:"9",y1:"9",x2:"39",y2:"49",className:"nice-microphone__slash"})]})})},jm={xxs:22,xs:28,sm:36,md:48,lg:64,xl:84,xxl:110},wm=[{id:"LT",shape:{kind:"rect",x:18,y:3,w:16,h:5,rx:2},label:[26,1]},{id:"RT",shape:{kind:"rect",x:66,y:3,w:16,h:5,rx:2},label:[74,1]},{id:"LB",shape:{kind:"rect",x:18,y:10,w:16,h:5,rx:2},label:[26,9]},{id:"RB",shape:{kind:"rect",x:66,y:10,w:16,h:5,rx:2},label:[74,9]},{id:"DpadUp",shape:{kind:"rect",x:25,y:26,w:5,h:6,rx:1},label:[27,24]},{id:"DpadDown",shape:{kind:"rect",x:25,y:38,w:5,h:6,rx:1},label:[27,50]},{id:"DpadLeft",shape:{kind:"rect",x:18,y:32,w:6,h:5,rx:1},label:[16,35]},{id:"DpadRight",shape:{kind:"rect",x:31,y:32,w:6,h:5,rx:1},label:[40,35]},{id:"Y",shape:{kind:"circle",cx:74,cy:25,r:4},label:[74,19]},{id:"A",shape:{kind:"circle",cx:74,cy:41,r:4},label:[74,51]},{id:"X",shape:{kind:"circle",cx:66,cy:33,r:4},label:[58,35]},{id:"B",shape:{kind:"circle",cx:82,cy:33,r:4},label:[90,35]},{id:"Back",shape:{kind:"circle",cx:44,cy:26,r:2.6},label:[44,20]},{id:"Start",shape:{kind:"circle",cx:56,cy:26,r:2.6},label:[56,20]},{id:"LS",shape:{kind:"circle",cx:42,cy:42,r:6},label:[42,54]},{id:"RS",shape:{kind:"circle",cx:60,cy:44,r:6},label:[60,56]}],km="M50 18 C66 18 72 20 76 26 L90 48 C94 58 86 64 80 58 L66 46 L34 46 L20 58 C14 64 6 58 10 48 L24 26 C28 20 34 18 50 18 Z";function Cm({shape:t}){return t.kind==="circle"?e.jsx("circle",{cx:t.cx,cy:t.cy,r:t.r}):e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,rx:t.rx??1})}const dl=({view:t="compact",size:n="md",onButtonPress:i,pressedButtons:a,highlightedButtons:r,live:o=!1,gamepadIndex:l=0,buttonLabels:d,actionTree:p,assignments:m,onAssign:g,...u})=>{const{t:x}=c.useNiceTranslation(),b=typeof n=="number"?n:jm[n]??48,[f,h]=s.useState(()=>new Set),[y,v]=s.useState(null);c.useGamepad({index:l,enabled:o,onButtonDown:M=>{h(L=>{const A=new Set(L);return A.add(M),A}),i?.(M)},onButtonUp:M=>{h(L=>{const A=new Set(L);return A.delete(M),A})}});const S=M=>!!r?.includes(M)||!!a?.includes(M)||f.has(M),j=b*1.5,T=j*(68/100),C=(M,L)=>{M.stopPropagation(),i?.(L),p&&v(A=>A===L?null:L)},N=t==="compact",_=!N&&(!!i||!!p),w=s.useRef(null);c.useRovingFocus(w,{orientation:"grid",itemSelector:".nice-gamepad__btn",enabled:_});const k=e.jsxs("svg",{className:`nice-gamepad nice-gamepad--${t}${_?" nice-gamepad--interactive":""}`,width:j,height:T,viewBox:"0 0 100 68",role:_?"group":"img","aria-label":u.name?x("gamepad.gamepad","Gamepad: {name}").replace("{name}",String(u.name)):x("gamepad.gamepad2","Gamepad"),children:[e.jsx("path",{d:km,className:"nice-gamepad__body"}),!N&&wm.map(({id:M,shape:L,label:A})=>{const D=d?.[M]??m?.[M];return e.jsxs("g",{"data-button":M,"data-pressed":S(M)?"true":void 0,className:`nice-gamepad__btn${y===M?" nice-gamepad__btn--armed":""}`,role:_?"button":void 0,"aria-label":_?D?`${M} ${D}`:M:void 0,"aria-pressed":_&&p?y===M:void 0,onClick:E=>C(E,M),onKeyDown:E=>{_&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),C(E,M))},children:[e.jsx(Cm,{shape:L}),D&&e.jsx("text",{x:A[0],y:A[1],className:"nice-gamepad__label",children:D})]},M)})]}),I=_?e.jsx("div",{ref:w,className:"nice-gamepad__pad",children:k}):k;return e.jsx(pr,{...u,children:p&&!N?e.jsxs("div",{className:"nice-gamepad__assign",children:[I,e.jsxs("div",{className:"nice-gamepad__tree",children:[e.jsx("div",{className:"nice-gamepad__tree-hint",children:y?x("gamepad.assignTo",'Assign to "{armed}"…').replace("{armed}",String(y)):x("gamepad.clickAButtonThenA","Click a button, then a node")}),e.jsx(Nt.NiceTreeView,{nodes:p,selectionMode:"single",onNodeClick:M=>{y&&(g?.(y,M),v(null))}})]})]}):I})},Sm=[],Tm=({devices:t,defaultDevices:n,onDevicesChange:i,autoDetect:a=!0,kinds:r=["microphone","gamepad"],slots:o,onAssign:l,onOpenConfig:d,columns:p,minColumnWidth:m=160,className:g,style:u,id:x,"data-testid":b})=>{const{t:f}=c.useNiceTranslation(),[h,y]=c.useControllableState({value:t,defaultValue:n,fallbackValue:Sm,onChange:i,componentName:"NiceDeviceManager"}),v=s.useCallback(N=>{N.length!==0&&y(_=>{const w=new Set(_.map(I=>I.id)),k=N.filter(I=>!w.has(I.id));return k.length?[..._,...k]:_})},[y]);s.useEffect(()=>{if(!a||!r.includes("microphone")||!navigator.mediaDevices?.enumerateDevices)return;let N=!1;const _=()=>{navigator.mediaDevices.enumerateDevices().then(w=>{if(N)return;const k=w.filter(I=>I.kind==="audioinput").map((I,M)=>({id:`mic:${I.deviceId||M}`,kind:"microphone",name:I.label||`Microphone ${M+1}`,deviceId:I.deviceId}));v(k)}).catch(()=>{})};return _(),navigator.mediaDevices.addEventListener?.("devicechange",_),()=>{N=!0,navigator.mediaDevices.removeEventListener?.("devicechange",_)}},[a,r,v]);const S=c.useConnectedGamepads(),j=a&&r.includes("gamepad");s.useEffect(()=>{j&&v(S.map(N=>({id:`pad:${N.index}`,kind:"gamepad",name:N.id.split("(")[0]?.trim()||`Controller ${N.index+1}`,deviceId:String(N.index)})))},[j,S,v]);const T=s.useCallback((N,_)=>{y(w=>w.map(k=>k.id===N?{...k,..._}:k))},[y]),C=s.useCallback((N,_)=>{T(N,{assignedTo:_}),l?.(N,_)},[T,l]);return e.jsx("div",{id:x,"data-testid":b,className:`nice-device-manager ${g??""}`.trim(),style:u,children:h.length===0?e.jsx("p",{className:"nice-device-manager__empty",children:f("deviceManager.noDevicesDetected","No devices detected.")}):e.jsx(cl,{columns:p,minColumnWidth:m,gap:12,children:h.map((N,_)=>{const w={name:N.name,description:N.description,number:N.number??_+1,color:N.color??"transparent",volume:N.volume,gain:N.gain,onColorChange:k=>T(N.id,{color:k}),onDescriptionChange:k=>T(N.id,{description:k}),onVolumeChange:k=>T(N.id,{volume:k}),onGainChange:k=>T(N.id,{gain:k}),onOpenConfig:()=>d?.(N)};return e.jsxs("div",{className:"nice-device-manager__cell",children:[N.kind==="microphone"?e.jsx(ll,{...w,level:N.level}):e.jsx(dl,{...w,view:"compact",live:!0}),o&&o.length>0&&e.jsx("div",{className:"nice-device-manager__slots",children:o.map(k=>e.jsx(Le.NiceButton,{size:"sm",variant:N.assignedTo===k.id?"primary":"ghost",onClick:()=>C(N.id,N.assignedTo===k.id?null:k.id),children:k.label},k.id))})]},N.id)})})})},Em=[];function xo(t,n){const i=t.getBoundingClientRect(),a=n.getBoundingClientRect(),r=getComputedStyle(t),o=parseFloat(r.borderLeftWidth)||0,l=parseFloat(r.borderTopWidth)||0;return{width:a.width,height:a.height,left:0,top:0,transform:`translate(${a.left-i.left-o}px, ${a.top-i.top-l}px)`,opacity:1}}function on({options:t=Em,value:n,defaultValue:i,onChange:a,size:r="md",block:o=!1,disabled:l=!1,readOnly:d=!1,loading:p=!1,error:m,highlightFill:g=!0,errorPlacement:u="bottom",className:x="",style:b,"data-testid":f="nice-segmented-control"}){const{t:h}=c.useNiceTranslation(),y=s.useRef(null),[v,S]=s.useState(i),[j,T]=s.useState({}),C=n!==void 0?n:v,N=t.findIndex(k=>k.value===C);s.useEffect(()=>{if(!y.current||N<0){T({opacity:0});return}const k=y.current,M=k.querySelectorAll(".nice-segmented-control__option")[N];if(!M){T({opacity:0});return}T(xo(k,M))},[N,t.length,g,r,o]),s.useEffect(()=>{const k=()=>{if(!y.current||N<0)return;const I=y.current,L=I.querySelectorAll(".nice-segmented-control__option")[N];L&&T(xo(I,L))};return window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[N]);const _=s.useCallback(k=>{l||d||p||t.find(M=>M.value===k)?.disabled||(n===void 0&&S(k),a?.(k))},[l,d,p,t,n,a]);c.useRovingFocus(y,{orientation:"both",wrap:!0,activateOnMove:!0});const w=e.jsxs("div",{ref:y,className:`nice-segmented-control nice-segmented-control--${r} ${o?"nice-segmented-control--block":""} ${l?"nice-segmented-control--disabled":""} ${d?"nice-segmented-control--readonly":""} ${p?"nice-segmented-control--loading":""} ${m?"nice-segmented-control--error":""} ${g?"nice-segmented-control--fill":""} ${x}`,style:b,role:"radiogroup","aria-label":h("controls.select","Select option"),"aria-busy":p||void 0,"aria-invalid":!!m||void 0,"data-testid":f,children:[e.jsx("div",{className:"nice-segmented-control__thumb",style:j}),t.map((k,I)=>{const M=k.value===C,L=l||k.disabled;return e.jsxs("button",{type:"button",className:`nice-segmented-control__option ${M?"nice-segmented-control__option--selected":""} ${L?"nice-segmented-control__option--disabled":""}`,onClick:()=>_(k.value),disabled:L||p,role:"radio","aria-checked":M,"data-testid":`${f}-option-${I}`,children:[k.icon&&e.jsx("span",{className:"nice-segmented-control__icon",children:k.icon}),e.jsx("span",{className:"nice-segmented-control__label",children:k.label})]},String(k.value))}),p&&e.jsx("div",{className:"nice-segmented-control__spinner","aria-hidden":"true",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})})]});return m?e.jsxs("div",{className:`nice-segmented-control-field${u==="right"?" nice-segmented-control-field--err-right":""}`,children:[w,e.jsx("div",{className:"nice-segmented-control__error",role:"alert",children:m})]}):w}process.env.NODE_ENV!=="production"&&(on.displayName="NiceSegmentedControl");const Im=["gamepad","hints","navigation","bindings"],Pm=["activate","back","secondary","tertiary","menu","view","sectionPrev","sectionNext","pagePrev","pageNext","first","last","toggleHints"],ms={navigate:"Move",activate:"Select",back:"Back",secondary:"Options",tertiary:"More",menu:"Menu",view:"Switch area",sectionPrev:"Previous section",sectionNext:"Next section",pagePrev:"Previous page",pageNext:"Next page",first:"First",last:"Last",scroll:"Scroll",toggleHints:"Show or hide hints"},Dm=Object.assign(function({sections:n=Im,className:i,style:a,id:r,"data-testid":o}){const{t:l}=c.useNiceTranslation(),[d,p]=c.useInputPreferences(),[m,g]=s.useState(null);s.useEffect(()=>{if(!(!m||typeof window>"u"))return c.getInputEngine().captureNextInput(h=>{m.device==="gamepad"&&h.button?p({gamepadBindings:{...d.gamepadBindings,[m.intent]:[h.button]}}):m.device==="keyboard"&&h.keys&&p({keyboardBindings:{...d.keyboardBindings,[m.intent]:[h.keys]}}),g(null)})},[m,d.gamepadBindings,d.keyboardBindings,p]);const u=(h,y)=>p({[h]:y}),x=l("inputSettings.auto","Automatic"),b=h=>{const{[h]:y,...v}=d.gamepadBindings,{[h]:S,...j}=d.keyboardBindings;p({gamepadBindings:v,keyboardBindings:j})},f=h=>{switch(h){case"gamepad":return e.jsxs("section",{className:"nice-input-settings__section",children:[e.jsx("h3",{className:"nice-input-settings__title",children:l("inputSettings.section.gamepad","Gamepad")}),e.jsxs("div",{className:"nice-input-settings__field",children:[e.jsx("span",{className:"nice-input-settings__label",children:l("inputSettings.confirmButton","Confirm with")}),e.jsx(on,{value:d.confirmButton,onChange:y=>u("confirmButton",y),options:[{value:"auto",label:x},{value:"south",label:l("input.pad.bottomButton","Bottom button")},{value:"east",label:l("input.pad.rightButton","Right button")}]})]}),e.jsx(Ft.NiceSelect,{label:l("inputSettings.glyphFamily","Button symbols"),value:d.glyphFamily,onChange:y=>u("glyphFamily",y),options:[{value:"auto",label:x},{value:"xbox",label:"Xbox"},{value:"playstation",label:"PlayStation"},{value:"nintendo",label:"Nintendo"},{value:"steam",label:"Steam"},{value:"generic",label:l("inputSettings.family.generic","Generic")}]}),e.jsx(rt.NiceSlider,{label:l("inputSettings.stickThreshold","Stick push needed to move"),min:.2,max:.9,step:.05,value:d.stickThreshold,onChange:y=>u("stickThreshold",y),showValue:!0}),e.jsx(rt.NiceSlider,{label:l("inputSettings.repeatDelay","Repeat after (ms)"),min:200,max:800,step:20,value:d.repeatDelay,onChange:y=>u("repeatDelay",y),showValue:!0}),e.jsx(rt.NiceSlider,{label:l("inputSettings.repeatInterval","Repeat every (ms)"),min:50,max:250,step:10,value:d.repeatInterval,onChange:y=>u("repeatInterval",y),showValue:!0}),e.jsx(Ut.NiceToggle,{label:l("inputSettings.invertScroll","Invert scrolling with the right stick"),checked:d.invertScroll,onChange:y=>u("invertScroll",y)}),e.jsx(Ut.NiceToggle,{label:l("inputSettings.vibration","Vibration"),checked:d.vibration,onChange:y=>u("vibration",y)})]},h);case"hints":return e.jsxs("section",{className:"nice-input-settings__section",children:[e.jsx("h3",{className:"nice-input-settings__title",children:l("inputSettings.section.hints","Button hints")}),e.jsxs("div",{className:"nice-input-settings__field",children:[e.jsx("span",{className:"nice-input-settings__label",children:l("inputSettings.hints","Show hints")}),e.jsx(on,{value:d.hints,onChange:y=>u("hints",y),options:[{value:"auto",label:l("inputSettings.hints.auto","With keyboard or pad")},{value:"always",label:l("inputSettings.always","Always")},{value:"never",label:l("inputSettings.never","Never")}]})]}),e.jsxs("div",{className:"nice-input-settings__field",children:[e.jsx("span",{className:"nice-input-settings__label",children:l("inputSettings.hintDensity","Where")}),e.jsx(on,{value:d.hintDensity,onChange:y=>u("hintDensity",y),options:[{value:"bar",label:l("inputSettings.density.bar","Hint bar")},{value:"bar-and-controls",label:l("inputSettings.density.barAndControls","Bar and controls")}]})]})]},h);case"navigation":return e.jsxs("section",{className:"nice-input-settings__section",children:[e.jsx("h3",{className:"nice-input-settings__title",children:l("inputSettings.section.navigation","Navigation")}),e.jsxs("div",{className:"nice-input-settings__field",children:[e.jsx("span",{className:"nice-input-settings__label",children:l("inputSettings.arrowNavigation","Arrow keys outside lists")}),e.jsx(on,{value:d.arrowNavigation,onChange:y=>u("arrowNavigation",y),options:[{value:"auto",label:l("inputSettings.arrows.auto","Depends on the area")},{value:"spatial",label:l("inputSettings.arrows.spatial","Move focus")},{value:"native",label:l("inputSettings.arrows.native","Scroll")}]})]}),e.jsxs("div",{className:"nice-input-settings__field",children:[e.jsx("span",{className:"nice-input-settings__label",children:l("inputSettings.onScreenKeyboard","On-screen keyboard")}),e.jsx(on,{value:d.onScreenKeyboard,onChange:y=>u("onScreenKeyboard",y),options:[{value:"auto",label:l("inputSettings.osk.auto","With a pad")},{value:"always",label:l("inputSettings.always","Always")},{value:"never",label:l("inputSettings.never","Never")}]})]})]},h);default:return e.jsxs("section",{className:"nice-input-settings__section",children:[e.jsx("h3",{className:"nice-input-settings__title",children:l("inputSettings.section.bindings","Buttons and keys")}),e.jsxs("table",{className:"nice-input-settings__bindings",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:l("inputSettings.actionColumn","Action")}),e.jsx("th",{scope:"col",children:l("inputSettings.gamepadColumn","Gamepad")}),e.jsx("th",{scope:"col",children:l("inputSettings.keyboardColumn","Keyboard")}),e.jsx("th",{scope:"col",children:e.jsx("span",{className:"nice-sr-only",children:l("inputSettings.reset","Reset")})})]})}),e.jsx("tbody",{children:Pm.map(y=>{const v=j=>m?.intent===y&&m.device===j,S=(d.keyboardBindings[y]??c.NICE_DEFAULT_KEYBOARD_BINDINGS[y])[0];return e.jsxs("tr",{children:[e.jsx("th",{scope:"row",className:"nice-input-settings__action",children:l(`input.intent.${y}`,ms[y])}),e.jsx("td",{children:e.jsx(Le.NiceButton,{size:"sm",variant:"ghost",onClick:()=>g({intent:y,device:"gamepad"}),"aria-label":`${l("inputSettings.change","Change")}: ${l(`input.intent.${y}`,ms[y])}`,children:v("gamepad")?l("inputSettings.pressButton","Press a button…"):e.jsx(c.NiceButtonPrompt,{intent:y,device:"gamepad",size:"sm"})})}),e.jsx("td",{children:e.jsx(Le.NiceButton,{size:"sm",variant:"ghost",onClick:()=>g({intent:y,device:"keyboard"}),"aria-label":`${l("inputSettings.change","Change")}: ${l(`input.intent.${y}`,ms[y])}`,children:v("keyboard")?l("inputSettings.pressKey","Press a key…"):S?e.jsx(c.NiceKeyCap,{keys:S,size:"sm"}):l("inputSettings.none","None")})}),e.jsx("td",{children:e.jsx(Le.NiceButton,{size:"sm",variant:"ghost",onClick:()=>b(y),children:l("inputSettings.reset","Reset")})})]},y)})})]}),e.jsxs("div",{className:"nice-input-settings__actions",children:[m&&e.jsx(Le.NiceButton,{size:"sm",onClick:()=>g(null),children:l("inputSettings.cancel","Cancel")}),e.jsx(Le.NiceButton,{size:"sm",variant:"secondary",onClick:()=>p({gamepadBindings:{},keyboardBindings:{}}),children:l("inputSettings.resetAll","Reset all bindings")})]})]},h)}};return e.jsx("div",{id:r,"data-testid":o,className:`nice-input-settings${i?` ${i}`:""}`,style:a,children:n.map(f)})},{displayName:"NiceInputSettings"}),Fa=({value:t,max:n=100,label:i,helperText:a,error:r,required:o,disabled:l,loading:d,showValue:p=!0,text:m,variant:g="primary",size:u="md",striped:x,animated:b,formatValue:f,labelPlacement:h="top",errorPlacement:y="bottom",labelWidth:v,controlWidth:S,className:j,style:T,id:C})=>{const N=c.useControlId(C),_=Math.min(100,Math.max(0,t/n*100)),w=m??(f?f(t,n):`${Math.round(_)}%`),k=p,I=i?e.jsxs("label",{className:"nice-field__label",htmlFor:N,children:[i,o&&e.jsx("span",{className:"nice-field__required",children:"*"})]}):null,M=r?e.jsx("div",{id:`${N}-error`,className:"nice-field__error",role:"alert",children:r}):null,L=!r&&a?e.jsx("div",{id:`${N}-helper`,className:"nice-field__helper",children:a}):null,A=e.jsxs("div",{className:`nice-progress ${l?"nice-progress--disabled":""} ${d?"nice-progress--loading":""}`,role:"progressbar",id:N,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":n,"aria-busy":d||void 0,"aria-disabled":l||void 0,children:[e.jsx("div",{className:`nice-progress__track ${u!=="md"?`nice-progress__track--${u}`:""}`,children:e.jsx("div",{className:`nice-progress__fill nice-progress__fill--${g} ${x||d?"nice-progress__fill--striped":""} ${b||d?"nice-progress__fill--animated":""}`,style:{width:d?"100%":`${_}%`}})}),k&&(h==="left"||h==="right")&&e.jsx("span",{className:"nice-progress__value",children:w})]}),D=e.jsxs("div",{className:"nice-progress__header",children:[I,k&&e.jsx("span",{className:"nice-progress__value",children:w})]});return e.jsxs("div",{className:`nice-field nice-field--${u} nice-field--progress ${h==="left"?"nice-field--label-left":""} ${j||""}`,style:{...T,...v!=null&&{"--nice-field-label-width":typeof v=="number"?`${v}px`:v},...S!=null&&{"--nice-field-control-width":typeof S=="number"?`${S}px`:S}},children:[h==="top"&&(k?D:I),h==="left"||h==="right"?e.jsxs("div",{className:"nice-field__control",style:{display:"flex",alignItems:"center",gap:"var(--nice-space-2, 8px)",flex:"1 1 auto"},children:[h==="right"?e.jsxs(e.Fragment,{children:[A,I]}):e.jsxs(e.Fragment,{children:[I,A]}),y==="right"&&M,y==="right"&&!r&&L]}):e.jsx("div",{className:"nice-field__control",children:A}),h==="bottom"&&(k?D:I),y!=="right"&&M,y!=="right"&&L]})},Ga=({vertical:t,text:n,size:i="md",className:a,style:r,testId:o,"data-testid":l})=>t?e.jsx("hr",{className:`nice-divider nice-divider--vertical nice-divider--${i} ${a||""}`,style:r,"data-testid":l??o}):n?e.jsx("div",{className:`nice-divider--with-text nice-divider--${i} ${a||""}`,style:r,"data-testid":l??o,children:n}):e.jsx("hr",{className:`nice-divider nice-divider--${i} ${a||""}`,style:r,"data-testid":l??o}),yo=t=>typeof t=="number"?t:/^\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t,Am={text:14,rect:80,circle:40},Rm={xxs:{text:6,rect:28,circle:16},xs:{text:8,rect:40,circle:24},sm:{text:11,rect:60,circle:32},small:{text:11,rect:60,circle:32},md:{text:14,rect:80,circle:40},medium:{text:14,rect:80,circle:40},lg:{text:20,rect:120,circle:56},large:{text:20,rect:120,circle:56},xl:{text:28,rect:160,circle:72},xxl:{text:36,rect:220,circle:96}},ia=({variant:t="text",width:n,height:i,count:a=1,size:r="md",orientation:o="vertical",animationSpeed:l,className:d,style:p,testId:m,"data-testid":g})=>{const u=Rm[r]??Am,x=yo(n??(t==="circle"?u.circle:"100%")),b=yo(i??(t==="text"?u.text:t==="circle"?u.circle:u.rect)),f=l!=null&&l>0?{"--nice-skeleton-speed":`${l}s`}:null;if(a<=1)return e.jsx("div",{className:`nice-skeleton nice-skeleton--${t} nice-skeleton--${r} ${d||""}`,style:{width:x,height:b,...f,...p},"data-testid":g??m});const h=o==="horizontal";return e.jsx("div",{className:`nice-skeleton-group ${d||""}`,style:{display:"flex",flexDirection:h?"row":"column",gap:"var(--nice-space-2, 8px)",width:"100%",...f,...p},"data-testid":g??m,children:Array.from({length:a}).map((y,v)=>e.jsx("div",{className:`nice-skeleton nice-skeleton--${t} nice-skeleton--${r}`,style:h?{flex:"1 1 0",minWidth:0,height:b}:{width:x,height:b}},v))})},mr=({icon:t,title:n,description:i,action:a,size:r="md",className:o,style:l,testId:d,"data-testid":p})=>e.jsxs("div",{className:`nice-empty nice-empty--${r} ${o||""}`,style:l,"data-testid":p??d,role:"status","aria-label":n,children:[t&&e.jsx("div",{className:"nice-empty__icon","aria-hidden":"true",children:t}),e.jsx("div",{className:"nice-empty__title",children:n}),i&&e.jsx("div",{className:"nice-empty__desc",children:i}),a]}),$m=[],No={xxs:9,xs:11,sm:13,small:13,md:16,medium:16,lg:20,large:20,xl:24,xxl:28},ul=Object.assign(s.forwardRef(({items:t=$m,mode:n="left",size:i="md",isFragment:a=!1,renderItem:r,className:o,style:l,id:d,testId:p,"data-testid":m,...g},u)=>{const{renderIcon:x}=c.useNiceIcon(),b=No[i]??No.md;return e.jsx("div",{ref:u,id:d,className:`nice-timeline nice-timeline--${n} nice-timeline--${i} ${a?"nice-timeline--fragment":""} ${o||""}`,style:l,"data-testid":m??p,...g,children:t.map((f,h)=>{const y=n==="alternate"?h%2===0?"left":"right":n;return e.jsxs("div",{className:`nice-timeline__item nice-timeline__item--${y}`,children:[e.jsx("div",{className:"nice-timeline__dot",style:f.color?{borderColor:f.color,color:f.color}:void 0,children:x(f.icon,b)??e.jsx("span",{className:"nice-timeline__dot-inner",style:f.color?{background:f.color}:void 0})}),a&&h===0&&e.jsx("div",{className:"nice-timeline__connector nice-timeline__connector--leading"}),(h<t.length-1||a)&&e.jsx("div",{className:"nice-timeline__connector"}),e.jsx("div",{className:"nice-timeline__content",children:r?r(f,h):e.jsxs(e.Fragment,{children:[f.title&&e.jsx("div",{className:"nice-timeline__title",children:f.title}),f.subtitle&&e.jsx("div",{className:"nice-timeline__subtitle",children:f.subtitle}),f.content&&e.jsx("div",{className:"nice-timeline__body",children:f.content})]})})]},f.key)})})}),{displayName:"NiceTimeline"}),Mm=[],pl=Object.assign(s.forwardRef(({items:t=Mm,visibleCount:n=1,showArrows:i=!0,showDots:a=!0,autoPlay:r=7e3,circular:o=!0,activeIndex:l,onChange:d,size:p="md",fullWidth:m=!0,className:g,style:u,id:x,testId:b,"data-testid":f,...h},y)=>{const{t:v}=c.useNiceTranslation(),[S,j]=s.useState(0),T=s.useRef(void 0),N=l!=null&&typeof d=="function"?l:S,_=Math.max(1,Math.floor(n||1)),w=Math.max(0,t.length-_),k=s.useCallback(V=>{let se=V;o?se=(V%t.length+t.length)%t.length:se=Math.max(0,Math.min(w,V)),j(se),d?.(se)},[t.length,w,o,d]),I=s.useCallback(()=>k(N+1),[k,N]),M=s.useCallback(()=>k(N-1),[k,N]),[L,A]=s.useState(!1),[D,E]=s.useState(!1),[R,O]=s.useState(!1),F=r>0&&!R&&!L&&!D;s.useEffect(()=>{if(F)return T.current=setInterval(I,r),()=>clearInterval(T.current)},[F,r,I]);const G=o||N>0,ae=o||N<w,B=s.useRef(null);s.useEffect(()=>{const V=B.current?.children;V&&Array.from(V).forEach((se,ce)=>{se.toggleAttribute("inert",ce<N||ce>=N+_)})},[N,_,t.length]);const W=s.useRef(null),re=s.useCallback(V=>{W.current=V,typeof y=="function"?y(V):y&&(y.current=V)},[y]);c.useIntent(["sectionPrev","sectionNext"],V=>{if(V.intent==="sectionNext"?!ae:!G)return!1;V.intent==="sectionNext"?I():M()},{ref:W,enabled:t.length>_}),c.useInputHints(W,[{intent:"sectionPrev",label:v("carousel.prev","Previous slide")},{intent:"sectionNext",label:v("carousel.next","Next slide")}],{enabled:t.length>_});const J=s.useCallback(V=>{V.target===V.currentTarget&&(V.key==="ArrowLeft"&&G?(V.preventDefault(),M()):V.key==="ArrowRight"&&ae?(V.preventDefault(),I()):V.key==="Home"?(V.preventDefault(),k(0)):V.key==="End"&&(V.preventDefault(),k(w)))},[M,I,k,G,ae,w]),oe=s.useRef(null);return c.useRovingFocus(oe,{orientation:"horizontal",activateOnMove:!0}),e.jsxs("div",{ref:re,id:x,className:`nice-carousel nice-carousel--${p} ${m?"nice-carousel--full-width":""} ${g||""}`,style:u,"data-testid":f??b,role:"region","aria-roledescription":"carousel","aria-label":v("carousel.label","Carousel"),tabIndex:0,onKeyDown:J,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),onFocus:()=>E(!0),onBlur:V=>{V.currentTarget.contains(V.relatedTarget)||E(!1)},...h,children:[r>0&&e.jsx("button",{type:"button",className:"nice-carousel__rotation",onClick:()=>O(V=>!V),"aria-label":R?v("carousel.startRotation","Start automatic slide show"):v("carousel.stopRotation","Stop automatic slide show"),children:e.jsx(c.NiceIcon,{name:R?"play":"pause",size:16})}),e.jsx("div",{className:"nice-carousel__viewport","aria-live":F?"off":"polite",children:e.jsx("div",{ref:B,className:"nice-carousel__track",style:{transform:`translateX(-${N*(100/_)}%)`,"--nice-carousel-slide-basis":`${100/_}%`},children:t.map((V,se)=>e.jsx("div",{className:"nice-carousel__slide",role:"group","aria-roledescription":"slide","aria-label":`${se+1} / ${t.length}`,children:V},se))})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-carousel__arrow nice-carousel__arrow--prev",onClick:M,disabled:!G,"aria-label":v("carousel.prev","Previous"),children:e.jsx(c.NiceIcon,{name:"chevron-left",size:20})}),e.jsx("button",{type:"button",className:"nice-carousel__arrow nice-carousel__arrow--next",onClick:I,disabled:!ae,"aria-label":v("carousel.next","Next"),children:e.jsx(c.NiceIcon,{name:"chevron-right",size:20})})]}),a&&t.length>_&&e.jsx("div",{className:"nice-carousel__dots",role:"tablist",ref:oe,children:Array.from({length:w+1},(V,se)=>e.jsx("button",{type:"button",className:`nice-carousel__dot ${se===N?"nice-carousel__dot--active":""}`,onClick:()=>k(se),role:"tab","aria-selected":se===N,"aria-label":`${v("carousel.goTo","Go to slide")} ${se+1}`},se))})]})}),{displayName:"NiceCarousel"}),Om=[];function zm({items:t=Om,itemHeight:n,height:i=400,overscan:a=3,renderItem:r,itemKey:o,className:l,style:d,size:p="md",disabled:m,readOnly:g,loading:u,error:x,testId:b,"data-testid":f,...h},y){const v=s.useRef(null),[S,j]=s.useState(0),T=typeof i=="number"?i:parseFloat(String(i)),C=Number.isFinite(T)?T:400,N=Number.isFinite(n)&&n>0?n:1,_=Number.isFinite(a)&&a>=0?Math.floor(a):0,w=t.length*N,{startIndex:k,endIndex:I}=s.useMemo(()=>{const A=Math.max(1,Math.ceil(C/N)),D=Math.floor(S/N),E=Math.max(0,D-_),R=Math.min(t.length-1,D+A+_);return{startIndex:E,endIndex:R}},[S,C,N,t.length,_]),M=s.useCallback(A=>{j(A.currentTarget.scrollTop)},[]);s.useEffect(()=>{y&&(typeof y=="function"?y(v.current):y.current=v.current)},[y]);const L=s.useMemo(()=>{const A=[];for(let D=k;D<=I;D++){const E=o?o(t[D],D):D;A.push(e.jsx("div",{className:"nice-virtual-scroller__item",style:{position:"absolute",top:D*N,left:0,right:0,height:N},children:r(t[D],D)},E))}return A},[k,I,t,N,r,o]);return e.jsxs("div",{ref:v,className:`nice-virtual-scroller nice-virtual-scroller--${p} ${m?"nice-virtual-scroller--disabled":""} ${x?"nice-virtual-scroller--error":""} ${l||""}`,style:{width:"100%",...d,height:typeof i=="string"&&!/^\d+(\.\d+)?$/.test(i)?i:C,overflow:"auto",position:"relative"},onScroll:M,role:"list","aria-disabled":m||void 0,"aria-busy":u||void 0,"data-testid":f??b,...h,children:[x?e.jsx("div",{className:"nice-virtual-scroller__error",role:"alert",children:x}):e.jsx("div",{style:{height:w,position:"relative",width:"100%"},children:L}),u&&e.jsx("div",{className:"nice-virtual-scroller__loading","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]})}const ml=Object.assign(s.forwardRef(zm),{displayName:"NiceVirtualScroller"}),Lm=[],hl=s.createContext(null);function ss(){const t=s.useContext(hl);if(!t)throw new Error("useFAQ must be used within NiceFAQ");return t}function _a(t,n){if(!n)return{score:1,indices:[]};const i=t.toLowerCase(),r=n.toLowerCase().split(/\s+/).filter(Boolean);let o=0;const l=[];for(const p of r){let m=!1,g=0;for(;(g=i.indexOf(p,g))!==-1;){m=!0,l.push([g,g+p.length]);const u=g===0||/\s/.test(t[g-1]),x=g+p.length===t.length||/\s/.test(t[g+p.length]);u&&x?o+=2:u?o+=1.5:o+=1,g+=1}if(!m){let u=0,x=-1;for(let b=0;b<i.length&&u<p.length;b++)if(i[b]===p[u]){if(x===-1||b===x+1)if(x===-1)l.push([b,b+1]);else{const f=l[l.length-1];f[1]=b+1}else l.push([b,b+1]);x=b,u++}if(u===p.length)o+=.5;else return null}}const d=Bm(l);return{score:o/r.length,indices:d}}function Bm(t){if(t.length===0)return[];const n=[...t].sort((a,r)=>a[0]-r[0]),i=[n[0]];for(let a=1;a<n.length;a++){const r=i[i.length-1],o=n[a];o[0]<=r[1]?r[1]=Math.max(r[1],o[1]):i.push(o)}return i}function Fm(t,n){if(!n.trim())return t.map(a=>({item:a,score:1,matches:[]}));const i=[];for(const a of t){const r=[];let o=0;const l=_a(a.question,n);if(l&&l.score>0&&(r.push({field:"question",indices:l.indices}),o+=l.score*3),typeof a.answer=="string"){const d=_a(a.answer,n);d&&d.score>0&&(r.push({field:"answer",indices:d.indices}),o+=d.score*1)}if(a.tags)for(const d of a.tags){const p=_a(d,n);if(p&&p.score>0){r.push({field:"tags",indices:p.indices}),o+=p.score*2;break}}if(a.keywords)for(const d of a.keywords){const p=_a(d,n);if(p&&p.score>0){r.push({field:"keywords",indices:p.indices}),o+=p.score*2.5;break}}r.length>0&&(a.featured&&(o*=1.2),i.push({item:a,score:o,matches:r}))}return i.sort((a,r)=>r.score-a.score)}const Vm=({text:t,indices:n})=>{if(n.length===0)return e.jsx(e.Fragment,{children:t});const i=[];let a=0;for(const[r,o]of n)r>a&&i.push(e.jsx("span",{children:t.slice(a,r)},`text-${a}`)),i.push(e.jsx("mark",{className:"nice-faq-highlight",children:t.slice(r,o)},`mark-${r}`)),a=o;return a<t.length&&i.push(e.jsx("span",{children:t.slice(a)},`text-${a}`)),e.jsx(e.Fragment,{children:i})},gl=({placeholder:t,autoFocus:n=!1,showIcon:i=!0,debounceMs:a=200})=>{const{t:r}=c.useNiceTranslation(),o=t??r("faq.searchFaqPlaceholder","Search FAQ..."),{searchQuery:l,setSearchQuery:d}=ss(),[p,m]=s.useState(l),g=s.useRef(null),u=s.useRef(null);s.useEffect(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{d(p)},a),()=>{u.current&&clearTimeout(u.current)}),[p,a,d]);const x=s.useCallback(()=>{m(""),d(""),g.current?.focus()},[d]);return e.jsxs("div",{className:"nice-faq-search",children:[i&&e.jsx("span",{className:"nice-faq-search-icon",children:e.jsx(c.NiceIcon,{name:"search",size:16})}),e.jsx("input",{ref:g,type:"text",className:"nice-faq-search-input",placeholder:o,value:p,onChange:b=>m(b.target.value),autoFocus:n,"aria-label":r("faq.searchFaq","Search FAQ")}),p&&e.jsx("button",{className:"nice-faq-search-clear",onClick:x,"aria-label":r("faq.clearSearch","Clear search"),children:e.jsx(c.NiceIcon,{name:"close",size:14})})]})},bl=({showCounts:t=!0,layout:n="horizontal"})=>{const{t:i}=c.useNiceTranslation(),{categories:a,items:r,selectedCategory:o,setSelectedCategory:l}=ss(),d=s.useMemo(()=>{const p={all:r.length};for(const m of r)m.category&&(p[m.category]=(p[m.category]||0)+1);return p},[r]);return a.length===0?null:n==="dropdown"?e.jsx("div",{className:"nice-faq-category-dropdown",children:e.jsxs("select",{value:o||"all",onChange:p=>l(p.target.value==="all"?null:p.target.value),className:"nice-faq-category-select",children:[e.jsxs("option",{value:"all",children:[i("faq.allCategories","All Categories")," ",t&&`(${d.all})`]}),a.map(p=>e.jsxs("option",{value:p.id,children:[p.name," ",t&&`(${d[p.id]||0})`]},p.id))]})}):e.jsxs("div",{className:`nice-faq-categories nice-faq-categories--${n}`,children:[e.jsxs("button",{className:`nice-faq-category-btn ${o?"":"nice-faq-category-btn--active"}`,onClick:()=>l(null),children:[e.jsx("span",{children:i("faq.all","All")}),t&&e.jsx("span",{className:"nice-faq-category-count",children:d.all})]}),a.map(p=>e.jsxs("button",{className:`nice-faq-category-btn ${o===p.id?"nice-faq-category-btn--active":""}`,onClick:()=>l(p.id),style:p.color?{"--cat-color":p.color}:void 0,children:[p.icon&&e.jsx("span",{className:"nice-faq-category-icon",children:p.icon}),e.jsx("span",{children:p.name}),t&&e.jsx("span",{className:"nice-faq-category-count",children:d[p.id]||0})]},p.id))]})},hr=({result:t,showFeedback:n=!0,showRelated:i=!0,animateExpand:a=!0})=>{const{t:r}=c.useNiceTranslation(),{item:o,matches:l}=t,{expandedIds:d,toggleExpanded:p,items:m,submitFeedback:g}=ss(),[u,x]=s.useState(null),[b,f]=s.useState(!1),[h,y]=s.useState(""),v=s.useRef(null),S=d.has(o.id);s.useEffect(()=>{v.current?.toggleAttribute("inert",!S)},[S]);const j=l.find(_=>_.field==="question")?.indices||[],T=s.useMemo(()=>!i||!o.relatedIds||o.relatedIds.length===0?[]:m.filter(_=>o.relatedIds?.includes(_.id)),[i,o.relatedIds,m]),C=_=>{x(_),_?g(o.id,_):f(!0)},N=()=>{g(o.id,!1,h),f(!1),y("")};return e.jsxs("div",{className:`nice-faq-item ${S?"nice-faq-item--expanded":""} ${o.featured?"nice-faq-item--featured":""}`,"data-question-id":o.id,children:[e.jsxs("button",{className:"nice-faq-question",onClick:()=>p(o.id),"aria-expanded":S,"aria-controls":`faq-answer-${o.id}`,children:[o.icon&&e.jsx("span",{className:"nice-faq-question-icon",children:o.icon}),e.jsx("span",{className:"nice-faq-question-text",children:e.jsx(Vm,{text:o.question,indices:j})}),e.jsx("span",{className:`nice-faq-chevron ${S?"nice-faq-chevron--open":""}`,children:e.jsx(c.NiceIcon,{name:"chevron-down",size:16})})]}),e.jsx("div",{id:`faq-answer-${o.id}`,className:`nice-faq-answer ${a?"nice-faq-answer--animated":""}`,ref:v,style:{maxHeight:S?a?v.current?.scrollHeight??1e3:void 0:0},"aria-hidden":!S,children:e.jsxs("div",{className:"nice-faq-answer-content",children:[typeof o.answer=="string"?e.jsx("p",{children:o.answer}):o.answer,o.tags&&o.tags.length>0&&e.jsx("div",{className:"nice-faq-tags",children:o.tags.map(_=>e.jsx("span",{className:"nice-faq-tag",children:_},_))}),T.length>0&&e.jsxs("div",{className:"nice-faq-related",children:[e.jsx("span",{className:"nice-faq-related-label",children:r("faq.related","Related:")}),T.map(_=>e.jsx("button",{className:"nice-faq-related-link",onClick:w=>{w.stopPropagation(),p(_.id),document.querySelector(`[data-question-id="${_.id}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},children:_.question},_.id))]}),n&&e.jsxs("div",{className:"nice-faq-feedback",children:[u===null?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-faq-feedback-label",children:r("faq.wasThisHelpful","Was this helpful?")}),e.jsxs("button",{className:"nice-faq-feedback-btn nice-faq-feedback-btn--yes",onClick:()=>C(!0),"aria-label":r("faq.yesThisWasHelpful","Yes, this was helpful"),children:[e.jsx(c.NiceIcon,{name:"check",size:14})," ",r("faq.yes","Yes")]}),e.jsxs("button",{className:"nice-faq-feedback-btn nice-faq-feedback-btn--no",onClick:()=>C(!1),"aria-label":r("faq.noThisWasNotHelpful","No, this was not helpful"),children:[e.jsx(c.NiceIcon,{name:"close",size:14})," ",r("faq.no","No")]})]}):e.jsx("span",{className:"nice-faq-feedback-thanks",children:u?r("faq.thanksForYourFeedback","Thanks for your feedback!"):""}),b&&e.jsxs("div",{className:"nice-faq-feedback-form",children:[e.jsx("textarea",{placeholder:r("faq.howCanWeImproveThis","How can we improve this answer?"),value:h,onChange:_=>y(_.target.value),className:"nice-faq-feedback-textarea",rows:3}),e.jsxs("div",{className:"nice-faq-feedback-actions",children:[e.jsx("button",{className:"nice-faq-feedback-submit",onClick:N,children:r("faq.submit","Submit")}),e.jsx("button",{className:"nice-faq-feedback-cancel",onClick:()=>{f(!1),x(null)},children:r("faq.cancel","Cancel")})]})]})]})]})})]})},Us=({category:t,results:n,showFeedback:i,showRelated:a,collapsible:r=!0})=>{const{t:o}=c.useNiceTranslation(),[l,d]=s.useState(!1),p=s.useId();return n.length===0?null:e.jsxs("div",{className:"nice-faq-group",children:[e.jsxs("div",{className:`nice-faq-group-header ${r?"nice-faq-group-header--collapsible":""}`,role:"presentation",onClick:r?()=>d(!l):void 0,style:t.color?{borderColor:t.color}:void 0,children:[t.icon&&e.jsx("span",{className:"nice-faq-group-icon",children:t.icon}),e.jsx("h3",{className:"nice-faq-group-title",children:t.name}),t.description&&e.jsx("p",{className:"nice-faq-group-desc",children:t.description}),e.jsx("span",{className:"nice-faq-group-count",children:n.length}),r&&e.jsx("button",{type:"button",className:`nice-faq-group-chevron ${l?"":"nice-faq-group-chevron--open"}`,"aria-expanded":!l,"aria-controls":l?void 0:p,"aria-label":`${l?o("faq.expandGroup","Expand"):o("faq.collapseGroup","Collapse")}: ${t.name}`,onClick:m=>{m.stopPropagation(),d(!l)},children:e.jsx(c.NiceIcon,{name:"chevron-down",size:16})})]}),!l&&e.jsx("div",{id:p,className:"nice-faq-group-items",children:n.map(m=>e.jsx(hr,{result:m,showFeedback:i,showRelated:a},m.item.id))})]})},qm=({items:t=Lm,categories:n=[],showSearch:i=!0,searchPlaceholder:a,autoFocusSearch:r=!1,showCategories:o=!0,categoryLayout:l="horizontal",groupByCategory:d=!0,allowMultiple:p=!0,defaultExpanded:m=[],showFeedback:g=!0,showRelated:u=!0,onFeedback:x,onAnalytics:b,showExpandControls:f=!0,animateExpand:h=!0,emptyMessage:y,generateSchema:v=!0,header:S,footer:j,size:T="md",className:C,style:N,testId:_,"data-testid":w})=>{const{t:k}=c.useNiceTranslation(),I=a??k("faq.searchFrequentlyAskedQuestions","Search frequently asked questions..."),M=y??k("faq.noQuestionsFoundMatchingYour","No questions found matching your search."),[L,A]=s.useState(new Set(m)),[D,E]=s.useState(""),[R,O]=s.useState(null),F=s.useMemo(()=>[...t].sort((le,Y)=>le.featured&&!Y.featured?-1:!le.featured&&Y.featured?1:(le.order??999)-(Y.order??999)),[t]),G=s.useMemo(()=>R?F.filter(le=>le.category===R):F,[F,R]),ae=s.useMemo(()=>Fm(G,D),[G,D]),B=s.useMemo(()=>{if(!d||n.length===0)return null;const le={},Y=[];for(const pe of ae){const ke=pe.item.category;ke?(le[ke]||(le[ke]=[]),le[ke].push(pe)):Y.push(pe)}return{groups:le,uncategorized:Y}},[d,n,ae]),W=s.useCallback(le=>{A(Y=>{const pe=new Set(Y);return pe.has(le)?(pe.delete(le),b?.({type:"collapse",questionId:le,timestamp:new Date().toISOString()})):(p||pe.clear(),pe.add(le),b?.({type:"expand",questionId:le,timestamp:new Date().toISOString()})),pe})},[p,b]),re=s.useCallback(()=>{A(new Set(t.map(le=>le.id)))},[t]),J=s.useCallback(()=>{A(new Set)},[]),oe=s.useCallback(le=>{E(le),le.trim()&&b?.({type:"search",searchQuery:le,timestamp:new Date().toISOString()})},[b]),V=s.useCallback((le,Y,pe)=>{const ke={questionId:le,helpful:Y,comment:pe,timestamp:new Date().toISOString()};x?.(ke),b?.({type:"feedback",questionId:le,timestamp:ke.timestamp,metadata:{helpful:Y,comment:pe}})},[x,b]),se=s.useMemo(()=>{if(!v)return null;const le={"@context":"https://schema.org","@type":"FAQPage",mainEntity:t.map(Y=>({"@type":"Question",name:Y.question,acceptedAnswer:{"@type":"Answer",text:typeof Y.answer=="string"?Y.answer:""}}))};return e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(le)}})},[v,t]),ce={items:F,categories:n,expandedIds:L,searchQuery:D,selectedCategory:R,toggleExpanded:W,expandAll:re,collapseAll:J,setSearchQuery:oe,setSelectedCategory:O,submitFeedback:V};return e.jsx(hl.Provider,{value:ce,children:e.jsxs("div",{className:`nice-faq nice-faq--${T} ${C||""}`,style:N,"data-testid":w??_,children:[se,S&&e.jsx("div",{className:"nice-faq-header",children:S}),e.jsxs("div",{className:"nice-faq-controls",children:[i&&e.jsx(gl,{placeholder:I,autoFocus:r}),o&&n.length>0&&e.jsx(bl,{layout:l,showCounts:!0}),f&&e.jsxs("div",{className:"nice-faq-expand-controls",children:[e.jsx("button",{className:"nice-faq-expand-btn",onClick:re,children:k("faq.expandAll","Expand All")}),e.jsx("button",{className:"nice-faq-expand-btn",onClick:J,children:k("faq.collapseAll","Collapse All")})]})]}),D&&e.jsx("div",{className:"nice-faq-results-info",children:(ae.length===1?k("faq.foundOneResult",'Found 1 result for "{query}"'):k("faq.foundResults",'Found {count} results for "{query}"')).replace("{count}",String(ae.length)).replace("{query}",D)}),e.jsx("div",{className:"nice-faq-list",children:ae.length===0?e.jsx("div",{className:"nice-faq-empty",children:typeof M=="string"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-faq-empty-icon",children:e.jsx(c.NiceIcon,{name:"search",size:32})}),e.jsx("p",{children:M})]}):M}):B?e.jsxs(e.Fragment,{children:[n.sort((le,Y)=>(le.order??999)-(Y.order??999)).map(le=>e.jsx(Us,{category:le,results:B.groups[le.id]||[],showFeedback:g,showRelated:u},le.id)),B.uncategorized.length>0&&e.jsx(Us,{category:{id:"other",name:"Other Questions"},results:B.uncategorized,showFeedback:g,showRelated:u})]}):ae.map(le=>e.jsx(hr,{result:le,showFeedback:g,showRelated:u,animateExpand:h},le.item.id))}),j&&e.jsx("div",{className:"nice-faq-footer",children:j})]})})},Hm=[];function hs(t,n){return n.split(".").reduce((i,a)=>{if(i&&typeof i=="object")return i[a]},t)}const Um=({status:t})=>{const{t:n}=c.useNiceTranslation(),a={connecting:{color:"var(--nice-color-warning, #f59e0b)",label:n("liveGrid.connecting","Connecting...")},connected:{color:"var(--nice-color-success, #22c55e)",label:n("liveGrid.live","Live")},disconnected:{color:"var(--nice-text-muted, #6b7280)",label:n("liveGrid.disconnected","Disconnected")},error:{color:"var(--nice-color-error, #ef4444)",label:n("error","Error")}}[t];return e.jsxs("div",{className:"nice-live-grid-status",children:[e.jsx("span",{className:"nice-live-grid-status-dot",style:{backgroundColor:a.color}}),e.jsx("span",{className:"nice-live-grid-status-label",children:a.label})]})};function Gm({columns:t=Hm,data:n=[],dataSource:i,rowKey:a="id",showConnectionStatus:r=!0,highlightDuration:o=2e3,updateAnimation:l="flash",maxRows:d,selectable:p=!1,selectedIds:m,onSelectionChange:g,onRowClick:u,onUpdate:x,onConnectionStatusChange:b,emptyContent:f,loadingContent:h,sortable:y=!1,sortField:v,sortDirection:S,onSortChange:j,virtualized:T=!1,rowHeight:C=40,height:N=400,className:_="",style:w,"data-testid":k},I){const{t:M}=c.useNiceTranslation(),[L,A]=s.useState(n),[D,E]=s.useState(!1),[R,O]=s.useState("disconnected"),[F,G]=s.useState(new Map),[ae,B]=s.useState(m||new Set),W=s.useRef(null),re=s.useRef(null),J=s.useRef(new Map),oe=m??ae,V=g??B,se=s.useCallback($=>$[a],[a]),ce=s.useCallback(($,ne,Se=[])=>{G(Q=>{const te=new Map(Q);return te.set($,{operation:ne,changedFields:new Set(Se),timestamp:Date.now()}),te});const Ce=J.current.get($);Ce&&clearTimeout(Ce);const K=setTimeout(()=>{G(Q=>{const te=new Map(Q);return te.delete($),te}),J.current.delete($)},o);J.current.set($,K)},[o]),le=s.useCallback($=>{const ne=se($.row);if(A(Se=>{switch($.operation){case"insert":{if(Se.some(Q=>se(Q)===ne))return Se;const K=[$.row,...Se];return d&&K.length>d?K.slice(0,d):K}case"update":return Se.map(Ce=>se(Ce)===ne?{...Ce,...$.row,...$.changes||{}}:Ce);case"upsert":{if(Se.some(Q=>se(Q)===ne))return Se.map(Q=>se(Q)===ne?{...Q,...$.row,...$.changes||{}}:Q);const K=[$.row,...Se];return d&&K.length>d?K.slice(0,d):K}case"delete":return Se.filter(Ce=>se(Ce)!==ne);default:return Se}}),l!=="none"){const Se=$.changes?Object.keys($.changes):[];ce(ne,$.operation,Se)}x?.($)},[se,d,l,ce,x]),Y=s.useCallback($=>{"updates"in $?$.fullRefresh?A($.updates.map(ne=>ne.row)):$.updates.forEach(le):le($)},[le]);s.useEffect(()=>{if(!i)return;i.fetchInitial&&(E(!0),i.fetchInitial().then(ne=>{A(ne),E(!1)})),re.current=i.subscribe(Y);let $;return i.onStatusChange?$=i.onStatusChange(ne=>{O(ne),b?.(ne)}):(O("connected"),b?.("connected")),()=>{re.current?.(),$?.()}},[i,Y,b]),s.useEffect(()=>{const $=J.current;return()=>{$.forEach(ne=>clearTimeout(ne))}},[]),s.useImperativeHandle(I,()=>({getData:()=>L,addRow:$=>le({operation:"insert",row:$}),updateRow:($,ne)=>{const Se=L.find(Ce=>se(Ce)===$);Se&&le({operation:"update",row:Se,changes:ne})},deleteRow:$=>{const ne=L.find(Se=>se(Se)===$);ne&&le({operation:"delete",row:ne})},refresh:()=>{i?.fetchInitial&&(E(!0),i.fetchInitial().then($=>{A($),E(!1)}))},getConnectionStatus:()=>R}));const pe=s.useMemo(()=>!v||!S?L:[...L].sort(($,ne)=>{const Se=hs($,v),Ce=hs(ne,v);if(Se===Ce)return 0;if(Se==null)return 1;if(Ce==null)return-1;const K=Se<Ce?-1:1;return S==="asc"?K:-K}),[L,v,S]),ke=s.useCallback(($,ne)=>{if(p){const Se=se($),Ce=new Set(oe);Ce.has(Se)?Ce.delete(Se):Ce.add(Se),V(Ce)}u?.($,ne)},[p,se,oe,V,u]),he=s.useCallback($=>{if(!y)return;let ne="asc";v===$&&(ne=S==="asc"?"desc":"asc"),j?.($,ne)},[y,v,S,j]),z=s.useCallback($=>{const ne=se($),Se=F.get(ne),Ce=oe.has(ne),K=["nice-live-grid-row"];return Ce&&K.push("nice-live-grid-row--selected"),Se&&(K.push(`nice-live-grid-row--${Se.operation}`),K.push(`nice-live-grid-row--${l}`)),K.join(" ")},[se,F,oe,l]),q=s.useCallback(($,ne)=>{const Se=se($);return F.get(Se)?.changedFields.has(ne)?"nice-live-grid-cell--changed":""},[se,F]);return D&&L.length===0?e.jsx("div",{className:`nice-live-grid nice-live-grid--loading ${_}`,style:w,"data-testid":k,children:h===void 0?M("loading","Loading…"):h}):e.jsxs("div",{ref:W,className:`nice-live-grid ${_}`,style:{...w,height:N},"data-testid":k,children:[r&&e.jsxs("div",{className:"nice-live-grid-header",children:[e.jsx(Um,{status:R}),e.jsx("span",{className:"nice-live-grid-count",children:M("liveGrid.rows","{count} rows").replace("{count}",String(L.length))})]}),e.jsx("div",{className:"nice-live-grid-table-wrapper",children:e.jsxs("table",{className:"nice-live-grid-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map($=>e.jsxs("th",{className:`nice-live-grid-th ${y&&$.sortable!==!1?"nice-live-grid-th--sortable":""}`,style:{width:$.width,minWidth:$.minWidth,maxWidth:$.maxWidth,textAlign:$.align||"left"},onClick:()=>$.sortable!==!1&&he(String($.field)),children:[$.headerRender?$.headerRender($):$.header,v===String($.field)&&e.jsx("span",{className:"nice-live-grid-sort-icon",children:e.jsx(c.NiceIcon,{name:S==="asc"?"sort-asc":"sort-desc",size:12})})]},String($.field)))})}),e.jsx("tbody",{children:pe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"nice-live-grid-empty",children:f===void 0?M("noData","No data"):f})}):pe.map($=>e.jsx("tr",{className:z($),onClick:ne=>ke($,ne),style:{height:C},children:t.map(ne=>{const Se=hs($,String(ne.field));return e.jsx("td",{className:`nice-live-grid-td ${q($,String(ne.field))}`,style:{textAlign:ne.align||"left"},children:ne.render?ne.render(Se,$,ne):String(Se??"")},String(ne.field))})},String(se($))))})]})})]})}const Wm=Object.assign(s.forwardRef(Gm),{displayName:"NiceLiveDataGrid"});function Di(t){return{key:t?.keyField??"id",children:t?.childrenField??"children"}}function Ti(t,n){return String(t[n])}function Ei(t,n){const i=t[n];return Array.isArray(i)?i:void 0}function _o(t,n,i){return{...t,[n]:i}}function sn(t,n,i){const a=Di(i),r=(o,l,d)=>{o.forEach((p,m)=>{const g={node:p,parent:l,parentId:l===null?null:Ti(l,a.key),index:m,siblings:o,ancestors:d,depth:d.length};if(n(p,g)===!1)return;const u=Ei(p,a.children);u?.length&&r(u,p,[...d,p])})};r(t,null,[])}function It(t,n,i){const a=Di(i),r=(o,l,d)=>{for(let p=0;p<o.length;p++){const m=o[p];if(Ti(m,a.key)===n)return{node:m,parent:l,parentId:l===null?null:Ti(l,a.key),index:p,siblings:o,ancestors:d,depth:d.length};const g=Ei(m,a.children);if(g?.length){const u=r(g,m,[...d,m]);if(u)return u}}};return r(t,null,[])}function Zn(t,n,i){return It(t,n,i)?.node}function gr(t,n,i,a){const r=Di(a);return!!It(t,n,a)?.ancestors.some(l=>Ti(l,r.key)===i)}function la(t,n){const i=Di(n),a=Ei(t,i.children);return a?.length?1+Math.max(...a.map(r=>la(r,n))):1}function br(t,n,i,a){const r=Di(a);if(n===null)return i(t);let o=!1;const l=d=>{let p=null;for(let m=0;m<d.length&&!o;m++){const g=d[m];let u=null;if(Ti(g,r.key)===n)u=_o(g,r.children,i(Ei(g,r.children)??[])),o=!0;else{const x=Ei(g,r.children),b=x?.length?l(x):null;b&&(u=_o(g,r.children,b))}u&&(p=p??[...d],p[m]=u)}return p};return l(t)??[...t]}function Ln(t,n,i,a){return i.parentId!==null&&!Zn(t,i.parentId,a)?t:br(t,i.parentId,r=>{const o=[...r];return o.splice(Math.max(0,Math.min(i.index,o.length)),0,n),o},a)}function ii(t,n,i){const a=It(t,n,i);return a?br(t,a.parentId,r=>r.filter((o,l)=>l!==a.index),i):t}function ua(t,n,i,a){const r=It(t,n,a);if(!r)return t;const o=typeof i=="function"?i(r.node):{...r.node,...i};return br(t,r.parentId,l=>l.map((d,p)=>p===r.index?o:d),a)}function Ai(t,n,i,a){const r=It(t,n,a);if(!r||i.parentId!==null&&(i.parentId===n||gr(t,i.parentId,n,a)||!Zn(t,i.parentId,a)))return t;let o=i.index;if(r.parentId===i.parentId&&(o>r.index&&(o-=1),o=Math.max(0,Math.min(o,r.siblings.length-1)),o===r.index))return t;const l=ii(t,n,a);return Ln(l,r.node,{parentId:i.parentId,index:o},a)}function Wa(t,n,i,a){const r=It(t,n,a);if(!r)return t;const o=Math.max(0,Math.min(r.index+i,r.siblings.length-1));return o===r.index?t:Ai(t,n,{parentId:r.parentId,index:o>r.index?o+1:o},a)}function fr(t,n,i){const a=Di(i),r=It(t,n,i);if(!r||r.index===0)return t;const o=r.siblings[r.index-1];return Ai(t,n,{parentId:Ti(o,a.key),index:Ei(o,a.children)?.length??0},i)}function vr(t,n,i){const a=It(t,n,i);if(!a||a.parentId===null)return t;const r=It(t,a.parentId,i);return r?Ai(t,n,{parentId:r.parentId,index:r.index+1},i):t}const Km=[],Ym=["moveUp","moveDown","indent","outdent","rename","remove"],Jm=5,jo=28,Qm=600,Xm=16,Zm=10;function eh(t){const{value:n,defaultValue:i,onChange:a,keyField:r="id",childrenField:o="children",labelField:l="label",getLabel:d,renderLabel:p,getIcon:m,renderRowEnd:g,selectedId:u,defaultSelectedId:x,onSelect:b,collapsedIds:f,defaultCollapsedIds:h,onCollapsedChange:y,canHaveChildren:v,canDrag:S,canDrop:j,maxDepth:T,editable:C=!1,removable:N=!1,actions:_=!0,contextMenuItems:w,onExternalDrop:k,emptyText:I,"aria-label":M,height:L,size:A="md",readOnly:D=!1,disabled:E=!1,className:R,style:O,id:F,title:G,accessMode:ae,"data-testid":B}=t,{t:W}=c.useNiceTranslation(),re=c.useNiceAccessMode(ae,F),J=E||re==="disabled",oe=D||re==="readOnly"||J,V=s.useMemo(()=>({keyField:r,childrenField:o}),[r,o]),[se,ce]=c.useControllableState({value:n,defaultValue:i,fallbackValue:[],componentName:"NiceSortableTree"}),[le,Y]=c.useControllableState({value:u,defaultValue:x,fallbackValue:null,componentName:"NiceSortableTree"}),[pe,ke]=c.useControllableState({value:f,defaultValue:h,fallbackValue:Km,componentName:"NiceSortableTree"}),he=s.useCallback(de=>String(de[r]),[r]),z=s.useCallback(de=>{const Pe=de[o];return Array.isArray(Pe)?Pe:[]},[o]),q=s.useCallback(de=>{if(d)return d(de);const Pe=de[l];return Pe==null?he(de):String(Pe)},[d,l,he]),$=(de,Pe)=>!oe&&(typeof de=="function"?de(Pe):de),ne=s.useCallback(de=>v?v(de):!0,[v]),Se=s.useMemo(()=>new Set(pe),[pe]),Ce=s.useMemo(()=>{const de=[];return sn(se,(Pe,qe)=>{const Ye=he(Pe),st=z(Pe).length>0,ft=st&&!Se.has(Ye);return de.push({node:Pe,id:Ye,depth:qe.depth,parentId:qe.parentId,index:qe.index,setSize:qe.siblings.length,hasChildren:st,expanded:ft}),ft?void 0:!1},V),de},[se,Se,he,z,V]),K=s.useMemo(()=>new Map(Ce.map(de=>[de.id,de])),[Ce]),Q=s.useRef(null),te=s.useRef(null),[ee,Te]=s.useState(""),Z=s.useRef(null),we=s.useCallback(de=>{ke(de),y?.(de)},[ke,y]),ie=s.useCallback((de,Pe)=>{const qe=pe.includes(de);Pe&&qe?we(pe.filter(Ye=>Ye!==de)):!Pe&&!qe&&we([...pe,de])},[pe,we]),xe=s.useCallback(de=>{Y(de),b?.(de,de===null?null:Zn(se,de,V)??null)},[Y,b,se,V]);c.useTreeFocus(te,{onToggle:(de,Pe)=>{const qe=de.dataset.nodeId;qe!==void 0&&ie(qe,Pe)}});const H=de=>{const Pe=It(se,de,V);return Pe?{parentId:Pe.parentId,index:Pe.index}:null},ve=(de,Pe)=>{const qe=It(de,Pe,V);if(!qe)return;const Ye=qe.parent?q(qe.parent):W("sortableTree.root","top level");Te(W("sortableTree.announceMoved","{label} moved to {parent}, position {position} of {count}").replace("{label}",q(qe.node)).replace("{parent}",Ye).replace("{position}",String(qe.index+1)).replace("{count}",String(qe.siblings.length)))},be=(de,Pe)=>de===se?!1:(ce(de),a?.(de,Pe),!0),Ee=(de,Pe,qe,Ye)=>{let st=0;if(Pe.parentId!==null){if(de!==null&&(Pe.parentId===de||gr(se,Pe.parentId,de,V)))return!1;const ft=It(se,Pe.parentId,V);if(!ft||!ne(ft.node))return!1;st=ft.depth+1}return T!==void 0&&st+qe>T?!1:j?j(de,Pe,Ye):!0},P=(de,Pe,qe,Ye)=>{const st=H(de);if(!st)return;const ft=Zn(se,de,V);if(!ft||!Ee(de,Pe,la(ft,V)))return;const at=It(Ye,de,V),_t=at?{parentId:at.parentId,index:at.index}:Pe;be(Ye,{type:qe,id:de,from:st,to:_t})&&(Z.current=de,_t.parentId!==null&&ie(_t.parentId,!0),ve(Ye,de))},U=(de,Pe)=>{const qe=Wa(se,de,Pe,V),Ye=It(qe,de,V);Ye&&P(de,{parentId:Ye.parentId,index:Ye.index},"move",qe)},X=de=>{const Pe=fr(se,de,V),qe=It(Pe,de,V);qe&&Pe!==se&&P(de,{parentId:qe.parentId,index:qe.index},"indent",Pe)},ge=de=>{const Pe=vr(se,de,V),qe=It(Pe,de,V);qe&&Pe!==se&&P(de,{parentId:qe.parentId,index:qe.index},"outdent",Pe)},_e=de=>{const Pe=H(de);if(!Pe)return;const qe=Ce.findIndex(vt=>vt.id===de),Ye=new Set,st=Zn(se,de,V);st&&sn([st],vt=>{Ye.add(he(vt))},V);const ft=Ce.slice(qe+1).find(vt=>!Ye.has(vt.id)),at=Ce.slice(0,Math.max(0,qe)).reverse().find(vt=>!Ye.has(vt.id)),_t=ft?.id??at?.id??null;be(ii(se,de,V),{type:"remove",id:de,from:Pe})&&(le!==null&&Ye.has(le)&&xe(_t),Z.current=_t,Te(W("sortableTree.announceRemoved","{label} removed").replace("{label}",st?q(st):de)))},[ye,me]=s.useState(null),ze=s.useRef(null);s.useEffect(()=>{ye!==null&&(ze.current?.focus(),ze.current?.select())},[ye]);const Be=(de,Pe)=>{me(null),Z.current=de;const qe=Zn(se,de,V),Ye=Pe?.trim();!qe||!Ye||Ye===q(qe)||be(ua(se,de,{[l]:Ye},V),{type:"rename",id:de,label:Ye})};s.useLayoutEffect(()=>{const de=Z.current;if(de===null||ye!==null)return;Z.current=null;const Pe=[...te.current?.querySelectorAll("[data-node-id]")??[]].find(qe=>qe.dataset.nodeId===de);Pe&&(Pe.focus(),Pe.scrollIntoView?.({block:"nearest"}))});const He=(de,Pe)=>{const qe=te.current;if(!qe)return null;const Ye=[...qe.querySelectorAll("[data-node-id]")];if(Ye.length===0)return{target:{parentId:null,index:0},line:null,insideId:null,invalid:!1};const st=Ye[0],ft=Ye[Ye.length-1],at=(_t,vt,yt)=>({top:vt==="top"?_t.offsetTop:_t.offsetTop+_t.offsetHeight,depth:yt});if(de<st.getBoundingClientRect().top){const _t=K.get(st.dataset.nodeId??"");return _t&&!Pe.has(_t.id)?{target:{parentId:null,index:0},line:at(st,"top",0),insideId:null,invalid:!1}:null}for(const _t of Ye){const vt=_t.getBoundingClientRect();if(de<vt.top||de>=vt.bottom)continue;const yt=K.get(_t.dataset.nodeId??"");if(!yt||Pe.has(yt.id))return null;const Gt=(de-vt.top)/Math.max(1,vt.height),hn=ne(yt.node)?Gt<.25?"before":Gt>.75?"after":"inside":Gt<.5?"before":"after";return hn==="before"?{target:{parentId:yt.parentId,index:yt.index},line:at(_t,"top",yt.depth),insideId:null,invalid:!1}:hn==="inside"?{target:{parentId:yt.id,index:z(yt.node).length},line:null,insideId:yt.id,invalid:!1}:yt.expanded?{target:{parentId:yt.id,index:0},line:at(_t,"bottom",yt.depth+1),insideId:null,invalid:!1}:{target:{parentId:yt.parentId,index:yt.index+1},line:at(_t,"bottom",yt.depth),insideId:null,invalid:!1}}return{target:{parentId:null,index:se.length},line:at(ft,"bottom",0),insideId:null,invalid:!1}},Xe=s.useRef(null),[it,mt]=s.useState(null),[bt,ot]=s.useState(null),wt=s.useRef(!1),Pt=de=>{clearTimeout(de.hoverTimer),de.hoverTimer=void 0,de.hoverId=null},je=(de,Pe)=>{const qe=Pe?.insideId??null;if(qe===de.hoverId)return;Pt(de);const Ye=qe?K.get(qe):void 0;Ye&&Ye.hasChildren&&!Ye.expanded&&(de.hoverId=qe,de.hoverTimer=setTimeout(()=>ie(Ye.id,!0),Qm))},Re=de=>{const Pe=Q.current;if(!Pe||Pe.scrollHeight<=Pe.clientHeight)return;const qe=Pe.getBoundingClientRect();de<qe.top+jo?Pe.scrollTop-=10:de>qe.bottom-jo&&(Pe.scrollTop+=10)},Ue=(de,Pe)=>{const qe=!!de.target.closest(".nice-sortable-tree__grip");if(oe||de.button!==0||ye!==null||de.pointerType==="touch"&&!qe||de.target.closest(".nice-sortable-tree__toggle, input, button")||S&&!S(Pe.node))return;const Ye=new Set;sn([Pe.node],st=>{Ye.add(he(st))},V),Xe.current={id:Pe.id,pointerId:de.pointerId,startY:de.clientY,startX:de.clientX,startScroll:Q.current?.scrollTop??0,rowTop:de.currentTarget.getBoundingClientRect().top,started:!1,height:la(Pe.node,V),block:Ye,view:null,hoverId:null,hoverTimer:void 0}},pt=de=>{const Pe=Xe.current;if(!Pe||de.pointerId!==Pe.pointerId)return;const qe=(Q.current?.scrollTop??0)-Pe.startScroll,Ye=de.clientY+Zm-Pe.rowTop+qe;if(!Pe.started){if(Math.hypot(de.clientX-Pe.startX,de.clientY-Pe.startY)<Jm)return;Pe.started=!0,de.currentTarget.setPointerCapture?.(de.pointerId),de.currentTarget.focus()}Re(de.clientY);const st=He(de.clientY,Pe.block),ft=st?{...st,invalid:!Ee(Pe.id,st.target,Pe.height)}:null;Pe.view=ft,je(Pe,ft),mt({ids:Pe.block,dy:Ye}),ot(ft)},Ke=de=>{const Pe=Xe.current;if(Xe.current=null,!!Pe){if(Pt(Pe),Pe.started){if(de&&Pe.view&&!Pe.view.invalid){const qe=Ai(se,Pe.id,Pe.view.target,V),Ye=It(qe,Pe.id,V);Ye&&qe!==se&&P(Pe.id,{parentId:Ye.parentId,index:Ye.index},"move",qe)}wt.current=!0,window.setTimeout(()=>{wt.current=!1},0)}mt(null),ot(null)}},ct=Oe.useTreeDragSession(),fe=s.useRef({view:null,hoverId:null,hoverTimer:void 0}),$e=s.useRef(()=>{});$e.current=de=>{const Pe=fe.current,qe=Q.current?.getBoundingClientRect(),Ye=!!qe&&de.x>=qe.left&&de.x<=qe.right&&de.y>=qe.top&&de.y<=qe.bottom;if(de.type==="move"){if(!Ye||oe||!k){Pe.view&&(Pe.view=null,Pt(Pe),ot(null));return}Re(de.y);const ft=He(de.y,new Set),at=ft?{...ft,invalid:!Ee(null,ft.target,1,de.payload)}:null;Pe.view=at,je(Pe,at),ot(at);return}const st=Pe.view;Pe.view=null,Pt(Pe),ot(null),de.commit&&Ye&&st&&!st.invalid&&k?.(de.payload,st.target)},s.useEffect(()=>ct?.subscribe(de=>$e.current(de)),[ct]);const[Je,ue]=s.useState(null),Ie=s.useRef(null);c.useOverlayFocus(Ie,{open:Je!==null,modal:!1,onClose:()=>ue(null)}),c.useRovingFocus(Ie,{orientation:"vertical",wrap:!0,enabled:Je!==null}),s.useLayoutEffect(()=>{const de=Ie.current;if(!Je||!de||typeof window>"u")return;const Pe=de.getBoundingClientRect(),qe=Math.max(8,Math.min(Je.x,window.innerWidth-Pe.width-8)),Ye=Math.max(8,Math.min(Je.y,window.innerHeight-Pe.height-8));(qe!==Je.x||Ye!==Je.y)&&ue({...Je,x:qe,y:Ye})},[Je]),s.useEffect(()=>{if(!Je)return;const de=Pe=>{Ie.current?.contains(Pe.target)||ue(null)};return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[Je]);const Me=_===!0?Ym:_===!1?[]:_,We=Je?K.get(Je.id):void 0,lt=[];if(We){const de=We.node,Pe=!oe&&(!S||S(de)),qe=We.index>0,Ye=(st,ft,at,_t,vt)=>{Me.includes(st)&<.push({id:st,label:ft,icon:e.jsx(c.NiceIcon,{name:at,size:14}),disabled:!_t,onClick:vt})};Ye("moveUp",W("sortableTree.moveUp","Move up"),"chevron-up",Pe&&qe,()=>U(We.id,-1)),Ye("moveDown",W("sortableTree.moveDown","Move down"),"chevron-down",Pe&&We.index<We.setSize-1,()=>U(We.id,1)),Ye("indent",W("sortableTree.indent","Indent"),"indent",Pe&&qe,()=>X(We.id)),Ye("outdent",W("sortableTree.outdent","Outdent"),"outdent",Pe&&We.parentId!==null,()=>ge(We.id)),Ye("rename",W("sortableTree.rename","Rename"),"edit",$(C,de),()=>me(We.id)),Ye("remove",W("sortableTree.remove","Remove"),"trash",$(N,de),()=>_e(We.id)),lt.push(...w?.(de)??[])}const Bt=(de,Pe)=>{if(de.target!==de.currentTarget)return;if(de.key==="Escape"&&Xe.current?.started){de.preventDefault(),Ke(!1);return}if(!oe&&(!S||S(Pe.node))&&de.ctrlKey&&de.shiftKey&&!de.altKey){const Ye=typeof window<"u"&&Q.current!==null&&window.getComputedStyle(Q.current).direction==="rtl",st=Ye&&de.key==="ArrowLeft"?"ArrowRight":Ye&&de.key==="ArrowRight"?"ArrowLeft":de.key,ft={ArrowUp:()=>U(Pe.id,-1),ArrowDown:()=>U(Pe.id,1),ArrowRight:()=>X(Pe.id),ArrowLeft:()=>ge(Pe.id)};if(ft[st]){de.preventDefault(),ft[st]();return}}de.key==="F2"&&$(C,Pe.node)?(de.preventDefault(),me(Pe.id)):de.key==="Delete"&&$(N,Pe.node)&&(de.preventDefault(),_e(Pe.id))};if(re==="hidden")return null;const Dt=it?.ids;return e.jsxs("div",{ref:Q,id:F,title:G,"data-testid":B,className:["nice-sortable-tree",`nice-sortable-tree--${A}`,it?"nice-sortable-tree--dragging":"",bt&&Ce.length===0&&!bt.invalid?"nice-sortable-tree--drop-empty":"",J?"nice-sortable-tree--disabled":"",R??""].filter(Boolean).join(" "),style:{...L!==void 0?{height:L,overflow:"auto"}:{},...O},"aria-disabled":J||void 0,children:[Ce.length===0&&e.jsx("div",{className:"nice-sortable-tree__empty",children:I??W("sortableTree.empty","Nothing here yet")}),e.jsxs("ul",{ref:te,role:"tree","aria-label":M,"aria-disabled":J||void 0,className:"nice-sortable-tree__list",children:[Ce.map(de=>{const Pe=de.id===le,qe=!!Dt?.has(de.id),Ye={depth:de.depth,hasChildren:de.hasChildren,expanded:de.expanded,selected:Pe,dragging:qe},st=ye===de.id,ft={"--nice-sortable-tree-depth":de.depth,...qe&&it?{transform:`translate(${Xm}px, ${it.dy}px)`}:{}};return e.jsxs("li",{role:"treeitem","data-node-id":de.id,"aria-level":de.depth+1,"aria-setsize":de.setSize,"aria-posinset":de.index+1,"aria-expanded":de.hasChildren?de.expanded:void 0,"aria-selected":Pe,"aria-label":q(de.node),tabIndex:-1,className:["nice-sortable-tree__row",Pe?"nice-sortable-tree__row--selected":"",qe?"nice-sortable-tree__row--dragging":"",bt?.insideId===de.id?bt.invalid?"nice-sortable-tree__row--drop-invalid":"nice-sortable-tree__row--drop-inside":""].filter(Boolean).join(" "),style:ft,onClick:at=>{if(wt.current){wt.current=!1;return}if(!J){if(de.hasChildren&&at.target.closest(".nice-sortable-tree__toggle")){ie(de.id,!de.expanded);return}xe(de.id)}},onDoubleClick:()=>{$(C,de.node)&&me(de.id)},onKeyDown:at=>Bt(at,de),onPointerDown:at=>Ue(at,de),onPointerMove:pt,onPointerUp:()=>Ke(!0),onPointerCancel:()=>Ke(!1),onContextMenu:at=>{if(J||Me.length===0&&!w)return;at.preventDefault(),at.stopPropagation();const _t=at.currentTarget.getBoundingClientRect(),vt=at.clientX===0&&at.clientY===0;ue({id:de.id,x:vt?_t.left+24:at.clientX,y:vt?_t.bottom:at.clientY})},children:[!oe&&(!S||S(de.node))&&e.jsx("span",{className:"nice-sortable-tree__grip","aria-hidden":"true",children:e.jsx(c.NiceIcon,{name:"grip",size:14})}),de.hasChildren?e.jsx("span",{className:"nice-sortable-tree__toggle","aria-hidden":"true",children:e.jsx(c.NiceIcon,{name:de.expanded?"chevron-down":"chevron-right",size:14})}):e.jsx("span",{className:"nice-sortable-tree__toggle nice-sortable-tree__toggle--leaf","aria-hidden":"true"}),m&&e.jsx("span",{className:"nice-sortable-tree__icon","aria-hidden":"true",children:m(de.node,Ye)}),st?e.jsx("input",{ref:ze,className:"nice-sortable-tree__input","aria-label":W("sortableTree.renameField","New name"),defaultValue:q(de.node),onClick:at=>at.stopPropagation(),onPointerDown:at=>at.stopPropagation(),onKeyDown:at=>{at.stopPropagation(),at.key==="Enter"?(at.preventDefault(),Be(de.id,at.currentTarget.value)):at.key==="Escape"&&(at.preventDefault(),Be(de.id,null))},onBlur:at=>{ye===de.id&&Be(de.id,at.currentTarget.value)}}):e.jsx("span",{className:"nice-sortable-tree__label",children:p?p(de.node,Ye):q(de.node)}),g&&e.jsx("span",{className:"nice-sortable-tree__end",children:g(de.node,Ye)})]},de.id)}),bt?.line&&e.jsx("li",{role:"none",className:`nice-sortable-tree__drop-line${bt.invalid?" nice-sortable-tree__drop-line--invalid":""}`,style:{top:bt.line.top,"--nice-sortable-tree-depth":bt.line.depth}})]}),e.jsx("div",{className:"nice-sr-only","aria-live":"polite",role:"status",children:ee}),Je&<.length>0&&e.jsx("ul",{ref:Ie,role:"menu","aria-label":W("sortableTree.menu","Node actions"),className:"nice-contextmenu nice-contextmenu__list nice-sortable-tree__menu",style:{position:"fixed",left:Je.x,top:Je.y},children:lt.map((de,Pe)=>e.jsx("li",{role:"none",className:"nice-contextmenu__item",children:e.jsxs("button",{type:"button",role:"menuitem",className:`nice-contextmenu__btn${de.danger?" nice-contextmenu__btn--danger":""}`,disabled:de.disabled,onClick:qe=>{ue(null),de.onClick?.(qe)},children:[de.icon&&e.jsx("span",{className:"nice-contextmenu__icon","aria-hidden":"true",children:de.icon}),e.jsx("span",{children:de.label??de.text})]})},de.id??de.key??Pe))})]})}const fl=Object.assign(eh,{displayName:"NiceSortableTree"}),wo=new WeakMap;function Cn(t){const n=wo.get(t);if(n)return n;const i=new Map;return sn(t,(a,r)=>{i.set(a.id,{node:a,ancestors:[...r.ancestors],order:i.size})}),wo.set(t,i),i}function vl(t,n){return Cn(t).get(n)?.node}function th(t,n){const i=Cn(t),a=new Set;for(const r of n){const o=i.get(r);o&&sn([o.node],l=>{l.route&&!l.disabled&&a.add(l.id)})}return[...a].sort((r,o)=>(i.get(r)?.order??0)-(i.get(o)?.order??0))}function wi(t,n){let i;return sn(t,a=>{if(i)return!1;n(a)&&(i=a)}),i}function xr(t){const n=new Set;return sn(t,i=>{n.add(i.id)}),n}function ki(t,n){let i=n;for(let a=2;t.has(i);a++)i=`${n}-${a}`;return t.add(i),i}function yr(t){const n=[];return sn(t,i=>{i.ref&&n.push(i.ref)}),n}function xl(t,n){const i=Cn(n),a=[];return sn(t,r=>{r.ref&&!i.get(r.ref)?.node.route&&a.push(r.id)}),a}function Nr(t,n){if(t.label)return t.label;const i=Cn(n);return(t.ref?i.get(t.ref)?.node.label:void 0)??(t.from?i.get(t.from)?.node.label:void 0)??t.ref??t.from??t.id}function Ka(t,n){const i=Cn(n);return(t.ref?i.get(t.ref):void 0)?.node??(t.from?i.get(t.from):void 0)?.node}function yl(t,n){return Cn(t).get(n)?.ancestors.map(i=>i.label)??[]}function ko(t,n,i){let a=null,r=t;for(const o of n){const l=wi(r,m=>m.from===o.id);if(l){a=l.id;continue}const d={id:ki(i,`g:${o.id}`),from:o.id,children:[]},p=a===null?r:It(r,a)?.node.children??[];r=Ln(r,d,{parentId:a,index:p.length}),a=d.id}return{menu:r,parentId:a}}function Nl(t,n,i,a={}){const r=Cn(n),o=Math.max(0,a.skipLevels??0),l=new Set(yr(t)),d=xr(t);let p=t;const m=[...new Set(i)].filter(g=>r.get(g)?.node.route&&!r.get(g)?.node.disabled).sort((g,u)=>(r.get(g)?.order??0)-(r.get(u)?.order??0));for(const g of m){const u=r.get(g);if(!u||l.has(g))continue;l.add(g);const x=u.ancestors.slice(o);if(u.node.children?.length){const h=ko(p,[...x,u.node],d);p=h.menu,h.parentId!==null&&(p=ua(p,h.parentId,{ref:g}));continue}const b=ko(p,x,d);p=b.menu;const f=b.parentId===null?p:It(p,b.parentId)?.node.children??[];p=Ln(p,{id:ki(d,`p:${g}`),ref:g},{parentId:b.parentId,index:f.length})}return p}function _l(t){let n=t;for(;;){const i=wi(n,a=>!!a.from&&!a.ref&&!a.children?.length);if(!i)return n;n=ii(n,i.id)}}function jl(t,n){const i=new Set(n);let a=t;for(const r of i){const o=wi(a,l=>l.ref===r);o&&(o.children?.length?a=ua(a,o.id,l=>{const{ref:d,...p}=l;return{...p,from:p.from??r}}):a=ii(a,o.id))}return a===t?a:_l(a)}function wl(t,n,i,a,r={}){const o=Cn(n),l=xr(t);let d=t,p=a.index;const m=g=>{const u=(g.children??[]).map(m).filter(f=>f!==null),x=!!g.route&&!g.disabled,b=x?wi(d,f=>f.ref===g.id):void 0;return b&&(d=ii(d,b.id),l.delete(b.id)),g.children?.length?!u.length&&!x?null:{id:ki(l,`g:${g.id}`),from:g.id,...x?{ref:g.id}:{},children:u}:x?{id:ki(l,`p:${g.id}`),ref:g.id}:null};for(const g of i){const u=o.get(g);if(!u)continue;const x=!!u.node.route&&!u.node.disabled,b=!u.node.children?.length||r.asPage,f=x?wi(d,y=>y.ref===g):void 0;if(b){if(f)d=Ai(d,f.id,{parentId:a.parentId,index:p});else if(x)d=Ln(d,{id:ki(l,`p:${g}`),ref:g},{parentId:a.parentId,index:p});else continue;const y=wi(d,v=>v.ref===g);p=(y?It(d,y.id)?.index??p:p)+1;continue}const h=m(u.node);h&&(a.parentId!==null&&!It(d,a.parentId)?d=Ln(d,h,{parentId:null,index:d.length}):(d=Ln(d,h,{parentId:a.parentId,index:p}),p+=1))}return _l(d)}function kl(t,n,i){const a=xr(t),r=ki(a,"group");return{menu:Ln(t,{id:r,label:n,children:[]},i??{parentId:null,index:t.length}),id:r}}function nh(t,n,i){if(t.icon)return i?i(t.icon):void 0;const a=n?.icon;return typeof a=="string"?i?i(a):void 0:a}function Cl(t,n,i={}){const a=Cn(n),r=o=>o.flatMap(l=>{const p=(l.ref?a.get(l.ref)?.node:void 0)?.route,m=r(l.children??[]);return!p&&m.length===0?[]:[{id:l.id,label:Nr(l,n),icon:nh(l,Ka(l,n),i.renderIcon),...p?{route:p}:{},...m.length?{children:m}:{}}]});return r(t)}function Sl(t,n,i={}){const a=Cl(t,n,i),r=[];let o=[];const l=()=>{o.length&&(r.push({id:`${o[0].id}:other`,label:i.otherLabel??"Other",views:o}),o=[])};for(const d of a){if(!d.children?.length){o.push(d);continue}l();const p=d.route?[{id:`${d.id}:page`,label:d.label,icon:d.icon,route:d.route}]:[];r.push({id:d.id,label:d.label,icon:d.icon,views:[...p,...d.children]})}return l(),[{source:i.source??{id:"menu",label:i.otherLabel??"Menu"},modules:r,roles:[],units:[]}]}function ih(t,n={}){const i=n.key??"id",a=(d,p)=>typeof i=="function"?i(d,p):i==="route"?d.route??d.id:d.id,r=(d,p)=>d.map(m=>({id:a(m,p),label:m.label,icon:m.icon,...m.route?{route:m.route}:{},...m.children?.length?{children:r(m.children,p)}:{}})),o=d=>d.modules.map(p=>({id:p.id,label:p.label,icon:p.icon,children:r(p.views,p)}));return n.includeSources??t.length>1?t.map(d=>({id:d.source.id,label:d.source.label,icon:d.source.icon,children:o(d)})):t.flatMap(o)}const ah=[],sh=[],rh={},oh=60,ch=t=>e.jsx(c.NiceIcon,{name:t,size:16});function Tl(t){return t.map(n=>{const i=n.children?.length?Tl(n.children):void 0,a=!!i?.some(r=>r.placeable);return n.route&&i?{key:`${n.id}::branch`,nodeId:n.id,label:n.label,icon:n.icon,placeable:!0,disabled:n.disabled,children:[{key:n.id,nodeId:n.id,label:n.label,icon:n.icon,route:n.route,own:!0,placeable:!0,disabled:n.disabled},...i]}:{key:n.id,nodeId:n.id,label:n.label,icon:n.icon,route:n.route,placeable:!!n.route||a,disabled:n.disabled,children:i}})}function El(t,n){return n<=0?[]:t.flatMap(i=>i.children?.length?[i.key,...El(i.children,n-1)]:[])}const lh=({drag:t,label:n,title:i})=>{const a=Oe.useTreeDragSession();return e.jsx("span",{className:"nice-menu-builder__grip",title:i,"aria-hidden":"true",onPointerDown:r=>{a&&(r.stopPropagation(),Oe.startTreeDrag(a,r,t,n))},children:e.jsx(c.NiceIcon,{name:"grip",size:14})})},dh=({value:t,onChange:n,renderIcon:i})=>{const{t:a}=c.useNiceTranslation(),[r,o]=s.useState(""),l=s.useRef(null);c.useRovingFocus(l,{orientation:"grid",itemSelector:"button"});const d=s.useMemo(()=>{const p=r.trim().toLowerCase(),m=p?c.NICE_BUILTIN_ICONS.filter(u=>u.includes(p)):c.NICE_BUILTIN_ICONS,g=m.slice(0,oh);return t&&m.includes(t)&&!g.includes(t)?[t,...g]:g},[r,t]);return e.jsxs("div",{className:"nice-menu-builder__icon-picker",children:[e.jsx(Ge.NiceTextInput,{type:"search",size:"sm",label:a("menuBuilder.iconSearch","Search icons"),value:r,onChange:o}),e.jsxs("div",{ref:l,role:"group","aria-label":a("menuBuilder.icons","Icons"),className:"nice-menu-builder__icon-grid",children:[d.map(p=>e.jsx("button",{type:"button",title:p,"aria-label":p,"aria-pressed":p===t,className:`nice-menu-builder__icon-option${p===t?" nice-menu-builder__icon-option--on":""}`,onClick:()=>n(p),children:i(p)},p)),d.length===0&&e.jsx("span",{className:"nice-menu-builder__hint",children:a("menuBuilder.noIcons","No icons found")})]})]})},uh=({catalog:t=ah,value:n,defaultValue:i,onChange:a,skipLevels:r=0,maxDepth:o,renderIcon:l=ch,renderIconPicker:d,showPreview:p=!0,previewProps:m,toolbar:g,height:u,size:x="md",readOnly:b=!1,disabled:f=!1,className:h,style:y,id:v,title:S,accessMode:j,"data-testid":T})=>{const{t:C}=c.useNiceTranslation(),N=c.useNiceAccessMode(j,v),_=f||N==="disabled",w=b||N==="readOnly"||_,[k,I]=c.useControllableState({value:n,defaultValue:i,fallbackValue:sh,componentName:"NiceMenuBuilder"}),M=te=>{te===k||w||(I(te),a?.(te))},[L,A]=s.useState(null),D=s.useRef(null),[E,R]=s.useState(0);s.useEffect(()=>{E>0&&D.current?.querySelector("input")?.focus()},[E]);const O=s.useMemo(()=>Tl(t),[t]),F=s.useMemo(()=>yr(k),[k]),G=s.useMemo(()=>new Set(xl(k,t)),[k,t]),ae=s.useMemo(()=>El(O,2),[O]),B=te=>{const ee=new Set(te),Te=new Set(F),Z=te.filter(xe=>!Te.has(xe)),we=F.filter(xe=>!ee.has(xe));let ie=k;Z.length&&(ie=Nl(ie,t,Z,{skipLevels:r})),we.length&&(ie=jl(ie,we)),M(ie)},W=s.useMemo(()=>[{field:"label",header:C("menuBuilder.catalogColumn","View"),render:(te,ee)=>e.jsxs("span",{className:"nice-menu-builder__catalog-cell",children:[!w&&!ee.disabled&&e.jsx(lh,{drag:{ids:[ee.nodeId],asPage:!!ee.own},label:ee.label,title:C("menuBuilder.dragHint","Drag into the menu")}),ee.icon!==void 0&&e.jsx("span",{className:"nice-menu-builder__icon","aria-hidden":"true",children:typeof ee.icon=="string"?l(ee.icon):ee.icon}),e.jsx("span",{className:"nice-menu-builder__label",children:ee.label}),ee.own&&e.jsx("span",{className:"nice-menu-builder__hint",children:C("menuBuilder.ownPage","(page)")})]})}],[C,w,l]),re=L?It(k,L)?.node:void 0,J=te=>!te.ref||te.children!==void 0,oe=te=>It(k,te)?.depth??0,V=(te,ee)=>{const Te=te;!Te||!Array.isArray(Te.ids)||M(wl(k,t,Te.ids,ee,{asPage:Te.asPage}))},se=()=>{let te;if(re){const Te=It(k,re.id);J(re)&&(o===void 0||(Te?.depth??0)+2<=o)?te={parentId:re.id,index:re.children?.length??0}:Te&&(te={parentId:Te.parentId,index:Te.index+1})}const ee=kl(k,C("menuBuilder.newGroup","New group"),te);M(ee.menu),A(ee.id),R(Te=>Te+1)},ce=te=>{const ee=It(k,te.id);if(!ee||ee.index===0)return!1;const Te=ee.siblings[ee.index-1];return J(Te)&&(o===void 0||ee.depth+1+la(te)<=o)},le=re?It(k,re.id):void 0,Y=te=>{re&&M(te(k,re.id))},pe=()=>{if(!re||!le)return;const te=le.siblings[le.index+1]??le.siblings[le.index-1];M(ii(k,re.id)),A(te?.id??le.parentId)},ke=te=>{if(te.icon)return l(te.icon);const ee=Ka(te,t);return typeof ee?.icon=="string"?l(ee.icon):ee?.icon!==void 0?ee.icon:e.jsx(c.NiceIcon,{name:te.ref?"file":"folder",size:16})},he=te=>{re&&M(ua(k,re.id,ee=>{const Te={...ee,...te};return Object.keys(te).forEach(Z=>{te[Z]===void 0&&delete Te[Z]}),Te}))},z=re?Ka(re,t):void 0,q=re?.ref?vl(t,re.ref):void 0,$=z?.label,ne=z?[...yl(t,z.id),z.label].join(" / "):"",Se=re?(d??(te=>e.jsx(dh,{...te,renderIcon:l})))({value:re.icon,onChange:te=>he({icon:te})}):null,Ce=s.useMemo(()=>p?Sl(k,t,{renderIcon:l,otherLabel:C("menuBuilder.other","Other"),source:{id:"menu-preview",label:C("menuBuilder.preview","Preview")}}):[],[p,k,t,l,C]);if(N==="hidden")return null;const K=(te,ee,Te,Z,we)=>e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",ariaLabel:ee,title:ee,disabled:!Z,onClick:we,children:e.jsx(c.NiceIcon,{name:Te,size:16})},te),Q=!w;return e.jsx(Oe.TreeDragSessionProvider,{children:e.jsx("div",{id:v,title:S,"data-testid":T,className:["nice-menu-builder",_?"nice-menu-builder--disabled":"",h??""].filter(Boolean).join(" "),style:{...u!==void 0?{height:u}:{},...y},"aria-disabled":_||void 0,children:e.jsxs("div",{className:"nice-menu-builder__grid",children:[e.jsxs("section",{className:"nice-menu-builder__column nice-menu-builder__column--catalog","aria-label":C("menuBuilder.catalog","Available views"),children:[e.jsx("header",{className:"nice-menu-builder__head",children:e.jsx("span",{className:"nice-menu-builder__title",children:C("menuBuilder.catalog","Available views")})}),e.jsx("div",{className:"nice-menu-builder__body nice-menu-builder__body--flush",children:e.jsx(Nt.NiceTreeGrid,{data:O,nested:!0,keyField:"key",columns:W,checkable:!0,checkStrategy:"leaves",checkedKeys:F,onCheckedChange:B,isRowCheckable:te=>te.placeable,isRowDisabled:te=>!!te.disabled,getRowLabel:te=>te.label,defaultExpandedKeys:ae,searchable:!0,searchPlaceholder:C("menuBuilder.searchViews","Search views"),searchFields:["label"],toolbarActions:["onlyChecked"],showSelectAll:!1,size:x,compact:!0,readOnly:w,emptyText:C("menuBuilder.catalogEmpty","No views to choose from")})})]}),e.jsxs("section",{className:"nice-menu-builder__column nice-menu-builder__column--menu","aria-label":C("menuBuilder.menu","Menu"),children:[e.jsxs("header",{className:"nice-menu-builder__head",children:[e.jsx("span",{className:"nice-menu-builder__title",children:C("menuBuilder.menu","Menu")}),Q&&e.jsxs("span",{className:"nice-menu-builder__tools",role:"group","aria-label":C("menuBuilder.tools","Menu tools"),children:[K("group",C("menuBuilder.addGroup","New group"),"folder",!0,se),K("up",C("sortableTree.moveUp","Move up"),"chevron-up",!!le&&le.index>0,()=>Y((te,ee)=>Wa(te,ee,-1))),K("down",C("sortableTree.moveDown","Move down"),"chevron-down",!!le&&le.index<le.siblings.length-1,()=>Y((te,ee)=>Wa(te,ee,1))),K("indent",C("sortableTree.indent","Indent"),"indent",!!re&&ce(re),()=>Y(fr)),K("outdent",C("sortableTree.outdent","Outdent"),"outdent",!!le&&le.parentId!==null,()=>Y(vr)),K("remove",C("sortableTree.remove","Remove"),"trash",!!re,pe)]}),g]}),e.jsx("div",{className:"nice-menu-builder__body",children:e.jsx(fl,{"aria-label":C("menuBuilder.menu","Menu"),value:k,onChange:te=>M(te),selectedId:L,onSelect:te=>A(te),getLabel:te=>Nr(te,t),getIcon:te=>ke(te),renderRowEnd:te=>G.has(te.id)?e.jsx("span",{className:"nice-menu-builder__badge",children:C("menuBuilder.unavailable","unavailable")}):null,canHaveChildren:J,canDrop:(te,ee)=>ee.parentId===null||o===void 0||te!==null||oe(ee.parentId)+2<=o,maxDepth:o,editable:Q,removable:Q,onExternalDrop:V,emptyText:C("menuBuilder.menuEmpty","Check views on the left or drag them here"),size:x,readOnly:w})})]}),e.jsxs("div",{className:"nice-menu-builder__side",children:[e.jsxs("section",{className:"nice-menu-builder__column nice-menu-builder__column--item","aria-label":C("menuBuilder.item","Item"),children:[e.jsxs("header",{className:"nice-menu-builder__head",children:[e.jsx("span",{className:"nice-menu-builder__title",children:C("menuBuilder.item","Item")}),re&&e.jsx("span",{className:"nice-menu-builder__kind",children:re.ref?C("menuBuilder.page","Page"):C("menuBuilder.group","Group")})]}),e.jsxs("div",{className:"nice-menu-builder__body nice-menu-builder__props",children:[!re&&e.jsx("p",{className:"nice-menu-builder__hint",children:C("menuBuilder.selectHint","Select an item of the menu to rename it or change its icon.")}),re&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-menu-builder__field",ref:D,children:[e.jsx(Ge.NiceTextInput,{label:C("menuBuilder.name","Name"),size:"sm",value:re.label??"",placeholder:$??C("menuBuilder.newGroup","New group"),onChange:te=>he({label:te.trim()?te:void 0}),readOnly:w}),Q&&re.label&&$&&e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",ariaLabel:C("menuBuilder.resetName","Name from the catalog"),title:C("menuBuilder.resetName","Name from the catalog"),onClick:()=>he({label:void 0}),children:e.jsx(c.NiceIcon,{name:"undo",size:16})})]}),e.jsxs("div",{className:"nice-menu-builder__field nice-menu-builder__field--icon",children:[e.jsx("span",{className:"nice-menu-builder__field-label",children:C("menuBuilder.icon","Icon")}),e.jsx("span",{className:"nice-menu-builder__icon-now","aria-hidden":"true",children:ke(re)}),Q&&re.icon&&e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",ariaLabel:C("menuBuilder.resetIcon","Icon from the catalog"),title:C("menuBuilder.resetIcon","Icon from the catalog"),onClick:()=>he({icon:void 0}),children:e.jsx(c.NiceIcon,{name:"undo",size:16})})]}),Q&&Se,(q?.route||ne)&&e.jsxs("dl",{className:"nice-menu-builder__facts",children:[q?.route&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:C("menuBuilder.route","Opens")}),e.jsx("dd",{children:e.jsx("code",{children:q.route})})]}),ne&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:C("menuBuilder.source","In the catalog")}),e.jsx("dd",{children:ne})]})]}),G.has(re.id)&&e.jsx("p",{className:"nice-menu-builder__warning",role:"note",children:C("menuBuilder.orphan","This view is no longer in the catalog — it will not show in the menu.")})]})]})]}),p&&e.jsxs("section",{className:"nice-menu-builder__column nice-menu-builder__column--preview","aria-label":C("menuBuilder.preview","Preview"),children:[e.jsx("header",{className:"nice-menu-builder__head",children:e.jsx("span",{className:"nice-menu-builder__title",children:C("menuBuilder.preview","Preview")})}),e.jsx("div",{className:"nice-menu-builder__body nice-menu-builder__body--flush",children:e.jsx(Oe.NiceSidebarNav,{data:Ce,minimal:!0,readonly:!0,contextMenu:!1,preferences:rh,...m})})]})]})]})})})},Il=s.createContext(null),ph=({children:t,type:n="single",value:i,defaultValue:a,disabled:r=!1,onChange:o,className:l="",style:d,testId:p,"data-testid":m})=>{const[g,u]=s.useState(a??(n==="single"?"":[])),x=i!==void 0,b=x?i:g,f=s.useCallback(v=>n==="single"?b===v:Array.isArray(b)&&b.includes(v),[n,b]),h=s.useCallback(v=>{let S;if(n==="single")S=b===v?"":v;else{const j=Array.isArray(b)?b:[];S=j.includes(v)?j.filter(T=>T!==v):[...j,v]}x||u(S),o?.(S)},[n,b,x,o]),y=s.useMemo(()=>({type:n,isPressed:f,toggle:h,disabled:r}),[n,f,h,r]);return e.jsx(Il.Provider,{value:y,children:e.jsx("div",{role:"group",className:`nice-toggle-group nice-toggle-group--${n} ${l}`,style:d,"data-testid":m??p,children:t})})},mh=Object.assign(({value:t,children:n,disabled:i=!1})=>{const a=s.useContext(Il);if(!a)throw new Error("NiceToggleGroup.Item must be rendered inside <NiceToggleGroup>");const r=a.isPressed(t),o=a.disabled||i;return e.jsx("button",{type:"button",className:`nice-toggle-group__item ${r?"nice-toggle-group__item--pressed":""}`,"aria-pressed":r,disabled:o,onClick:()=>a.toggle(t),children:n})},{displayName:"NiceToggleGroup.Item"}),Gs=Object.assign(ph,{displayName:"NiceToggleGroup",Item:mh}),hh=["daily","weekly","monthly","yearly"],gh={daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly"},bh={daily:"Repeat every (days)",weekly:"Repeat every (weeks)",monthly:"Repeat every (months)",yearly:"Repeat every (years)"},fh={daily:{single:"Every day",other:"Every {n} days"},weekly:{single:"Every week",other:"Every {n} weeks"},monthly:{single:"Every month",other:"Every {n} months"},yearly:{single:"Every year",other:"Every {n} years"}},Co=10,Pl=864e5,vh=new Date(2023,0,1);function So(t,n){try{return new Intl.PluralRules(t).select(n)}catch{return n===1?"one":"other"}}function Ws(t,n,i){const a=new Date(vh.getTime()+n*Pl);try{return new Intl.DateTimeFormat(t,{weekday:i}).format(a)}catch{return new Intl.DateTimeFormat("en",{weekday:i}).format(a)}}function Dl(t,n){try{return new Intl.DateTimeFormat(t,n)}catch{return new Intl.DateTimeFormat("en",n)}}function To(t){const n=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function xh(t,n,i,a){const r=Math.max(1,Math.floor(t.interval??1)),o=fh[t.freq],l=[r===1?n(`recurrence.summary.${t.freq}.single`,o.single):n(`recurrence.summary.${t.freq}.${So(i,r)}`,o.other).replace("{n}",String(r))];if(t.freq==="weekly"&&t.byDay?.length&&l.push(a.filter(d=>t.byDay?.includes(d)).map(d=>Ws(i,d,"short")).join(", ")),t.count&&t.count>0)l.push(n(`recurrence.summary.times.${So(i,t.count)}`,t.count===1?"once":"{n} times").replace("{n}",String(t.count)));else if(t.until){const d=Dl(i,{day:"numeric",month:"short",year:"numeric"});l.push(`${n("recurrence.summary.until","until")} ${d.format(new Date(t.until))}`)}return l.join(" · ")}const yh=({value:t,defaultValue:n=null,onChange:i,start:a,allowNone:r=!0,previewCount:o=5,weekStartsOn:l=1,label:d,size:p="md",disabled:m=!1,readOnly:g=!1,className:u="",style:x,id:b,accessMode:f,"data-testid":h})=>{const{t:y,lang:v}=c.useNiceTranslation(),S=c.useNiceAccessMode(f,b),[j,T]=c.useControllableState({value:t,defaultValue:n,onChange:i,componentName:"NiceRecurrenceEditor"}),[C]=s.useState(()=>new Date),N=a??C,_=m||g||S==="disabled"||S==="readOnly",w=c.normalizeSize(p),k=w==="xxs"||w==="xs"?w:"sm",I=s.useMemo(()=>Array.from({length:7},(F,G)=>(G+l)%7),[l]),M=s.useMemo(()=>{if(!j||o<=0)return[];const F=new Date(N.getTime()+100*365*Pl);return Rt.recurrenceDates(j,N,F,o)},[j,N,o]);if(S==="hidden")return null;const L=F=>{j&&T({...j,...F})},A=F=>{if(F==="none"){T(null);return}const G=F,ae=j?{...j,freq:G}:{freq:G,interval:1};G==="weekly"?ae.byDay=j?.byDay?.length?j.byDay:[N.getDay()]:delete ae.byDay,T(ae)},D=j?.count?"after":j?.until?"on":"never",E=F=>{if(!j)return;const G={...j};if(delete G.count,delete G.until,F==="after")T({...G,count:Co});else if(F==="on"){const ae=new Date(N);ae.setMonth(ae.getMonth()+3),T({...G,until:ae})}else T(G)},R=[...r?[{value:"none",label:y("recurrence.freq.none","Does not repeat")}]:[],...hh.map(F=>({value:F,label:y(`recurrence.freq.${F}`,gh[F])}))],O=Dl(v,{weekday:"short",day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{id:b,className:`nice-recurrence nice-recurrence--${w} ${u}`,style:x,"data-testid":h,children:[e.jsx(Ft.NiceSelect,{size:k,label:d??y("recurrence.frequency","Repeats"),value:j?j.freq:"none",options:R,onChange:F=>A(Array.isArray(F)?F[0]??"none":F),disabled:_}),j&&e.jsxs(e.Fragment,{children:[e.jsx(Ge.NiceNumberInput,{size:k,className:"nice-recurrence__interval",label:y(`recurrence.interval.${j.freq}`,bh[j.freq]),min:1,max:999,value:j.interval??1,onChange:F=>L({interval:Math.max(1,Math.round(F??1))}),disabled:_}),j.freq==="weekly"&&e.jsxs("div",{className:"nice-recurrence__days",role:"group","aria-label":y("recurrence.days","On days"),children:[e.jsx("span",{className:"nice-recurrence__caption",children:y("recurrence.days","On days")}),e.jsx(Gs,{type:"multiple",disabled:_,value:(j.byDay??[]).map(String),onChange:F=>{const G=(Array.isArray(F)?F:[F]).map(Number);G.length>0&&L({byDay:G.sort((ae,B)=>ae-B)})},children:I.map(F=>e.jsx(Gs.Item,{value:String(F),children:e.jsx("span",{title:Ws(v,F,"long"),children:Ws(v,F,"short")})},F))})]}),e.jsxs("div",{className:"nice-recurrence__ends",children:[e.jsx(rt.NiceRadioGroup,{size:k,label:y("recurrence.endsLabel","Ends"),direction:"vertical",value:D,onChange:E,disabled:_,options:[{value:"never",label:y("recurrence.ends.never","Never")},{value:"on",label:y("recurrence.ends.on","On a date")},{value:"after",label:y("recurrence.ends.after","After a number of occurrences")}]}),D==="on"&&j.until&&e.jsx(rt.NiceDateTimePicker,{size:k,label:y("recurrence.endDate","End date"),dateFormatPreset:"date-local",value:To(new Date(j.until)),min:To(N),onChange:F=>{const[G,ae,B]=F.split("-").map(Number);G&&ae&&B&&L({until:new Date(G,ae-1,B,23,59,59)})},disabled:_}),D==="after"&&e.jsx(Ge.NiceNumberInput,{size:k,className:"nice-recurrence__count",label:y("recurrence.count","Occurrences"),min:1,max:9999,value:j.count??Co,onChange:F=>L({count:Math.max(1,Math.round(F??1))}),disabled:_})]}),e.jsx("p",{className:"nice-recurrence__summary","aria-live":"polite",children:xh(j,y,v,I)}),M.length>0&&e.jsxs("div",{className:"nice-recurrence__preview",children:[e.jsx("span",{className:"nice-recurrence__caption",children:y("recurrence.next","Next dates")}),e.jsx("ol",{className:"nice-recurrence__dates",children:M.map(F=>e.jsx("li",{children:e.jsx("time",{dateTime:F.toISOString(),children:O.format(F)})},F.getTime()))})]})]})]})};function Nh(t,n=1){let i;if(typeof t.quantity=="number"){const r=t.quantity*n;i=Number.isInteger(r)?String(r):String(Math.round(r*100)/100)}else i=t.quantity!=null?String(t.quantity):"";const a=t.unit??"";return[i,a].filter(Boolean).join(" ").trim()}const _h=({photos:t})=>{const{t:n}=c.useNiceTranslation(),i=[...t].sort((l,d)=>+!!d.primary-+!!l.primary),[a,r]=s.useState(i[0]?.id),o=i.find(l=>l.id===a)??i[0];return e.jsxs("div",{className:"nice-recipe__gallery",children:[o&&e.jsxs("div",{className:"nice-recipe__photo-main",children:[e.jsx("img",{src:o.url,alt:o.caption??""}),o.caption&&e.jsx("div",{className:"nice-recipe__photo-caption",children:o.caption})]}),i.length>1&&e.jsx("div",{className:"nice-recipe__photo-thumbs",children:i.map(l=>e.jsx("button",{type:"button",className:`nice-recipe__thumb${l.id===o?.id?" nice-recipe__thumb--active":""}`,onClick:()=>r(l.id),"aria-label":l.caption??n("recipe.photo","Photo"),children:e.jsx("img",{src:l.url,alt:l.caption??""})},l.id))})]})},jh=({recipe:t,compact:n=!1,hidePhotos:i=!1,hideIngredients:a=!1,hideSteps:r=!1,onIngredientToggle:o,onStepToggle:l,className:d,style:p,accessMode:m,id:g,"data-testid":u})=>{const{t:x}=c.useNiceTranslation(),b=c.useNiceAccessMode(m,g),f=t.servings,[h,y]=s.useState(f);if(s.useEffect(()=>{y(f)},[f]),b==="hidden")return null;const v=b==="readOnly"||b==="disabled",S=Rt.recipeTotalMinutes(t),j=t.photos??[],T=[...t.steps].sort((w,k)=>w.order-k.order),C=!v&&typeof f=="number"&&f>0&&typeof h=="number"&&h>0?h/f:1,N=!n&&typeof f=="number"&&f>0&&!v,_=()=>{typeof window<"u"&&window.print()};return e.jsxs("div",{className:`nice-recipe${n?" nice-recipe--compact":""} ${d??""}`,style:p,"data-testid":u,children:[e.jsxs("header",{className:"nice-recipe__header",children:[e.jsx("h3",{className:"nice-recipe__title",children:t.title||x("recipe.untitled","Untitled recipe")}),!n&&t.description&&e.jsx("p",{className:"nice-recipe__description",children:t.description}),e.jsxs("div",{className:"nice-recipe__meta",children:[t.servings!=null&&e.jsxs("span",{className:"nice-recipe__meta-item",children:[e.jsx(c.NiceIcon,{name:"box",size:14})," ",h??t.servings," ",x("recipe.servings","servings")]}),S!=null&&e.jsxs("span",{className:"nice-recipe__meta-item",children:[e.jsx(c.NiceIcon,{name:"clock",size:14})," ",S," ",x("recipe.minutes","min")]}),t.difficulty&&e.jsx("span",{className:`nice-recipe__badge nice-recipe__badge--${t.difficulty}`,children:x(`recipe.difficulty.${t.difficulty}`,t.difficulty)}),t.cuisine&&e.jsxs("span",{className:"nice-recipe__meta-item",children:[e.jsx(c.NiceIcon,{name:"globe",size:14})," ",t.cuisine]}),t.sourceUrl&&e.jsxs("a",{className:"nice-recipe__meta-item nice-recipe__source",href:t.sourceUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(c.NiceIcon,{name:"link",size:14})," ",x("recipe.source","Source")]})]}),(N||!n)&&e.jsxs("div",{className:"nice-recipe__actions",children:[N&&e.jsxs("span",{className:"nice-recipe__servings-stepper",children:[e.jsx("button",{type:"button",className:"nice-recipe__servings-btn","aria-label":x("recipe.servingsDecrease","Decrease servings"),onClick:()=>y(w=>Math.max(1,(w??f??1)-1)),disabled:(h??f??1)<=1,children:"−"}),e.jsxs("span",{"aria-live":"polite",className:"nice-recipe__servings-value",children:[h??f," ×"]}),e.jsx("button",{type:"button",className:"nice-recipe__servings-btn","aria-label":x("recipe.servingsIncrease","Increase servings"),onClick:()=>y(w=>Math.min(99,(w??f??1)+1)),disabled:(h??f??1)>=99,children:"+"}),C!==1&&e.jsx("button",{type:"button",className:"nice-recipe__servings-reset",onClick:()=>y(f),children:x("recipe.reset","Reset")})]}),!n&&e.jsxs("button",{type:"button",className:"nice-recipe__print",onClick:_,"aria-label":x("recipe.print","Print recipe"),children:[e.jsx(c.NiceIcon,{name:"printer",size:14})," ",x("recipe.print","Print")]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"nice-recipe__tags",children:t.tags.map(w=>e.jsxs("span",{className:"nice-recipe__tag",children:["#",w]},w))})]}),!i&&j.length>0&&e.jsx(_h,{photos:j}),e.jsxs("div",{className:"nice-recipe__body",children:[!a&&t.ingredients.length>0&&e.jsxs("section",{className:"nice-recipe__section nice-recipe__section--ingredients",children:[e.jsx("h4",{className:"nice-recipe__section-title",children:x("recipe.ingredients","Ingredients")}),e.jsx("ul",{className:"nice-recipe__ingredients",children:t.ingredients.map(w=>e.jsx("li",{className:"nice-recipe__ingredient",children:e.jsxs("label",{className:`nice-recipe__ingredient-row${w.checked?" nice-recipe__ingredient-row--checked":""}`,children:[e.jsx("input",{type:"checkbox",checked:!!w.checked,disabled:v||!o,onChange:()=>o?.(w)}),e.jsx("span",{className:"nice-recipe__ingredient-qty",children:Nh(w,C)}),e.jsx("span",{className:"nice-recipe__ingredient-name",children:w.name}),w.notes&&e.jsxs("span",{className:"nice-recipe__ingredient-notes",children:["— ",w.notes]})]})},w.id))})]}),!r&&T.length>0&&e.jsxs("section",{className:"nice-recipe__section nice-recipe__section--steps",children:[e.jsx("h4",{className:"nice-recipe__section-title",children:x("recipe.steps","Steps")}),e.jsx("ol",{className:"nice-recipe__steps",children:T.map(w=>e.jsx("li",{className:`nice-recipe__step${w.done?" nice-recipe__step--done":""}`,children:e.jsxs("label",{className:"nice-recipe__step-row",children:[e.jsx("input",{type:"checkbox",checked:!!w.done,disabled:v||!l,onChange:()=>l?.(w)}),e.jsxs("div",{className:"nice-recipe__step-body",children:[e.jsx("div",{className:"nice-recipe__step-instruction",children:w.instruction}),w.durationMinutes!=null&&e.jsxs("div",{className:"nice-recipe__step-duration",children:[e.jsx(c.NiceIcon,{name:"clock",size:14})," ",w.durationMinutes," ",x("recipe.minutes","min")]}),w.image&&e.jsx("img",{className:"nice-recipe__step-image",src:w.image,alt:""})]})]})},w.id))})]})]}),!n&&t.nutrition&&e.jsxs("footer",{className:"nice-recipe__nutrition",children:[t.nutrition.calories!=null&&e.jsx("span",{children:x("recipe.kcal","{label}: {value} kcal").replace("{label}",x("recipe.nutrition.calories","Calories")).replace("{value}",String(t.nutrition.calories))}),t.nutrition.protein!=null&&e.jsxs("span",{children:[x("recipe.nutrition.protein","Protein"),": ",t.nutrition.protein," g"]}),t.nutrition.fat!=null&&e.jsxs("span",{children:[x("recipe.nutrition.fat","Fat"),": ",t.nutrition.fat," g"]}),t.nutrition.carbs!=null&&e.jsxs("span",{children:[x("recipe.nutrition.carbs","Carbs"),": ",t.nutrition.carbs," g"]}),t.nutrition.fiber!=null&&e.jsxs("span",{children:[x("recipe.nutrition.fiber","Fiber"),": ",t.nutrition.fiber," g"]}),t.nutrition.sugar!=null&&e.jsxs("span",{children:[x("recipe.nutrition.sugar","Sugar"),": ",t.nutrition.sugar," g"]}),t.nutrition.sodium!=null&&e.jsx("span",{children:x("recipe.mg","{label}: {value} mg").replace("{label}",x("recipe.nutrition.sodium","Sodium")).replace("{value}",String(t.nutrition.sodium))})]})]})},wh=[],kh=[{value:"",label:"All"},{value:"easy",label:"Easy"},{value:"medium",label:"Medium"},{value:"hard",label:"Hard"}],Al=({recipes:t=wh,onSelect:n,initialQuery:i="",hideFilters:a,emptyMessage:r,className:o,style:l,"data-testid":d})=>{const{t:p}=c.useNiceTranslation(),[m,g]=s.useState(i),[u,x]=s.useState(""),[b,f]=s.useState(""),h=s.useMemo(()=>{const v=new Set;for(const S of t)for(const j of S.tags??[])v.add(j);return Array.from(v).sort()},[t]),y=s.useMemo(()=>{const v=m.trim().toLowerCase();return t.filter(S=>u&&S.difficulty!==u||b&&!(S.tags??[]).includes(b)?!1:v?[S.title,S.description??"",S.cuisine??"",...S.tags??[]].join(" ").toLowerCase().includes(v):!0)},[t,m,u,b]);return e.jsxs("div",{className:`nice-recipe-list ${o??""}`,style:l,"data-testid":d,children:[e.jsxs("div",{className:"nice-recipe-list__toolbar",children:[e.jsx("input",{type:"search",className:"nice-recipe-list__search",value:m,placeholder:p("recipe.list.search","Search recipes…"),onChange:v=>g(v.target.value),"aria-label":p("recipe.list.search","Search recipes")}),!a&&e.jsxs(e.Fragment,{children:[e.jsx("select",{className:"nice-recipe-list__filter",value:u,onChange:v=>x(v.target.value),"aria-label":p("recipe.difficulty","Difficulty"),children:kh.map(v=>e.jsx("option",{value:v.value,children:v.label},v.value||"all"))}),h.length>0&&e.jsxs("select",{className:"nice-recipe-list__filter",value:b,onChange:v=>f(v.target.value),"aria-label":p("recipe.tags","Tags"),children:[e.jsx("option",{value:"",children:p("recipe.list.allTags","All tags")}),h.map(v=>e.jsxs("option",{value:v,children:["#",v]},v))]})]}),e.jsxs("span",{className:"nice-recipe-list__count","aria-live":"polite",children:[y.length," / ",t.length]})]}),y.length===0?e.jsx("div",{className:"nice-recipe-list__empty",children:r??p("recipe.list.empty","No recipes match the current filters.")}):e.jsx("ul",{className:"nice-recipe-list__grid",children:y.map(v=>{const S=v.photos?.find(T=>T.primary)??v.photos?.[0],j=Rt.recipeTotalMinutes(v);return e.jsx("li",{className:"nice-recipe-list__item",children:e.jsxs("button",{type:"button",className:"nice-recipe-list__card",onClick:()=>n?.(v),children:[S&&e.jsx("span",{className:"nice-recipe-list__thumb",children:e.jsx("img",{src:S.url,alt:S.caption??v.title,loading:"lazy"})}),e.jsxs("span",{className:"nice-recipe-list__body",children:[e.jsx("span",{className:"nice-recipe-list__title",children:v.title}),v.description&&e.jsx("span",{className:"nice-recipe-list__desc",children:v.description}),e.jsxs("span",{className:"nice-recipe-list__meta",children:[typeof v.servings=="number"&&e.jsxs("span",{className:"nice-recipe-list__meta-item",children:[e.jsx(c.NiceIcon,{name:"utensils",size:12})," ",v.servings]}),j!=null&&j>0&&e.jsxs("span",{className:"nice-recipe-list__meta-item",children:[e.jsx(c.NiceIcon,{name:"clock",size:12})," ",p("recipe.min","{total} min").replace("{total}",String(j))]}),v.difficulty&&e.jsx("span",{className:`nice-recipe__badge nice-recipe__badge--${v.difficulty}`,children:v.difficulty})]}),v.tags&&v.tags.length>0&&e.jsx("span",{className:"nice-recipe-list__tags",children:v.tags.slice(0,4).map(T=>e.jsxs("span",{className:"nice-recipe__tag",children:["#",T]},T))})]})]})},v.id)})})]})},Ch=[],Sh=[],Th=["breakfast","lunch","dinner"],Eh=1440*60*1e3;function Ih(t){const n=new Date(t);n.setHours(0,0,0,0);const i=n.getDay(),a=i===0?-6:1-i;return n.setDate(n.getDate()+a),n}function Eo(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}const Ph=({recipes:t=Ch,meals:n=Sh,onChange:i,weekStart:a,rows:r=Th,readOnly:o,className:l,style:d,"data-testid":p})=>{const{t:m,lang:g}=c.useNiceTranslation(),u=s.useMemo(()=>Ih(a??new Date),[a]),x=s.useMemo(()=>Array.from({length:7},(T,C)=>new Date(u.getTime()+C*Eh)),[u]),b=s.useMemo(()=>{const T=new Map;for(const C of t)T.set(C.id,C);return T},[t]),f=s.useCallback((T,C)=>n.filter(N=>N.kind===C&&N.servedAt instanceof Date&&Eo(N.servedAt,T)),[n]),h=s.useCallback((T,C,N)=>{if(!N||o)return;const _=b.get(N),w=new Date(T);w.setHours(C==="breakfast"?8:C==="lunch"?13:C==="dinner"?19:16,0,0,0);const k={id:Rt.newRecipeId("meal"),name:_?.title??m("mealplan.untitled","Meal"),kind:C,servedAt:w,recipeIds:[N],servings:_?.servings};i?.([...n,k])},[n,i,o,b,m]),y=s.useCallback(T=>{o||i?.(n.filter(C=>C.id!==T))},[n,i,o]),v=T=>T.toLocaleDateString(g,{weekday:"short",day:"numeric",month:"short"}),S=T=>m(`mealplan.kind.${T}`,T.charAt(0).toUpperCase()+T.slice(1)),j=new Date;return e.jsx("div",{className:`nice-mealplan ${l??""}`,style:d,"data-testid":p,children:e.jsxs("div",{className:"nice-mealplan__grid",style:{gridTemplateColumns:"auto repeat(7, minmax(8rem, 1fr))"},children:[e.jsx("div",{className:"nice-mealplan__corner"}),x.map(T=>e.jsx("div",{className:`nice-mealplan__day-head${Eo(T,j)?" nice-mealplan__day-head--today":""}`,children:v(T)},T.toISOString())),r.map(T=>e.jsxs(s.Fragment,{children:[e.jsx("div",{className:"nice-mealplan__row-head",children:S(T)}),x.map(C=>{const N=f(C,T);return e.jsxs("div",{className:"nice-mealplan__cell",children:[N.map(_=>{const w=_.recipeIds[0]?b.get(_.recipeIds[0]):void 0;return e.jsxs("div",{className:"nice-mealplan__chip",title:_.name,children:[e.jsx("span",{className:"nice-mealplan__chip-title",children:w?.title??_.name}),!o&&e.jsx("button",{type:"button",className:"nice-mealplan__chip-remove","aria-label":m("mealplan.remove","Remove meal"),onClick:()=>y(_.id),children:e.jsx(c.NiceIcon,{name:"close",size:14})})]},_.id)}),!o&&t.length>0&&e.jsxs("select",{className:"nice-mealplan__add",value:"","aria-label":m("mealplan.addRecipe","Add recipe"),onChange:_=>{const w=_.target.value;w&&h(C,T,w),_.target.value=""},children:[e.jsxs("option",{value:"",children:["+ ",m("mealplan.add","Add")]}),t.map(_=>e.jsx("option",{value:_.id,children:_.title},_.id))]})]},`${T}-${C.toISOString()}`)})]},T))]})})},Dh=[],Ah=[],Rh=({recipes:t=Dh,collections:n=Ah,onChange:i,readOnly:a,onSelectRecipe:r,className:o,style:l,"data-testid":d})=>{const{t:p}=c.useNiceTranslation(),{prompt:m,element:g}=xt.useNiceDialogs(),[u,x]=s.useState(n[0]?.id??null),[b,f]=s.useState(null),h=s.useMemo(()=>{const k=new Map;for(const I of t)k.set(I.id,I);return k},[t]),y=s.useMemo(()=>n.find(k=>k.id===u)??n[0]??null,[n,u]),v=s.useMemo(()=>y?y.recipeIds.map(k=>h.get(k)).filter(k=>!!k):[],[y,h]),S=s.useCallback(k=>{i?.(k)},[i]),j=s.useCallback(()=>{a||m({title:p("collections.namePrompt","Collection name")}).then(k=>{if(!k||!k.trim())return;const I={id:Rt.newRecipeId("coll"),name:k.trim(),recipeIds:[]};S([...n,I]),x(I.id)})},[n,a,p,S,m]),T=s.useCallback(k=>{if(a)return;const I=n.filter(M=>M.id!==k);S(I),u===k&&x(I[0]?.id??null)},[u,n,a,S]),C=s.useCallback(()=>{if(!b)return;const k=b.value.trim();k&&S(n.map(I=>I.id===b.id?{...I,name:k}:I)),f(null)},[n,b,S]),N=s.useCallback(k=>{!y||!k||a||y.recipeIds.includes(k)||S(n.map(I=>I.id===y.id?{...I,recipeIds:[...I.recipeIds,k]}:I))},[y,n,a,S]),_=s.useCallback(k=>{!y||a||S(n.map(I=>I.id===y.id?{...I,recipeIds:I.recipeIds.filter(M=>M!==k)}:I))},[y,n,a,S]),w=s.useMemo(()=>y?t.filter(k=>!y.recipeIds.includes(k.id)):[],[y,t]);return e.jsxs("div",{className:`nice-recipe-collections ${o??""}`,style:l,"data-testid":d,children:[g,e.jsxs("aside",{className:"nice-recipe-collections__sidebar",children:[e.jsxs("div",{className:"nice-recipe-collections__sidebar-head",children:[e.jsx("span",{className:"nice-recipe-collections__sidebar-title",children:p("collections.title","Collections")}),!a&&e.jsx("button",{type:"button",className:"nice-recipe-collections__sidebar-add",onClick:j,"aria-label":p("collections.create","Create collection"),children:e.jsx(c.NiceIcon,{name:"plus",size:14})})]}),e.jsx("ul",{className:"nice-recipe-collections__list",children:n.map(k=>{const I=y?.id===k.id,M=b?.id===k.id;return e.jsxs("li",{className:`nice-recipe-collections__item${I?" nice-recipe-collections__item--active":""}`,children:[M?e.jsx("input",{autoFocus:!0,className:"nice-recipe-collections__rename",value:b.value,onChange:L=>f({id:k.id,value:L.target.value}),onBlur:C,onKeyDown:L=>{L.key==="Enter"?C():L.key==="Escape"&&f(null)}}):e.jsxs("button",{type:"button",className:"nice-recipe-collections__item-btn",onClick:()=>x(k.id),onDoubleClick:()=>!a&&f({id:k.id,value:k.name}),children:[e.jsx("span",{className:"nice-recipe-collections__item-name",children:k.name}),e.jsx("span",{className:"nice-recipe-collections__item-count",children:k.recipeIds.length})]}),!a&&!M&&e.jsx("button",{type:"button",className:"nice-recipe-collections__item-remove",onClick:()=>T(k.id),"aria-label":p("collections.delete","Delete collection"),title:p("collections.delete","Delete collection"),children:e.jsx(c.NiceIcon,{name:"close",size:14})})]},k.id)})})]}),e.jsx("section",{className:"nice-recipe-collections__main",children:y?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"nice-recipe-collections__header",children:[e.jsx("h3",{className:"nice-recipe-collections__name",children:y.name}),!a&&w.length>0&&e.jsxs("select",{className:"nice-recipe-collections__add-recipe",value:"","aria-label":p("collections.addRecipe","Add recipe"),onChange:k=>{const I=k.target.value;I&&N(I),k.target.value=""},children:[e.jsxs("option",{value:"",children:["+ ",p("collections.addRecipe","Add recipe")]}),w.map(k=>e.jsx("option",{value:k.id,children:k.title},k.id))]})]}),v.length===0?e.jsx("div",{className:"nice-recipe-collections__empty",children:p("collections.empty","No recipes in this collection yet.")}):e.jsx(Al,{recipes:v,hideFilters:!0,onSelect:k=>r?.(k)}),!a&&v.length>0&&e.jsxs("details",{className:"nice-recipe-collections__manage",children:[e.jsx("summary",{children:p("collections.manage","Manage recipes")}),e.jsx("ul",{className:"nice-recipe-collections__manage-list",children:v.map(k=>e.jsxs("li",{children:[e.jsx("span",{children:k.title}),e.jsx("button",{type:"button",onClick:()=>_(k.id),"aria-label":p("collections.removeRecipe","Remove recipe from collection"),children:p("collections.removeShort","Remove")})]},k.id))})]})]}):e.jsx("div",{className:"nice-recipe-collections__empty",children:p("collections.emptyState","No collection selected.")})})]})},$h=[],gi=["hour","day","week","month","quarter","year"],Mh=t=>{switch(t){case"hour":return{msPerPixel:6e4,unitMs:36e5,unitLabel:"HH:mm",headerFormat:"MMM d, yyyy"};case"day":return{msPerPixel:36e5,unitMs:864e5,unitLabel:"d",headerFormat:"MMM yyyy"};case"week":return{msPerPixel:864e5/2,unitMs:6048e5,unitLabel:"W",headerFormat:"MMM yyyy"};case"month":return{msPerPixel:864e5*2,unitMs:2592e6,unitLabel:"MMM",headerFormat:"yyyy"};case"quarter":return{msPerPixel:864e5*7,unitMs:7776e6,unitLabel:"Q",headerFormat:"yyyy"};case"year":return{msPerPixel:864e5*30,unitMs:31536e6,unitLabel:"yyyy",headerFormat:""};default:return{msPerPixel:864e5,unitMs:864e5,unitLabel:"d",headerFormat:"MMM yyyy"}}},bi=(t,n,i="pl-PL")=>{const a={};if(n.includes("yyyy")&&(a.year="numeric"),n.includes("MMM")&&(a.month="short"),n.includes("MM")&&!n.includes("MMM")&&(a.month="2-digit"),(n.includes("dd")||n.includes("d"))&&(a.day="2-digit"),n.includes("EEE")&&(a.weekday="short"),n.includes("HH")&&(a.hour="2-digit",a.hour12=!1),n.includes("mm")&&!n.includes("MMM")&&(a.minute="2-digit"),n==="W")return`T${Oh(t)}`;if(n==="Q")return`Q${Math.ceil((t.getMonth()+1)/3)}`;const r=a.year||a.month||a.day||a.weekday;return(a.hour||a.minute)&&!r?t.toLocaleTimeString(i,a):t.toLocaleDateString(i,a)},Oh=t=>{const n=new Date(t);n.setHours(0,0,0,0),n.setDate(n.getDate()+4-(n.getDay()||7));const i=new Date(n.getFullYear(),0,1);return Math.ceil(((n.getTime()-i.getTime())/864e5+1)/7)},Io=(t,n)=>new Date(t.getTime()+n),zh=["var(--nice-color-primary, #3b82f6)","var(--nice-color-error, #ef4444)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-success, #84cc16)","var(--nice-warning, #f97316)","var(--nice-color-accent, #6366f1)"],Lh=Object.assign(s.forwardRef((t,n)=>{const{t:i}=c.useNiceTranslation(),{events:a=$h,groups:r=[],markers:o=[],initialZoom:l="week",initialDate:d,width:p=800,height:m=400,showToday:g=!0,showZoomControls:u=!0,showNavControls:x=!0,showMinimap:b=!1,onEventClick:f,onEventHover:h,onDateChange:y,onZoomChange:v,renderEvent:S,colors:j=zh,locale:T="pl-PL",className:C,style:N,..._}=t,[w,k]=s.useState(l),[I,M]=s.useState(d||new Date),[L,A]=s.useState(!1),[D,E]=s.useState({x:0,date:new Date}),[R,O]=s.useState(null),[F,G]=s.useState(new Set),ae=s.useRef(null),B=s.useMemo(()=>Mh(w),[w]),W=p*B.msPerPixel,re=I.getTime()-W/2,J=I.getTime()+W/2,oe=s.useMemo(()=>new Date(re),[re]),V=s.useMemo(()=>new Date(J),[J]),se=s.useCallback(H=>(H.getTime()-oe.getTime())/B.msPerPixel,[oe,B.msPerPixel]);s.useCallback(H=>{const ve=H*B.msPerPixel;return new Date(oe.getTime()+ve)},[oe,B.msPerPixel]);const ce=s.useMemo(()=>{const H=[];let ve=new Date(oe);switch(w){case"hour":ve.setMinutes(0,0,0);break;case"day":ve.setHours(0,0,0,0);break;case"week":{const be=ve.getDay();ve.setDate(ve.getDate()-be+1),ve.setHours(0,0,0,0);break}case"month":ve.setDate(1),ve.setHours(0,0,0,0);break;case"quarter":ve.setMonth(Math.floor(ve.getMonth()/3)*3),ve.setDate(1),ve.setHours(0,0,0,0);break;case"year":ve.setMonth(0,1),ve.setHours(0,0,0,0);break}for(;ve<=V;){const be=se(ve),Ee=w==="day"?ve.getDay()===1:w==="week"?ve.getDate()===1:w==="month"?ve.getMonth()%3===0:w==="quarter"?ve.getMonth()===0:!0;H.push({date:new Date(ve),x:be,isMain:Ee,isWeekend:w==="day"&&(ve.getDay()===0||ve.getDay()===6)}),ve=Io(ve,B.unitMs)}return H},[oe,V,w,B,se]),le=s.useMemo(()=>{const H=B.unitMs/B.msPerPixel;return H<=0?1:Math.max(1,Math.ceil(40/H))},[B]),Y=s.useMemo(()=>{const H=new Map;return H.set("__default",[]),r.forEach(ve=>H.set(ve.id,[])),a.forEach(ve=>{const be=ve.group&&H.has(ve.group)?ve.group:"__default",Ee=H.get(be)||[];Ee.push(ve),H.set(be,Ee)}),H},[a,r]),pe=s.useMemo(()=>{const H=[];return Y.get("__default")?.length&&H.push({id:"__default",title:"",events:Y.get("__default")||[],isGroup:!1}),r.forEach(ve=>{F.has(ve.id)||H.push({id:ve.id,title:ve.title,events:Y.get(ve.id)||[],isGroup:!0})}),H},[Y,r,F]),ke=s.useCallback(H=>{M(H),y?.(H)},[y]),he=s.useCallback(()=>{const H=gi.indexOf(w);if(H>0){const ve=gi[H-1];k(ve),v?.(ve)}},[w,v]),z=s.useCallback(()=>{const H=gi.indexOf(w);if(H<gi.length-1){const ve=gi[H+1];k(ve),v?.(ve)}},[w,v]),q=s.useCallback(H=>{k(H),v?.(H)},[v]),$=s.useCallback(H=>{const ve=Io(I,H*W*.5);ke(ve)},[I,W,ke]),ne=s.useCallback(H=>{H.button===0&&(A(!0),E({x:H.clientX,date:I}))},[I]),Se=s.useCallback(H=>{if(!L)return;const be=(D.x-H.clientX)*B.msPerPixel,Ee=new Date(D.date.getTime()+be);M(Ee)},[L,D,B.msPerPixel]),Ce=s.useCallback(()=>{L&&(A(!1),y?.(I))},[L,I,y]),K=s.useCallback(H=>{H.preventDefault(),H.deltaY<0?he():z()},[he,z]),Q=s.useCallback(H=>{O(H),h?.(H)},[h]),te=s.useCallback(()=>{O(null),h?.(null)},[h]),ee=s.useRef(null);c.useRovingFocus(ee,{orientation:"grid",itemSelector:".nice-timeline-event, .nice-timeline-milestone"});const Te=H=>ve=>{(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),f?.(H))};s.useImperativeHandle(n,()=>({goToDate:ke,zoomIn:he,zoomOut:z,setZoom:q,getCurrentDate:()=>I,getCurrentZoom:()=>w}),[ke,he,z,q,I,w]);const Z=40,we=60,ie=Math.max(pe.length*Z,m-we-40),xe=se(new Date);return e.jsxs("div",{className:`nice-timeline ${C||""}`,style:{width:p,...N},..._,children:[e.jsxs("div",{className:"nice-timeline-toolbar",children:[x&&e.jsx("div",{className:"nice-timeline-nav",children:e.jsxs(Rt.NiceButtonGroup,{size:"sm",children:[e.jsx(Le.NiceButton,{onClick:()=>$(-1),"aria-label":i("planning.previous","Previous"),children:e.jsx(c.NiceIcon,{name:"chevron-left",size:14})}),e.jsx(Le.NiceButton,{onClick:()=>ke(new Date),children:i("scheduling.today","Today")}),e.jsx(Le.NiceButton,{onClick:()=>$(1),"aria-label":i("planning.next","Next"),children:e.jsx(c.NiceIcon,{name:"chevron-right",size:14})})]})}),e.jsx("div",{className:"nice-timeline-center",children:e.jsxs("span",{className:"nice-timeline-range",children:[bi(oe,"MMM d, yyyy",T)," —"," ",bi(V,"MMM d, yyyy",T)]})}),u&&e.jsx("div",{className:"nice-timeline-zoom",children:e.jsx(Rt.NiceButtonGroup,{size:"sm",children:gi.map(H=>e.jsx(Le.NiceButton,{variant:w===H?"primary":"secondary",onClick:()=>q(H),children:H==="hour"?i("planning.hourShort","hr"):H==="day"?i("planning.dayShort","day"):H==="week"?i("planning.weekShort","wk"):H==="month"?i("planning.monthShort","mo"):H==="quarter"?i("planning.quarterShort","qtr"):i("planning.yearShort","yr")},H))})})]}),e.jsxs("div",{ref:ae,className:"nice-timeline-container",onMouseDown:ne,onMouseMove:Se,onMouseUp:Ce,onMouseLeave:Ce,onWheel:K,style:{cursor:L?"grabbing":"grab"},children:[e.jsxs("div",{className:"nice-timeline-header",style:{height:we},children:[e.jsx("div",{className:"nice-timeline-header-main",children:B.headerFormat&&e.jsx("span",{children:bi(I,B.headerFormat,T)})}),e.jsx("div",{className:"nice-timeline-header-units",children:ce.map((H,ve)=>{const be=ve%le===0||H.isMain,Ee=w==="hour"&&H.date.getHours()===0,P=Ee?"d MMM":B.unitLabel;return e.jsx("div",{className:`nice-timeline-unit ${H.isMain?"main":""} ${H.isWeekend?"nice-timeline-unit--weekend":""} ${Ee?"nice-timeline-unit--midnight":""} ${be?"":"nice-timeline-unit--no-label"}`,style:{left:H.x},children:be&&e.jsx("span",{children:bi(H.date,P,T)})},ve)})})]}),e.jsxs("div",{ref:ee,className:"nice-timeline-chart",style:{height:ie},role:"group","aria-label":i("timeline.events","Events"),children:[e.jsxs("svg",{className:"nice-timeline-grid",width:p,height:ie,children:[ce.map((H,ve)=>{if(!H.isWeekend)return null;const be=ce[ve+1],Ee=(be?be.x:H.x+B.unitMs/B.msPerPixel)-H.x;return e.jsx("rect",{x:H.x,y:0,width:Ee,height:ie,className:"nice-timeline-weekend-band"},`wk-${ve}`)}),ce.map((H,ve)=>e.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:ie,className:H.isMain?"main":"minor"},ve)),g&&xe>=0&&xe<=p&&e.jsx("line",{x1:xe,y1:0,x2:xe,y2:ie,className:"today"}),pe.map((H,ve)=>e.jsx("line",{x1:0,y1:(ve+1)*Z,x2:p,y2:(ve+1)*Z,className:"row-sep"},ve))]}),o.map((H,ve)=>{const be=se(H.date);return be<0||be>p?null:e.jsx("div",{className:`nice-timeline-marker ${H.type||"line"}`,style:{left:be,borderColor:H.color},children:e.jsx("span",{className:"nice-timeline-marker-label",children:H.label})},ve)}),pe.map((H,ve)=>e.jsx("div",{className:"nice-timeline-row",style:{top:ve*Z,height:Z},children:H.events.map((be,Ee)=>{const P=se(be.start),U=be.end?se(be.end):P+10,X=Math.max(U-P,20),ge=be.color||j[Ee%j.length];return P>p||U<0?null:be.type==="milestone"?e.jsx("div",{className:`nice-timeline-milestone ${R?.id===be.id?"hovered":""}`,style:{left:P,borderColor:ge},onClick:()=>f?.(be),onKeyDown:Te(be),onMouseEnter:()=>Q(be),onMouseLeave:te,onFocus:()=>Q(be),onBlur:te,role:"button","aria-label":be.title,title:be.title,children:be.icon||e.jsx(c.NiceIcon,{name:"diamond",size:12})},be.id):e.jsx("div",{className:`nice-timeline-event ${be.type||"event"} ${R?.id===be.id?"hovered":""}`,style:{left:Math.max(P,0),width:X,backgroundColor:ge},onClick:()=>f?.(be),onKeyDown:Te(be),onMouseEnter:()=>Q(be),onMouseLeave:te,onFocus:()=>Q(be),onBlur:te,role:"button","aria-label":be.title,title:be.description||be.title,children:S?S(be):e.jsx("span",{className:"nice-timeline-event-title",children:be.title})},be.id)})},H.id)),g&&xe>=0&&xe<=p&&e.jsx("div",{className:"nice-timeline-today-marker",style:{left:xe},children:e.jsx("span",{children:i("scheduling.today","Today")})})]}),R&&e.jsxs("div",{className:"nice-timeline-tooltip",style:{left:se(R.start)+10},children:[e.jsx("strong",{children:R.title}),R.description&&e.jsx("p",{children:R.description}),e.jsxs("small",{children:[bi(R.start,"MMM d, yyyy HH:mm",T),R.end&&` — ${bi(R.end,"MMM d, yyyy HH:mm",T)}`]})]})]}),b&&e.jsx("div",{className:"nice-timeline-minimap"}),e.jsx("style",{children:`
|
|
4
4
|
.nice-timeline {
|
package/dist/index.d.ts
CHANGED
|
@@ -24344,7 +24344,7 @@ export declare interface NiceTreeContextMenuItem {
|
|
|
24344
24344
|
disabled?: boolean;
|
|
24345
24345
|
}
|
|
24346
24346
|
|
|
24347
|
-
export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
|
|
24347
|
+
export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, contextMenuItems, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
|
|
24348
24348
|
|
|
24349
24349
|
/** What a `checkedSummary` function of {@link NiceTreeGrid} gets. */
|
|
24350
24350
|
export declare interface NiceTreeGridCheckedSummaryInfo<T = NiceTreeGridNode> {
|
|
@@ -24373,6 +24373,19 @@ export declare interface NiceTreeGridCheckInfo<T = NiceTreeGridNode> {
|
|
|
24373
24373
|
halfCheckedKeys: string[];
|
|
24374
24374
|
}
|
|
24375
24375
|
|
|
24376
|
+
/** An entry of a {@link NiceTreeGridProps.contextMenuItems} menu (1.4.5). */
|
|
24377
|
+
export declare interface NiceTreeGridMenuItem {
|
|
24378
|
+
id: string;
|
|
24379
|
+
label?: default_2.ReactNode;
|
|
24380
|
+
/** NiceIcon name. */
|
|
24381
|
+
icon?: string;
|
|
24382
|
+
disabled?: boolean;
|
|
24383
|
+
danger?: boolean;
|
|
24384
|
+
/** A line between entries instead of an entry. */
|
|
24385
|
+
divider?: boolean;
|
|
24386
|
+
onSelect?: () => void;
|
|
24387
|
+
}
|
|
24388
|
+
|
|
24376
24389
|
/** A row node in the {@link NiceTreeGrid} (supports index-signature for dynamic fields). */
|
|
24377
24390
|
export declare interface NiceTreeGridNode {
|
|
24378
24391
|
[field: string]: unknown;
|
|
@@ -24540,6 +24553,12 @@ export declare interface NiceTreeGridProps<T extends NiceTreeGridNode = NiceTree
|
|
|
24540
24553
|
toolbar?: default_2.ReactNode;
|
|
24541
24554
|
/** Called when a row is clicked. */
|
|
24542
24555
|
onRowClick?: (row: T) => void;
|
|
24556
|
+
/**
|
|
24557
|
+
* A row's context menu (1.4.5): opened by a right click, Shift+F10 or the Menu key on the row;
|
|
24558
|
+
* the arrows move in it, Enter picks, Escape closes it and gives focus back to the row. No items,
|
|
24559
|
+
* no menu.
|
|
24560
|
+
*/
|
|
24561
|
+
contextMenuItems?: (row: T) => NiceTreeGridMenuItem[] | undefined;
|
|
24543
24562
|
}
|
|
24544
24563
|
|
|
24545
24564
|
/** A built-in button in the rows of {@link NiceTreeGrid}. */
|