playbook_ui 15.0.0.pre.alpha.stimulusbutton10763 → 15.1.0.pre.alpha.PLAY2320advancedtablepaginationPropsbug10943

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d949c2d669654df8d56ca2863fef4dbdcb143cf8acb4f3a5693eee5c9be68f8
4
- data.tar.gz: 9dbc0f1e5082115203fe7f31c2e80cfd0fa8c23ad3359e09db20e15a51c2f289
3
+ metadata.gz: d6edd8330e8554c8c02e3ef266be3f236979fbfa4f0440553da4dc104c88c6f0
4
+ data.tar.gz: b4482fa2271cf322984be06d70ceee5f8074e9a666c3d9d818e76c36b47ba2cc
5
5
  SHA512:
6
- metadata.gz: d139edd243825c2115465ee24481d84b1dd57db03ea1f9096ccfbda81f42b3e82fefcffa586e668d2a163d2777c61981b152e0985b4c21c4401f85c1c8e83e4d
7
- data.tar.gz: 38ec1c3422f047193fc6604f8f2eb6daee1a5d380ecf1ce663c8e34d4efefc421d72cc9444724f2fa52df90ab7f04013ba95886c304b5925b9915f15168ef106
6
+ metadata.gz: 70b73b6e2683c90f12eea3e21d8c54f2368e344e65f441b363a93eb410cb1211f6b278d37a6d5d22b50b03e441aee812b6c4403818907cf30ae400f883eb8617
7
+ data.tar.gz: 88bb3611125a1eccddc1cf51595d6014c2e4a2ba0bc01844041d4cb9ca16667eb167c08f43967384de7639014d797d2baec95cea6147eb7c372cb2f0a99b39bf
@@ -146,8 +146,6 @@ export function useTableState({
146
146
 
147
147
  // Pagination configuration
148
148
  const paginationInitializer = useMemo(() => {
149
- if (!pagination) return {};
150
-
151
149
  return {
152
150
  getPaginationRowModel: getPaginationRowModel(),
153
151
  paginateExpandedRows: false,
@@ -1,28 +1,30 @@
1
- <br/>
2
- <%= pb_rails("button", props: { text: "Disable Buttons", variant: "link", id: "toggle-disabled-demo" }) %>
3
- <%= pb_rails("button", props: { text: "Enable Buttons", variant: "link", id: "toggle-enabled-demo" }) %>
4
- <br/>
5
- <%= pb_rails("button", props: { text: "I am a Normal Button", id: "normal_managed_button", data:{pb_button_managed: true}, margin_bottom: "lg" }) %>
6
- <br/>
7
- <%= pb_rails("button", props: { text: "I am an <a> Button", id: "a_tag_managed_button", tag:"a", data:{pb_button_managed: true}, link: "http://google.com", margin_right: "lg" }) %>
1
+ <%= pb_rails("body", props: { text: "Click to disable the Buttons below", id: "toggle-disabled-demo", cursor: "pointer", color:"link", margin_bottom:"sm" }) %>
2
+ <%= pb_rails("body", props: { text: "Click to enable the Buttons below", id: "toggle-enabled-demo", cursor: "pointer", color:"link", margin_bottom:"sm" }) %>
8
3
 
4
+ <%= pb_rails("card", props:{display:"flex", flex_direction:"row", justify_content:"center"}) do %>
5
+ <%= pb_rails("button", props: { text: "I am a Button", id: "normal_managed_button", data:{pb_button_managed: true}, margin_right: "lg" }) %>
6
+ <%= pb_rails("button", props: { text: "I am an <a> Button", id: "a_tag_managed_button", tag:"a", data:{pb_button_managed: true}, link: "http://google.com"}) %>
7
+ <% end %>
9
8
  <script>
10
9
  document.addEventListener('DOMContentLoaded', function () {
11
10
  const disableTrigger = document.querySelector('#toggle-disabled-demo')
12
11
  const enableTrigger = document.querySelector('#toggle-enabled-demo')
13
12
 
14
- // Managed Buttons
13
+ // Find the Buttons you want to 'manage'
15
14
  const btn = document.querySelector('#normal_managed_button');
16
15
  const link = document.querySelector('#a_tag_managed_button');
17
16
 
18
17
  disableTrigger.addEventListener('click', (e) => {
19
- // Disable both default button and a tag button
18
+ // Disable default button
20
19
  btn.setAttribute('disabled', true)
20
+ // Disable a tag button
21
21
  link.setAttribute('aria-disabled', 'true')
22
22
  });
23
+
23
24
  enableTrigger.addEventListener('click', (e) => {
24
- // Enable both default button and a tag button
25
+ // Enable default button
25
26
  btn.removeAttribute('disabled')
27
+ // Enable a tag button
26
28
  link.removeAttribute('aria-disabled')
27
29
  });
28
30
  });
@@ -1,5 +1,7 @@
1
- If needing to toggle the disabled state of the Button dynmically, you can now do so in rails using the `pb-button-managed` data attribute.
1
+ If needing to toggle the disabled state of the Button dynamically (for example, within a Turbo or Stimulus context), you can now do so in rails using the `pb-button-managed` data attribute.
2
2
 
3
- If your button has `data:{ pb-button-managed: true }` on it, you can then toggle state via attributes: for buttons set/remove disabled, for links set/remove aria-disabled="true". This will handle disabling the button, preventing clicks as well as all style changes so you don't have to.
3
+ 1) Add the following data attribute to your button kit: `data:{ pb-button-managed: true }`
4
+
5
+ 2) To toggle enabled/disabled state via attributes: for buttons set/remove disabled, for links set/remove aria-disabled="true". This will handle disabling the button, preventing clicks as well as all style changes so you don't have to.
4
6
 
5
7
  Click to enable or disable the buttons above and view the code snippet below for details!
@@ -1,17 +1,20 @@
1
- <%= pb_rails("button", props: { text: "Disable Button", variant: "link", id: "toggle-disabled-demo-with-helper" }) %>
2
- <%= pb_rails("button", props: { text: "Enable Button", variant: "link", id: "toggle-enabled-demo-with-helper" }) %>
1
+ <%= pb_rails("body", props: { text: "Click to disable the Button below", id: "toggle-disabled-demo-with-helper", cursor: "pointer", color:"link", margin_bottom:"sm" }) %>
2
+ <%= pb_rails("body", props: { text: "Click to enable the Button below", id: "toggle-enabled-demo-with-helper", cursor: "pointer", color:"link", margin_bottom:"sm" }) %>
3
3
  <br/>
4
+ <%= pb_rails("card", props:{display:"flex", flex_direction:"row", justify_content:"center"}) do %>
4
5
  <%= pb_rails("button", props: { text: "Watch me Change!", id: "managed_button_with_helper", data:{pb_button_managed: true} }) %>
6
+ <% end %>
5
7
 
6
8
  <script>
7
9
  document.addEventListener('DOMContentLoaded', function () {
8
- const demoBtn = document.querySelector('#managed_button_with_helper')
9
-
10
10
  const disable = document.querySelector('#toggle-disabled-demo-with-helper')
11
11
  const enable = document.querySelector('#toggle-enabled-demo-with-helper')
12
12
 
13
- disable.addEventListener('click', (e) => {demoBtn._pbButton.disable()});
13
+ // Find the Button you want to 'manage'
14
+ const demoBtn = document.querySelector('#managed_button_with_helper')
14
15
 
16
+ // Use the pbButton object created by the kit to call the enable/disable methods
17
+ disable.addEventListener('click', (e) => {demoBtn._pbButton.disable()});
15
18
  enable.addEventListener('click', (e) => {demoBtn._pbButton.enable()});
16
19
 
17
20
  });
@@ -1,5 +1,7 @@
1
1
  The disabled state for the button can also be toggled via small helpers available through the `pb-button-managed` data attribute.
2
2
 
3
- If your button has `data:{ pb-button-managed: true }` on it, you can then toggle state via the provided `_pbButton.disable()` and `_pbButton.enable()` helpers as shoen in the code snippet below.
3
+ 1) Add the following data attribute to your button kit: `data:{ pb-button-managed: true }`
4
4
 
5
- Click to enable or disable the buttons above!
5
+ 2) Toggle state via the provided `_pbButton.disable()` and `_pbButton.enable()` helpers as shown in the code snippet below.
6
+
7
+ Click to enable or disable the buttons above to see this in action!
@@ -56,7 +56,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
56
56
  <Icon
57
57
  aria={{ label: 'loading icon' }}
58
58
  fixedWidth
59
- icon={variant === 'dotted' ? 'spinner' : variant === 'solid' ? 'spinner-solid' : undefined}
59
+ icon={variant === 'dotted' ? 'spinner' : variant === 'solid' ? 'circle-notch' : undefined}
60
60
  pulse
61
61
  />
62
62
  {text}
@@ -20,7 +20,7 @@ module Playbook
20
20
  if variant == "dotted"
21
21
  "spinner"
22
22
  elsif variant == "solid"
23
- "spinner-solid"
23
+ "circle-notch"
24
24
  end
25
25
  end
26
26
  end
@@ -18,7 +18,7 @@ import{r as requireLazysizes}from"./lazysizes-B7xYodB-.js";import{jsx,Fragment,j
18
18
  * LICENSE.md file in the root directory of this source tree.
19
19
  *
20
20
  * @license MIT
21
- */function flexRender(Comp,props){return!Comp?null:isReactComponent(Comp)?React.createElement(Comp,props):Comp}function isReactComponent(component){return isClassComponent(component)||typeof component==="function"||isExoticComponent(component)}function isClassComponent(component){return typeof component==="function"&&(()=>{const proto=Object.getPrototypeOf(component);return proto.prototype&&proto.prototype.isReactComponent})()}function isExoticComponent(component){return typeof component==="object"&&typeof component.$$typeof==="symbol"&&["react.memo","react.forward_ref"].includes(component.$$typeof.description)}function useReactTable(options){const resolvedOptions={state:{},onStateChange:()=>{},renderFallbackValue:null,...options};const[tableRef]=React.useState((()=>({current:createTable(resolvedOptions)})));const[state,setState]=React.useState((()=>tableRef.current.initialState));tableRef.current.setOptions((prev=>({...prev,...options,state:{...state,...options.state},onStateChange:updater=>{setState(updater);options.onStateChange==null||options.onStateChange(updater)}})));return tableRef.current}const displayIcon=icon=>{if(typeof icon==="string"){return[icon,icon]}return icon};const SortIconButton=({header:header,sortIcon:sortIcon,enableSortingRemoval:enableSortingRemoval})=>{const firstIcon=displayIcon(sortIcon)[0];const secondIcon=displayIcon(sortIcon)[1];return jsxs(Fragment,{children:[header.column.getIsSorted()==="desc"&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:firstIcon})},firstIcon),header.column.getIsSorted()==="asc"&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:secondIcon})},secondIcon),header.column.getIsSorted()===false&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:enableSortingRemoval?"arrow-up-arrow-down":secondIcon})},enableSortingRemoval?"arrow-up-arrow-down":secondIcon)]})};const ToggleIconButton=({row:row,onClick:onClick})=>{const{toggleExpansionIcon:toggleExpansionIcon}=useContext(AdvancedTableContext);return jsx("button",{className:"gray-icon toggle-all-icon",onClick:()=>onClick(row),children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:displayIcon(toggleExpansionIcon)[0]})},displayIcon(toggleExpansionIcon)[0])};const findColumnDefByAccessor=(defs,targetAccessor)=>{for(const def of defs){if(def.accessor===targetAccessor){return def}if(Array.isArray(def.columns)&&def.columns.length){const found=findColumnDefByAccessor(def.columns,targetAccessor);if(found)return found}}return void 0};const filterExpandableRows=expandedState=>{for(const expandedRow in expandedState){if(expandedState[expandedRow]===false){delete expandedState[expandedRow]}}return expandedState};const updateExpandAndCollapseState=(tableRows,expanded,targetParent,targetDepth)=>{const updateExpandedRows={};const rows=targetDepth!==void 0?tableRows.flatRows:tableRows.rows;const rowsToToggle=[];for(const row of rows){const shouldBeUpdated=targetDepth!==void 0?row.depth<=targetDepth:targetParent===void 0?row.depth===0:targetParent===row.parentId;if(shouldBeUpdated){rowsToToggle.push(row)}}const anyCollapsed=rowsToToggle.some((row=>!row.getIsExpanded()));const isExpandAction=anyCollapsed;for(const row of rowsToToggle){const shouldUpdate=isExpandAction||targetDepth===void 0?true:row.depth===targetDepth;if(shouldUpdate){updateExpandedRows[row.id]=isExpandAction}}return filterExpandableRows({...expanded,...updateExpandedRows})};const isChrome=()=>{const userAgent=navigator.userAgent.toLowerCase();return userAgent.includes("chrome")&&!userAgent.includes("edg")};const TableHeaderCell=({enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:headerChildren,isPinnedLeft:isPinnedLeft=false,loading:loading,sortIcon:sortIcon,table:table})=>{var _a,_b,_c,_d;const{columnDefinitions:columnDefinitions,expanded:expanded,setExpanded:setExpanded,expandByDepth:expandByDepth,enableSortingRemoval:enableSortingRemoval,onExpandByDepthClick:onExpandByDepthClick,toggleExpansionIcon:toggleExpansionIcon,sortControl:sortControl,responsive:responsive,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,showActionsBar:showActionsBar,stickyLeftColumn:stickyLeftColumn,inlineRowLoading:inlineRowLoading,isActionBarVisible:isActionBarVisible}=useContext(AdvancedTableContext);const toggleSortButton=event=>{if(sortControl){const sortIsDesc=(header==null?void 0:header.column.getIsSorted())==="desc";sortIsDesc?sortControl.onChange({desc:true}):sortControl.onChange({desc:false})}else{header==null?void 0:header.column.getToggleSortingHandler()(event)}};const alignmentMap={left:"start",center:"center",right:"end"};const colDef=header?findColumnDefByAccessor(columnDefinitions,header.column.id):void 0;const headerAlignment=((_a=colDef==null?void 0:colDef.columnStyling)==null?void 0:_a.headerAlignment)??((_b=colDef==null?void 0:colDef.columnStyling)==null?void 0:_b.headerAligment);const isLeafColumn=(header==null?void 0:header.column.getLeafColumns().length)===1&&(header==null?void 0:header.column.getLeafColumns()[0].id)===header.column.id;const columnHasVisibleLeaf=col=>{var _a2;return((_a2=col.getIsVisible)==null?void 0:_a2.call(col))||Array.isArray(col.columns)&&col.columns.some((child=>columnHasVisibleLeaf(child)))};const isLastHeaderCell=(()=>{var _a2;if(!header)return false;if(header.colSpan>1&&header.column.parent!==void 0)return true;const parent=header.column.parent;if(!parent){const topHeaders=table==null?void 0:table.getHeaderGroups()[0].headers.filter((h=>columnHasVisibleLeaf(h.column)));return((_a2=topHeaders==null?void 0:topHeaders.at(-1))==null?void 0:_a2.id)===header.id}const visibleSiblings=parent.columns.filter(columnHasVisibleLeaf);return visibleSiblings.at(-1)===header.column})();const cellClassName=classnames("table-header-cells",`${showActionsBar&&isActionBarVisible&&"header-cells-with-actions"}`,`${isChrome()?"chrome-styles":""}`,`${enableSorting?"table-header-cells-active":""}`,{"pinned-left":responsive==="scroll"&&isPinnedLeft},isLastHeaderCell?"last-header-cell":"",stickyLeftColumn&&stickyLeftColumn.length>0&&isPinnedLeft?"sticky-left":"",((_c=colDef==null?void 0:colDef.columnStyling)==null?void 0:_c.headerPadding)&&`p_${(_d=colDef==null?void 0:colDef.columnStyling)==null?void 0:_d.headerPadding}`);const cellId=`${loading?`loading-${header==null?void 0:header.id}`:`${header==null?void 0:header.id}`}`;const isToggleExpansionEnabledLoading=(header==null?void 0:header.index)===0&&loading&&(enableToggleExpansion==="all"||"header")&&enableToggleExpansion!=="none";const isToggleExpansionEnabled=(header==null?void 0:header.index)===0&&!loading&&(enableToggleExpansion==="all"||"header")&&enableToggleExpansion!=="none";let justifyHeader;if(headerAlignment&&alignmentMap[headerAlignment]){justifyHeader=alignmentMap[headerAlignment]}else if((header==null?void 0:header.index)===0&&hasAnySubRows||(header==null?void 0:header.index)===0&&inlineRowLoading||(header==null?void 0:header.index)===0&&isToggleExpansionEnabled){justifyHeader=enableSorting?"between":"start"}else{justifyHeader=isLeafColumn?"end":"center"}const[showPopover,setShowPopover]=useState(false);const togglePopover=()=>setShowPopover((prev=>!prev));const handleShouldClose=shouldClose=>setShowPopover(!shouldClose);const popoverReference=jsx("div",{className:"gray-icon toggle-all-icon",onClick:togglePopover,children:jsx(Icon,{icon:displayIcon(toggleExpansionIcon)[0]})});const handleExpandDepth=depth=>{if(onExpandByDepthClick){const flatRows=table==null?void 0:table.getRowModel().flatRows;onExpandByDepthClick(depth,flatRows)}const updated=updateExpandAndCollapseState(table.getRowModel(),expanded,void 0,depth);setExpanded(updated)};return jsx("th",{align:headerAlignment?headerAlignment:"right",className:cellClassName,colSpan:header==null?void 0:header.colSpan,id:cellId,style:{left:isPinnedLeft?(header==null?void 0:header.index)===1?"180px":`${header==null?void 0:header.column.getStart("left")}px`:void 0},children:(header==null?void 0:header.isPlaceholder)?null:headerChildren&&(header==null?void 0:header.index)===0?jsxs(Flex,{alignItems:"center",children:[headerChildren,jsx("div",{children:flexRender(header.column.columnDef.header,header.getContext())})]}):jsxs(Flex,{alignItems:"center",justify:justifyHeader,children:[selectableRows&&(header==null?void 0:header.index)===0&&hasAnySubRows&&jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()}),isToggleExpansionEnabled&&hasAnySubRows&&!expandByDepth&&jsx(ToggleIconButton,{onClick:handleExpandOrCollapse}),isToggleExpansionEnabled&&hasAnySubRows&&expandByDepth&&jsx(PbReactPopover,{closeOnClick:"any",placement:"bottom-start",reference:popoverReference,shouldClosePopover:handleShouldClose,show:showPopover,zIndex:3,children:expandByDepth.map(((option,index)=>jsxs(Fragment,{children:[jsx(Flex,{alignItems:"center",className:"pb-advanced-table-popover-option",cursor:"pointer",htmlOptions:{onClick:()=>{handleExpandDepth(option.depth)}},paddingX:"sm",paddingY:"xs",children:option.label}),index!==expandByDepth.length-1&&jsx(SectionSeparator,{})]})))}),isToggleExpansionEnabledLoading&&jsx("div",{className:"loading-toggle-icon header-toggle-icon"}),jsxs(Flex,{className:`${(header==null?void 0:header.index)===0&&enableSorting&&"header-sort-button pb_th_link"} ${(header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())&&"header-sort-secondary-columns"}`,cursor:(header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting?"pointer":"default",...((header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting)&&{htmlOptions:{onClick:event=>toggleSortButton(event),onKeyDown:event=>{if(event.key==="Enter"){toggleSortButton(event)}},tabIndex:0}},justify:(header==null?void 0:header.index)===0&&enableSorting?"between":headerAlignment?alignmentMap[headerAlignment]:"none",paddingLeft:(header==null?void 0:header.index)===0?enableSorting?"xxs":"xs":"none",children:[jsx("div",{children:flexRender(header==null?void 0:header.column.columnDef.header,header==null?void 0:header.getContext())}),((header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting)&&(loading?jsx("div",{className:"loading-toggle-icon"}):jsx(SortIconButton,{enableSortingRemoval:enableSortingRemoval,header:header,sortIcon:sortIcon}))]})]})},`${header==null?void 0:header.id}-header`)};const TableHeader=({children:children,className:className,dark:dark=false,enableSorting:enableSorting=false,id:id,sortIcon:sortIcon=["arrow-up-wide-short","arrow-down-short-wide"],...props})=>{const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,loading:loading,table:table,hasAnySubRows:hasAnySubRows,showActionsBar:showActionsBar,selectableRows:selectableRows,responsive:responsive,headerRef:headerRef,virtualizedRows:virtualizedRows,enableVirtualization:enableVirtualization}=useContext(AdvancedTableContext);const isVirtualized=virtualizedRows||enableVirtualization;const classes=classnames(buildCss("pb_advanced_table_header"),globalProps(props),className);const columnPinning=table.getState().columnPinning;const customCellClassnames=classnames("table-header-cells-custom",`${showActionsBar&&"header-cells-with-actions"}`,`${isChrome()?"chrome-styles":""}`,`${responsive==="scroll"&&"pinned-left"}`);const renderRegularTableHeader=()=>jsx("thead",{className:classes,id:id,children:table.getHeaderGroups().map(((headerGroup,index)=>jsxs("tr",{ref:index===0?headerRef:null,children:[!hasAnySubRows&&selectableRows&&jsx("th",{className:customCellClassnames,children:jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()})}),headerGroup.headers.map((header=>{const isPinnedLeft=columnPinning.left.includes(header.id);return jsx(TableHeaderCell,{enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:children,isPinnedLeft:isPinnedLeft,loading:loading,sortIcon:sortIcon,table:table},`${header.id}-header`)}))]},`${headerGroup.id}-headerGroup`)))});const renderVirtualizedTableHeader=()=>jsx("thead",{className:classes,"data-virtualized":"true",id:id,children:table.getHeaderGroups().map(((headerGroup,index)=>jsxs("tr",{className:"virtualized-header-row-header",ref:index===0?headerRef:null,children:[!hasAnySubRows&&selectableRows&&jsx("th",{className:classnames(customCellClassnames,"virtualized-header-cell"),children:jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()})}),headerGroup.headers.map((header=>{const isPinnedLeft=columnPinning.left.includes(header.id);return jsx(TableHeaderCell,{enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:children,isPinnedLeft:isPinnedLeft,isVirtualized:true,loading:loading,sortIcon:sortIcon,table:table},`${header.id}-header-virtualized`)}))]},`${headerGroup.id}-headerGroup-virtualized`)))});return jsx(Fragment,{children:isVirtualized?renderVirtualizedTableHeader():renderRegularTableHeader()})};const getRowColorClass=(row,inlineRowLoading)=>{var _a;const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a=row.original)==null?void 0:_a.children)&&!row.original.children.length?true:false;const shouldShowExpandedBackground=isExpandable&&(!inlineRowLoading&&row.getCanExpand()||inlineRowLoading&&(rowHasNoChildren||row.getCanExpand()));return row.getIsSelected()?"bg-row-selection":shouldShowExpandedBackground?"bg-silver":"bg-white"};const shouldShowLoadingIndicator=(row,inlineRowLoading,cellAccessorsLength)=>{var _a;const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a=row.original)==null?void 0:_a.children)&&!row.original.children.length?true:false;return isExpandable&&(inlineRowLoading&&rowHasNoChildren)&&row.depth<cellAccessorsLength};const LoadingInline=props=>{const{align:align="left",aria:aria={},className:className,data:data={},dark:dark=false,htmlOptions:htmlOptions={},id:id,text:text2=" Loading",variant:variant="dotted"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss(`pb_loading_inline_kit_${align}`),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Body$1,{color:"light",dark:dark,children:[jsx(Icon,{aria:{label:"loading icon"},fixedWidth:true,icon:variant==="dotted"?"spinner":variant==="solid"?"spinner-solid":void 0,pulse:true}),text2]})})};const CollapsibleTrail=({leftOffset:leftOffset})=>{const style={left:`${leftOffset}em`};return jsx("div",{className:"collapsible-trail",style:style})};const renderCollapsibleTrail=currentDepth=>{const lines=[];for(let i=1;i<=currentDepth;i++){const additionalOffset=i>1?(i-1)*.25:0;const leftOffset=i*1+additionalOffset;lines.push(jsx(CollapsibleTrail,{leftOffset:leftOffset},i))}return lines};const SubRowHeaderRow=({collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:onClick,row:row,subRowHeaders:subRowHeaders,table:table})=>{var _a;const{inlineRowLoading:inlineRowLoading,customSort:customSort,onCustomSortClick:onCustomSortClick}=useContext(AdvancedTableContext);const numberOfColumns=table.getAllFlatColumns().length;const rowHasChildren=row.original.children?true:false;const canExpand=inlineRowLoading?rowHasChildren:row.getCanExpand();const hasSubrowsToSort=(_a=row.getParentRow())==null?void 0:_a.subRows;return jsxs("tr",{className:"custom-row bg-silver",children:[jsxs("td",{className:`custom-row-first-column ${isChrome()?"chrome-styles":""}`,colSpan:1,children:[collapsibleTrail&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("div",{style:{paddingLeft:`${row.depth*1.25}em`},children:jsxs(Flex,{align:"center",columnGap:"xs",justifyContent:customSort&&hasSubrowsToSort&&hasSubrowsToSort.length>1?"between":void 0,children:[jsxs(Flex,{columnGap:"xs",children:[enableToggleExpansion==="all"&&canExpand?jsx(ToggleIconButton,{onClick:onClick,row:row}):null,jsx(Caption,{marginLeft:canExpand?"none":"xs",text:subRowHeaders[row.depth-1]})]}),customSort&&hasSubrowsToSort&&hasSubrowsToSort.length>1&&jsx("button",{"aria-label":"Sort this group",className:"sort-button-icon gray-icon",onClick:()=>{var _a2;onCustomSortClick&&onCustomSortClick((_a2=row.getParentRow())==null?void 0:_a2.subRows)},children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:"sort"})})]})})]}),jsx("td",{colSpan:numberOfColumns-1})]})};const LoadingCell=()=>jsx("div",{className:"loading-cell"});const TableCellRenderer=({row:row,collapsibleTrail:collapsibleTrail=true,loading:loading=false,stickyLeftColumn:stickyLeftColumn,columnPinning:columnPinning,customRowStyle:customRowStyle,columnDefinitions:columnDefinitions,isMultiHeaderColumn:isMultiHeaderColumn=false})=>jsx(Fragment,{children:row.getVisibleCells().map(((cell,i)=>{var _a,_b;const isPinnedLeft=columnPinning.left.includes(cell.column.id);const isLastCell=(()=>{var _a2;if(!isMultiHeaderColumn){return false}const parent=cell.column.parent;if(!parent){const last=row.getVisibleCells().at(-1);return(last==null?void 0:last.column.id)===cell.column.id}const visibleSiblings=parent.columns.filter((col=>col.getIsVisible()));return((_a2=visibleSiblings.at(-1))==null?void 0:_a2.id)===cell.column.id})();const{column:column}=cell;const colDef=findColumnDefByAccessor(columnDefinitions??[],column.id);const cellAlignment=((_a=colDef==null?void 0:colDef.columnStyling)==null?void 0:_a.cellAlignment)??"right";const paddingValue=((_b=colDef==null?void 0:colDef.columnStyling)==null?void 0:_b.cellPadding)??(customRowStyle==null?void 0:customRowStyle.cellPadding);const paddingClass=paddingValue?`p_${paddingValue}`:void 0;return jsxs("td",{align:cellAlignment,className:classnames(`${cell.id}-cell position_relative`,isChrome()?"chrome-styles":"",isPinnedLeft&&"pinned-left",stickyLeftColumn&&stickyLeftColumn.length>0&&isPinnedLeft&&"sticky-left",isLastCell&&"last-cell",paddingClass),style:{left:isPinnedLeft?i===1?"180px":`${column.getStart("left")}px`:void 0,backgroundColor:i===0&&(customRowStyle==null?void 0:customRowStyle.backgroundColor),color:customRowStyle==null?void 0:customRowStyle.fontColor},children:[collapsibleTrail&&i===0&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("span",{id:`${cell.id}-span`,children:loading?jsx(LoadingCell,{}):flexRender(cell.column.columnDef.cell,cell.getContext())})]},`${cell.id}-data`)}))});const RegularTableView=({collapsibleTrail:collapsibleTrail=true,subRowHeaders:subRowHeaders})=>{var _a;const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,inlineRowLoading:inlineRowLoading,loading:loading,table:table,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,stickyLeftColumn:stickyLeftColumn,pinnedRows:pinnedRows,headerHeight:headerHeight,rowHeight:rowHeight,rowStyling:rowStyling=[],sampleRowRef:sampleRowRef}=useContext(AdvancedTableContext);useEffect((()=>{if(stickyLeftColumn&&Array.isArray(stickyLeftColumn)){stickyLeftColumn.forEach((columnId=>{const column=table.getColumn(columnId);if(column&&column.getCanPin()){column.pin("left")}}))}}),[stickyLeftColumn,table]);const columnPinning=table.getState().columnPinning||{left:[]};const columnDefinitions=((_a=table.options.meta)==null?void 0:_a.columnDefinitions)||[];const isMultiHeaderColumn=columnDefinitions.some((obj=>"columns"in obj));function PinnedRow({row:row}){const customRowStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));return jsx("tr",{className:classnames(`pinned-row`),style:{backgroundColor:(customRowStyle==null?void 0:customRowStyle.backgroundColor)?customRowStyle==null?void 0:customRowStyle.backgroundColor:"white",color:customRowStyle==null?void 0:customRowStyle.fontColor,position:"sticky",top:row.getIsPinned()==="top"?`${row.getPinnedIndex()*rowHeight+headerHeight}px`:void 0,zIndex:"3"},children:jsx(TableCellRenderer,{collapsibleTrail:collapsibleTrail,columnDefinitions:columnDefinitions,columnPinning:columnPinning,customRowStyle:customRowStyle,isMultiHeaderColumn:isMultiHeaderColumn,loading:loading,row:row,stickyLeftColumn:stickyLeftColumn})})}const totalRows=pinnedRows?table.getCenterRows():table.getRowModel().rows;return jsxs(Fragment,{children:[pinnedRows&&table.getTopRows().map((row=>jsx(PinnedRow,{row:row},row.id))),totalRows.map(((row,rowIndex)=>{var _a2,_b;const isFirstChildofSubrow=row.depth>0&&row.index===0;const numberOfColumns=table.getAllFlatColumns().length;const isFirstRegularRow=rowIndex===0&&!row.getIsPinned();const customRowStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));const rowColor=getRowColorClass(row,inlineRowLoading||false);const isDataLoading=shouldShowLoadingIndicator(row,inlineRowLoading||false,((_b=(_a2=columnDefinitions[0])==null?void 0:_a2.cellAccessors)==null?void 0:_b.length)||0);return jsxs(React__default.Fragment,{children:[isFirstChildofSubrow&&subRowHeaders&&jsx(SubRowHeaderRow,{collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:handleExpandOrCollapse,row:row,subRowHeaders:subRowHeaders,table:table}),jsxs("tr",{className:`${rowColor} ${row.depth>0?`depth-sub-row-${row.depth}`:""}`,id:`${row.index}-${row.id}-${row.depth}-row`,ref:isFirstRegularRow?sampleRowRef:null,style:{backgroundColor:customRowStyle==null?void 0:customRowStyle.backgroundColor,color:customRowStyle==null?void 0:customRowStyle.fontColor},children:[selectableRows&&!hasAnySubRows&&jsx("td",{className:"checkbox-cell",children:jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()})}),jsx(TableCellRenderer,{collapsibleTrail:collapsibleTrail,columnDefinitions:columnDefinitions,columnPinning:columnPinning,customRowStyle:customRowStyle,isMultiHeaderColumn:isMultiHeaderColumn,loading:loading,row:row,stickyLeftColumn:stickyLeftColumn})]}),isDataLoading&&jsx("tr",{children:jsx("td",{colSpan:numberOfColumns,style:{paddingLeft:`${row.depth===0?.5:row.depth*2}em`},children:jsx(LoadingInline,{})})},`${row.id}-loading-row`)]},`${row.index}-${row.id}-${row.depth}-row`)}))]})};const VirtualizedTableView=({collapsibleTrail:collapsibleTrail=true,subRowHeaders:subRowHeaders,isFetching:isFetching})=>{var _a;const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,inlineRowLoading:inlineRowLoading,loading:loading,table:table,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,virtualizer:virtualizer,flattenedItems:flattenedItems,totalAvailableCount:totalAvailableCount}=useContext(AdvancedTableContext);const columnPinning=table.getState().columnPinning||{left:[]};const sortingState=JSON.stringify(table.getState().sorting||[]);const[columnWidths,setColumnWidths]=useState({});const getHeaderCellWidths=()=>{const widths={};const headerCells=document.querySelectorAll(".table-header-cells, .table-header-cells-custom");if(selectableRows&&!hasAnySubRows&&headerCells.length>0){widths["checkbox"]=`${headerCells[0].getBoundingClientRect().width}px`}table.getFlatHeaders().forEach(((header,index)=>{const headerIndex=selectableRows&&!hasAnySubRows?index+1:index;if(headerCells[headerIndex]){const width=headerCells[headerIndex].getBoundingClientRect().width;widths[header.id]=`${width}px`}}));return widths};const debounce2=(func,wait)=>{let timeout;return function executedFunction(...args){const later=()=>{clearTimeout(timeout);func(...args)};clearTimeout(timeout);timeout=setTimeout(later,wait)}};useLayoutEffect((()=>{const timer=setTimeout((()=>{setColumnWidths(getHeaderCellWidths())}),0);return()=>clearTimeout(timer)}),[table,selectableRows,hasAnySubRows,sortingState]);useEffect((()=>{const handleResize=debounce2((()=>{setColumnWidths(getHeaderCellWidths())}),0);window.addEventListener("resize",handleResize);return()=>{window.removeEventListener("resize",handleResize)}}),[table,selectableRows,hasAnySubRows]);if(!virtualizer||!flattenedItems){return jsx("tr",{children:jsx("td",{colSpan:table.getAllFlatColumns().length||1,children:"No data to display."})})}const virtualItems=((_a=virtualizer.getVirtualItems)==null?void 0:_a.call(virtualizer))||[];if(!virtualItems.length){return jsx("tr",{children:jsx("td",{colSpan:table.getAllFlatColumns().length||1,children:"No items to display."})})}const topLevelRowCount=table.getRowModel().flatRows.filter((row=>row.depth===0)).length;return jsx(Fragment,{children:virtualItems.map((virtualRow=>{const item=flattenedItems[virtualRow.index];if(!item)return null;const virtualItemStyle=getVirtualizedRowStyle(virtualRow.start);if(item.type==="header"){return jsx("tr",{className:"virtualized-table-row virtualized-header-row",style:virtualItemStyle,children:jsx("td",{colSpan:table.getAllFlatColumns().length,children:jsx(SubRowHeaderRow,{collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:handleExpandOrCollapse,row:item.row,subRowHeaders:subRowHeaders,table:table})})},`header-${item.id}-sort-${sortingState}`)}if(item.type==="row"){const row=item.row;const rowColor=getRowColorClass(row,inlineRowLoading||false);return jsxs("tr",{className:`virtualized-table-row ${rowColor} ${row.depth>0?`depth-sub-row-${row.depth}`:""}`,"data-index":virtualRow.index,ref:node=>{if(node){try{virtualizer.measureElement(node)}catch(err){}}},style:virtualItemStyle,children:[selectableRows&&!hasAnySubRows&&jsx("td",{className:"checkbox-cell",style:{width:columnWidths["checkbox"]||"auto"},children:jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()})}),row.getVisibleCells().map(((cell,i)=>{var _a2,_b,_c;const isPinnedLeft=columnPinning.left.includes(cell.column.id);const isLastCell=((_c=(_b=(_a2=cell.column.parent)==null?void 0:_a2.columns)==null?void 0:_b.at(-1))==null?void 0:_c.id)===cell.column.id;const cellWidth=columnWidths[cell.column.id]||"auto";return jsxs("td",{align:"right",className:classnames(`${cell.id}-cell position_relative`,isChrome()?"chrome-styles":"",isPinnedLeft&&"pinned-left",isLastCell&&"last-cell"),style:{width:cellWidth},children:[collapsibleTrail&&i===0&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("span",{id:`${cell.id}-span`,children:loading?jsx(LoadingCell,{}):flexRender(cell.column.columnDef.cell,cell.getContext())})]},`${cell.id}-data`)}))]},`row-${item.id}-sort-${sortingState}`)}if(item.type==="loading"){const row=item.row;const numberOfColumns=table.getAllFlatColumns().length;return jsx("tr",{className:"virtualized-table-row virtualized-loading-row",style:virtualItemStyle,children:jsx("td",{colSpan:numberOfColumns,style:{paddingLeft:`${row.depth===0?.5:row.depth*2}em`},children:jsx(LoadingInline,{})})},`loading-${item.id}-sort-${sortingState}`)}if(item.type==="footer"){return jsx("tr",{className:"virtualized-table-row virtualized-footer",style:virtualItemStyle,children:jsx("td",{colSpan:table.getAllFlatColumns().length,children:jsx(Flex,{align:"center",justify:"center",children:isFetching?jsx(LoadingInline,{}):jsx(Detail,{text:`Showing ${topLevelRowCount} of ${totalAvailableCount} rows`})})})},`footer-row`)}return null}))})};const TableBody=({className:className,collapsibleTrail:collapsibleTrail=true,dark:dark=false,id:id,subRowHeaders:subRowHeaders,isFetching:isFetching,...props})=>{const{responsive:responsive,isPinnedLeft:isPinnedLeft=false,virtualizer:virtualizer,virtualizedRows:virtualizedRows,enableVirtualization:enableVirtualization}=useContext(AdvancedTableContext);const isVirtualized=virtualizedRows||enableVirtualization;const classes=classnames(buildCss("pb_advanced_table_body"),{"pinned-left":responsive==="scroll"&&isPinnedLeft},globalProps(props),className);const style=virtualizer?{height:`${virtualizer.getTotalSize()}px`,position:"relative",width:"100%"}:{};return jsx(Fragment,{children:jsxs("tbody",{className:classes,"data-virtualized":isVirtualized?"true":"false",id:id,style:style,children:[isVirtualized&&virtualizer?jsx(VirtualizedTableView,{collapsibleTrail:collapsibleTrail,isFetching:isFetching,subRowHeaders:subRowHeaders}):jsx(RegularTableView,{collapsibleTrail:collapsibleTrail,subRowHeaders:subRowHeaders}),isVirtualized&&!virtualizer&&jsx("tr",{children:jsx("td",{colSpan:999,style:{padding:"10px",textAlign:"center"},children:jsx("div",{children:"No data to display."})})})]})})};const Pagination=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,current:current=1,onChange:onChange,range:range=5,total:total=1}=props;const[currentPage,setCurrentPage]=useState(current);const handlePageChange=pageNumber=>{if(pageNumber>=1&&pageNumber<=total){setCurrentPage(pageNumber);if(onChange){onChange(pageNumber)}}};const renderPageButtons=()=>{const buttons=[];let rangeStart=Math.max(1,currentPage-Math.floor(range/2));let rangeEnd=Math.min(total,rangeStart+range-1);if(rangeEnd-rangeStart+1<range){if(rangeStart>1){rangeStart=Math.max(1,rangeEnd-range+1)}else{rangeEnd=Math.min(total,rangeStart+range-1)}}if(rangeStart>1){buttons.push(jsx("li",{className:"pagination-number",onClick:()=>handlePageChange(1),children:"1"},1))}if(rangeStart>2){buttons.push(jsx("li",{className:"pagination-number",onClick:()=>handlePageChange(2),children:"2"},2))}for(let i=rangeStart;i<=rangeEnd;i++){buttons.push(jsx("li",{className:`pagination-number ${i===currentPage?"active":""}`,onClick:()=>handlePageChange(i),children:i},i))}if(rangeEnd<total-1){buttons.push(jsx("li",{className:`pagination-number ${total-1===currentPage?"active":""}`,onClick:()=>handlePageChange(total-1),children:total-1},total-1))}if(rangeEnd<total){buttons.push(jsx("li",{className:`pagination-number ${total===currentPage?"active":""}`,onClick:()=>handlePageChange(total),children:total},total))}return buttons};useEffect((()=>{if(current>=1&&current<=total){setCurrentPage(current)}}),[current,total]);const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_paginate"),globalProps(props),className);if(total<=1){return null}return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs("div",{className:"pb_pagination",children:[jsx("li",{className:`pagination-left ${currentPage===1?"disabled":""}`,onClick:()=>handlePageChange(currentPage-1),children:jsx(Icon,{icon:"chevron-left"})}),renderPageButtons(),jsx("li",{className:`pagination-right ${currentPage===total?"disabled":""}`,onClick:()=>handlePageChange(currentPage+1),children:jsx(Icon,{icon:"chevron-right"})})]})})};const TablePagination=({table:table,onChange:onChange,position:position,range:range=5})=>{const current=table.getState().pagination.pageIndex+1;const total=table.getPageCount();return jsx(Pagination,{current:current,marginBottom:position==="top"?"xs":void 0,marginTop:position==="bottom"?"xs":void 0,onChange:onChange,range:range,total:total},`pagination-${position}-${current}`)};const buildVisibilityTree=(defs,allowed)=>defs.map((def=>{const isGroup=Array.isArray(def.columns)&&def.columns.length>0;if(!(allowed==null?void 0:allowed.length)){return isGroup?{id:def.id,label:def.label,children:buildVisibilityTree(def.columns,allowed)}:{id:def.id,label:def.label}}if(allowed.includes(def.id)){return isGroup?{id:def.id,label:def.label,children:buildVisibilityTree(def.columns,null)}:{id:def.id,label:def.label}}if(isGroup){const kids=buildVisibilityTree(def.columns,allowed).filter(Boolean);return kids.length?{id:def.id,label:def.label,children:kids}:null}return null})).filter(Boolean);const showActionBar=elem=>{elem.style.display="block";const height=elem.scrollHeight+"px";elem.style.height=height;elem.classList.add("is-visible");elem.style.overflow="hidden";window.setTimeout((()=>{if(elem.classList.contains("is-visible")){elem.style.height="";elem.style.overflow="visible"}}),300)};const hideActionBar=elem=>{elem.style.height=elem.scrollHeight+"px";elem.offsetHeight;window.setTimeout((()=>{elem.style.height="0";elem.style.overflow="hidden"}),10);window.setTimeout((()=>{elem.classList.remove("is-visible")}),300)};const TableActionBar=({isVisible:isVisible,selectedCount:selectedCount,actions:actions,type:type="row-selection"})=>{var _a;const cardRef=useRef(null);const{table:table,columnVisibilityControl:columnVisibilityControl,columnDefinitions:columnDefinitions}=useContext(AdvancedTableContext);const includeIds=columnVisibilityControl==null?void 0:columnVisibilityControl.includeIds;const firstLeafId=(_a=table.getAllLeafColumns()[0])==null?void 0:_a.id;const tree=buildVisibilityTree(columnDefinitions,includeIds).filter((node=>node.id!==firstLeafId));const renderLeaf=(id,label)=>{const col=table.getColumn(id);const show=col.getIsVisible();const handleVisibilityChange=()=>{col.toggleVisibility();if(columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange){const updatedVisibilityState={...table.getAllColumns().reduce(((acc,col2)=>{acc[col2.id]=col2.getIsVisible();return acc}),{})};columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange(updatedVisibilityState)}};return jsx(Checkbox,{checked:show,onChange:handleVisibilityChange,paddingBottom:"xs",text:label},id)};const gatherLeafIds=node=>node.children&&node.children.length?node.children.flatMap(gatherLeafIds):node.id?[node.id]:[];const renderGroup=node=>{var _a2;const leaves=gatherLeafIds(node);const visibleArray=leaves.map((id=>table.getColumn(id).getIsVisible()));const allOn=visibleArray.every(Boolean);const someOn=visibleArray.some(Boolean);const handleGroupVisibilityChange=()=>{leaves.forEach((id=>table.getColumn(id).toggleVisibility(!allOn)));if(columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange){const updatedVisibilityState={...table.getAllColumns().reduce(((acc,col)=>{acc[col.id]=col.getIsVisible();return acc}),{})};columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange(updatedVisibilityState)}};return jsxs(Fragment,{children:[jsx(Checkbox,{checked:allOn,indeterminate:!allOn&&someOn,onChange:handleGroupVisibilityChange,paddingBottom:"xs",text:node.label}),jsx(Flex,{flexDirection:"column",paddingLeft:"lg",children:(_a2=node==null?void 0:node.children)==null?void 0:_a2.map((child=>child.children?renderGroup(child):renderLeaf(child.id,child.label)))})]})};useEffect((()=>{if(cardRef.current&&type==="row-selection"){if(isVisible){showActionBar(cardRef.current)}else{hideActionBar(cardRef.current)}}}),[isVisible,type]);const[showPopover,setShowPopover]=useState(false);const togglePopover=()=>setShowPopover((prev=>!prev));const handleShouldClose=shouldClose=>setShowPopover(!shouldClose);const popoverReference=jsx(Tooltip,{placement:"top",text:"Column Configuration",children:jsx("div",{onClick:togglePopover,children:jsx(Icon,{color:"primary",cursor:"pointer",icon:"sliders-h"})})});return jsx(Card,{borderNone:!isVisible,className:`${isVisible&&"show-action-card row-selection-actions-card"}`,htmlOptions:{ref:cardRef},padding:`${isVisible?"xs":"none"}`,children:jsx(Flex,{alignItems:"center",justify:type==="row-selection"?"between":"end",children:type==="row-selection"?jsxs(Fragment,{children:[jsxs(Caption,{color:"light",paddingLeft:"xs",size:"xs",children:[selectedCount," Selected"]}),jsx(FlexItem,{children:actions})]}):jsx(PbReactPopover,{closeOnClick:"outside",placement:"bottom-end",reference:popoverReference,shouldClosePopover:handleShouldClose,show:showPopover,zIndex:3,children:jsxs(Fragment,{children:[jsx(Caption,{paddingY:"sm",text:"Columns Config",textAlign:"center"}),jsx(SectionSeparator,{paddingBottom:"xs"}),tree.map((node=>jsx(Flex,{cursor:"pointer",flexDirection:"column",paddingX:"xs",children:node.children?renderGroup(node):renderLeaf(node.id,node.label)},node.id)))]})})})})};const CustomCell=({getValue:getValue,onRowToggleClick:onRowToggleClick,row:row,value:value,customRenderer:customRenderer,selectableRows:selectableRows,customStyle:customStyle={}})=>{const{setExpanded:setExpanded,expanded:expanded,expandedControl:expandedControl,inlineRowLoading:inlineRowLoading,hasAnySubRows:hasAnySubRows}=useContext(AdvancedTableContext);const handleOnExpand=row2=>{onRowToggleClick&&onRowToggleClick(row2);if(!expandedControl){setExpanded({...expanded,[row2.id]:!row2.getIsExpanded()})}};const RowHasChildren=row.original.children?true:false;const renderButton=inlineRowLoading?RowHasChildren:row.getCanExpand();return jsx("div",{style:{paddingLeft:`${row.depth*1.25}em`},children:jsxs(Flex,{alignItems:"center",columnGap:"xs",justify:"start",orientation:"row",children:[selectableRows&&hasAnySubRows&&jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()}),renderButton?jsx("button",{className:"gray-icon expand-toggle-icon",onClick:()=>handleOnExpand(row),style:{color:customStyle==null?void 0:customStyle.expandButtonColor},children:row.getIsExpanded()?jsx(Icon,{cursor:"pointer",icon:"circle-play",rotation:90}):jsx(Icon,{cursor:"pointer",icon:"circle-play"})}):null,jsx(FlexItem,{paddingLeft:renderButton?"none":"xs",children:row.depth===0?customRenderer?customRenderer(row,getValue()):getValue():customRenderer?customRenderer(row,value):value})]})})};const createCellFunction=(cellAccessors,customRenderer,isFirstColumn,onRowToggleClick,selectableRows,rowStyling)=>{const cellRenderer=({row:row,getValue:getValue})=>{const rowData=row.original;const customStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));if(isFirstColumn){switch(row.depth){case 0:{return jsx(CustomCell,{customRenderer:customRenderer,customStyle:customStyle,getValue:getValue,onRowToggleClick:onRowToggleClick,row:row,selectableRows:selectableRows})}default:{const depthAccessor=cellAccessors[row.depth-1];const accessorValue=rowData[depthAccessor];return accessorValue?jsx(CustomCell,{customRenderer:customRenderer,onRowToggleClick:onRowToggleClick,row:row,selectableRows:selectableRows,value:accessorValue}):"N/A"}}}return customRenderer?customRenderer(row,getValue()):getValue()};cellRenderer.displayName="CellRenderer";return cellRenderer};function useTableState({tableData:tableData,columnDefinitions:columnDefinitions,enableSortingRemoval:enableSortingRemoval,expandedControl:expandedControl,sortControl:sortControl,onRowToggleClick:onRowToggleClick,selectableRows:selectableRows,initialLoadingRowsCount:initialLoadingRowsCount=10,loading:loading,pagination:pagination=false,paginationProps:paginationProps,virtualizedRows:virtualizedRows=false,tableOptions:tableOptions,columnVisibilityControl:columnVisibilityControl,pinnedRows:pinnedRows,rowStyling:rowStyling}){var _a,_b;const[localExpanded,setLocalExpanded]=useState({});const[loadingStateRowCount,setLoadingStateRowCount]=useState(initialLoadingRowsCount);const[rowSelection,setRowSelection]=useState({});const[localColumnVisibility,setLocalColumnVisibility]=useState({});const[localRowPinning,setLocalRowPinning]=useState({top:[]});const expanded=expandedControl?expandedControl.value:localExpanded;const setExpanded=expandedControl?expandedControl.onChange:setLocalExpanded;const columnVisibility=columnVisibilityControl&&columnVisibilityControl.value?columnVisibilityControl.value:localColumnVisibility;const setColumnVisibility=columnVisibilityControl&&columnVisibilityControl.onChange?columnVisibilityControl.onChange:setLocalColumnVisibility;const rowPinning=(pinnedRows==null?void 0:pinnedRows.value)??localRowPinning;const onRowPinningChange=(pinnedRows==null?void 0:pinnedRows.onChange)??setLocalRowPinning;const fetchSize=20;const[fullData]=useState(tableData);const[dataChunk,setDataChunk]=useState(fullData.slice(0,fetchSize));const[totalFetched,setTotalFetched]=useState(fetchSize);const[isFetching,setIsFetching]=useState(false);const columnHelper=createColumnHelper();const buildColumns=useCallback(((columnDefinitions2,isRoot=true)=>(columnDefinitions2==null?void 0:columnDefinitions2.map(((column,index)=>{const isFirstColumn=isRoot&&index===0;if(column.columns&&column.columns.length>0){return{header:column.header??column.label??"",id:column.id??column.label??`group-${index}`,columns:buildColumns(column.columns,false)}}const columnStructure={...columnHelper.accessor(column.accessor,{header:column.header??column.label??"",enableSorting:isFirstColumn||column.enableSort===true})};if(column.cellAccessors||column.customRenderer){columnStructure.cell=createCellFunction(column.cellAccessors||[],column.customRenderer,isFirstColumn,onRowToggleClick,selectableRows,rowStyling)}return columnStructure})))||[]),[columnHelper,onRowToggleClick,selectableRows]);const columns=useMemo((()=>buildColumns(columnDefinitions)),[buildColumns,columnDefinitions]);const sorting=useMemo((()=>[{id:columnDefinitions[0].accessor,desc:sortControl&&sortControl.value!==null?!sortControl.value.desc:false}]),[columnDefinitions,sortControl]);const customState=useCallback((()=>({state:{expanded:expanded,...sortControl&&{sorting:sorting},...selectableRows&&{rowSelection:rowSelection},...columnVisibility&&{columnVisibility:columnVisibility},...pinnedRows&&{rowPinning:rowPinning}}})),[expanded,sortControl,sorting,selectableRows,rowSelection,columnVisibility,rowPinning]);const paginationInitializer=useMemo((()=>{if(!pagination)return{};return{getPaginationRowModel:getPaginationRowModel(),paginateExpandedRows:false,initialState:{pagination:{pageIndex:(paginationProps==null?void 0:paginationProps.pageIndex)??0,pageSize:(paginationProps==null?void 0:paginationProps.pageSize)??20}}}}),[pagination,paginationProps]);const table=useReactTable({data:loading?Array(loadingStateRowCount).fill({}):virtualizedRows?dataChunk:tableData,columns:columns,onExpandedChange:setExpanded,getSubRows:row=>row.children,getCoreRowModel:getCoreRowModel(),getExpandedRowModel:getExpandedRowModel(),getSortedRowModel:getSortedRowModel(),enableSortingRemoval:enableSortingRemoval,sortDescFirst:true,onRowSelectionChange:setRowSelection,onRowPinningChange:onRowPinningChange,getRowId:selectableRows||pinnedRows||rowStyling?row=>row.id:void 0,onColumnVisibilityChange:setColumnVisibility,meta:{columnDefinitions:columnDefinitions},...customState(),...paginationInitializer,...tableOptions});useEffect((()=>{var _a2;const topPins=((_a2=pinnedRows==null?void 0:pinnedRows.value)==null?void 0:_a2.top)??[];if(topPins.length===0){onRowPinningChange({top:[]});return}const rows=table.getRowModel().rows;const collectAllDescendantIds=subs=>subs.flatMap((r=>[r.id,...collectAllDescendantIds(r.subRows)]));const allPinned=[];topPins.forEach((id=>{const parent=rows.find((r=>r.id===id&&r.depth===0));if(parent){allPinned.push(parent.id,...collectAllDescendantIds(parent.subRows))}}));onRowPinningChange({top:allPinned})}),[table,(_b=(_a=pinnedRows==null?void 0:pinnedRows.value)==null?void 0:_a.top)==null?void 0:_b.join(",")]);const hasAnySubRows=table.getRowModel().rows.some((row=>row.subRows&&row.subRows.length>0));const selectedRowsLength=Object.keys(table.getState().rowSelection).length;const fetchNextPage=useCallback((()=>{if(isFetching||totalFetched>=fullData.length)return;setIsFetching(true);setTimeout((()=>{const nextChunk=fullData.slice(totalFetched,totalFetched+fetchSize);setDataChunk((prev=>[...prev,...nextChunk]));setTotalFetched((prev=>prev+nextChunk.length));setIsFetching(false)}),500)}),[isFetching,totalFetched,fullData,fetchSize]);const updateLoadingStateRowCount=useCallback((()=>{const rowsCount=table.getRowModel().rows.length;if(rowsCount!==loadingStateRowCount&&rowsCount!==0){setLoadingStateRowCount(rowsCount)}}),[loadingStateRowCount,table]);return{table:table,expanded:expanded,setExpanded:setExpanded,hasAnySubRows:hasAnySubRows,selectedRowsLength:selectedRowsLength,fetchNextPage:fetchNextPage,updateLoadingStateRowCount:updateLoadingStateRowCount,rowSelection:rowSelection,fullData:fullData,totalFetched:totalFetched,isFetching:isFetching}}function useTableActions({table:table,expanded:expanded,setExpanded:setExpanded,onToggleExpansionClick:onToggleExpansionClick,onRowSelectionChange:onRowSelectionChange}){const[bottomReached,setBottomReached]=useState(false);const bottomTimeout=useRef(null);const handleExpandOrCollapse=useCallback((async row=>{if(onToggleExpansionClick)onToggleExpansionClick(row);const updatedExpandedState=await updateExpandAndCollapseState(table.getRowModel(),expanded,row==null?void 0:row.parentId,void 0);setExpanded(updatedExpandedState)}),[expanded,setExpanded,onToggleExpansionClick,table]);const onPageChange=useCallback((page=>{table.setPageIndex(page-1)}),[table]);const fetchMoreOnBottomReached=useCallback(((containerRef,fetchNextPage,isFetching,totalFetched,totalDBRowCount)=>{if(!containerRef||isFetching||totalFetched>=totalDBRowCount)return;const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=containerRef;const distanceFromBottom=scrollHeight-scrollTop-clientHeight;if(distanceFromBottom<50){if(!bottomReached){setBottomReached(true);bottomTimeout.current=setTimeout((()=>{fetchNextPage();setBottomReached(false)}),1e3)}}else{setBottomReached(false);if(bottomTimeout.current){clearTimeout(bottomTimeout.current);bottomTimeout.current=null}}}),[bottomReached]);useEffect((()=>{if(onRowSelectionChange){onRowSelectionChange(table.getState().rowSelection)}}),[table.getState().rowSelection,onRowSelectionChange]);return{handleExpandOrCollapse:handleExpandOrCollapse,onPageChange:onPageChange,fetchMoreOnBottomReached:fetchMoreOnBottomReached}}const AdvancedTable=props=>{const{aria:aria={},actions:actions,children:children,className:className,columnDefinitions:columnDefinitions,columnGroupBorderColor:columnGroupBorderColor,columnVisibilityControl:columnVisibilityControl,customSort:customSort,dark:dark=false,data:data={},enableToggleExpansion:enableToggleExpansion="header",enableSortingRemoval:enableSortingRemoval=false,expandedControl:expandedControl,expandByDepth:expandByDepth,onExpandByDepthClick:onExpandByDepthClick,htmlOptions:htmlOptions={},id:id,initialLoadingRowsCount:initialLoadingRowsCount=10,inlineRowLoading:inlineRowLoading=false,loading:loading,maxHeight:maxHeight,onRowToggleClick:onRowToggleClick,onToggleExpansionClick:onToggleExpansionClick,onCustomSortClick:onCustomSortClick,pagination:pagination=false,paginationProps:paginationProps,pinnedRows:pinnedRows,responsive:responsive="scroll",rowStyling:rowStyling,scrollBarNone:scrollBarNone=false,showActionsBar:showActionsBar=true,selectableRows:selectableRows,sortControl:sortControl,stickyLeftColumn:stickyLeftColumn,tableData:tableData,tableOptions:tableOptions,tableProps:tableProps,toggleExpansionIcon:toggleExpansionIcon="arrows-from-line",onRowSelectionChange:onRowSelectionChange,virtualizedRows:virtualizedRows=false,allowFullScreen:allowFullScreen=false,fullScreenControl:fullScreenControl}=props;const tableWrapperRef=useRef(null);const{table:table,expanded:expanded,setExpanded:setExpanded,hasAnySubRows:hasAnySubRows,selectedRowsLength:selectedRowsLength,fetchNextPage:fetchNextPage,updateLoadingStateRowCount:updateLoadingStateRowCount,fullData:fullData,totalFetched:totalFetched,isFetching:isFetching}=useTableState({tableData:tableData,columnDefinitions:columnDefinitions,enableSortingRemoval:enableSortingRemoval,expandedControl:expandedControl,sortControl:sortControl,onRowToggleClick:onRowToggleClick,selectableRows:selectableRows,initialLoadingRowsCount:initialLoadingRowsCount,loading:loading,pagination:pagination,paginationProps:paginationProps,virtualizedRows:virtualizedRows,tableOptions:tableOptions,columnVisibilityControl:columnVisibilityControl,pinnedRows:pinnedRows,rowStyling:rowStyling});const{handleExpandOrCollapse:handleExpandOrCollapse,onPageChange:onPageChange,fetchMoreOnBottomReached:fetchMoreOnBottomReached}=useTableActions({table:table,expanded:expanded,setExpanded:setExpanded,onToggleExpansionClick:onToggleExpansionClick,onRowSelectionChange:onRowSelectionChange});useEffect((()=>{if(!loading){updateLoadingStateRowCount()}}),[loading,updateLoadingStateRowCount]);useEffect((()=>{fetchMoreOnBottomReached(tableWrapperRef.current,fetchNextPage,isFetching,totalFetched,fullData.length)}),[fetchMoreOnBottomReached,fetchNextPage,isFetching,totalFetched,fullData.length]);const[isFullscreen,setIsFullscreen]=useState(false);const toggleFullscreen=useCallback((()=>{setIsFullscreen((prevState=>!prevState))}),[]);useEffect((()=>{if(allowFullScreen&&fullScreenControl){fullScreenControl({toggleFullscreen:toggleFullscreen,isFullscreen:isFullscreen})}}),[allowFullScreen,fullScreenControl,toggleFullscreen,isFullscreen]);const renderFullscreenHeader=()=>{if(!isFullscreen)return null;const defaultMinimizeIcon=jsx("button",{className:"gray-icon fullscreen-icon",onClick:toggleFullscreen,children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:"arrow-down-left-and-arrow-up-right-to-center",...props})});return jsx(Card,{borderNone:true,borderRadius:"none",className:"advanced-table-fullscreen-header",...props,children:jsx(Flex,{justify:"end",children:defaultMinimizeIcon})})};useEffect((()=>{if(!allowFullScreen)return;const handleKeyDown=event=>{if(event.key==="Escape"&&isFullscreen){event.preventDefault();toggleFullscreen()}};document.addEventListener("keydown",handleKeyDown);return()=>{document.removeEventListener("keydown",handleKeyDown)}}),[allowFullScreen,toggleFullscreen,isFullscreen]);const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const isActionBarVisible=selectableRows&&showActionsBar&&selectedRowsLength>0||columnVisibilityControl;const classes=classnames(buildCss("pb_advanced_table"),`advanced-table-responsive-${responsive}`,maxHeight?`advanced-table-max-height-${maxHeight}`:"",{"advanced-table-fullscreen":isFullscreen,"advanced-table-allow-fullscreen":allowFullScreen,"hidden-action-bar":(selectableRows||columnVisibilityControl)&&!isActionBarVisible},{"advanced-table-sticky-left-columns":stickyLeftColumn&&stickyLeftColumn.length>0},columnGroupBorderColor?`column-group-border-${columnGroupBorderColor}`:"",scrollBarNone?"advanced-table-hide-scrollbar":"",globalProps(props),className);const tableWrapperStyle=virtualizedRows?getVirtualizedContainerStyles(maxHeight):{};const tableElement=jsx(Table,{className:`${loading?"content-loading":""}`,dark:dark,dataTable:true,numberSpacing:"tabular",responsive:"none",...tableProps,children:children?children:jsxs(Fragment,{children:[jsx(TableHeader,{}),jsx(TableBody,{isFetching:isFetching})]})});return jsxs(Fragment,{children:[pagination&&jsx(TablePagination,{onChange:onPageChange,position:"top",range:paginationProps==null?void 0:paginationProps.range,table:table}),jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,onScroll:virtualizedRows?e=>fetchMoreOnBottomReached(e.currentTarget,fetchNextPage,isFetching,totalFetched,fullData.length):void 0,ref:tableWrapperRef,style:tableWrapperStyle,children:[renderFullscreenHeader(),jsx(AdvancedTableProvider,{columnDefinitions:columnDefinitions,columnGroupBorderColor:columnGroupBorderColor,columnVisibilityControl:columnVisibilityControl,customSort:customSort,enableSortingRemoval:enableSortingRemoval,enableToggleExpansion:enableToggleExpansion,enableVirtualization:virtualizedRows,expandByDepth:expandByDepth,expanded:expanded,expandedControl:expandedControl,handleExpandOrCollapse:handleExpandOrCollapse,hasAnySubRows:hasAnySubRows,inlineRowLoading:inlineRowLoading,isActionBarVisible:isActionBarVisible,isFullscreen:isFullscreen,loading:loading,onCustomSortClick:onCustomSortClick,onExpandByDepthClick:onExpandByDepthClick,pinnedRows:pinnedRows,responsive:responsive,rowStyling:rowStyling,selectableRows:selectableRows,setExpanded:setExpanded,showActionsBar:showActionsBar,sortControl:sortControl,stickyLeftColumn:stickyLeftColumn,subRowHeaders:tableOptions==null?void 0:tableOptions.subRowHeaders,table:table,tableContainerRef:tableWrapperRef,toggleExpansionIcon:toggleExpansionIcon,totalAvailableCount:fullData.length,virtualizedRows:virtualizedRows,children:jsxs(React__default.Fragment,{children:[jsx(TableActionBar,{actions:actions,isVisible:isActionBarVisible,selectedCount:selectedRowsLength,type:columnVisibilityControl?"column-visibility":"row-selection"}),virtualizedRows?jsx("div",{style:{overflow:"auto",width:"100%"},children:tableElement}):tableElement]})})]}),pagination&&jsx(TablePagination,{onChange:onPageChange,position:"bottom",range:paginationProps==null?void 0:paginationProps.range,table:table})]})};AdvancedTable.Header=TableHeader;AdvancedTable.Body=TableBody;const BreadCrumbItem=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,component:component="a",...rest}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const Component=component||"span";const css=classnames(buildCss("pb_bread_crumb_item_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:css,id:id,children:jsx(Component,{className:"pb_bread_crumb_item",...domSafeProps(rest)})})};const BreadCrumbs=props=>{const{aria:aria={label:"Breadcrumb Navigation"},className:className,data:data={},htmlOptions:htmlOptions={},id:id,children:children}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const css=classnames(buildCss("pb_bread_crumbs_kit"),globalProps(props),className);return jsx("nav",{...ariaProps,...dataProps,...htmlProps,className:css,id:id,children:children})};const ButtonToolbar=props=>{const{aria:aria={},children:children,className:className,data:data={},htmlOptions:htmlOptions={},id:id,orientation:orientation="horizontal",text:text2,variant:variant="primary"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_button_toolbar_kit",orientation,variant),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:children||text2})};const contactTypeMap={cell:"mobile",email:"envelope",extension:"phone-plus",home:"phone",work:"phone-office","work-cell":"phone-laptop","wrong-phone":"phone-slash",international:"globe"};const envelopeIcon=getAllIcons()["envelope"].icon;const formatContact=(contactString,contactType)=>{if(contactType==="email")return contactString;if(contactType==="international")return contactString;const cleaned=contactString.replace(/\D/g,"");const phoneNumber=cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);if(contactType==="extension"){return cleaned.match(/^\d{4}$/)}if(phoneNumber){const intlCode=phoneNumber[1]?"+1 ":"";return[intlCode,"(",phoneNumber[2],") ",phoneNumber[3],"-",phoneNumber[4]].join("")}return null};const Contact=props=>{const{aria:aria={},className:className,contactDetail:contactDetail,contactType:contactType,contactValue:contactValue,data:data={},dark:dark=false,htmlOptions:htmlOptions={},id:id}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_contact_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Body$1,{className:"pb_contact_kit",color:"light",dark:dark,tag:"span",children:[contactType==="email"?jsx(Icon,{className:"svg-inline--fa envelope",customIcon:envelopeIcon,dark:dark,fixedWidth:true}):jsx(Icon,{dark:dark,fixedWidth:true,icon:contactTypeMap[contactType]||"phone"}),` ${formatContact(contactValue,contactType)} `,contactDetail&&jsx(Caption,{dark:dark,size:"xs",tag:"span",text:contactDetail})]})})};const CopyButton=props=>{const{aria:aria={},className:className,data:data={},from:from="",id:id,text:text2="Copy",timeout:timeout=1e3,tooltipPlacement:tooltipPlacement="bottom",tooltipText:tooltipText="Copied!",value:value=""}=props;const[copied,copy]=usePBCopy({value:value,from:from,timeout:timeout});const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const classes=classnames(buildCss("pb_copy_button_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,className:classes,id:id,children:jsx(Tooltip,{forceOpenTooltip:copied,placement:tooltipPlacement,showTooltip:false,text:tooltipText,children:jsx(Button,{icon:"copy",onClick:copy,children:text2})})})};const sizes$1={lg:1,md:3,sm:4};const Currency=props=>{const{abbreviate:abbreviate=false,align:align="left",aria:aria={},amount:amount,data:data={},decimals:decimals="default",emphasized:emphasized=true,htmlOptions:htmlOptions={},id:id,unit:unit,className:className,label:label="",nullDisplay:nullDisplay="",size:size="sm",symbol:symbol="$",variant:variant="default",dark:dark=false,unstyled:unstyled=false,commaSeparator:commaSeparator=false}=props;const emphasizedClass=emphasized?"":"_deemphasized";let variantClass;if(variant==="light"){variantClass="_light"}else if(variant==="bold"){variantClass="_bold"}const[whole,decimal="00"]=amount.split(".");const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_currency_kit",align,size),globalProps(props),className);const getFormattedNumber=input=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}).format(input);const getAbbreviatedValue=abbrType=>{const num=`${getFormattedNumber(whole.split(",").join(""))}`,isAmount=abbrType==="amount",isUnit=abbrType==="unit";return isAmount?num.slice(0,-1):isUnit?num.slice(-1):""};const getMatchingDecimalAmount=decimals==="matching"?amount:whole;const getMatchingDecimalValue=decimals==="matching"?"":`.${decimal}`;const formatAmount=amount2=>{if(!commaSeparator)return amount2;const[wholePart,decimalPart]=amount2.split(".");const formattedWhole=new Intl.NumberFormat("en-US").format(parseInt(wholePart));return decimalPart?`${formattedWhole}.${decimalPart}`:formattedWhole};const swapNegative=size==="sm"&&symbol!=="";const handleNegative=amount.startsWith("-")&&swapNegative?"-":"";const getAbsoluteAmount=amountString=>amountString.replace(/^-/,"");const getAbbrOrFormatAmount=abbreviate?getAbbreviatedValue("amount"):formatAmount(getMatchingDecimalAmount);const getAmount=swapNegative?getAbsoluteAmount(getAbbrOrFormatAmount):getAbbrOrFormatAmount;const getAbbreviation=abbreviate?getAbbreviatedValue("unit"):null;const getDecimalValue=abbreviate?"":getMatchingDecimalValue;return jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:[jsx(Caption,{dark:dark,children:label}),jsx("div",{className:`pb_currency_wrapper${variantClass||emphasizedClass}`,children:unstyled?nullDisplay&&!amount?jsx("div",{children:nullDisplay}):jsxs(Fragment,{children:[jsxs("div",{children:[handleNegative,symbol]}),jsx("div",{children:getAmount}),jsxs("div",{children:[getAbbreviation,unit?unit:getDecimalValue]})]}):nullDisplay&&!amount?jsx(Title,{className:"pb_currency_value",dark:dark,size:sizes$1[size],children:nullDisplay}):jsxs(Fragment,{children:[jsxs(Body$1,{className:"dollar_sign",color:"light",dark:dark,children:[handleNegative,symbol]}),jsx(Title,{className:"pb_currency_value",dark:dark,size:sizes$1[size],children:getAmount}),jsxs(Body$1,{className:"unit",color:"light",dark:dark,children:[getAbbreviation,unit?unit:getDecimalValue]})]})})]})};const statusMap={increase:"positive",decrease:"negative",neutral:"neutral"};const iconMap$1={increase:"arrow-up",decrease:"arrow-down"};const StatChange=props=>{const{change:change="neutral",className:className,dark:dark=false,htmlOptions:htmlOptions={},icon:icon,id:id,value:value}=props;const status=statusMap[change];let returnedIcon=iconMap$1[change];if(icon){returnedIcon=icon}const htmlProps=buildHtmlProps(htmlOptions);return jsx(Fragment,{children:value&&jsx("div",{className:classnames(buildCss("pb_stat_change_kit",status),globalProps(props),className),id:id,...htmlProps,children:jsxs(Body$1,{dark:dark,status:status,children:[" ",returnedIcon&&jsxs(Fragment,{children:[jsx(Icon,{dark:dark,fixed_width:true,icon:returnedIcon})," "]}),`${value}%`]})})})};const StatValue=props=>{const{className:className,htmlOptions:htmlOptions={},id:id,unit:unit,value:value=0}=props;const htmlProps=buildHtmlProps(htmlOptions);const displayValue=function(value2){if(value2||value2===0){return jsx(Title,{size:1,tag:"span",text:`${value2}`})}};const displayUnit=function(unit2){if(unit2){return jsx(Title,{size:3,tag:"span",text:unit2})}};return jsx("div",{className:classnames("pb_stat_value_kit",globalProps(props),className),id:id,...htmlProps,children:jsxs("div",{className:"pb_stat_value_wrapper",children:[displayValue(value)," ",displayUnit(unit)]})})};const DashboardValue=props=>{const{align:align="left",aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,statChange:statChange={},statLabel:statLabel,statValue:statValue={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_dashboard_value_kit",align),globalProps(props),className);return jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:[statLabel&&jsx(Body$1,{color:"light",children:statLabel}),statValue&&jsx(StatValue,{unit:statValue.unit,value:statValue.value}),statChange&&jsx(StatChange,{change:statChange.change,value:statChange.value})]})};const PbDate=props=>{const{aria:aria={},alignment:alignment="left",className:className,dark:dark=false,data:data={},htmlOptions:htmlOptions={},id:id,showDayOfWeek:showDayOfWeek=false,showCurrentYear:showCurrentYear=false,showIcon:showIcon=false,size:size="md",unstyled:unstyled=false,value:value}=props;const weekday=DateTime$1.toWeekday(value);const month=DateTime$1.toMonth(value);const day=DateTime$1.toDay(value);const year=DateTime$1.toYear(value);const currentYear=(new Date).getFullYear();const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_date_kit",alignment),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:unstyled?jsxs(Fragment,{children:[showIcon&&jsx("div",{children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt"})}),showDayOfWeek&&jsxs(Fragment,{children:[jsx("div",{children:weekday}),jsx("div",{children:"•"})]}),jsxs("span",{children:[jsxs("span",{children:[month," ",day]}),(currentYear!==year||showCurrentYear)&&jsx("span",{children:`, ${year}`})]})]}):size=="md"||size=="lg"?jsxs(Title,{dark:dark,size:4,tag:"h4",children:[showIcon&&jsx(Body$1,{className:"pb_icon_kit_container",color:"light",tag:"span",children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt"})}),showDayOfWeek&&jsxs(Fragment,{children:[weekday,jsx(Body$1,{color:"light",tag:"span",text:" • "})]}),jsxs("span",{children:[month," ",day]}),(currentYear!==year||showCurrentYear)&&jsx("span",{children:`, ${year}`})]}):jsxs(Fragment,{children:[showIcon&&jsx(Caption,{className:"pb_icon_kit_container",dark:dark,tag:"span",children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt",size:"sm"})}),showDayOfWeek&&jsxs(Fragment,{children:[jsx(Caption,{dark:dark,tag:"div",children:weekday}),jsx(Caption,{color:"light",dark:dark,tag:"div",text:" • "})]}),jsxs(Caption,{dark:dark,tag:"span",children:[month," ",day,(currentYear!==year||showCurrentYear)&&jsx(Fragment,{children:`, ${year}`})]})]})})};const DatePicker=props=>{if(props.plugins);const{allowInput:allowInput=false,aria:aria={},className:className,customQuickPickDates:customQuickPickDates,dark:dark=false,data:data={},defaultDate:defaultDate="",disableDate:disableDate=null,disableInput:disableInput,disableRange:disableRange=null,disableWeekdays:disableWeekdays=null,enableTime:enableTime=false,error:error,format:format="m/d/Y",hideIcon:hideIcon=false,hideLabel:hideLabel=false,htmlOptions:htmlOptions={},id:id,initializeOnce:initializeOnce=false,inLine:inLine=false,inputAria:inputAria={},inputData:inputData={},inputOnChange:inputOnChange,inputValue:inputValue,label:label="Date Picker",maxDate:maxDate,minDate:minDate,mode:mode="single",name:name,onChange:onChange=()=>{},onClose:onClose,pickerId:pickerId,placeholder:placeholder="Select Date",plugins:plugins=false,position:position,positionElement:positionElement,scrollContainer:scrollContainer,selectionType:selectionType="",showTimezone:showTimezone=false,staticPosition:staticPosition=true,thisRangesEndToday:thisRangesEndToday=false,yearRange:yearRange=[1900,2100],controlsStartId:controlsStartId,controlsEndId:controlsEndId,syncStartWith:syncStartWith,syncEndWith:syncEndWith}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const inputAriaProps=buildAriaProps(inputAria);const inputDataProps=buildDataProps(inputData);const getCursorStyle=cursor=>{if(disableInput)return"not-allowed";if(cursor){return camelToSnakeCase(cursor).replace(/_/g,"-")}return"pointer"};useEffect((()=>{datePickerHelper({allowInput:allowInput,customQuickPickDates:customQuickPickDates,defaultDate:defaultDate,disableDate:disableDate,disableRange:disableRange,disableWeekdays:disableWeekdays,enableTime:enableTime,format:format,maxDate:maxDate,minDate:minDate,mode:mode,onChange:onChange,onClose:onClose,pickerId:pickerId,plugins:plugins,position:position,positionElement:positionElement,selectionType:selectionType,showTimezone:showTimezone,staticPosition:staticPosition,thisRangesEndToday:thisRangesEndToday,yearRange:yearRange,controlsStartId:controlsStartId,controlsEndId:controlsEndId,syncStartWith:syncStartWith,syncEndWith:syncEndWith,required:false},scrollContainer)}),initializeOnce?[]:void 0);const filteredProps={...props};if(filteredProps.marginBottom===void 0){filteredProps.marginBottom="sm"}filteredProps==null?true:delete filteredProps.position;const classes=classnames(buildCss("pb_date_picker_kit"),globalProps(filteredProps),error?"error":null,className);const iconWrapperClass=()=>{let base="cal_icon_wrapper";if(dark){base+=" dark"}if(hideLabel){base+=" no_label_shift"}if(error){base+=" error"}return base};const angleDown=getAllIcons()["angleDown"].icon;return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs("div",{...inputAriaProps,...inputDataProps,className:"input_wrapper",children:[!hideLabel&&jsx(Caption,{className:"pb_date_picker_kit_label",text:label}),jsxs(Fragment,{children:[jsxs("div",{className:"date_picker_input_wrapper",children:[jsx("input",{autoComplete:"off",className:"date_picker_input",disabled:disableInput,id:pickerId,name:name,onChange:inputOnChange,placeholder:placeholder,style:{cursor:getCursorStyle(filteredProps.cursor)},value:inputValue}),error&&jsx(Body$1,{status:"negative",text:error,variant:null})]}),!hideIcon&&jsx("div",{className:iconWrapperClass(),id:`cal-icon-${pickerId}`,children:jsx(Icon,{className:"cal_icon",icon:"calendar-alt"})}),hideIcon&&inLine?jsxs("div",{children:[jsx("div",{className:`${iconWrapperClass()} date-picker-inline-icon-plus`,id:`${pickerId}-icon-plus`,children:jsx(Icon,{className:"date-picker-plus-icon",icon:"plus"})}),jsx("div",{className:`${iconWrapperClass()} date-picker-inline-angle-down`,id:`${pickerId}-angle-down`,children:jsx(Icon,{className:"angle_down_icon svg-inline--fa",customIcon:angleDown})})]}):null]})]})})};const dateTimestamp$1=(dateValue,includeYear)=>{if(includeYear){return`${DateTime$1.toMonth(dateValue)} ${DateTime$1.toDay(dateValue)}, ${DateTime$1.toYear(dateValue)}`}else{return`${DateTime$1.toMonth(dateValue)} ${DateTime$1.toDay(dateValue)}`}};const dateTimeIso$1=dateValue=>DateTime$1.toIso(dateValue);const DateRangeInline=props=>{const{align:align="left",className:className,dark:dark=false,data:data={},endDate:endDate,htmlOptions:htmlOptions={},icon:icon=false,size:size="sm",startDate:startDate}=props;const dateInCurrentYear=()=>{const currentDate=new Date;return(startDate==null?void 0:startDate.getFullYear())===(endDate==null?void 0:endDate.getFullYear())&&(startDate==null?void 0:startDate.getFullYear())===currentDate.getFullYear()};const dateRangeClasses=buildCss("pb_date_range_inline_kit",align);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const renderTime=date=>jsx("time",{dateTime:dateTimeIso$1(date),children:dateInCurrentYear()?` ${dateTimestamp$1(date,false)} `:` ${dateTimestamp$1(date,true)} `});return jsx("div",{...dataProps,...htmlProps,className:classnames(dateRangeClasses,globalProps(props),className),children:jsxs("div",{className:"pb_date_range_inline_wrapper",children:[size==="xs"&&jsxs(Fragment,{children:[icon&&jsx(Caption,{dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_icon",dark:dark,fixedWidth:true,icon:"calendar-alt",size:size,tag:"span"})}),jsx(Caption,{dark:dark,tag:"span",children:renderTime(startDate)}),jsx(Caption,{dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_arrow",dark:dark,fixedWidth:true,icon:"long-arrow-right",tag:"span"})}),jsx(Caption,{dark:dark,tag:"span",children:renderTime(endDate)})]}),size==="sm"&&jsxs(Fragment,{children:[icon&&jsx(Body$1,{color:"light",dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_icon",dark:dark,fixedWidth:true,icon:"calendar-alt",size:size,tag:"span"})}),jsx(Body$1,{dark:dark,tag:"span",children:renderTime(startDate)}),jsx(Body$1,{color:"light",dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_arrow",dark:dark,fixedWidth:true,icon:"long-arrow-right",tag:"span"})}),jsx(Body$1,{dark:dark,tag:"span",children:renderTime(endDate)})]})]})})};const DateYearStacked=props=>{const{align:align="left",className:className,dark:dark=false,date:date,data:data={},htmlOptions:htmlOptions={}}=props;const css=classnames(buildCss("pb_date_year_stacked",align),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsxs("div",{...dataProps,...htmlProps,className:css,children:[jsx(Title,{dark:dark,size:4,text:`${DateTime$1.toDay(date)} ${DateTime$1.toMonth(date).toUpperCase()}`}),jsx(Body$1,{color:"light",children:DateTime$1.toYear(date)})]})};const DateRangeStacked=props=>{const{className:className,dark:dark=false,endDate:endDate,htmlOptions:htmlOptions={},startDate:startDate,data:data={}}=props;const css=classnames(buildCss("pb_date_range_stacked"),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx("div",{...dataProps,...htmlProps,className:css,children:jsxs(Flex,{vertical:"center",children:[jsx(FlexItem,{children:jsx(DateYearStacked,{align:"right",dark:dark,date:startDate})}),jsx(FlexItem,{children:jsx("div",{children:jsx(Body$1,{color:"light",tag:"span",children:jsx(Icon,{className:"pb_date_range_stacked_arrow",fixedWidth:true,icon:"long-arrow-right"})})})}),jsx(FlexItem,{children:jsx(DateYearStacked,{dark:dark,date:endDate})})]})})};const sizes={sm:4,md:3};const DateStacked=props=>{const{align:align="left",bold:bold=false,reverse:reverse=false,className:className,dark:dark=false,date:date,data:data={},htmlOptions:htmlOptions={},size:size="sm"}=props;const classes=classnames(buildCss("pb_date_stacked_kit",align,size,{dark:dark,reverse:reverse}),globalProps(props),className);const currentYear=(new Date).getFullYear();const inputYear=DateTime$1.toYear(date);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx(Fragment,{children:bold==false?jsxs("div",{...dataProps,...htmlProps,className:classes,children:[jsxs("div",{className:"pb_date_stacked_day_month",children:[jsx(Caption,{text:DateTime$1.toMonth(date).toUpperCase()}),jsx(Title,{dark:dark,size:sizes[size],text:DateTime$1.toDay(date).toString()})]}),currentYear!=inputYear&&jsx(Caption,{size:"xs",children:inputYear})]}):jsx("div",{...dataProps,...htmlProps,className:classes,children:jsxs("div",{className:"pb_date_stacked_day_month",children:[jsx(Title,{bold:true,dark:dark,size:"4",text:DateTime$1.toMonth(date)}),jsx(Title,{bold:true,dark:dark,size:"4",text:DateTime$1.toDay(date).toString()}),currentYear!=inputYear&&jsx(Title,{size:"4",children:inputYear})]})})})};const Time=props=>{const{align:align,className:className,date:date,htmlOptions:htmlOptions={},showIcon:showIcon,size:size,timeZone:timeZone,unstyled:unstyled=false,showTimezone:showTimezone=true}=props;const classes=classnames(buildCss("pb_time_kit",align,size),globalProps(props),className);const clockIcon=getAllIcons()["clock"];const htmlProps=buildHtmlProps(htmlOptions);return jsxs("div",{...htmlProps,className:classes,children:[showIcon&&(unstyled?jsxs("span",{children:[jsx(Icon,{className:"svg-inline--fa clock",customIcon:clockIcon.icon})," "]}):jsx(Fragment,{children:jsxs(Body$1,{color:"light",tag:"span",children:[jsx(Icon,{className:"svg-inline--fa clock",customIcon:clockIcon.icon,fixedWidth:true,size:size==="md"?"":"sm"})," "]})})),jsx("time",{dateTime:date.toLocaleString(),children:jsx("span",{children:unstyled?jsxs(Fragment,{children:[jsx("span",{children:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx("span",{children:DateTime$1.toTimeZone(date,timeZone)})]}):size==="md"?jsxs(Fragment,{children:[jsx(Body$1,{className:"pb_time",tag:"span",text:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx(Body$1,{color:"light",tag:"span",text:DateTime$1.toTimeZone(date,timeZone)})]}):jsxs(Fragment,{children:[jsx(Caption,{color:"light",tag:"span",text:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx(Caption,{color:"light",tag:"span",text:DateTime$1.toTimeZone(date,timeZone)})]})})})]})};const DateTime=props=>{const{align:align="left",aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},showDayOfWeek:showDayOfWeek=false,datetime:datetime2,id:id,showIcon:showIcon=false,size:size="md",timeZone:timeZone="America/New_York"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_date_time",size),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Flex,{horizontal:align,vertical:"baseline",children:[jsx(PbDate,{showDayOfWeek:showDayOfWeek,size:size,value:datetime2}),jsx(Time,{date:datetime2,marginLeft:"sm",showIcon:showIcon,size:size,timeZone:timeZone})]})})};const TimeStackedDefault=props=>{if(props.date);const{align:align="left",className:className,dark:dark,data:data={},date:date,htmlOptions:htmlOptions={},time:time,timeZone:timeZone}=props;const classes=classnames(buildCss("pb_time_stacked_kit",align),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx("div",{className:classes,...dataProps,...htmlProps,children:jsx(Body$1,{className:classnames("pb_time_stacked","time-spacing"),color:"light",dark:dark,children:jsxs("time",{children:[DateTime$1.toTimeWithMeridiem(date?date:new Date(time),timeZone),jsx(Caption,{className:"pb_time_stacked",color:"light",dark:dark,tag:"span",text:DateTime$1.toTimeZone(date?date:new Date(time),timeZone)})]})})})};const DateTimeStacked=props=>{if(props.date);const{date:date,datetime:datetime2,dark:dark,htmlOptions:htmlOptions={},timeZone:timeZone="America/New_York"}=props;const classes=buildCss("pb_date_time_stacked_kit",globalProps(props));const htmlProps=buildHtmlProps(htmlOptions);return jsxs(Flex,{inline:false,vertical:"stretch",...htmlProps,...props,children:[jsx(FlexItem,{children:jsx(DateStacked,{align:"right",bold:true,dark:dark,date:date||datetime2})}),jsx(SectionSeparator,{className:"date-time-padding",orientation:"vertical"}),jsx(FlexItem,{children:jsx(TimeStackedDefault,{className:classes,dark:dark,date:date||datetime2,timeZone:timeZone})})]})};var lib={exports:{}};var Modal$1={};var propTypes={exports:{}};var ReactPropTypesSecret_1;var hasRequiredReactPropTypesSecret;function requireReactPropTypesSecret(){if(hasRequiredReactPropTypesSecret)return ReactPropTypesSecret_1;hasRequiredReactPropTypesSecret=1;var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";ReactPropTypesSecret_1=ReactPropTypesSecret;return ReactPropTypesSecret_1}var factoryWithThrowingShims;var hasRequiredFactoryWithThrowingShims;function requireFactoryWithThrowingShims(){if(hasRequiredFactoryWithThrowingShims)return factoryWithThrowingShims;hasRequiredFactoryWithThrowingShims=1;var ReactPropTypesSecret=requireReactPropTypesSecret();function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;factoryWithThrowingShims=function(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){return}var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}shim.isRequired=shim;function getShim(){return shim}var ReactPropTypes={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes};return factoryWithThrowingShims}var hasRequiredPropTypes;function requirePropTypes(){if(hasRequiredPropTypes)return propTypes.exports;hasRequiredPropTypes=1;{propTypes.exports=requireFactoryWithThrowingShims()()}return propTypes.exports}var ModalPortal={exports:{}};var focusManager={};var tabbable={exports:{}};var hasRequiredTabbable;function requireTabbable(){if(hasRequiredTabbable)return tabbable.exports;hasRequiredTabbable=1;(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.default=findTabbableDescendants;
21
+ */function flexRender(Comp,props){return!Comp?null:isReactComponent(Comp)?React.createElement(Comp,props):Comp}function isReactComponent(component){return isClassComponent(component)||typeof component==="function"||isExoticComponent(component)}function isClassComponent(component){return typeof component==="function"&&(()=>{const proto=Object.getPrototypeOf(component);return proto.prototype&&proto.prototype.isReactComponent})()}function isExoticComponent(component){return typeof component==="object"&&typeof component.$$typeof==="symbol"&&["react.memo","react.forward_ref"].includes(component.$$typeof.description)}function useReactTable(options){const resolvedOptions={state:{},onStateChange:()=>{},renderFallbackValue:null,...options};const[tableRef]=React.useState((()=>({current:createTable(resolvedOptions)})));const[state,setState]=React.useState((()=>tableRef.current.initialState));tableRef.current.setOptions((prev=>({...prev,...options,state:{...state,...options.state},onStateChange:updater=>{setState(updater);options.onStateChange==null||options.onStateChange(updater)}})));return tableRef.current}const displayIcon=icon=>{if(typeof icon==="string"){return[icon,icon]}return icon};const SortIconButton=({header:header,sortIcon:sortIcon,enableSortingRemoval:enableSortingRemoval})=>{const firstIcon=displayIcon(sortIcon)[0];const secondIcon=displayIcon(sortIcon)[1];return jsxs(Fragment,{children:[header.column.getIsSorted()==="desc"&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:firstIcon})},firstIcon),header.column.getIsSorted()==="asc"&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:secondIcon})},secondIcon),header.column.getIsSorted()===false&&jsx("div",{className:"sort-button-icon",style:{paddingLeft:`${(header==null?void 0:header.index)===0?"2px":"4px"}`},children:jsx(Icon,{icon:enableSortingRemoval?"arrow-up-arrow-down":secondIcon})},enableSortingRemoval?"arrow-up-arrow-down":secondIcon)]})};const ToggleIconButton=({row:row,onClick:onClick})=>{const{toggleExpansionIcon:toggleExpansionIcon}=useContext(AdvancedTableContext);return jsx("button",{className:"gray-icon toggle-all-icon",onClick:()=>onClick(row),children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:displayIcon(toggleExpansionIcon)[0]})},displayIcon(toggleExpansionIcon)[0])};const findColumnDefByAccessor=(defs,targetAccessor)=>{for(const def of defs){if(def.accessor===targetAccessor){return def}if(Array.isArray(def.columns)&&def.columns.length){const found=findColumnDefByAccessor(def.columns,targetAccessor);if(found)return found}}return void 0};const filterExpandableRows=expandedState=>{for(const expandedRow in expandedState){if(expandedState[expandedRow]===false){delete expandedState[expandedRow]}}return expandedState};const updateExpandAndCollapseState=(tableRows,expanded,targetParent,targetDepth)=>{const updateExpandedRows={};const rows=targetDepth!==void 0?tableRows.flatRows:tableRows.rows;const rowsToToggle=[];for(const row of rows){const shouldBeUpdated=targetDepth!==void 0?row.depth<=targetDepth:targetParent===void 0?row.depth===0:targetParent===row.parentId;if(shouldBeUpdated){rowsToToggle.push(row)}}const anyCollapsed=rowsToToggle.some((row=>!row.getIsExpanded()));const isExpandAction=anyCollapsed;for(const row of rowsToToggle){const shouldUpdate=isExpandAction||targetDepth===void 0?true:row.depth===targetDepth;if(shouldUpdate){updateExpandedRows[row.id]=isExpandAction}}return filterExpandableRows({...expanded,...updateExpandedRows})};const isChrome=()=>{const userAgent=navigator.userAgent.toLowerCase();return userAgent.includes("chrome")&&!userAgent.includes("edg")};const TableHeaderCell=({enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:headerChildren,isPinnedLeft:isPinnedLeft=false,loading:loading,sortIcon:sortIcon,table:table})=>{var _a,_b,_c,_d;const{columnDefinitions:columnDefinitions,expanded:expanded,setExpanded:setExpanded,expandByDepth:expandByDepth,enableSortingRemoval:enableSortingRemoval,onExpandByDepthClick:onExpandByDepthClick,toggleExpansionIcon:toggleExpansionIcon,sortControl:sortControl,responsive:responsive,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,showActionsBar:showActionsBar,stickyLeftColumn:stickyLeftColumn,inlineRowLoading:inlineRowLoading,isActionBarVisible:isActionBarVisible}=useContext(AdvancedTableContext);const toggleSortButton=event=>{if(sortControl){const sortIsDesc=(header==null?void 0:header.column.getIsSorted())==="desc";sortIsDesc?sortControl.onChange({desc:true}):sortControl.onChange({desc:false})}else{header==null?void 0:header.column.getToggleSortingHandler()(event)}};const alignmentMap={left:"start",center:"center",right:"end"};const colDef=header?findColumnDefByAccessor(columnDefinitions,header.column.id):void 0;const headerAlignment=((_a=colDef==null?void 0:colDef.columnStyling)==null?void 0:_a.headerAlignment)??((_b=colDef==null?void 0:colDef.columnStyling)==null?void 0:_b.headerAligment);const isLeafColumn=(header==null?void 0:header.column.getLeafColumns().length)===1&&(header==null?void 0:header.column.getLeafColumns()[0].id)===header.column.id;const columnHasVisibleLeaf=col=>{var _a2;return((_a2=col.getIsVisible)==null?void 0:_a2.call(col))||Array.isArray(col.columns)&&col.columns.some((child=>columnHasVisibleLeaf(child)))};const isLastHeaderCell=(()=>{var _a2;if(!header)return false;if(header.colSpan>1&&header.column.parent!==void 0)return true;const parent=header.column.parent;if(!parent){const topHeaders=table==null?void 0:table.getHeaderGroups()[0].headers.filter((h=>columnHasVisibleLeaf(h.column)));return((_a2=topHeaders==null?void 0:topHeaders.at(-1))==null?void 0:_a2.id)===header.id}const visibleSiblings=parent.columns.filter(columnHasVisibleLeaf);return visibleSiblings.at(-1)===header.column})();const cellClassName=classnames("table-header-cells",`${showActionsBar&&isActionBarVisible&&"header-cells-with-actions"}`,`${isChrome()?"chrome-styles":""}`,`${enableSorting?"table-header-cells-active":""}`,{"pinned-left":responsive==="scroll"&&isPinnedLeft},isLastHeaderCell?"last-header-cell":"",stickyLeftColumn&&stickyLeftColumn.length>0&&isPinnedLeft?"sticky-left":"",((_c=colDef==null?void 0:colDef.columnStyling)==null?void 0:_c.headerPadding)&&`p_${(_d=colDef==null?void 0:colDef.columnStyling)==null?void 0:_d.headerPadding}`);const cellId=`${loading?`loading-${header==null?void 0:header.id}`:`${header==null?void 0:header.id}`}`;const isToggleExpansionEnabledLoading=(header==null?void 0:header.index)===0&&loading&&(enableToggleExpansion==="all"||"header")&&enableToggleExpansion!=="none";const isToggleExpansionEnabled=(header==null?void 0:header.index)===0&&!loading&&(enableToggleExpansion==="all"||"header")&&enableToggleExpansion!=="none";let justifyHeader;if(headerAlignment&&alignmentMap[headerAlignment]){justifyHeader=alignmentMap[headerAlignment]}else if((header==null?void 0:header.index)===0&&hasAnySubRows||(header==null?void 0:header.index)===0&&inlineRowLoading||(header==null?void 0:header.index)===0&&isToggleExpansionEnabled){justifyHeader=enableSorting?"between":"start"}else{justifyHeader=isLeafColumn?"end":"center"}const[showPopover,setShowPopover]=useState(false);const togglePopover=()=>setShowPopover((prev=>!prev));const handleShouldClose=shouldClose=>setShowPopover(!shouldClose);const popoverReference=jsx("div",{className:"gray-icon toggle-all-icon",onClick:togglePopover,children:jsx(Icon,{icon:displayIcon(toggleExpansionIcon)[0]})});const handleExpandDepth=depth=>{if(onExpandByDepthClick){const flatRows=table==null?void 0:table.getRowModel().flatRows;onExpandByDepthClick(depth,flatRows)}const updated=updateExpandAndCollapseState(table.getRowModel(),expanded,void 0,depth);setExpanded(updated)};return jsx("th",{align:headerAlignment?headerAlignment:"right",className:cellClassName,colSpan:header==null?void 0:header.colSpan,id:cellId,style:{left:isPinnedLeft?(header==null?void 0:header.index)===1?"180px":`${header==null?void 0:header.column.getStart("left")}px`:void 0},children:(header==null?void 0:header.isPlaceholder)?null:headerChildren&&(header==null?void 0:header.index)===0?jsxs(Flex,{alignItems:"center",children:[headerChildren,jsx("div",{children:flexRender(header.column.columnDef.header,header.getContext())})]}):jsxs(Flex,{alignItems:"center",justify:justifyHeader,children:[selectableRows&&(header==null?void 0:header.index)===0&&hasAnySubRows&&jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()}),isToggleExpansionEnabled&&hasAnySubRows&&!expandByDepth&&jsx(ToggleIconButton,{onClick:handleExpandOrCollapse}),isToggleExpansionEnabled&&hasAnySubRows&&expandByDepth&&jsx(PbReactPopover,{closeOnClick:"any",placement:"bottom-start",reference:popoverReference,shouldClosePopover:handleShouldClose,show:showPopover,zIndex:3,children:expandByDepth.map(((option,index)=>jsxs(Fragment,{children:[jsx(Flex,{alignItems:"center",className:"pb-advanced-table-popover-option",cursor:"pointer",htmlOptions:{onClick:()=>{handleExpandDepth(option.depth)}},paddingX:"sm",paddingY:"xs",children:option.label}),index!==expandByDepth.length-1&&jsx(SectionSeparator,{})]})))}),isToggleExpansionEnabledLoading&&jsx("div",{className:"loading-toggle-icon header-toggle-icon"}),jsxs(Flex,{className:`${(header==null?void 0:header.index)===0&&enableSorting&&"header-sort-button pb_th_link"} ${(header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())&&"header-sort-secondary-columns"}`,cursor:(header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting?"pointer":"default",...((header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting)&&{htmlOptions:{onClick:event=>toggleSortButton(event),onKeyDown:event=>{if(event.key==="Enter"){toggleSortButton(event)}},tabIndex:0}},justify:(header==null?void 0:header.index)===0&&enableSorting?"between":headerAlignment?alignmentMap[headerAlignment]:"none",paddingLeft:(header==null?void 0:header.index)===0?enableSorting?"xxs":"xs":"none",children:[jsx("div",{children:flexRender(header==null?void 0:header.column.columnDef.header,header==null?void 0:header.getContext())}),((header==null?void 0:header.index)!==0&&(header==null?void 0:header.column.getCanSort())||(header==null?void 0:header.index)===0&&enableSorting)&&(loading?jsx("div",{className:"loading-toggle-icon"}):jsx(SortIconButton,{enableSortingRemoval:enableSortingRemoval,header:header,sortIcon:sortIcon}))]})]})},`${header==null?void 0:header.id}-header`)};const TableHeader=({children:children,className:className,dark:dark=false,enableSorting:enableSorting=false,id:id,sortIcon:sortIcon=["arrow-up-wide-short","arrow-down-short-wide"],...props})=>{const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,loading:loading,table:table,hasAnySubRows:hasAnySubRows,showActionsBar:showActionsBar,selectableRows:selectableRows,responsive:responsive,headerRef:headerRef,virtualizedRows:virtualizedRows,enableVirtualization:enableVirtualization}=useContext(AdvancedTableContext);const isVirtualized=virtualizedRows||enableVirtualization;const classes=classnames(buildCss("pb_advanced_table_header"),globalProps(props),className);const columnPinning=table.getState().columnPinning;const customCellClassnames=classnames("table-header-cells-custom",`${showActionsBar&&"header-cells-with-actions"}`,`${isChrome()?"chrome-styles":""}`,`${responsive==="scroll"&&"pinned-left"}`);const renderRegularTableHeader=()=>jsx("thead",{className:classes,id:id,children:table.getHeaderGroups().map(((headerGroup,index)=>jsxs("tr",{ref:index===0?headerRef:null,children:[!hasAnySubRows&&selectableRows&&jsx("th",{className:customCellClassnames,children:jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()})}),headerGroup.headers.map((header=>{const isPinnedLeft=columnPinning.left.includes(header.id);return jsx(TableHeaderCell,{enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:children,isPinnedLeft:isPinnedLeft,loading:loading,sortIcon:sortIcon,table:table},`${header.id}-header`)}))]},`${headerGroup.id}-headerGroup`)))});const renderVirtualizedTableHeader=()=>jsx("thead",{className:classes,"data-virtualized":"true",id:id,children:table.getHeaderGroups().map(((headerGroup,index)=>jsxs("tr",{className:"virtualized-header-row-header",ref:index===0?headerRef:null,children:[!hasAnySubRows&&selectableRows&&jsx("th",{className:classnames(customCellClassnames,"virtualized-header-cell"),children:jsx(Checkbox,{checked:table==null?void 0:table.getIsAllRowsSelected(),indeterminate:table==null?void 0:table.getIsSomeRowsSelected(),onChange:table==null?void 0:table.getToggleAllRowsSelectedHandler()})}),headerGroup.headers.map((header=>{const isPinnedLeft=columnPinning.left.includes(header.id);return jsx(TableHeaderCell,{enableSorting:enableSorting,enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,header:header,headerChildren:children,isPinnedLeft:isPinnedLeft,isVirtualized:true,loading:loading,sortIcon:sortIcon,table:table},`${header.id}-header-virtualized`)}))]},`${headerGroup.id}-headerGroup-virtualized`)))});return jsx(Fragment,{children:isVirtualized?renderVirtualizedTableHeader():renderRegularTableHeader()})};const getRowColorClass=(row,inlineRowLoading)=>{var _a;const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a=row.original)==null?void 0:_a.children)&&!row.original.children.length?true:false;const shouldShowExpandedBackground=isExpandable&&(!inlineRowLoading&&row.getCanExpand()||inlineRowLoading&&(rowHasNoChildren||row.getCanExpand()));return row.getIsSelected()?"bg-row-selection":shouldShowExpandedBackground?"bg-silver":"bg-white"};const shouldShowLoadingIndicator=(row,inlineRowLoading,cellAccessorsLength)=>{var _a;const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a=row.original)==null?void 0:_a.children)&&!row.original.children.length?true:false;return isExpandable&&(inlineRowLoading&&rowHasNoChildren)&&row.depth<cellAccessorsLength};const LoadingInline=props=>{const{align:align="left",aria:aria={},className:className,data:data={},dark:dark=false,htmlOptions:htmlOptions={},id:id,text:text2=" Loading",variant:variant="dotted"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss(`pb_loading_inline_kit_${align}`),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Body$1,{color:"light",dark:dark,children:[jsx(Icon,{aria:{label:"loading icon"},fixedWidth:true,icon:variant==="dotted"?"spinner":variant==="solid"?"circle-notch":void 0,pulse:true}),text2]})})};const CollapsibleTrail=({leftOffset:leftOffset})=>{const style={left:`${leftOffset}em`};return jsx("div",{className:"collapsible-trail",style:style})};const renderCollapsibleTrail=currentDepth=>{const lines=[];for(let i=1;i<=currentDepth;i++){const additionalOffset=i>1?(i-1)*.25:0;const leftOffset=i*1+additionalOffset;lines.push(jsx(CollapsibleTrail,{leftOffset:leftOffset},i))}return lines};const SubRowHeaderRow=({collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:onClick,row:row,subRowHeaders:subRowHeaders,table:table})=>{var _a;const{inlineRowLoading:inlineRowLoading,customSort:customSort,onCustomSortClick:onCustomSortClick}=useContext(AdvancedTableContext);const numberOfColumns=table.getAllFlatColumns().length;const rowHasChildren=row.original.children?true:false;const canExpand=inlineRowLoading?rowHasChildren:row.getCanExpand();const hasSubrowsToSort=(_a=row.getParentRow())==null?void 0:_a.subRows;return jsxs("tr",{className:"custom-row bg-silver",children:[jsxs("td",{className:`custom-row-first-column ${isChrome()?"chrome-styles":""}`,colSpan:1,children:[collapsibleTrail&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("div",{style:{paddingLeft:`${row.depth*1.25}em`},children:jsxs(Flex,{align:"center",columnGap:"xs",justifyContent:customSort&&hasSubrowsToSort&&hasSubrowsToSort.length>1?"between":void 0,children:[jsxs(Flex,{columnGap:"xs",children:[enableToggleExpansion==="all"&&canExpand?jsx(ToggleIconButton,{onClick:onClick,row:row}):null,jsx(Caption,{marginLeft:canExpand?"none":"xs",text:subRowHeaders[row.depth-1]})]}),customSort&&hasSubrowsToSort&&hasSubrowsToSort.length>1&&jsx("button",{"aria-label":"Sort this group",className:"sort-button-icon gray-icon",onClick:()=>{var _a2;onCustomSortClick&&onCustomSortClick((_a2=row.getParentRow())==null?void 0:_a2.subRows)},children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:"sort"})})]})})]}),jsx("td",{colSpan:numberOfColumns-1})]})};const LoadingCell=()=>jsx("div",{className:"loading-cell"});const TableCellRenderer=({row:row,collapsibleTrail:collapsibleTrail=true,loading:loading=false,stickyLeftColumn:stickyLeftColumn,columnPinning:columnPinning,customRowStyle:customRowStyle,columnDefinitions:columnDefinitions,isMultiHeaderColumn:isMultiHeaderColumn=false})=>jsx(Fragment,{children:row.getVisibleCells().map(((cell,i)=>{var _a,_b;const isPinnedLeft=columnPinning.left.includes(cell.column.id);const isLastCell=(()=>{var _a2;if(!isMultiHeaderColumn){return false}const parent=cell.column.parent;if(!parent){const last=row.getVisibleCells().at(-1);return(last==null?void 0:last.column.id)===cell.column.id}const visibleSiblings=parent.columns.filter((col=>col.getIsVisible()));return((_a2=visibleSiblings.at(-1))==null?void 0:_a2.id)===cell.column.id})();const{column:column}=cell;const colDef=findColumnDefByAccessor(columnDefinitions??[],column.id);const cellAlignment=((_a=colDef==null?void 0:colDef.columnStyling)==null?void 0:_a.cellAlignment)??"right";const paddingValue=((_b=colDef==null?void 0:colDef.columnStyling)==null?void 0:_b.cellPadding)??(customRowStyle==null?void 0:customRowStyle.cellPadding);const paddingClass=paddingValue?`p_${paddingValue}`:void 0;return jsxs("td",{align:cellAlignment,className:classnames(`${cell.id}-cell position_relative`,isChrome()?"chrome-styles":"",isPinnedLeft&&"pinned-left",stickyLeftColumn&&stickyLeftColumn.length>0&&isPinnedLeft&&"sticky-left",isLastCell&&"last-cell",paddingClass),style:{left:isPinnedLeft?i===1?"180px":`${column.getStart("left")}px`:void 0,backgroundColor:i===0&&(customRowStyle==null?void 0:customRowStyle.backgroundColor),color:customRowStyle==null?void 0:customRowStyle.fontColor},children:[collapsibleTrail&&i===0&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("span",{id:`${cell.id}-span`,children:loading?jsx(LoadingCell,{}):flexRender(cell.column.columnDef.cell,cell.getContext())})]},`${cell.id}-data`)}))});const RegularTableView=({collapsibleTrail:collapsibleTrail=true,subRowHeaders:subRowHeaders})=>{var _a;const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,inlineRowLoading:inlineRowLoading,loading:loading,table:table,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,stickyLeftColumn:stickyLeftColumn,pinnedRows:pinnedRows,headerHeight:headerHeight,rowHeight:rowHeight,rowStyling:rowStyling=[],sampleRowRef:sampleRowRef}=useContext(AdvancedTableContext);useEffect((()=>{if(stickyLeftColumn&&Array.isArray(stickyLeftColumn)){stickyLeftColumn.forEach((columnId=>{const column=table.getColumn(columnId);if(column&&column.getCanPin()){column.pin("left")}}))}}),[stickyLeftColumn,table]);const columnPinning=table.getState().columnPinning||{left:[]};const columnDefinitions=((_a=table.options.meta)==null?void 0:_a.columnDefinitions)||[];const isMultiHeaderColumn=columnDefinitions.some((obj=>"columns"in obj));function PinnedRow({row:row}){const customRowStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));return jsx("tr",{className:classnames(`pinned-row`),style:{backgroundColor:(customRowStyle==null?void 0:customRowStyle.backgroundColor)?customRowStyle==null?void 0:customRowStyle.backgroundColor:"white",color:customRowStyle==null?void 0:customRowStyle.fontColor,position:"sticky",top:row.getIsPinned()==="top"?`${row.getPinnedIndex()*rowHeight+headerHeight}px`:void 0,zIndex:"3"},children:jsx(TableCellRenderer,{collapsibleTrail:collapsibleTrail,columnDefinitions:columnDefinitions,columnPinning:columnPinning,customRowStyle:customRowStyle,isMultiHeaderColumn:isMultiHeaderColumn,loading:loading,row:row,stickyLeftColumn:stickyLeftColumn})})}const totalRows=pinnedRows?table.getCenterRows():table.getRowModel().rows;return jsxs(Fragment,{children:[pinnedRows&&table.getTopRows().map((row=>jsx(PinnedRow,{row:row},row.id))),totalRows.map(((row,rowIndex)=>{var _a2,_b;const isFirstChildofSubrow=row.depth>0&&row.index===0;const numberOfColumns=table.getAllFlatColumns().length;const isFirstRegularRow=rowIndex===0&&!row.getIsPinned();const customRowStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));const rowColor=getRowColorClass(row,inlineRowLoading||false);const isDataLoading=shouldShowLoadingIndicator(row,inlineRowLoading||false,((_b=(_a2=columnDefinitions[0])==null?void 0:_a2.cellAccessors)==null?void 0:_b.length)||0);return jsxs(React__default.Fragment,{children:[isFirstChildofSubrow&&subRowHeaders&&jsx(SubRowHeaderRow,{collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:handleExpandOrCollapse,row:row,subRowHeaders:subRowHeaders,table:table}),jsxs("tr",{className:`${rowColor} ${row.depth>0?`depth-sub-row-${row.depth}`:""}`,id:`${row.index}-${row.id}-${row.depth}-row`,ref:isFirstRegularRow?sampleRowRef:null,style:{backgroundColor:customRowStyle==null?void 0:customRowStyle.backgroundColor,color:customRowStyle==null?void 0:customRowStyle.fontColor},children:[selectableRows&&!hasAnySubRows&&jsx("td",{className:"checkbox-cell",children:jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()})}),jsx(TableCellRenderer,{collapsibleTrail:collapsibleTrail,columnDefinitions:columnDefinitions,columnPinning:columnPinning,customRowStyle:customRowStyle,isMultiHeaderColumn:isMultiHeaderColumn,loading:loading,row:row,stickyLeftColumn:stickyLeftColumn})]}),isDataLoading&&jsx("tr",{children:jsx("td",{colSpan:numberOfColumns,style:{paddingLeft:`${row.depth===0?.5:row.depth*2}em`},children:jsx(LoadingInline,{})})},`${row.id}-loading-row`)]},`${row.index}-${row.id}-${row.depth}-row`)}))]})};const VirtualizedTableView=({collapsibleTrail:collapsibleTrail=true,subRowHeaders:subRowHeaders,isFetching:isFetching})=>{var _a;const{enableToggleExpansion:enableToggleExpansion,handleExpandOrCollapse:handleExpandOrCollapse,inlineRowLoading:inlineRowLoading,loading:loading,table:table,selectableRows:selectableRows,hasAnySubRows:hasAnySubRows,virtualizer:virtualizer,flattenedItems:flattenedItems,totalAvailableCount:totalAvailableCount}=useContext(AdvancedTableContext);const columnPinning=table.getState().columnPinning||{left:[]};const sortingState=JSON.stringify(table.getState().sorting||[]);const[columnWidths,setColumnWidths]=useState({});const getHeaderCellWidths=()=>{const widths={};const headerCells=document.querySelectorAll(".table-header-cells, .table-header-cells-custom");if(selectableRows&&!hasAnySubRows&&headerCells.length>0){widths["checkbox"]=`${headerCells[0].getBoundingClientRect().width}px`}table.getFlatHeaders().forEach(((header,index)=>{const headerIndex=selectableRows&&!hasAnySubRows?index+1:index;if(headerCells[headerIndex]){const width=headerCells[headerIndex].getBoundingClientRect().width;widths[header.id]=`${width}px`}}));return widths};const debounce2=(func,wait)=>{let timeout;return function executedFunction(...args){const later=()=>{clearTimeout(timeout);func(...args)};clearTimeout(timeout);timeout=setTimeout(later,wait)}};useLayoutEffect((()=>{const timer=setTimeout((()=>{setColumnWidths(getHeaderCellWidths())}),0);return()=>clearTimeout(timer)}),[table,selectableRows,hasAnySubRows,sortingState]);useEffect((()=>{const handleResize=debounce2((()=>{setColumnWidths(getHeaderCellWidths())}),0);window.addEventListener("resize",handleResize);return()=>{window.removeEventListener("resize",handleResize)}}),[table,selectableRows,hasAnySubRows]);if(!virtualizer||!flattenedItems){return jsx("tr",{children:jsx("td",{colSpan:table.getAllFlatColumns().length||1,children:"No data to display."})})}const virtualItems=((_a=virtualizer.getVirtualItems)==null?void 0:_a.call(virtualizer))||[];if(!virtualItems.length){return jsx("tr",{children:jsx("td",{colSpan:table.getAllFlatColumns().length||1,children:"No items to display."})})}const topLevelRowCount=table.getRowModel().flatRows.filter((row=>row.depth===0)).length;return jsx(Fragment,{children:virtualItems.map((virtualRow=>{const item=flattenedItems[virtualRow.index];if(!item)return null;const virtualItemStyle=getVirtualizedRowStyle(virtualRow.start);if(item.type==="header"){return jsx("tr",{className:"virtualized-table-row virtualized-header-row",style:virtualItemStyle,children:jsx("td",{colSpan:table.getAllFlatColumns().length,children:jsx(SubRowHeaderRow,{collapsibleTrail:collapsibleTrail,enableToggleExpansion:enableToggleExpansion,onClick:handleExpandOrCollapse,row:item.row,subRowHeaders:subRowHeaders,table:table})})},`header-${item.id}-sort-${sortingState}`)}if(item.type==="row"){const row=item.row;const rowColor=getRowColorClass(row,inlineRowLoading||false);return jsxs("tr",{className:`virtualized-table-row ${rowColor} ${row.depth>0?`depth-sub-row-${row.depth}`:""}`,"data-index":virtualRow.index,ref:node=>{if(node){try{virtualizer.measureElement(node)}catch(err){}}},style:virtualItemStyle,children:[selectableRows&&!hasAnySubRows&&jsx("td",{className:"checkbox-cell",style:{width:columnWidths["checkbox"]||"auto"},children:jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()})}),row.getVisibleCells().map(((cell,i)=>{var _a2,_b,_c;const isPinnedLeft=columnPinning.left.includes(cell.column.id);const isLastCell=((_c=(_b=(_a2=cell.column.parent)==null?void 0:_a2.columns)==null?void 0:_b.at(-1))==null?void 0:_c.id)===cell.column.id;const cellWidth=columnWidths[cell.column.id]||"auto";return jsxs("td",{align:"right",className:classnames(`${cell.id}-cell position_relative`,isChrome()?"chrome-styles":"",isPinnedLeft&&"pinned-left",isLastCell&&"last-cell"),style:{width:cellWidth},children:[collapsibleTrail&&i===0&&row.depth>0&&renderCollapsibleTrail(row.depth),jsx("span",{id:`${cell.id}-span`,children:loading?jsx(LoadingCell,{}):flexRender(cell.column.columnDef.cell,cell.getContext())})]},`${cell.id}-data`)}))]},`row-${item.id}-sort-${sortingState}`)}if(item.type==="loading"){const row=item.row;const numberOfColumns=table.getAllFlatColumns().length;return jsx("tr",{className:"virtualized-table-row virtualized-loading-row",style:virtualItemStyle,children:jsx("td",{colSpan:numberOfColumns,style:{paddingLeft:`${row.depth===0?.5:row.depth*2}em`},children:jsx(LoadingInline,{})})},`loading-${item.id}-sort-${sortingState}`)}if(item.type==="footer"){return jsx("tr",{className:"virtualized-table-row virtualized-footer",style:virtualItemStyle,children:jsx("td",{colSpan:table.getAllFlatColumns().length,children:jsx(Flex,{align:"center",justify:"center",children:isFetching?jsx(LoadingInline,{}):jsx(Detail,{text:`Showing ${topLevelRowCount} of ${totalAvailableCount} rows`})})})},`footer-row`)}return null}))})};const TableBody=({className:className,collapsibleTrail:collapsibleTrail=true,dark:dark=false,id:id,subRowHeaders:subRowHeaders,isFetching:isFetching,...props})=>{const{responsive:responsive,isPinnedLeft:isPinnedLeft=false,virtualizer:virtualizer,virtualizedRows:virtualizedRows,enableVirtualization:enableVirtualization}=useContext(AdvancedTableContext);const isVirtualized=virtualizedRows||enableVirtualization;const classes=classnames(buildCss("pb_advanced_table_body"),{"pinned-left":responsive==="scroll"&&isPinnedLeft},globalProps(props),className);const style=virtualizer?{height:`${virtualizer.getTotalSize()}px`,position:"relative",width:"100%"}:{};return jsx(Fragment,{children:jsxs("tbody",{className:classes,"data-virtualized":isVirtualized?"true":"false",id:id,style:style,children:[isVirtualized&&virtualizer?jsx(VirtualizedTableView,{collapsibleTrail:collapsibleTrail,isFetching:isFetching,subRowHeaders:subRowHeaders}):jsx(RegularTableView,{collapsibleTrail:collapsibleTrail,subRowHeaders:subRowHeaders}),isVirtualized&&!virtualizer&&jsx("tr",{children:jsx("td",{colSpan:999,style:{padding:"10px",textAlign:"center"},children:jsx("div",{children:"No data to display."})})})]})})};const Pagination=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,current:current=1,onChange:onChange,range:range=5,total:total=1}=props;const[currentPage,setCurrentPage]=useState(current);const handlePageChange=pageNumber=>{if(pageNumber>=1&&pageNumber<=total){setCurrentPage(pageNumber);if(onChange){onChange(pageNumber)}}};const renderPageButtons=()=>{const buttons=[];let rangeStart=Math.max(1,currentPage-Math.floor(range/2));let rangeEnd=Math.min(total,rangeStart+range-1);if(rangeEnd-rangeStart+1<range){if(rangeStart>1){rangeStart=Math.max(1,rangeEnd-range+1)}else{rangeEnd=Math.min(total,rangeStart+range-1)}}if(rangeStart>1){buttons.push(jsx("li",{className:"pagination-number",onClick:()=>handlePageChange(1),children:"1"},1))}if(rangeStart>2){buttons.push(jsx("li",{className:"pagination-number",onClick:()=>handlePageChange(2),children:"2"},2))}for(let i=rangeStart;i<=rangeEnd;i++){buttons.push(jsx("li",{className:`pagination-number ${i===currentPage?"active":""}`,onClick:()=>handlePageChange(i),children:i},i))}if(rangeEnd<total-1){buttons.push(jsx("li",{className:`pagination-number ${total-1===currentPage?"active":""}`,onClick:()=>handlePageChange(total-1),children:total-1},total-1))}if(rangeEnd<total){buttons.push(jsx("li",{className:`pagination-number ${total===currentPage?"active":""}`,onClick:()=>handlePageChange(total),children:total},total))}return buttons};useEffect((()=>{if(current>=1&&current<=total){setCurrentPage(current)}}),[current,total]);const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_paginate"),globalProps(props),className);if(total<=1){return null}return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs("div",{className:"pb_pagination",children:[jsx("li",{className:`pagination-left ${currentPage===1?"disabled":""}`,onClick:()=>handlePageChange(currentPage-1),children:jsx(Icon,{icon:"chevron-left"})}),renderPageButtons(),jsx("li",{className:`pagination-right ${currentPage===total?"disabled":""}`,onClick:()=>handlePageChange(currentPage+1),children:jsx(Icon,{icon:"chevron-right"})})]})})};const TablePagination=({table:table,onChange:onChange,position:position,range:range=5})=>{const current=table.getState().pagination.pageIndex+1;const total=table.getPageCount();return jsx(Pagination,{current:current,marginBottom:position==="top"?"xs":void 0,marginTop:position==="bottom"?"xs":void 0,onChange:onChange,range:range,total:total},`pagination-${position}-${current}`)};const buildVisibilityTree=(defs,allowed)=>defs.map((def=>{const isGroup=Array.isArray(def.columns)&&def.columns.length>0;if(!(allowed==null?void 0:allowed.length)){return isGroup?{id:def.id,label:def.label,children:buildVisibilityTree(def.columns,allowed)}:{id:def.id,label:def.label}}if(allowed.includes(def.id)){return isGroup?{id:def.id,label:def.label,children:buildVisibilityTree(def.columns,null)}:{id:def.id,label:def.label}}if(isGroup){const kids=buildVisibilityTree(def.columns,allowed).filter(Boolean);return kids.length?{id:def.id,label:def.label,children:kids}:null}return null})).filter(Boolean);const showActionBar=elem=>{elem.style.display="block";const height=elem.scrollHeight+"px";elem.style.height=height;elem.classList.add("is-visible");elem.style.overflow="hidden";window.setTimeout((()=>{if(elem.classList.contains("is-visible")){elem.style.height="";elem.style.overflow="visible"}}),300)};const hideActionBar=elem=>{elem.style.height=elem.scrollHeight+"px";elem.offsetHeight;window.setTimeout((()=>{elem.style.height="0";elem.style.overflow="hidden"}),10);window.setTimeout((()=>{elem.classList.remove("is-visible")}),300)};const TableActionBar=({isVisible:isVisible,selectedCount:selectedCount,actions:actions,type:type="row-selection"})=>{var _a;const cardRef=useRef(null);const{table:table,columnVisibilityControl:columnVisibilityControl,columnDefinitions:columnDefinitions}=useContext(AdvancedTableContext);const includeIds=columnVisibilityControl==null?void 0:columnVisibilityControl.includeIds;const firstLeafId=(_a=table.getAllLeafColumns()[0])==null?void 0:_a.id;const tree=buildVisibilityTree(columnDefinitions,includeIds).filter((node=>node.id!==firstLeafId));const renderLeaf=(id,label)=>{const col=table.getColumn(id);const show=col.getIsVisible();const handleVisibilityChange=()=>{col.toggleVisibility();if(columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange){const updatedVisibilityState={...table.getAllColumns().reduce(((acc,col2)=>{acc[col2.id]=col2.getIsVisible();return acc}),{})};columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange(updatedVisibilityState)}};return jsx(Checkbox,{checked:show,onChange:handleVisibilityChange,paddingBottom:"xs",text:label},id)};const gatherLeafIds=node=>node.children&&node.children.length?node.children.flatMap(gatherLeafIds):node.id?[node.id]:[];const renderGroup=node=>{var _a2;const leaves=gatherLeafIds(node);const visibleArray=leaves.map((id=>table.getColumn(id).getIsVisible()));const allOn=visibleArray.every(Boolean);const someOn=visibleArray.some(Boolean);const handleGroupVisibilityChange=()=>{leaves.forEach((id=>table.getColumn(id).toggleVisibility(!allOn)));if(columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange){const updatedVisibilityState={...table.getAllColumns().reduce(((acc,col)=>{acc[col.id]=col.getIsVisible();return acc}),{})};columnVisibilityControl==null?void 0:columnVisibilityControl.onColumnVisibilityChange(updatedVisibilityState)}};return jsxs(Fragment,{children:[jsx(Checkbox,{checked:allOn,indeterminate:!allOn&&someOn,onChange:handleGroupVisibilityChange,paddingBottom:"xs",text:node.label}),jsx(Flex,{flexDirection:"column",paddingLeft:"lg",children:(_a2=node==null?void 0:node.children)==null?void 0:_a2.map((child=>child.children?renderGroup(child):renderLeaf(child.id,child.label)))})]})};useEffect((()=>{if(cardRef.current&&type==="row-selection"){if(isVisible){showActionBar(cardRef.current)}else{hideActionBar(cardRef.current)}}}),[isVisible,type]);const[showPopover,setShowPopover]=useState(false);const togglePopover=()=>setShowPopover((prev=>!prev));const handleShouldClose=shouldClose=>setShowPopover(!shouldClose);const popoverReference=jsx(Tooltip,{placement:"top",text:"Column Configuration",children:jsx("div",{onClick:togglePopover,children:jsx(Icon,{color:"primary",cursor:"pointer",icon:"sliders-h"})})});return jsx(Card,{borderNone:!isVisible,className:`${isVisible&&"show-action-card row-selection-actions-card"}`,htmlOptions:{ref:cardRef},padding:`${isVisible?"xs":"none"}`,children:jsx(Flex,{alignItems:"center",justify:type==="row-selection"?"between":"end",children:type==="row-selection"?jsxs(Fragment,{children:[jsxs(Caption,{color:"light",paddingLeft:"xs",size:"xs",children:[selectedCount," Selected"]}),jsx(FlexItem,{children:actions})]}):jsx(PbReactPopover,{closeOnClick:"outside",placement:"bottom-end",reference:popoverReference,shouldClosePopover:handleShouldClose,show:showPopover,zIndex:3,children:jsxs(Fragment,{children:[jsx(Caption,{paddingY:"sm",text:"Columns Config",textAlign:"center"}),jsx(SectionSeparator,{paddingBottom:"xs"}),tree.map((node=>jsx(Flex,{cursor:"pointer",flexDirection:"column",paddingX:"xs",children:node.children?renderGroup(node):renderLeaf(node.id,node.label)},node.id)))]})})})})};const CustomCell=({getValue:getValue,onRowToggleClick:onRowToggleClick,row:row,value:value,customRenderer:customRenderer,selectableRows:selectableRows,customStyle:customStyle={}})=>{const{setExpanded:setExpanded,expanded:expanded,expandedControl:expandedControl,inlineRowLoading:inlineRowLoading,hasAnySubRows:hasAnySubRows}=useContext(AdvancedTableContext);const handleOnExpand=row2=>{onRowToggleClick&&onRowToggleClick(row2);if(!expandedControl){setExpanded({...expanded,[row2.id]:!row2.getIsExpanded()})}};const RowHasChildren=row.original.children?true:false;const renderButton=inlineRowLoading?RowHasChildren:row.getCanExpand();return jsx("div",{style:{paddingLeft:`${row.depth*1.25}em`},children:jsxs(Flex,{alignItems:"center",columnGap:"xs",justify:"start",orientation:"row",children:[selectableRows&&hasAnySubRows&&jsx(Checkbox,{checked:row.getIsSelected(),disabled:!row.getCanSelect(),indeterminate:row.getIsSomeSelected(),name:row.id,onChange:row.getToggleSelectedHandler()}),renderButton?jsx("button",{className:"gray-icon expand-toggle-icon",onClick:()=>handleOnExpand(row),style:{color:customStyle==null?void 0:customStyle.expandButtonColor},children:row.getIsExpanded()?jsx(Icon,{cursor:"pointer",icon:"circle-play",rotation:90}):jsx(Icon,{cursor:"pointer",icon:"circle-play"})}):null,jsx(FlexItem,{paddingLeft:renderButton?"none":"xs",children:row.depth===0?customRenderer?customRenderer(row,getValue()):getValue():customRenderer?customRenderer(row,value):value})]})})};const createCellFunction=(cellAccessors,customRenderer,isFirstColumn,onRowToggleClick,selectableRows,rowStyling)=>{const cellRenderer=({row:row,getValue:getValue})=>{const rowData=row.original;const customStyle=(rowStyling==null?void 0:rowStyling.length)>0&&(rowStyling==null?void 0:rowStyling.find((s=>(s==null?void 0:s.rowId)===row.id)));if(isFirstColumn){switch(row.depth){case 0:{return jsx(CustomCell,{customRenderer:customRenderer,customStyle:customStyle,getValue:getValue,onRowToggleClick:onRowToggleClick,row:row,selectableRows:selectableRows})}default:{const depthAccessor=cellAccessors[row.depth-1];const accessorValue=rowData[depthAccessor];return accessorValue?jsx(CustomCell,{customRenderer:customRenderer,onRowToggleClick:onRowToggleClick,row:row,selectableRows:selectableRows,value:accessorValue}):"N/A"}}}return customRenderer?customRenderer(row,getValue()):getValue()};cellRenderer.displayName="CellRenderer";return cellRenderer};function useTableState({tableData:tableData,columnDefinitions:columnDefinitions,enableSortingRemoval:enableSortingRemoval,expandedControl:expandedControl,sortControl:sortControl,onRowToggleClick:onRowToggleClick,selectableRows:selectableRows,initialLoadingRowsCount:initialLoadingRowsCount=10,loading:loading,pagination:pagination=false,paginationProps:paginationProps,virtualizedRows:virtualizedRows=false,tableOptions:tableOptions,columnVisibilityControl:columnVisibilityControl,pinnedRows:pinnedRows,rowStyling:rowStyling}){var _a,_b;const[localExpanded,setLocalExpanded]=useState({});const[loadingStateRowCount,setLoadingStateRowCount]=useState(initialLoadingRowsCount);const[rowSelection,setRowSelection]=useState({});const[localColumnVisibility,setLocalColumnVisibility]=useState({});const[localRowPinning,setLocalRowPinning]=useState({top:[]});const expanded=expandedControl?expandedControl.value:localExpanded;const setExpanded=expandedControl?expandedControl.onChange:setLocalExpanded;const columnVisibility=columnVisibilityControl&&columnVisibilityControl.value?columnVisibilityControl.value:localColumnVisibility;const setColumnVisibility=columnVisibilityControl&&columnVisibilityControl.onChange?columnVisibilityControl.onChange:setLocalColumnVisibility;const rowPinning=(pinnedRows==null?void 0:pinnedRows.value)??localRowPinning;const onRowPinningChange=(pinnedRows==null?void 0:pinnedRows.onChange)??setLocalRowPinning;const fetchSize=20;const[fullData]=useState(tableData);const[dataChunk,setDataChunk]=useState(fullData.slice(0,fetchSize));const[totalFetched,setTotalFetched]=useState(fetchSize);const[isFetching,setIsFetching]=useState(false);const columnHelper=createColumnHelper();const buildColumns=useCallback(((columnDefinitions2,isRoot=true)=>(columnDefinitions2==null?void 0:columnDefinitions2.map(((column,index)=>{const isFirstColumn=isRoot&&index===0;if(column.columns&&column.columns.length>0){return{header:column.header??column.label??"",id:column.id??column.label??`group-${index}`,columns:buildColumns(column.columns,false)}}const columnStructure={...columnHelper.accessor(column.accessor,{header:column.header??column.label??"",enableSorting:isFirstColumn||column.enableSort===true})};if(column.cellAccessors||column.customRenderer){columnStructure.cell=createCellFunction(column.cellAccessors||[],column.customRenderer,isFirstColumn,onRowToggleClick,selectableRows,rowStyling)}return columnStructure})))||[]),[columnHelper,onRowToggleClick,selectableRows]);const columns=useMemo((()=>buildColumns(columnDefinitions)),[buildColumns,columnDefinitions]);const sorting=useMemo((()=>[{id:columnDefinitions[0].accessor,desc:sortControl&&sortControl.value!==null?!sortControl.value.desc:false}]),[columnDefinitions,sortControl]);const customState=useCallback((()=>({state:{expanded:expanded,...sortControl&&{sorting:sorting},...selectableRows&&{rowSelection:rowSelection},...columnVisibility&&{columnVisibility:columnVisibility},...pinnedRows&&{rowPinning:rowPinning}}})),[expanded,sortControl,sorting,selectableRows,rowSelection,columnVisibility,rowPinning]);const paginationInitializer=useMemo((()=>({getPaginationRowModel:getPaginationRowModel(),paginateExpandedRows:false,initialState:{pagination:{pageIndex:(paginationProps==null?void 0:paginationProps.pageIndex)??0,pageSize:(paginationProps==null?void 0:paginationProps.pageSize)??20}}})),[pagination,paginationProps]);const table=useReactTable({data:loading?Array(loadingStateRowCount).fill({}):virtualizedRows?dataChunk:tableData,columns:columns,onExpandedChange:setExpanded,getSubRows:row=>row.children,getCoreRowModel:getCoreRowModel(),getExpandedRowModel:getExpandedRowModel(),getSortedRowModel:getSortedRowModel(),enableSortingRemoval:enableSortingRemoval,sortDescFirst:true,onRowSelectionChange:setRowSelection,onRowPinningChange:onRowPinningChange,getRowId:selectableRows||pinnedRows||rowStyling?row=>row.id:void 0,onColumnVisibilityChange:setColumnVisibility,meta:{columnDefinitions:columnDefinitions},...customState(),...paginationInitializer,...tableOptions});useEffect((()=>{var _a2;const topPins=((_a2=pinnedRows==null?void 0:pinnedRows.value)==null?void 0:_a2.top)??[];if(topPins.length===0){onRowPinningChange({top:[]});return}const rows=table.getRowModel().rows;const collectAllDescendantIds=subs=>subs.flatMap((r=>[r.id,...collectAllDescendantIds(r.subRows)]));const allPinned=[];topPins.forEach((id=>{const parent=rows.find((r=>r.id===id&&r.depth===0));if(parent){allPinned.push(parent.id,...collectAllDescendantIds(parent.subRows))}}));onRowPinningChange({top:allPinned})}),[table,(_b=(_a=pinnedRows==null?void 0:pinnedRows.value)==null?void 0:_a.top)==null?void 0:_b.join(",")]);const hasAnySubRows=table.getRowModel().rows.some((row=>row.subRows&&row.subRows.length>0));const selectedRowsLength=Object.keys(table.getState().rowSelection).length;const fetchNextPage=useCallback((()=>{if(isFetching||totalFetched>=fullData.length)return;setIsFetching(true);setTimeout((()=>{const nextChunk=fullData.slice(totalFetched,totalFetched+fetchSize);setDataChunk((prev=>[...prev,...nextChunk]));setTotalFetched((prev=>prev+nextChunk.length));setIsFetching(false)}),500)}),[isFetching,totalFetched,fullData,fetchSize]);const updateLoadingStateRowCount=useCallback((()=>{const rowsCount=table.getRowModel().rows.length;if(rowsCount!==loadingStateRowCount&&rowsCount!==0){setLoadingStateRowCount(rowsCount)}}),[loadingStateRowCount,table]);return{table:table,expanded:expanded,setExpanded:setExpanded,hasAnySubRows:hasAnySubRows,selectedRowsLength:selectedRowsLength,fetchNextPage:fetchNextPage,updateLoadingStateRowCount:updateLoadingStateRowCount,rowSelection:rowSelection,fullData:fullData,totalFetched:totalFetched,isFetching:isFetching}}function useTableActions({table:table,expanded:expanded,setExpanded:setExpanded,onToggleExpansionClick:onToggleExpansionClick,onRowSelectionChange:onRowSelectionChange}){const[bottomReached,setBottomReached]=useState(false);const bottomTimeout=useRef(null);const handleExpandOrCollapse=useCallback((async row=>{if(onToggleExpansionClick)onToggleExpansionClick(row);const updatedExpandedState=await updateExpandAndCollapseState(table.getRowModel(),expanded,row==null?void 0:row.parentId,void 0);setExpanded(updatedExpandedState)}),[expanded,setExpanded,onToggleExpansionClick,table]);const onPageChange=useCallback((page=>{table.setPageIndex(page-1)}),[table]);const fetchMoreOnBottomReached=useCallback(((containerRef,fetchNextPage,isFetching,totalFetched,totalDBRowCount)=>{if(!containerRef||isFetching||totalFetched>=totalDBRowCount)return;const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=containerRef;const distanceFromBottom=scrollHeight-scrollTop-clientHeight;if(distanceFromBottom<50){if(!bottomReached){setBottomReached(true);bottomTimeout.current=setTimeout((()=>{fetchNextPage();setBottomReached(false)}),1e3)}}else{setBottomReached(false);if(bottomTimeout.current){clearTimeout(bottomTimeout.current);bottomTimeout.current=null}}}),[bottomReached]);useEffect((()=>{if(onRowSelectionChange){onRowSelectionChange(table.getState().rowSelection)}}),[table.getState().rowSelection,onRowSelectionChange]);return{handleExpandOrCollapse:handleExpandOrCollapse,onPageChange:onPageChange,fetchMoreOnBottomReached:fetchMoreOnBottomReached}}const AdvancedTable=props=>{const{aria:aria={},actions:actions,children:children,className:className,columnDefinitions:columnDefinitions,columnGroupBorderColor:columnGroupBorderColor,columnVisibilityControl:columnVisibilityControl,customSort:customSort,dark:dark=false,data:data={},enableToggleExpansion:enableToggleExpansion="header",enableSortingRemoval:enableSortingRemoval=false,expandedControl:expandedControl,expandByDepth:expandByDepth,onExpandByDepthClick:onExpandByDepthClick,htmlOptions:htmlOptions={},id:id,initialLoadingRowsCount:initialLoadingRowsCount=10,inlineRowLoading:inlineRowLoading=false,loading:loading,maxHeight:maxHeight,onRowToggleClick:onRowToggleClick,onToggleExpansionClick:onToggleExpansionClick,onCustomSortClick:onCustomSortClick,pagination:pagination=false,paginationProps:paginationProps,pinnedRows:pinnedRows,responsive:responsive="scroll",rowStyling:rowStyling,scrollBarNone:scrollBarNone=false,showActionsBar:showActionsBar=true,selectableRows:selectableRows,sortControl:sortControl,stickyLeftColumn:stickyLeftColumn,tableData:tableData,tableOptions:tableOptions,tableProps:tableProps,toggleExpansionIcon:toggleExpansionIcon="arrows-from-line",onRowSelectionChange:onRowSelectionChange,virtualizedRows:virtualizedRows=false,allowFullScreen:allowFullScreen=false,fullScreenControl:fullScreenControl}=props;const tableWrapperRef=useRef(null);const{table:table,expanded:expanded,setExpanded:setExpanded,hasAnySubRows:hasAnySubRows,selectedRowsLength:selectedRowsLength,fetchNextPage:fetchNextPage,updateLoadingStateRowCount:updateLoadingStateRowCount,fullData:fullData,totalFetched:totalFetched,isFetching:isFetching}=useTableState({tableData:tableData,columnDefinitions:columnDefinitions,enableSortingRemoval:enableSortingRemoval,expandedControl:expandedControl,sortControl:sortControl,onRowToggleClick:onRowToggleClick,selectableRows:selectableRows,initialLoadingRowsCount:initialLoadingRowsCount,loading:loading,pagination:pagination,paginationProps:paginationProps,virtualizedRows:virtualizedRows,tableOptions:tableOptions,columnVisibilityControl:columnVisibilityControl,pinnedRows:pinnedRows,rowStyling:rowStyling});const{handleExpandOrCollapse:handleExpandOrCollapse,onPageChange:onPageChange,fetchMoreOnBottomReached:fetchMoreOnBottomReached}=useTableActions({table:table,expanded:expanded,setExpanded:setExpanded,onToggleExpansionClick:onToggleExpansionClick,onRowSelectionChange:onRowSelectionChange});useEffect((()=>{if(!loading){updateLoadingStateRowCount()}}),[loading,updateLoadingStateRowCount]);useEffect((()=>{fetchMoreOnBottomReached(tableWrapperRef.current,fetchNextPage,isFetching,totalFetched,fullData.length)}),[fetchMoreOnBottomReached,fetchNextPage,isFetching,totalFetched,fullData.length]);const[isFullscreen,setIsFullscreen]=useState(false);const toggleFullscreen=useCallback((()=>{setIsFullscreen((prevState=>!prevState))}),[]);useEffect((()=>{if(allowFullScreen&&fullScreenControl){fullScreenControl({toggleFullscreen:toggleFullscreen,isFullscreen:isFullscreen})}}),[allowFullScreen,fullScreenControl,toggleFullscreen,isFullscreen]);const renderFullscreenHeader=()=>{if(!isFullscreen)return null;const defaultMinimizeIcon=jsx("button",{className:"gray-icon fullscreen-icon",onClick:toggleFullscreen,children:jsx(Icon,{cursor:"pointer",fixedWidth:true,icon:"arrow-down-left-and-arrow-up-right-to-center",...props})});return jsx(Card,{borderNone:true,borderRadius:"none",className:"advanced-table-fullscreen-header",...props,children:jsx(Flex,{justify:"end",children:defaultMinimizeIcon})})};useEffect((()=>{if(!allowFullScreen)return;const handleKeyDown=event=>{if(event.key==="Escape"&&isFullscreen){event.preventDefault();toggleFullscreen()}};document.addEventListener("keydown",handleKeyDown);return()=>{document.removeEventListener("keydown",handleKeyDown)}}),[allowFullScreen,toggleFullscreen,isFullscreen]);const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const isActionBarVisible=selectableRows&&showActionsBar&&selectedRowsLength>0||columnVisibilityControl;const classes=classnames(buildCss("pb_advanced_table"),`advanced-table-responsive-${responsive}`,maxHeight?`advanced-table-max-height-${maxHeight}`:"",{"advanced-table-fullscreen":isFullscreen,"advanced-table-allow-fullscreen":allowFullScreen,"hidden-action-bar":(selectableRows||columnVisibilityControl)&&!isActionBarVisible},{"advanced-table-sticky-left-columns":stickyLeftColumn&&stickyLeftColumn.length>0},columnGroupBorderColor?`column-group-border-${columnGroupBorderColor}`:"",scrollBarNone?"advanced-table-hide-scrollbar":"",globalProps(props),className);const tableWrapperStyle=virtualizedRows?getVirtualizedContainerStyles(maxHeight):{};const tableElement=jsx(Table,{className:`${loading?"content-loading":""}`,dark:dark,dataTable:true,numberSpacing:"tabular",responsive:"none",...tableProps,children:children?children:jsxs(Fragment,{children:[jsx(TableHeader,{}),jsx(TableBody,{isFetching:isFetching})]})});return jsxs(Fragment,{children:[pagination&&jsx(TablePagination,{onChange:onPageChange,position:"top",range:paginationProps==null?void 0:paginationProps.range,table:table}),jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,onScroll:virtualizedRows?e=>fetchMoreOnBottomReached(e.currentTarget,fetchNextPage,isFetching,totalFetched,fullData.length):void 0,ref:tableWrapperRef,style:tableWrapperStyle,children:[renderFullscreenHeader(),jsx(AdvancedTableProvider,{columnDefinitions:columnDefinitions,columnGroupBorderColor:columnGroupBorderColor,columnVisibilityControl:columnVisibilityControl,customSort:customSort,enableSortingRemoval:enableSortingRemoval,enableToggleExpansion:enableToggleExpansion,enableVirtualization:virtualizedRows,expandByDepth:expandByDepth,expanded:expanded,expandedControl:expandedControl,handleExpandOrCollapse:handleExpandOrCollapse,hasAnySubRows:hasAnySubRows,inlineRowLoading:inlineRowLoading,isActionBarVisible:isActionBarVisible,isFullscreen:isFullscreen,loading:loading,onCustomSortClick:onCustomSortClick,onExpandByDepthClick:onExpandByDepthClick,pinnedRows:pinnedRows,responsive:responsive,rowStyling:rowStyling,selectableRows:selectableRows,setExpanded:setExpanded,showActionsBar:showActionsBar,sortControl:sortControl,stickyLeftColumn:stickyLeftColumn,subRowHeaders:tableOptions==null?void 0:tableOptions.subRowHeaders,table:table,tableContainerRef:tableWrapperRef,toggleExpansionIcon:toggleExpansionIcon,totalAvailableCount:fullData.length,virtualizedRows:virtualizedRows,children:jsxs(React__default.Fragment,{children:[jsx(TableActionBar,{actions:actions,isVisible:isActionBarVisible,selectedCount:selectedRowsLength,type:columnVisibilityControl?"column-visibility":"row-selection"}),virtualizedRows?jsx("div",{style:{overflow:"auto",width:"100%"},children:tableElement}):tableElement]})})]}),pagination&&jsx(TablePagination,{onChange:onPageChange,position:"bottom",range:paginationProps==null?void 0:paginationProps.range,table:table})]})};AdvancedTable.Header=TableHeader;AdvancedTable.Body=TableBody;const BreadCrumbItem=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,component:component="a",...rest}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const Component=component||"span";const css=classnames(buildCss("pb_bread_crumb_item_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:css,id:id,children:jsx(Component,{className:"pb_bread_crumb_item",...domSafeProps(rest)})})};const BreadCrumbs=props=>{const{aria:aria={label:"Breadcrumb Navigation"},className:className,data:data={},htmlOptions:htmlOptions={},id:id,children:children}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const css=classnames(buildCss("pb_bread_crumbs_kit"),globalProps(props),className);return jsx("nav",{...ariaProps,...dataProps,...htmlProps,className:css,id:id,children:children})};const ButtonToolbar=props=>{const{aria:aria={},children:children,className:className,data:data={},htmlOptions:htmlOptions={},id:id,orientation:orientation="horizontal",text:text2,variant:variant="primary"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_button_toolbar_kit",orientation,variant),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:children||text2})};const contactTypeMap={cell:"mobile",email:"envelope",extension:"phone-plus",home:"phone",work:"phone-office","work-cell":"phone-laptop","wrong-phone":"phone-slash",international:"globe"};const envelopeIcon=getAllIcons()["envelope"].icon;const formatContact=(contactString,contactType)=>{if(contactType==="email")return contactString;if(contactType==="international")return contactString;const cleaned=contactString.replace(/\D/g,"");const phoneNumber=cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);if(contactType==="extension"){return cleaned.match(/^\d{4}$/)}if(phoneNumber){const intlCode=phoneNumber[1]?"+1 ":"";return[intlCode,"(",phoneNumber[2],") ",phoneNumber[3],"-",phoneNumber[4]].join("")}return null};const Contact=props=>{const{aria:aria={},className:className,contactDetail:contactDetail,contactType:contactType,contactValue:contactValue,data:data={},dark:dark=false,htmlOptions:htmlOptions={},id:id}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_contact_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Body$1,{className:"pb_contact_kit",color:"light",dark:dark,tag:"span",children:[contactType==="email"?jsx(Icon,{className:"svg-inline--fa envelope",customIcon:envelopeIcon,dark:dark,fixedWidth:true}):jsx(Icon,{dark:dark,fixedWidth:true,icon:contactTypeMap[contactType]||"phone"}),` ${formatContact(contactValue,contactType)} `,contactDetail&&jsx(Caption,{dark:dark,size:"xs",tag:"span",text:contactDetail})]})})};const CopyButton=props=>{const{aria:aria={},className:className,data:data={},from:from="",id:id,text:text2="Copy",timeout:timeout=1e3,tooltipPlacement:tooltipPlacement="bottom",tooltipText:tooltipText="Copied!",value:value=""}=props;const[copied,copy]=usePBCopy({value:value,from:from,timeout:timeout});const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const classes=classnames(buildCss("pb_copy_button_kit"),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,className:classes,id:id,children:jsx(Tooltip,{forceOpenTooltip:copied,placement:tooltipPlacement,showTooltip:false,text:tooltipText,children:jsx(Button,{icon:"copy",onClick:copy,children:text2})})})};const sizes$1={lg:1,md:3,sm:4};const Currency=props=>{const{abbreviate:abbreviate=false,align:align="left",aria:aria={},amount:amount,data:data={},decimals:decimals="default",emphasized:emphasized=true,htmlOptions:htmlOptions={},id:id,unit:unit,className:className,label:label="",nullDisplay:nullDisplay="",size:size="sm",symbol:symbol="$",variant:variant="default",dark:dark=false,unstyled:unstyled=false,commaSeparator:commaSeparator=false}=props;const emphasizedClass=emphasized?"":"_deemphasized";let variantClass;if(variant==="light"){variantClass="_light"}else if(variant==="bold"){variantClass="_bold"}const[whole,decimal="00"]=amount.split(".");const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_currency_kit",align,size),globalProps(props),className);const getFormattedNumber=input=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}).format(input);const getAbbreviatedValue=abbrType=>{const num=`${getFormattedNumber(whole.split(",").join(""))}`,isAmount=abbrType==="amount",isUnit=abbrType==="unit";return isAmount?num.slice(0,-1):isUnit?num.slice(-1):""};const getMatchingDecimalAmount=decimals==="matching"?amount:whole;const getMatchingDecimalValue=decimals==="matching"?"":`.${decimal}`;const formatAmount=amount2=>{if(!commaSeparator)return amount2;const[wholePart,decimalPart]=amount2.split(".");const formattedWhole=new Intl.NumberFormat("en-US").format(parseInt(wholePart));return decimalPart?`${formattedWhole}.${decimalPart}`:formattedWhole};const swapNegative=size==="sm"&&symbol!=="";const handleNegative=amount.startsWith("-")&&swapNegative?"-":"";const getAbsoluteAmount=amountString=>amountString.replace(/^-/,"");const getAbbrOrFormatAmount=abbreviate?getAbbreviatedValue("amount"):formatAmount(getMatchingDecimalAmount);const getAmount=swapNegative?getAbsoluteAmount(getAbbrOrFormatAmount):getAbbrOrFormatAmount;const getAbbreviation=abbreviate?getAbbreviatedValue("unit"):null;const getDecimalValue=abbreviate?"":getMatchingDecimalValue;return jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:[jsx(Caption,{dark:dark,children:label}),jsx("div",{className:`pb_currency_wrapper${variantClass||emphasizedClass}`,children:unstyled?nullDisplay&&!amount?jsx("div",{children:nullDisplay}):jsxs(Fragment,{children:[jsxs("div",{children:[handleNegative,symbol]}),jsx("div",{children:getAmount}),jsxs("div",{children:[getAbbreviation,unit?unit:getDecimalValue]})]}):nullDisplay&&!amount?jsx(Title,{className:"pb_currency_value",dark:dark,size:sizes$1[size],children:nullDisplay}):jsxs(Fragment,{children:[jsxs(Body$1,{className:"dollar_sign",color:"light",dark:dark,children:[handleNegative,symbol]}),jsx(Title,{className:"pb_currency_value",dark:dark,size:sizes$1[size],children:getAmount}),jsxs(Body$1,{className:"unit",color:"light",dark:dark,children:[getAbbreviation,unit?unit:getDecimalValue]})]})})]})};const statusMap={increase:"positive",decrease:"negative",neutral:"neutral"};const iconMap$1={increase:"arrow-up",decrease:"arrow-down"};const StatChange=props=>{const{change:change="neutral",className:className,dark:dark=false,htmlOptions:htmlOptions={},icon:icon,id:id,value:value}=props;const status=statusMap[change];let returnedIcon=iconMap$1[change];if(icon){returnedIcon=icon}const htmlProps=buildHtmlProps(htmlOptions);return jsx(Fragment,{children:value&&jsx("div",{className:classnames(buildCss("pb_stat_change_kit",status),globalProps(props),className),id:id,...htmlProps,children:jsxs(Body$1,{dark:dark,status:status,children:[" ",returnedIcon&&jsxs(Fragment,{children:[jsx(Icon,{dark:dark,fixed_width:true,icon:returnedIcon})," "]}),`${value}%`]})})})};const StatValue=props=>{const{className:className,htmlOptions:htmlOptions={},id:id,unit:unit,value:value=0}=props;const htmlProps=buildHtmlProps(htmlOptions);const displayValue=function(value2){if(value2||value2===0){return jsx(Title,{size:1,tag:"span",text:`${value2}`})}};const displayUnit=function(unit2){if(unit2){return jsx(Title,{size:3,tag:"span",text:unit2})}};return jsx("div",{className:classnames("pb_stat_value_kit",globalProps(props),className),id:id,...htmlProps,children:jsxs("div",{className:"pb_stat_value_wrapper",children:[displayValue(value)," ",displayUnit(unit)]})})};const DashboardValue=props=>{const{align:align="left",aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,statChange:statChange={},statLabel:statLabel,statValue:statValue={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_dashboard_value_kit",align),globalProps(props),className);return jsxs("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:[statLabel&&jsx(Body$1,{color:"light",children:statLabel}),statValue&&jsx(StatValue,{unit:statValue.unit,value:statValue.value}),statChange&&jsx(StatChange,{change:statChange.change,value:statChange.value})]})};const PbDate=props=>{const{aria:aria={},alignment:alignment="left",className:className,dark:dark=false,data:data={},htmlOptions:htmlOptions={},id:id,showDayOfWeek:showDayOfWeek=false,showCurrentYear:showCurrentYear=false,showIcon:showIcon=false,size:size="md",unstyled:unstyled=false,value:value}=props;const weekday=DateTime$1.toWeekday(value);const month=DateTime$1.toMonth(value);const day=DateTime$1.toDay(value);const year=DateTime$1.toYear(value);const currentYear=(new Date).getFullYear();const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_date_kit",alignment),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:unstyled?jsxs(Fragment,{children:[showIcon&&jsx("div",{children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt"})}),showDayOfWeek&&jsxs(Fragment,{children:[jsx("div",{children:weekday}),jsx("div",{children:"•"})]}),jsxs("span",{children:[jsxs("span",{children:[month," ",day]}),(currentYear!==year||showCurrentYear)&&jsx("span",{children:`, ${year}`})]})]}):size=="md"||size=="lg"?jsxs(Title,{dark:dark,size:4,tag:"h4",children:[showIcon&&jsx(Body$1,{className:"pb_icon_kit_container",color:"light",tag:"span",children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt"})}),showDayOfWeek&&jsxs(Fragment,{children:[weekday,jsx(Body$1,{color:"light",tag:"span",text:" • "})]}),jsxs("span",{children:[month," ",day]}),(currentYear!==year||showCurrentYear)&&jsx("span",{children:`, ${year}`})]}):jsxs(Fragment,{children:[showIcon&&jsx(Caption,{className:"pb_icon_kit_container",dark:dark,tag:"span",children:jsx(Icon,{fixedWidth:true,icon:"calendar-alt",size:"sm"})}),showDayOfWeek&&jsxs(Fragment,{children:[jsx(Caption,{dark:dark,tag:"div",children:weekday}),jsx(Caption,{color:"light",dark:dark,tag:"div",text:" • "})]}),jsxs(Caption,{dark:dark,tag:"span",children:[month," ",day,(currentYear!==year||showCurrentYear)&&jsx(Fragment,{children:`, ${year}`})]})]})})};const DatePicker=props=>{if(props.plugins);const{allowInput:allowInput=false,aria:aria={},className:className,customQuickPickDates:customQuickPickDates,dark:dark=false,data:data={},defaultDate:defaultDate="",disableDate:disableDate=null,disableInput:disableInput,disableRange:disableRange=null,disableWeekdays:disableWeekdays=null,enableTime:enableTime=false,error:error,format:format="m/d/Y",hideIcon:hideIcon=false,hideLabel:hideLabel=false,htmlOptions:htmlOptions={},id:id,initializeOnce:initializeOnce=false,inLine:inLine=false,inputAria:inputAria={},inputData:inputData={},inputOnChange:inputOnChange,inputValue:inputValue,label:label="Date Picker",maxDate:maxDate,minDate:minDate,mode:mode="single",name:name,onChange:onChange=()=>{},onClose:onClose,pickerId:pickerId,placeholder:placeholder="Select Date",plugins:plugins=false,position:position,positionElement:positionElement,scrollContainer:scrollContainer,selectionType:selectionType="",showTimezone:showTimezone=false,staticPosition:staticPosition=true,thisRangesEndToday:thisRangesEndToday=false,yearRange:yearRange=[1900,2100],controlsStartId:controlsStartId,controlsEndId:controlsEndId,syncStartWith:syncStartWith,syncEndWith:syncEndWith}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const inputAriaProps=buildAriaProps(inputAria);const inputDataProps=buildDataProps(inputData);const getCursorStyle=cursor=>{if(disableInput)return"not-allowed";if(cursor){return camelToSnakeCase(cursor).replace(/_/g,"-")}return"pointer"};useEffect((()=>{datePickerHelper({allowInput:allowInput,customQuickPickDates:customQuickPickDates,defaultDate:defaultDate,disableDate:disableDate,disableRange:disableRange,disableWeekdays:disableWeekdays,enableTime:enableTime,format:format,maxDate:maxDate,minDate:minDate,mode:mode,onChange:onChange,onClose:onClose,pickerId:pickerId,plugins:plugins,position:position,positionElement:positionElement,selectionType:selectionType,showTimezone:showTimezone,staticPosition:staticPosition,thisRangesEndToday:thisRangesEndToday,yearRange:yearRange,controlsStartId:controlsStartId,controlsEndId:controlsEndId,syncStartWith:syncStartWith,syncEndWith:syncEndWith,required:false},scrollContainer)}),initializeOnce?[]:void 0);const filteredProps={...props};if(filteredProps.marginBottom===void 0){filteredProps.marginBottom="sm"}filteredProps==null?true:delete filteredProps.position;const classes=classnames(buildCss("pb_date_picker_kit"),globalProps(filteredProps),error?"error":null,className);const iconWrapperClass=()=>{let base="cal_icon_wrapper";if(dark){base+=" dark"}if(hideLabel){base+=" no_label_shift"}if(error){base+=" error"}return base};const angleDown=getAllIcons()["angleDown"].icon;return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs("div",{...inputAriaProps,...inputDataProps,className:"input_wrapper",children:[!hideLabel&&jsx(Caption,{className:"pb_date_picker_kit_label",text:label}),jsxs(Fragment,{children:[jsxs("div",{className:"date_picker_input_wrapper",children:[jsx("input",{autoComplete:"off",className:"date_picker_input",disabled:disableInput,id:pickerId,name:name,onChange:inputOnChange,placeholder:placeholder,style:{cursor:getCursorStyle(filteredProps.cursor)},value:inputValue}),error&&jsx(Body$1,{status:"negative",text:error,variant:null})]}),!hideIcon&&jsx("div",{className:iconWrapperClass(),id:`cal-icon-${pickerId}`,children:jsx(Icon,{className:"cal_icon",icon:"calendar-alt"})}),hideIcon&&inLine?jsxs("div",{children:[jsx("div",{className:`${iconWrapperClass()} date-picker-inline-icon-plus`,id:`${pickerId}-icon-plus`,children:jsx(Icon,{className:"date-picker-plus-icon",icon:"plus"})}),jsx("div",{className:`${iconWrapperClass()} date-picker-inline-angle-down`,id:`${pickerId}-angle-down`,children:jsx(Icon,{className:"angle_down_icon svg-inline--fa",customIcon:angleDown})})]}):null]})]})})};const dateTimestamp$1=(dateValue,includeYear)=>{if(includeYear){return`${DateTime$1.toMonth(dateValue)} ${DateTime$1.toDay(dateValue)}, ${DateTime$1.toYear(dateValue)}`}else{return`${DateTime$1.toMonth(dateValue)} ${DateTime$1.toDay(dateValue)}`}};const dateTimeIso$1=dateValue=>DateTime$1.toIso(dateValue);const DateRangeInline=props=>{const{align:align="left",className:className,dark:dark=false,data:data={},endDate:endDate,htmlOptions:htmlOptions={},icon:icon=false,size:size="sm",startDate:startDate}=props;const dateInCurrentYear=()=>{const currentDate=new Date;return(startDate==null?void 0:startDate.getFullYear())===(endDate==null?void 0:endDate.getFullYear())&&(startDate==null?void 0:startDate.getFullYear())===currentDate.getFullYear()};const dateRangeClasses=buildCss("pb_date_range_inline_kit",align);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const renderTime=date=>jsx("time",{dateTime:dateTimeIso$1(date),children:dateInCurrentYear()?` ${dateTimestamp$1(date,false)} `:` ${dateTimestamp$1(date,true)} `});return jsx("div",{...dataProps,...htmlProps,className:classnames(dateRangeClasses,globalProps(props),className),children:jsxs("div",{className:"pb_date_range_inline_wrapper",children:[size==="xs"&&jsxs(Fragment,{children:[icon&&jsx(Caption,{dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_icon",dark:dark,fixedWidth:true,icon:"calendar-alt",size:size,tag:"span"})}),jsx(Caption,{dark:dark,tag:"span",children:renderTime(startDate)}),jsx(Caption,{dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_arrow",dark:dark,fixedWidth:true,icon:"long-arrow-right",tag:"span"})}),jsx(Caption,{dark:dark,tag:"span",children:renderTime(endDate)})]}),size==="sm"&&jsxs(Fragment,{children:[icon&&jsx(Body$1,{color:"light",dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_icon",dark:dark,fixedWidth:true,icon:"calendar-alt",size:size,tag:"span"})}),jsx(Body$1,{dark:dark,tag:"span",children:renderTime(startDate)}),jsx(Body$1,{color:"light",dark:dark,tag:"span",children:jsx(Icon,{className:"pb_date_range_inline_arrow",dark:dark,fixedWidth:true,icon:"long-arrow-right",tag:"span"})}),jsx(Body$1,{dark:dark,tag:"span",children:renderTime(endDate)})]})]})})};const DateYearStacked=props=>{const{align:align="left",className:className,dark:dark=false,date:date,data:data={},htmlOptions:htmlOptions={}}=props;const css=classnames(buildCss("pb_date_year_stacked",align),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsxs("div",{...dataProps,...htmlProps,className:css,children:[jsx(Title,{dark:dark,size:4,text:`${DateTime$1.toDay(date)} ${DateTime$1.toMonth(date).toUpperCase()}`}),jsx(Body$1,{color:"light",children:DateTime$1.toYear(date)})]})};const DateRangeStacked=props=>{const{className:className,dark:dark=false,endDate:endDate,htmlOptions:htmlOptions={},startDate:startDate,data:data={}}=props;const css=classnames(buildCss("pb_date_range_stacked"),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx("div",{...dataProps,...htmlProps,className:css,children:jsxs(Flex,{vertical:"center",children:[jsx(FlexItem,{children:jsx(DateYearStacked,{align:"right",dark:dark,date:startDate})}),jsx(FlexItem,{children:jsx("div",{children:jsx(Body$1,{color:"light",tag:"span",children:jsx(Icon,{className:"pb_date_range_stacked_arrow",fixedWidth:true,icon:"long-arrow-right"})})})}),jsx(FlexItem,{children:jsx(DateYearStacked,{dark:dark,date:endDate})})]})})};const sizes={sm:4,md:3};const DateStacked=props=>{const{align:align="left",bold:bold=false,reverse:reverse=false,className:className,dark:dark=false,date:date,data:data={},htmlOptions:htmlOptions={},size:size="sm"}=props;const classes=classnames(buildCss("pb_date_stacked_kit",align,size,{dark:dark,reverse:reverse}),globalProps(props),className);const currentYear=(new Date).getFullYear();const inputYear=DateTime$1.toYear(date);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx(Fragment,{children:bold==false?jsxs("div",{...dataProps,...htmlProps,className:classes,children:[jsxs("div",{className:"pb_date_stacked_day_month",children:[jsx(Caption,{text:DateTime$1.toMonth(date).toUpperCase()}),jsx(Title,{dark:dark,size:sizes[size],text:DateTime$1.toDay(date).toString()})]}),currentYear!=inputYear&&jsx(Caption,{size:"xs",children:inputYear})]}):jsx("div",{...dataProps,...htmlProps,className:classes,children:jsxs("div",{className:"pb_date_stacked_day_month",children:[jsx(Title,{bold:true,dark:dark,size:"4",text:DateTime$1.toMonth(date)}),jsx(Title,{bold:true,dark:dark,size:"4",text:DateTime$1.toDay(date).toString()}),currentYear!=inputYear&&jsx(Title,{size:"4",children:inputYear})]})})})};const Time=props=>{const{align:align,className:className,date:date,htmlOptions:htmlOptions={},showIcon:showIcon,size:size,timeZone:timeZone,unstyled:unstyled=false,showTimezone:showTimezone=true}=props;const classes=classnames(buildCss("pb_time_kit",align,size),globalProps(props),className);const clockIcon=getAllIcons()["clock"];const htmlProps=buildHtmlProps(htmlOptions);return jsxs("div",{...htmlProps,className:classes,children:[showIcon&&(unstyled?jsxs("span",{children:[jsx(Icon,{className:"svg-inline--fa clock",customIcon:clockIcon.icon})," "]}):jsx(Fragment,{children:jsxs(Body$1,{color:"light",tag:"span",children:[jsx(Icon,{className:"svg-inline--fa clock",customIcon:clockIcon.icon,fixedWidth:true,size:size==="md"?"":"sm"})," "]})})),jsx("time",{dateTime:date.toLocaleString(),children:jsx("span",{children:unstyled?jsxs(Fragment,{children:[jsx("span",{children:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx("span",{children:DateTime$1.toTimeZone(date,timeZone)})]}):size==="md"?jsxs(Fragment,{children:[jsx(Body$1,{className:"pb_time",tag:"span",text:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx(Body$1,{color:"light",tag:"span",text:DateTime$1.toTimeZone(date,timeZone)})]}):jsxs(Fragment,{children:[jsx(Caption,{color:"light",tag:"span",text:DateTime$1.toTimeWithMeridiem(date,timeZone)})," ",showTimezone&&jsx(Caption,{color:"light",tag:"span",text:DateTime$1.toTimeZone(date,timeZone)})]})})})]})};const DateTime=props=>{const{align:align="left",aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},showDayOfWeek:showDayOfWeek=false,datetime:datetime2,id:id,showIcon:showIcon=false,size:size="md",timeZone:timeZone="America/New_York"}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_date_time",size),globalProps(props),className);return jsx("div",{...ariaProps,...dataProps,...htmlProps,className:classes,id:id,children:jsxs(Flex,{horizontal:align,vertical:"baseline",children:[jsx(PbDate,{showDayOfWeek:showDayOfWeek,size:size,value:datetime2}),jsx(Time,{date:datetime2,marginLeft:"sm",showIcon:showIcon,size:size,timeZone:timeZone})]})})};const TimeStackedDefault=props=>{if(props.date);const{align:align="left",className:className,dark:dark,data:data={},date:date,htmlOptions:htmlOptions={},time:time,timeZone:timeZone}=props;const classes=classnames(buildCss("pb_time_stacked_kit",align),globalProps(props),className);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);return jsx("div",{className:classes,...dataProps,...htmlProps,children:jsx(Body$1,{className:classnames("pb_time_stacked","time-spacing"),color:"light",dark:dark,children:jsxs("time",{children:[DateTime$1.toTimeWithMeridiem(date?date:new Date(time),timeZone),jsx(Caption,{className:"pb_time_stacked",color:"light",dark:dark,tag:"span",text:DateTime$1.toTimeZone(date?date:new Date(time),timeZone)})]})})})};const DateTimeStacked=props=>{if(props.date);const{date:date,datetime:datetime2,dark:dark,htmlOptions:htmlOptions={},timeZone:timeZone="America/New_York"}=props;const classes=buildCss("pb_date_time_stacked_kit",globalProps(props));const htmlProps=buildHtmlProps(htmlOptions);return jsxs(Flex,{inline:false,vertical:"stretch",...htmlProps,...props,children:[jsx(FlexItem,{children:jsx(DateStacked,{align:"right",bold:true,dark:dark,date:date||datetime2})}),jsx(SectionSeparator,{className:"date-time-padding",orientation:"vertical"}),jsx(FlexItem,{children:jsx(TimeStackedDefault,{className:classes,dark:dark,date:date||datetime2,timeZone:timeZone})})]})};var lib={exports:{}};var Modal$1={};var propTypes={exports:{}};var ReactPropTypesSecret_1;var hasRequiredReactPropTypesSecret;function requireReactPropTypesSecret(){if(hasRequiredReactPropTypesSecret)return ReactPropTypesSecret_1;hasRequiredReactPropTypesSecret=1;var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";ReactPropTypesSecret_1=ReactPropTypesSecret;return ReactPropTypesSecret_1}var factoryWithThrowingShims;var hasRequiredFactoryWithThrowingShims;function requireFactoryWithThrowingShims(){if(hasRequiredFactoryWithThrowingShims)return factoryWithThrowingShims;hasRequiredFactoryWithThrowingShims=1;var ReactPropTypesSecret=requireReactPropTypesSecret();function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;factoryWithThrowingShims=function(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){return}var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}shim.isRequired=shim;function getShim(){return shim}var ReactPropTypes={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes};return factoryWithThrowingShims}var hasRequiredPropTypes;function requirePropTypes(){if(hasRequiredPropTypes)return propTypes.exports;hasRequiredPropTypes=1;{propTypes.exports=requireFactoryWithThrowingShims()()}return propTypes.exports}var ModalPortal={exports:{}};var focusManager={};var tabbable={exports:{}};var hasRequiredTabbable;function requireTabbable(){if(hasRequiredTabbable)return tabbable.exports;hasRequiredTabbable=1;(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.default=findTabbableDescendants;
22
22
  /*!
23
23
  * Adapted from jQuery UI core
24
24
  *
@@ -1 +1 @@
1
- import"./_weekday_stacked-BMwekyel.js";import"./lazysizes-B7xYodB-.js";import"./_typeahead-D3MtsWXG.js";import"./_line_graph-C9stNsP3.js";import"./lib-QZuu1ltS.js";import"react/jsx-runtime";import"react";import"react-dom";import"react-trix";import"trix";import"react-is";
1
+ import"./_weekday_stacked-F-TrWrrZ.js";import"./lazysizes-B7xYodB-.js";import"./_typeahead-D3MtsWXG.js";import"./_line_graph-C9stNsP3.js";import"./lib-QZuu1ltS.js";import"react/jsx-runtime";import"react";import"react-dom";import"react-trix";import"trix";import"react-is";
data/dist/menu.yml CHANGED
@@ -134,7 +134,7 @@ kits:
134
134
  status: stable
135
135
  icons_used: true
136
136
  react_rendered: false
137
- enhanced_element_used: false
137
+ enhanced_element_used: true
138
138
  - name: button_toolbar
139
139
  platforms: *1
140
140
  description: This kit should primarily hold the most commonly used buttons.