ingred-ui 31.0.0 → 31.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,13 +55,28 @@ Storybook: https://ingred-ui.netlify.app/
55
55
 
56
56
  ## Development
57
57
 
58
+ このリポジトリでは [pnpm](https://pnpm.io/) を使います(`package.json` の `packageManager` フィールド参照)。Node.js 20 以上を推奨します。
59
+
60
+ ```bash
61
+ # 初回・依存更新後
62
+ pnpm install
63
+
64
+ # よく使うコマンド
65
+ pnpm run lint
66
+ pnpm run test
67
+ pnpm run storybook
68
+ pnpm run build-storybook
69
+ pnpm run build
70
+ pnpm run format
71
+ ```
72
+
58
73
  ### 祝日データの更新
59
74
 
60
75
  カレンダーコンポーネントで使用される日本の祝日データは、内閣府が公開しているCSVファイルから自動的に更新されます。
61
76
 
62
77
  ```bash
63
78
  # 手動で祝日データを更新
64
- yarn update-holidays
79
+ pnpm run update-holidays
65
80
  ```
66
81
 
67
82
  詳細な情報については、[scripts/holiday/README.md](./scripts/holiday/README.md) を参照してください。
@@ -1,4 +1,4 @@
1
- import { Property } from "csstype";
1
+ import type { Property } from "csstype";
2
2
  import { FlexProps } from "../Flex/Flex";
3
3
  import { SpacerProps } from "../../utils/spacer";
4
4
  export type CardProps = SpacerProps & FlexProps & {
@@ -1,2 +1,3 @@
1
- export { default } from "./Card";
1
+ import Card from "./Card";
2
+ export default Card;
2
3
  export type { CardProps } from "./Card";
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Property } from "csstype";
2
+ import type { Property } from "csstype";
3
3
  export type FileUploaderProps = {
4
4
  description?: string;
5
5
  title?: string;
@@ -1,4 +1,4 @@
1
- import { Property } from "csstype";
1
+ import type { Property } from "csstype";
2
2
  type TLengthStyledSystem = string | 0 | number;
3
3
  export type FlexProps = {
4
4
  display?: "flex" | "inline-flex";
@@ -1,2 +1,3 @@
1
- export { default } from "./Flex";
1
+ import Flex from "./Flex";
2
+ export default Flex;
2
3
  export type { FlexProps } from "./Flex";
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Property } from "csstype";
2
+ import type { Property } from "csstype";
3
3
  import { InputSize, InputVariant } from "./types";
4
4
  export type InputProps = (React.ComponentPropsWithoutRef<"input"> | React.ComponentPropsWithoutRef<"textarea">) & {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Property } from "csstype";
2
+ import type { Property } from "csstype";
3
3
  import { Theme } from "../../themes";
4
4
  import { IconName } from "../Icon";
5
5
  export type ContentType = "default" | "warning" | "disabled";
@@ -1,4 +1,4 @@
1
- import { Placement } from "@floating-ui/core";
1
+ import type { Placement } from "@floating-ui/react";
2
2
  import * as React from "react";
3
3
  import { ModalProps } from "../Modal";
4
4
  import { AutoPlacement } from "../../hooks/usePlacement";
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Property } from "csstype";
2
+ import type { Property } from "csstype";
3
3
  export type ScrollAreaProps = React.ComponentPropsWithoutRef<"div"> & {
4
4
  height?: Property.Height;
5
5
  maxHeight?: Property.MaxHeight;
@@ -1 +1,2 @@
1
- export { default } from "./Spacer";
1
+ import Spacer from "./Spacer";
2
+ export default Spacer;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Property } from "csstype";
2
+ import type { Property } from "csstype";
3
3
  export type SpinnerProps = {
4
4
  width?: Property.Width;
5
5
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { IconName } from "../Icon/Icon";
3
3
  import { SwitchSize, SwitchVariant } from "./types";
4
- import { Placement } from "@floating-ui/core";
4
+ import type { Placement } from "@floating-ui/react";
5
5
  type Case = {
6
6
  name: string;
7
7
  value?: string | number;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Placement } from "@floating-ui/core";
2
+ import type { Placement } from "@floating-ui/react";
3
3
  import { CSSTransitionProps } from "../../utils/reactTransitionGroup";
4
4
  import { AutoPlacement } from "../../hooks/usePlacement";
5
5
  export type TooltipProps = Omit<React.ComponentPropsWithoutRef<"div">, "content"> & {
package/dist/index.es.js CHANGED
@@ -1093,7 +1093,7 @@ object-assign
1093
1093
  z-index: 1;
1094
1094
  `,Fu=e=>{var{value:n,multiple:l=!1,disabled:s=!1,placeholder:d="選択してください",size:u="medium",variant:p="light",tagVariant:m,tagOverflow:f="truncate",showBulkActions:b=!1,selectAllLabel:v="すべて選択",clearAllLabel:x="すべてクリア",searchable:y=!1,searchPlaceholder:w="検索",noResultsMessage:C="見つかりませんでした",error:E=!1,applyButtonText:I="適用",cancelButtonText:k="キャンセル",children:M,onChange:A,onTempChange:$,width:L,minWidth:O,placement:S,middleware:V}=e,H=D(e,["value","multiple","disabled","placeholder","size","variant","tagVariant","tagOverflow","showBulkActions","selectAllLabel","clearAllLabel","searchable","searchPlaceholder","noResultsMessage","error","applyButtonText","cancelButtonText","children","onChange","onTempChange","width","minWidth","placement","middleware"]);const[R,N]=r(!1),[z,T]=r(""),[Z,B]=r([]),[P,_]=r(!1),G=i(null),Y=a((()=>m||("light"===p?"dark":"light")),[p,m]),F=a((()=>l?Array.isArray(n)?n:[]:void 0!==n?[n]:[]),[n,l]),j=a((()=>{if(!M)return[];const e=[],t=n=>{h.forEach(n,(n=>{if(!g(n))return;const r=n;if(r.type&&"string"!=typeof r.type){const n=r.type.displayName||r.type.name;if("Select2Option"===n){const t=r.props.value,n=r.props.children,i=!!r.props.disabled,o=r.props.prepend,a=r.props.append;void 0!==t&&e.push({value:t,label:String(n),disabled:i,prepend:o,append:a})}else"Select2OptionGroup"===n&&r.props.children&&t(r.props.children)}}))};return t(M),e}),[M]),W=c((e=>{null==A||A(e)}),[A]),X=c((e=>{s||(N(e),e&&l&&B([...F]),e||T(""))}),[s,l,F]),J=c((e=>{e.disabled||(W(e.value),N(!1),T(""))}),[W]),U=c(((e,t)=>{t.disabled||B((n=>e?[...n,t.value]:n.filter((e=>e!==t.value))))}),[]),Q=c((()=>{l&&W(Z),N(!1),T("")}),[W,l,Z]),q=c((()=>{N(!1),T("")}),[]),K=c((e=>{if(l&&Array.isArray(n)){const t=n.filter((t=>t!==e));W(t)}}),[l,n,W]),te=c((e=>{T(e.target.value)}),[]),ne=c((e=>{e.stopPropagation(),T("")}),[]),re=c((()=>{s||X(!R)}),[s,X,R]),ie=a((()=>j.find((e=>e.value===n))),[j,n]),oe=a((()=>l&&Array.isArray(n)?j.filter((e=>n.includes(e.value))):[]),[l,j,n]),ae=a((()=>{if(!y||!z)return j;const e=z.trim();if(!e)return j;const t=e.includes(","),n=e.startsWith('"')&&e.endsWith('"'),r=hd(e);return j.filter((i=>{const o=i.label.toLowerCase();return n?r.some((e=>o===e.toLowerCase())):t?r.some((e=>o.includes(e.toLowerCase()))):o.includes(e.toLowerCase())}))}),[j,z,y]),le=c((()=>{const e=ae.filter((e=>!e.disabled)).map((e=>e.value));B((t=>[...new Set([...t,...e])]))}),[ae]),se=c((()=>{B([])}),[]),ce=c((()=>{G.current&&"wrap"!==f&&_(G.current.scrollWidth>G.current.clientWidth)}),[f]);o((()=>{if(!window.ResizeObserver)return;if(!G.current)return;ce();const e=new window.ResizeObserver((()=>{G.current&&ce()}));return e.observe(G.current),()=>{e.disconnect()}}),[ce,oe,f]),o((()=>{l&&Array.isArray(n)&&B(n)}),[l,n]),o((()=>{l&&"function"==typeof $&&$(Z)}),[l,Z]);const de=a((()=>b&&l?t.createElement(Gu,null,t.createElement(Au,{content:v,positionPriority:["top"],offset:[0,8],disabled:0===ae.length},t.createElement(rc,{icon:t.createElement(ee,{name:"check_thin",color:"currentColor"}),size:"small",color:"secondaryDark",disabled:0===ae.length,onClick:le})),t.createElement(Au,{content:x,positionPriority:["top"],offset:[0,8],disabled:0===ae.length},t.createElement(rc,{icon:t.createElement(ee,{name:"close",color:"currentColor"}),size:"small",color:"secondaryDark",disabled:0===ae.length,onClick:se}))):null),[b,l,v,x,ae,le,se]),ue=a((()=>y&&b&&l?t.createElement(Pu,null,t.createElement(_u,null,t.createElement(Bu,{autoFocus:!0,placeholder:w,value:z,onChange:te}),z&&t.createElement(Yu,{type:"button","aria-label":"検索をリセット",onClick:ne},t.createElement(ee,{name:"close_circle",type:"fill",color:"currentColor"}))),de):y?t.createElement(Pu,null,t.createElement(_u,null,t.createElement(Bu,{autoFocus:!0,placeholder:w,value:z,onChange:te}),z&&t.createElement(Yu,{type:"button","aria-label":"検索をリセット",onClick:ne},t.createElement(ee,{name:"close_circle",type:"fill",color:"currentColor"})))):b&&l?de:null),[y,b,l,z,w,te,ne,de]),pe=a((()=>l?t.createElement(Rs,null,t.createElement(rc,{color:"clear",size:"small",onClick:q},k),t.createElement(rc,{color:"primary",size:"small",onClick:Q},I)):null),[l,Q,q,I,k]),me=t.createElement(Ou,Object.assign({$disabled:s,$error:E,$hasValue:l?Array.isArray(n)&&n.length>0:!!ie,$isOpen:R,$multiple:l,$size:u,$variant:p,"aria-expanded":R,"aria-invalid":E,disabled:s,role:"combobox",type:"button"},H),l&&Array.isArray(n)&&0===n.length?t.createElement(Tu,{$disabled:s,$variant:p},d):!l&&t.createElement(Vu,null,ie?t.createElement(t.Fragment,null,ie.prepend&&t.createElement(Ru,{$size:u,$disabled:s},t.isValidElement(ie.prepend)&&ie.prepend.type===ee?t.cloneElement(ie.prepend,{size:parseInt($u[u].iconSize,10),color:ie.prepend.props.color||"currentColor"}):ie.prepend),t.createElement(Hu,null,ie.label)):t.createElement(Tu,{$disabled:s,$variant:p},d)),t.createElement(Zu,{$disabled:s,$size:u,$multiple:l},t.createElement(ee,{name:"arrow_down",color:"currentColor"})));return t.createElement(Du,null,t.createElement(Lu,{$disabled:s,$error:E,$isOpen:R,$size:u,$variant:p,$tagOverflow:f,"data-disabled":s,"data-overflowing":"wrap"!==f&&P,style:{cursor:l||s?"default":"pointer"}},t.createElement(Ls,null,t.createElement(Ds,{noResultsMessage:y?C:void 0,open:R,stickyFooter:pe,stickyHeader:ue,trigger:me,width:L,minWidth:O,placement:S,middleware:V,onOpenChange:X},(()=>{const e=y&&!!z?new Set(ae.map((e=>e.value))):void 0;if(M){const r=((e,r)=>{const i=[];let o=null;const a=(e,i,o)=>{const a=e.props.value,s=!!e.props.disabled,c=e.props.children,d=e.props.prepend,u=e.props.append;if(r&&!r.has(a))return null;const p=l?Z.includes(a):a===n;return t.createElement(ro,{key:`${i}-${o}`,checked:p,closeOnChange:!l,disabled:s,tabIndex:0,prepend:d,append:u,onChange:()=>{l?U(!p,{value:a,label:String(c),disabled:s,prepend:d,append:u}):J({value:a,label:String(c),disabled:s,prepend:d,append:u})}},c)},s=()=>{if(null===o)return;const e=o,n=e.options.map(((t,n)=>a(t,`option-${e.label}`,n))).filter(Boolean);0!==n.length&&(i.push(t.createElement(Os,{key:`heading-${e.label}`},e.label)),i.push(...n))};return h.forEach(e,(e=>{if(!g(e))return;const n=e;if(n.type&&"string"!=typeof n.type){const e=n.type.displayName||n.type.name;if("Select2OptionGroup"===e)null!==o&&s(),o={label:n.props.label,options:[]},n.props.children&&h.forEach(n.props.children,(e=>{if(g(e)){const t=e;"Select2Option"===(t.type.displayName||t.type.name)&&null!==o&&o.options.push(t)}}));else if("Select2Separator"===e)i.length>0&&i.push(t.createElement(Hs,{key:`separator-${i.length}`}));else if("Select2Option"===e)if(null!==o)o.options.push(n);else{const e=n.props.value;if(r&&!r.has(e))return;i.push(a(n,"option",i.length))}else i.push(n)}})),null!==o&&s(),i})(M,e);return 0===r.length?t.createElement(vs,{message:C}):r}return ae.length>0?ae.map((e=>{const r=l?Z.includes(e.value):e.value===n;return t.createElement(ro,{key:e.value.toString(),checked:r,closeOnChange:!l,disabled:e.disabled,tabIndex:0,prepend:e.prepend,append:e.append,onChange:()=>{l?U(!r,e):J(e)}},e.label)})):t.createElement(vs,{message:C})})())),l&&t.createElement(Su,{$tagOverflow:f},t.createElement(Nu,{ref:G,$tagOverflow:f,"data-testid":"tag-container",onClick:re},oe.map((e=>{const n=s?void 0:()=>K(e.value);return t.createElement(zu,{key:e.value.toString(),disabled:s,label:e.label,size:u,variant:Y,onRemove:n})}))))))},ju=e=>null;ju.displayName="Select2Option";const Wu=e=>null;Wu.displayName="Select2OptionGroup";const Xu=()=>null;Xu.displayName="Select2Separator";const Ju=x(ve)`
1095
1095
  ${_}
1096
- `,Uu=e.forwardRef((function({children:t,size:n="md"},r){const i=J();return e.createElement(re,{ref:r,display:"flex",alignItems:"center"},e.createElement(Ys,{pr:.5},e.createElement(ee,{name:"alert",type:"fill",color:i.palette.danger.base,size:"sm"===n?"sm-md":n})),e.createElement(Ju,{color:i.palette.danger.base,size:n},t))})),Qu=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l}=e;return"checkbox"===t?n:"radio"===t?[r]:l?[i,o]:[a]},qu=(e,t)=>{const n=Ke(e).find((e=>e.value===t));return(null==n?void 0:n.label)||t},Ku=e=>{const{conditionConfig:t,inputType:n,operator:r,values:i,dateFormat:o}=e;return i.map((e=>{if("checkbox"===n||"radio"===n){const n=((e,t)=>{if(t){const n=e.operators.find((e=>e.value===t));if(null==n?void 0:n.options)return n.options}return e.options||[]})(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n&&o){const t=String(e);if(!t||""===t.trim())return t;const n=Ts(t,"YYYY-MM-DD");return n.isValid()?n.format(o):t}return String(e)}))},ep=e=>{const{inputType:t,operator:n,selectedValues:r,selectedRadioValue:i,startDate:o,endDate:a,value:l,isRangeOperator:s,customValidation:c}=e;if("checkbox"===t){if(0===r.length)return{isValid:!1,errorMessage:"少なくとも1つの項目を選択してください"}}else if("radio"===t){if(""===i||null==i)return{isValid:!1,errorMessage:"項目を選択してください"}}else if(s){if(!o||!a)return{isValid:!1,errorMessage:"開始日と終了日の両方を選択してください"}}else if(!l||""===l.trim())return{isValid:!1,errorMessage:"date"===t?"日付を選択してください":"値を入力してください"};if(c){let e;return e="checkbox"===t?r:"radio"===t?[i]:s?[o,a]:[l],c(e,n)}return s&&new Date(o)>new Date(a)?{isValid:!1,errorMessage:"開始日は終了日より前である必要があります"}:{isValid:!0,errorMessage:""}},tp=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l}=e;return"checkbox"===t?n.length>0:"radio"===t?""!==r&&null!=r:l?!(!i||!o):!(!a||""===a.trim())},np=e=>!1!==e.required,rp=(e,t)=>{const n=Qe(t,e.conditionKey);return n?{condition:e,conditionConfig:n}:null},ip=e=>{const{condition:t,conditionConfig:n}=e,r=et(n,t.operator),i=tt(n,t.operator);return tp({inputType:r,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:i})},op=e=>{const{condition:t,conditionConfig:n}=e,r=et(n,t.operator),i=tt(n,t.operator);return ep({inputType:r,operator:t.operator,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:i,customValidation:n.customValidation})},ap={MENU_WIDTH:160,CONFIG_PANEL_WIDTH:264,DEFAULT_MENU_POSITION:24,TAG_SPACING:8,TAG_OFFSET_MULTIPLE:40,ESTIMATED_TAG_WIDTH:120,ICON_AREA_WIDTH:24,CLEAR_BUTTON_WIDTH:16,FALLBACK_POSITION_X:80,FALLBACK_POSITION_Y:148,CONFIG_PANEL_HEADER_HEIGHT:60,CONFIG_PANEL_BUTTON_HEIGHT:50,CONFIG_PANEL_PADDING:16,CONFIG_PANEL_MIN_CONTENT_HEIGHT:200,TRANSITION_DURATION:200,MIN_VALUE_LENGTH:1},lp="[data-tag]",sp='[role="menu"]',cp='[data-advanced-filter-trigger="true"]',dp='[role="button"]',up=({options:e,selectedValues:n,onValueToggle:r})=>t.createElement(bt,null,e.map((e=>t.createElement(ro,{key:String(e.value),checked:n.includes(e.value),onChange:t=>r(e.value,t)},e.label))));up.displayName="CheckboxValueInput";const pp=({options:e,selectedRadioValue:n,onRadioChange:r})=>t.createElement(bt,null,e.map((e=>t.createElement(ro,{key:String(e.value),checked:n===e.value,onChange:t=>{t&&r(e.value)}},e.label))));pp.displayName="RadioValueInput";const mp=640,hp=["日","月","火","水","木","金","土"],gp={components:{ConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FullSizeConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FileUploader:{defaultProps:{title:"ファイルをドラッグ&ドロップ、またはここをクリック"}},ItemEmpty:{defaultProps:{title:"見つかりませんでした。"}},Select:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません"}},CreatableSelect:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません",addMessage:"次の文字列を追加する"}},MultipleFilter:{defaultProps:{placeholder:"新しいフィルターを追加してください"}},FilterCard:{defaultProps:{applyButtonTitle:"適用",inputErrorText:"入力してください",formPlaceholder:"検索",sectionTitle:"セクション"}},EditFilterCard:{defaultProps:{}},DatePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...hp]}}},DateRangePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...hp]},applyButtonText:"適用",cancelButtonText:"キャンセル"}},WeekTime:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},WeekTimeSelector:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},DualListBox:{defaultProps:{selectedItemTitle:"個選択済み"}}}},fp={components:{ConfirmModal:{defaultProps:{confirmText:"确认",cancelText:"取消"}},FullSizeConfirmModal:{defaultProps:{confirmText:"确认",cancelText:"取消"}},FileUploader:{defaultProps:{title:"把文件拖入, 同样支持点击上传。"}},ItemEmpty:{defaultProps:{title:"未找到。"}}}},bp={components:{DatePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}}},DateRangePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},applyButtonText:"Apply",cancelButtonText:"Cancel"}},WeekTime:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},WeekTimeSelector:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},DualListBox:{defaultProps:{selectedItemTitle:"selected"}}}},vp=e.createContext({locale:bp}),xp=({locale:t,children:n})=>e.createElement(vp.Provider,{value:{locale:t}},n);function yp(e){var n,r;const{name:i,props:o}=e,a=t.useContext(vp).locale,l=Object.assign({},o);if(!a||!a.components)return l;const s=null===(r=null===(n=a.components)||void 0===n?void 0:n[i])||void 0===r?void 0:r.defaultProps;for(const e in s)void 0===l[e]&&(l[e]=s[e]);return l}const wp=n((function(e,n){const i=yp({props:e,name:"DatePicker"}),{date:o,format:l="YYYY-MM-DD",disabled:s=!1,size:d="medium",variant:u="light",width:p,monthFormat:m,weekConfig:h,showDateFields:g=!1,showTimeFields:f=!1,timeFieldProps:b,useCalendarRange:v=!1,isOutsideRange:x,error:y=!1,errorText:w,defaultPresetButton:C,presetButtons:E,onPresetButtonClick:I,onDateChange:k,onDatesChange:M,endDate:A}=i,$=J(),[D,L]=r(!1),{context:O,refs:S,strategy:V,x:H,y:R}=Ni({placement:"bottom-start",open:D,onOpenChange:L,middleware:[zn(10),Nn(),Tn({padding:8})]}),N=Hi(O),z=Fi(O),{getReferenceProps:T,getFloatingProps:Z}=Ti([N,z]),B=c((()=>{s||L((e=>!e))}),[s]),P=c((e=>{k(e),L(!1)}),[k]),_=a((()=>t.createElement(ee,{name:"date_range",color:s?$.palette.neutral.base:$.palette.text.accent})),[s,$]),G=a((()=>"100%"===p||"string"==typeof p&&p.includes("100%")?{width:"100%"}:{width:"fit-content"}),[p]);return t.createElement(re,{ref:n,style:G},t.createElement("div",Object.assign({ref:S.setReference},T()),t.createElement($E,{date:o,format:l,error:y,errorText:w,disabled:s,size:d,variant:u,width:p,append:_,onDateChange:k,onAppendClick:B})),D&&t.createElement(ki,null,t.createElement($i,{context:O,modal:!1,initialFocus:-1,returnFocus:!1},v?t.createElement(Wh,Object.assign({ref:S.setFloating,startDate:o,endDate:A||o,monthFormat:m,weekConfig:h,defaultPresetButton:C,presetButtons:E,showDateFields:g,showTimeFields:f,timeFieldProps:b,dateFieldFormat:l,isOutsideRange:x,style:{position:V,top:null!=R?R:0,left:null!=H?H:0,zIndex:$.depth.calendarRange,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:I,onDatesChange:M},Z())):t.createElement(kh,Object.assign({ref:S.setFloating,date:o,monthFormat:m,weekConfig:h,defaultPresetButton:C,presetButtons:E,showDateFields:g,showTimeFields:f,timeFieldProps:b,dateFieldFormat:l,isOutsideRange:x,style:{position:V,top:null!=R?R:0,left:null!=H?H:0,zIndex:$.depth.calendar,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:I,onDateChange:P},Z())))))}));var Cp=u(wp);const Ep=({startDate:e,endDate:n,onStartDateChange:r,onEndDateChange:i,format:o="YYYY-MM-DD"})=>{const l=a((()=>{if(e&&""!==e.trim()){const t=Ts(e,"YYYY-MM-DD");return t.isValid()?t:Ts()}return Ts()}),[e]),s=a((()=>{if(n&&""!==n.trim()){const e=Ts(n,"YYYY-MM-DD");return e.isValid()?e:Ts()}return Ts()}),[n]);return t.createElement(ut,null,t.createElement(mt,null,t.createElement(ft,{htmlFor:"start-date-picker"},"開始日"),t.createElement(Cp,{date:l,format:o,variant:"dark",width:"100%",onDateChange:e=>{r(e.format("YYYY-MM-DD"))}})),t.createElement(mt,null,t.createElement(ft,{htmlFor:"end-date-picker"},"終了日"),t.createElement(Cp,{date:s,format:o,variant:"dark",width:"100%",onDateChange:e=>{i(e.format("YYYY-MM-DD"))}})))};Ep.displayName="DateRangeInput";const Ip=({inputType:e,value:n,placeholder:r,onValueChange:i,onKeyDown:o,format:l="YYYY-MM-DD"})=>{const s=a((()=>{if("date"===e&&n&&""!==n.trim()){const e=Ts(n,"YYYY-MM-DD");return e.isValid()?e:Ts()}return Ts()}),[e,n]),c=e=>{const t=e.format("YYYY-MM-DD");i(t)};return"date"===e?t.createElement(gt,null,t.createElement(Cp,{date:s,format:l,variant:"dark",width:"100%",onDateChange:c})):t.createElement(ht,null,t.createElement(hs,{type:"text",value:n,placeholder:r,fullWidth:!0,variant:"dark",onChange:e=>i(e.target.value),onKeyDown:o}))};Ip.displayName="TextValueInput";const kp=({filterConfig:e,operator:n,value:r,selectedValues:i,selectedRadioValue:o,startDate:a,endDate:l,onValueChange:s,onValueToggle:c,onRadioChange:d,onStartDateChange:u,onEndDateChange:p,onKeyDown:m,isRangeOperator:h})=>{const g=ze(e,n);return"checkbox"===g?t.createElement(up,{options:Ze(e,n),selectedValues:i,onValueToggle:c}):"radio"===g?t.createElement(pp,{options:Ze(e,n),selectedRadioValue:o,onRadioChange:d}):h(n)?t.createElement(Ep,{startDate:a,endDate:l,format:Be(e),onStartDateChange:u,onEndDateChange:p}):t.createElement(Ip,{inputType:g,value:r,placeholder:Te(e),format:"date"===g?Be(e):void 0,onValueChange:s,onKeyDown:m})};kp.displayName="ConfigPanelValueInput";const Mp=(e,t,n)=>{if(!t)return((e,t)=>{const n=qe(e),r=et(e,n);let i="",o="",a="";return tt(e,n)?(o=t,a=t):"date"===r&&(i=t),{id:`condition_${e.conditionKey}`,conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:n,value:i,selectedValues:[],selectedRadioValue:"",startDate:o,endDate:a}})(e,n);let r="",i=[],o="",a="",l="";if((t.isRange||!1)&&t.values.length>=2)a="string"==typeof t.values[0]?t.values[0]:"",l="string"==typeof t.values[1]?t.values[1]:"";else if(t.values.length>0){const e=t.values[0];"string"==typeof e&&(r=e),i=t.values,o=e}return{id:`condition_${e.conditionKey}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:t.operator,value:r,selectedValues:i,selectedRadioValue:o,startDate:a,endDate:l}},Ap=({filterConfig:e,multiConditionState:n,onKeyDown:r})=>{const{conditions:i,updateConditionOperator:o,updateConditionValue:a,updateConditionSelectedValues:l,updateConditionSelectedRadioValue:s,updateConditionStartDate:c,updateConditionEndDate:d}=n,u=Ue(e);return t.createElement("div",null,u.map(((n,p)=>{const m=i.find((e=>e.conditionKey===n.conditionKey));if(!m)return null;const h=et(n,m.operator),g=tt(n,m.operator),f=u.length>=2;return t.createElement("div",{key:m.id},p>0&&t.createElement(Hs,null),f&&t.createElement(Os,null,n.conditionLabel),t.createElement($t,null,t.createElement(Fu,{value:m.operator,variant:"dark",onChange:e=>{"string"==typeof e&&o(m.id,e)}},Ke(n).map((e=>t.createElement(ju,{key:e.value,value:e.value},e.label))))),t.createElement($t,null,t.createElement(kp,{endDate:m.endDate,filterConfig:e?Object.assign(Object.assign({},e),{operators:Ke(n),inputType:h,options:n.options}):void 0,isRangeOperator:()=>g,operator:m.operator,selectedRadioValue:m.selectedRadioValue,selectedValues:m.selectedValues,startDate:m.startDate,value:m.value,onEndDateChange:e=>{d(m.id,e)},onKeyDown:r,onRadioChange:e=>{s(m.id,e)},onStartDateChange:e=>{c(m.id,e)},onValueChange:e=>{a(m.id,e)},onValueToggle:(e,t)=>{const n=[...m.selectedValues];if(t)n.push(e);else{const t=n.indexOf(e);t>-1&&n.splice(t,1)}l(m.id,n)}})))})))};Ap.displayName="MultiConditionInput";const $p=({filterType:e,isOpen:n,onApply:i,onCancel:l,editingFilter:s,filterConfig:d,savedCoordinates:u})=>{const p=(e=>void 0!==(null==e?void 0:e.multiConditionConfigs)&&e.multiConditionConfigs.length>0)(d),[m,h]=r(""),g=c((()=>h("")),[]),f=c((e=>{const t=Ne(d).find((t=>t.value===e));return(null==t?void 0:t.isRange)||!1}),[d]),b=((e,t,n,i)=>{const[a,l]=r(Re(e)),[s,d]=r(""),[u,p]=r([]),[m,h]=r(""),[g,f]=r(""),[b,v]=r("");o((()=>{if(t)l(t.operator),d("string"==typeof t.values[0]?t.values[0]:""),p(t.values),h(t.values[0]||""),n&&n(t.operator)?(f("string"==typeof t.values[0]?t.values[0]:""),v("string"==typeof t.values[1]?t.values[1]:"")):(f(""),v(""));else{const t=Re(e);l(t);const r=ze(e,t),i=Ts().format("YYYY-MM-DD");n&&n(t)?(f(i),v(i),d("")):"date"===r?(d(i),f(""),v("")):(d(""),f(""),v("")),p([]),h("")}}),[t,n,e]);const x=c((e=>{d(e),null==i||i()}),[i]),y=c(((e,t)=>{p(t?t=>[...t,e]:t=>t.filter((t=>t!==e))),null==i||i()}),[i]),w=c((e=>{h(e),null==i||i()}),[i]),C=c((e=>{f(e),null==i||i()}),[i]),E=c((e=>{v(e),null==i||i()}),[i]);return{operator:a,value:s,selectedValues:u,selectedRadioValue:m,startDate:g,endDate:b,setOperator:l,setValue:d,setSelectedValues:p,setSelectedRadioValue:h,setStartDate:f,setEndDate:v,handleValueChange:x,handleValueToggle:y,handleRadioChange:w,handleStartDateChange:C,handleEndDateChange:E}})(d,s||void 0,f,g),v=((e,t,n)=>{const i=a((()=>Ue(e)),[e]),[l,s]=r([]);o((()=>{var e;if(0===i.length)return;const n=Ts().format("YYYY-MM-DD"),r=new Map((null===(e=null==t?void 0:t.conditions)||void 0===e?void 0:e.map((e=>[e.conditionKey,e])))||[]),o=i.map((e=>Mp(e,r.get(e.conditionKey),n)));s(o)}),[t,i]);const d=c((()=>{if(0===i.length)return;const e=new Set(l.map((e=>e.conditionKey))),t=i.find((t=>!e.has(t.conditionKey)))||i[0],r=qe(t),o=et(t,r),a=Ts().format("YYYY-MM-DD");let c="",d="",u="";tt(t,r)?(d=a,u=a):"date"===o&&(c=a);const p={id:`condition_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:r,value:c,selectedValues:[],selectedRadioValue:"",startDate:d,endDate:u};s((e=>[...e,p])),null==n||n()}),[i,l,n]),u=c((e=>{s((t=>t.filter((t=>t.id!==e)))),null==n||n()}),[n]),p=c(((e,t,r)=>{const o=i.find((e=>e.conditionKey===t));if(!o)return;const a=qe(o),l=et(o,a),c=Ts().format("YYYY-MM-DD");let d="",u="",p="";tt(o,a)?(u=c,p=c):"date"===l&&(d=c),s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{conditionKey:t,conditionLabel:r,operator:a,value:d,selectedValues:[],selectedRadioValue:"",startDate:u,endDate:p}):n)))),null==n||n()}),[i,n]),m=c(((e,t)=>{s((n=>n.map((n=>{if(n.id!==e)return n;const r=i.find((e=>e.conditionKey===n.conditionKey));if(!r)return n;const o=et(r,t),a=Ts().format("YYYY-MM-DD"),l=tt(r,t);let s=n.value,c=n.startDate,d=n.endDate,u=n.selectedValues,p=n.selectedRadioValue;return l?(c&&""!==c.trim()||(c=a),d&&""!==d.trim()||(d=a),s="",u=[],p=""):"date"===o?(s&&""!==s.trim()||(s=a),c="",d="",u=[],p=""):(c="",d=""),Object.assign(Object.assign({},n),{operator:t,value:s,startDate:c,endDate:d,selectedValues:u,selectedRadioValue:p})})))),null==n||n()}),[i,n]),h=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{value:t}):n)))),null==n||n()}),[n]),g=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedValues:t}):n)))),null==n||n()}),[n]),f=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedRadioValue:t}):n)))),null==n||n()}),[n]),b=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{startDate:t}):n)))),null==n||n()}),[n]),v=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{endDate:t}):n)))),null==n||n()}),[n]),x=c((e=>l.find((t=>t.id===e))),[l]);return{conditions:l,addCondition:d,removeCondition:u,updateConditionKey:p,updateConditionOperator:m,updateConditionValue:h,updateConditionSelectedValues:g,updateConditionSelectedRadioValue:f,updateConditionStartDate:b,updateConditionEndDate:v,getConditionById:x}})(d,s||null,g),x=c((()=>((e,t)=>{if(0===e.length)return{isValid:!1,errorMessage:"少なくとも1つの条件を設定してください"};if(!e.some((e=>{const n=rp(e,t);return!!n&&ip(n)})))return{isValid:!1,errorMessage:"少なくとも1つの条件を入力してください"};for(const n of e){const e=rp(n,t);if(!e)return{isValid:!1,errorMessage:`条件設定 ${n.conditionKey} が見つかりません`};if(!np(e.conditionConfig))continue;const r=op(e);if(!r.isValid)return{isValid:!1,errorMessage:`${n.conditionLabel}: ${r.errorMessage}`}}return{isValid:!0,errorMessage:""}})(v.conditions,d)),[v.conditions,d]),y=c((()=>((e,t)=>0!==e.length&&(!!e.some((e=>{const n=rp(e,t);return!!n&&ip(n)}))&&e.every((e=>{const n=rp(e,t);return!!n&&(!np(n.conditionConfig)||ip(n))}))))(v.conditions,d)),[v.conditions,d]),{validateInput:w,canApply:C}=(({filterConfig:e,operator:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l})=>({validateInput:c((()=>{const s=ze(e,t);return ep({inputType:s,operator:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l(t),customValidation:null==e?void 0:e.customValidation})}),[e,t,n,r,i,o,a,l]),canApply:c((()=>{const s=ze(e,t);return tp({inputType:s,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l(t)})}),[e,n,r,t,i,o,a,l])}))({filterConfig:d,operator:b.operator,selectedValues:b.selectedValues,selectedRadioValue:b.selectedRadioValue,startDate:b.startDate,endDate:b.endDate,value:b.value,isRangeOperator:f}),{refs:E,floatingStyles:I,getFloatingProps:k,isPositioned:M,contentMaxHeight:A}=(({isOpen:e,savedCoordinates:t,onCancel:n})=>{const[i,a]=r(!1),[l,s]=r(300),{refs:c,floatingStyles:d,context:u}=Ni({open:e,onOpenChange:e=>{e||n()},placement:"bottom-start",middleware:[Tn({padding:8,crossAxis:!1}),Zn({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){const r=Math.max(ap.CONFIG_PANEL_MIN_CONTENT_HEIGHT,t-ap.CONFIG_PANEL_HEADER_HEIGHT-ap.CONFIG_PANEL_BUTTON_HEIGHT-ap.CONFIG_PANEL_PADDING);s(r),Object.assign(n.floating.style,{maxWidth:`${Math.max(0,e)}px`})}}})]}),p=Hi(u,{outsidePress:e=>!e.target.closest("[data-tag]")}),{getFloatingProps:m}=Ti([p]);return o((()=>{if(t&&e){const e={getBoundingClientRect:()=>({width:0,height:0,x:t.x,y:t.y,top:t.y,left:t.x,right:t.x,bottom:t.y})};c.setReference(e),a(!0)}}),[t,e,c]),o((()=>{e||a(!1)}),[e]),{refs:c,floatingStyles:d,getFloatingProps:m,isPositioned:i,contentMaxHeight:l,context:u}})({isOpen:n,savedCoordinates:u||null,onCancel:l}),$=c((()=>{if(p){const e=x();if(!e.isValid)return void h(e.errorMessage);h("");const t=(e=>{const{conditions:t,filterConfig:n}=e,r=[],i=[];for(const e of t)try{const t=Qe(n,e.conditionKey);if(!t){i.push(`条件設定 ${e.conditionKey} が見つかりません`);continue}const o=et(t,e.operator),a=tt(t,e.operator),l=Qu({inputType:o,selectedValues:e.selectedValues,selectedRadioValue:e.selectedRadioValue,startDate:e.startDate,endDate:e.endDate,value:e.value,isRangeOperator:a});if(!l||0===l.length||!l.some((e=>""!==e&&null!=e)))continue;const s=qu(t,e.operator),c=Ku({conditionConfig:t,inputType:o,operator:e.operator,values:l,dateFormat:n?Be(n):void 0});r.push({conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:e.operator,operatorLabel:s,values:l,valueLabels:c,isRange:a})}catch(t){const n=t instanceof Error?t.message:"不明なエラーが発生しました";i.push(`条件 ${e.conditionLabel} の処理中にエラーが発生しました: ${n}`)}return{conditions:r,errors:i}})({conditions:v.conditions,filterConfig:d});if(t.errors.length>0)return void h(t.errors.join("\n"));i({operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions})}else{const e=w();if(!e.isValid)return void h(e.errorMessage);h("");const t=ze(d,b.operator),n=Qu({inputType:t,selectedValues:b.selectedValues,selectedRadioValue:b.selectedRadioValue,startDate:b.startDate,endDate:b.endDate,value:b.value,isRangeOperator:f(b.operator)}),r=((e,t)=>{var n;return e&&(null===(n=Ne(e).find((e=>e.value===t)))||void 0===n?void 0:n.label)||t})(d,b.operator),o=(e=>{const{filterConfig:t,inputType:n,operator:r,values:i}=e;return i.map((e=>{if("checkbox"===n||"radio"===n){const n=Ze(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n){const n=Be(t),r=String(e);if(!r||""===r.trim())return r;const i=Ts(r,"YYYY-MM-DD");return i.isValid()?i.format(n):r}return String(e)}))})({filterConfig:d,inputType:t,operator:b.operator,values:n});i({operator:b.operator,operatorLabel:r,values:n,valueLabels:o,isRange:f(b.operator)})}}),[p,d,v,b,w,x,i,f]),{handleKeyDown:D}=(({isOpen:e,canApply:t,handleApply:n,onCancel:r,floatingRef:i})=>{const a=c((e=>{if("Enter"===e.key&&!e.shiftKey&&!e.ctrlKey&&!e.altKey){if(e.isComposing||229===e.keyCode)return void e.preventDefault();e.preventDefault(),t()&&n()}}),[t,n]);return o((()=>{const t=t=>{"Escape"===t.key&&e&&r()};return e&&document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[e,r]),o((()=>{if(!e)return;const t=e=>{var t;const n=e.target;(null===(t=i.current)||void 0===t?void 0:t.contains(n))&&a(e)};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[e,a,i]),{handleKeyDown:e=>{a(e)}}})({isOpen:n,canApply:p?y:C,handleApply:$,onCancel:l,floatingRef:E.floating}),L=a((()=>{if(p)return!1;return"text"===ze(d,b.operator)&&("contains"===b.operator||"not_contains"===b.operator)}),[d,b.operator,p]);return t.createElement(It,Object.assign({ref:E.setFloating,$isOpen:n,$isPositioned:M,style:I,tabIndex:-1,onKeyDown:D},k()),t.createElement(kt,null,t.createElement(Mt,null,e)),t.createElement(At,{style:{maxHeight:`${A}px`}},p?t.createElement(Ap,{filterConfig:d,multiConditionState:v,onKeyDown:D}):t.createElement(t.Fragment,null,t.createElement($t,null,t.createElement(Fu,{value:b.operator,variant:"dark",onChange:e=>{if("string"!=typeof e)return;g();const t=e;b.setOperator(t);const n=Ts().format("YYYY-MM-DD"),r=(e=>{const{filterConfig:t,newOperator:n,isRangeOperator:r,currentStartDate:i,currentEndDate:o,currentValue:a,todayString:l}=e;if(r(n))return{startDate:i&&""!==i.trim()?void 0:l,endDate:o&&""!==o.trim()?void 0:l};{const e={startDate:"",endDate:""};return"date"!==ze(t,n)||a&&""!==a.trim()||(e.value=l),e}})({filterConfig:d,newOperator:t,isRangeOperator:f,currentStartDate:b.startDate,currentEndDate:b.endDate,currentValue:b.value,todayString:n});void 0!==r.startDate&&b.setStartDate(r.startDate),void 0!==r.endDate&&b.setEndDate(r.endDate),void 0!==r.value&&b.setValue(r.value)}},Ne(d).map((e=>t.createElement(ju,{key:e.value,value:e.value},e.label))))),t.createElement($t,null,t.createElement(kp,{endDate:b.endDate,filterConfig:d,isRangeOperator:f,operator:b.operator,selectedRadioValue:b.selectedRadioValue,selectedValues:b.selectedValues,startDate:b.startDate,value:b.value,onEndDateChange:b.handleEndDateChange,onKeyDown:D,onRadioChange:b.handleRadioChange,onStartDateChange:b.handleStartDateChange,onValueChange:b.handleValueChange,onValueToggle:b.handleValueToggle}),L&&t.createElement(Vs,{prepend:t.createElement(ee,{name:"question"})},"カンマ区切りで複数ワードをOR検索できます。")))),m&&t.createElement(Dt,null,t.createElement(Uu,{size:"sm"},m)),t.createElement(Lt,null,t.createElement(Rs,null,t.createElement(rc,{type:"button",size:"small",color:"clear",onClick:l},"キャンセル"),t.createElement(rc,{type:"button",size:"small",disabled:p?!y():!C(),onClick:$},"適用"))))};$p.displayName="AdvancedFilterConfigPanel";const Dp=({types:e,onFiltersChange:t,initialAppliedFilters:n})=>{const[a,l]=r(null),[s,c]=r(!1),[d,u]=r((()=>null!=n?n:[])),[p,m]=r(null),[h,g]=r(!1),f=i(null),[b,v]=r(24),[x,y]=r(null),w=i(t);w.current=t;const C=i(p);C.current=p;const E=i(d);E.current=d,o((()=>{var t;const n=new Set(e.map((e=>e.type))),r=E.current,i=r.filter((e=>n.has(e.type)));if(i.length!==r.length){u(i),null===(t=w.current)||void 0===t||t.call(w,i);const e=C.current;e&&!n.has(e.type)&&(m(null),c(!1),l(null))}}),[e]);return{selectedType:a,isConfigPanelOpen:s,appliedFilters:d,editingFilter:p,isMenuOpen:h,menuPosition:b,savedMenuCoordinates:x,triggerRef:f,setSelectedType:l,setIsConfigPanelOpen:c,setAppliedFilters:u,setEditingFilter:m,setIsMenuOpen:g,setMenuPosition:v,setSavedMenuCoordinates:y,handleTypeSelect:e=>{l(e),c(!0)},handleConfigApply:n=>{let r;if(p){const e=((e,t)=>t.conditions&&t.conditions.length>0?Object.assign(Object.assign({},e),{operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions}):Object.assign(Object.assign({},e),{operator:t.operator,operatorLabel:t.operatorLabel,values:t.values,valueLabels:t.valueLabels,isRange:t.isRange,conditions:void 0}))(p,n);r=d.map((t=>t.id===p.id?e:t)),m(null)}else{const t=Xe(e,a),i=((e,t,n)=>n.conditions&&n.conditions.length>0?{id:He(),type:e,typeLabel:t,operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:n.conditions}:{id:He(),type:e,typeLabel:t,operator:n.operator,operatorLabel:n.operatorLabel,values:n.values,valueLabels:n.valueLabels,isRange:n.isRange})(a,t,n);r=[...d,i]}u(r),null==t||t(r),c(!1),l(null)},handleRemoveFilter:e=>{const n=((e,t)=>e.filter((e=>e.id!==t)))(d,e);u(n),null==t||t(n),p&&p.id===e&&(m(null),c(!1),l(null))},handleClearAll:()=>{const e=[];u(e),null==t||t(e),m(null),c(!1),l(null),g(!1)},handleConfigCancel:()=>{c(!1),l(null),m(null)},handleEditFilter:e=>{p&&p.id===e.id||(h&&g(!1),m(e),l(e.type),c(!0))}}};class Lp{static calculateMenuPosition(){const e=document.querySelectorAll(lp);if(0===e.length)return ap.DEFAULT_MENU_POSITION;const t=e[0].closest(dp);if(!t)return ap.DEFAULT_MENU_POSITION;const n=e[e.length-1].getBoundingClientRect(),r=t.getBoundingClientRect();let i=n.right-r.left+ap.TAG_SPACING;return e.length>=1&&(i+=ap.TAG_OFFSET_MULTIPLE),this.calculateSafePosition(i)}static calculateSafePosition(e){const t=window.innerWidth,n=Math.max(ap.MENU_WIDTH,ap.CONFIG_PANEL_WIDTH);return e+n>t-16?Math.max(0,t-n-16):e}static calculateConfigPanelPosition(e,t,n){const r=t.findIndex((t=>t.id===e.id));if(-1===r)return this.getFallbackPosition();const i=document.querySelectorAll(lp);let o=null;for(const t of i){if(t.getAttribute("data-tag")===e.id){o=t;break}}let a=null==n?void 0:n.current;if(!a){const e=document.querySelector(cp);e&&(a=e)}return o&&a?this.calculateFromActualElements(o,a):a?this.calculateFromTrigger(a,r):this.getFallbackPosition(r)}static calculateFromActualElements(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{position:r.left-n.left,coordinates:{x:r.left,y:r.bottom+16}}}static calculateFromTrigger(e,t){const n=e.getBoundingClientRect(),r=n.left+ap.ICON_AREA_WIDTH+t*ap.ESTIMATED_TAG_WIDTH;return{position:r-n.left,coordinates:{x:r,y:n.bottom+ap.TAG_SPACING}}}static getFallbackPosition(e=0){const t=ap.FALLBACK_POSITION_X+e*ap.ESTIMATED_TAG_WIDTH;return{position:t,coordinates:{x:t,y:ap.FALLBACK_POSITION_Y}}}static getSavedCoordinates(){const e=document.querySelector(sp);if(!e)return null;const t=e.getBoundingClientRect();return{x:t.left,y:t.top}}}const Op=({setMenuPosition:e})=>{const t=c((()=>{const t=Lp.calculateMenuPosition();e(t)}),[e]);return{handleMenuOpen:t}},Sp=({types:e,placeholder:n="フィルターを追加",disabled:r=!1,filterConfigs:i={},size:o="medium",variant:a="light",width:l="100%",onFiltersChange:s,initialAppliedFilters:c})=>{const{selectedType:d,isConfigPanelOpen:u,appliedFilters:p,editingFilter:m,isMenuOpen:h,menuPosition:g,savedMenuCoordinates:f,triggerRef:b,setMenuPosition:v,setSavedMenuCoordinates:x,setIsMenuOpen:y,handleTypeSelect:w,handleConfigApply:C,handleRemoveFilter:E,handleClearAll:I,handleConfigCancel:k,handleEditFilter:M}=Dp({types:e,onFiltersChange:s,initialAppliedFilters:c}),{handleMenuOpen:A}=Op({setMenuPosition:v});t.useLayoutEffect((()=>{if(m){const{position:e,coordinates:t}=Lp.calculateConfigPanelPosition(m,p,b);v(e),x(t)}}),[m,p,b,v,x]);const $=We(e,p);return t.createElement("div",null,$.length>0&&t.createElement(Ls,null,t.createElement(Ds,{open:h,trigger:t.createElement(Ot,{ref:b,placeholder:n,disabled:r,isOpen:h,appliedFilters:p,size:o,variant:a,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),minWidth:ap.MENU_WIDTH,placement:"bottom-start",middleware:[zn({mainAxis:8,crossAxis:g}),Tn({padding:8}),Zn({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){Object.assign(n.floating.style,{width:"max-content",minWidth:`${ap.MENU_WIDTH}px`,maxWidth:`${Math.max(0,e)}px`,maxHeight:`${Math.max(0,t)}px`});const r=n.floating.getBoundingClientRect();x({x:r.left,y:r.top})}}})],onOpenChange:e=>{y(e),e&&A()}},$.map((e=>t.createElement(dt,{key:e.type,disabled:e.disabled,closeOnClick:!0,onClick:()=>w(e.type)},e.label))))),0===$.length&&t.createElement(Ot,{placeholder:"すべてのフィルターが適用済み",disabled:!0,appliedFilters:p,size:o,variant:a,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),u&&d&&f&&t.createElement($p,{filterType:Xe(e,d),isOpen:u,editingFilter:m,filterConfig:i[d],savedCoordinates:f,onApply:C,onCancel:k}))};Sp.displayName="AdvancedFilter";const Vp=e=>{if(e instanceof Date)return!isNaN(e.getTime());if("number"==typeof e){const t=new Date(e);return!isNaN(t.getTime())}if("string"==typeof e){if(""===e.trim())return!1;return Ts(e).isValid()}return!1},Hp=e=>{if(e instanceof Date)return isNaN(e.getTime())?null:e;if("number"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("string"==typeof e){const t=Ts(e);if(t.isValid())return t.toDate()}return null},Rp=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Np=(e,t)=>0===((e,t)=>{const n=Rp(e),r=Rp(t);return n.getTime()-r.getTime()})(e,t),zp=[{value:"equals",label:"次に一致する"},{value:"contains",label:"次を含む"},{value:"starts_with",label:"次で始まる"},{value:"ends_with",label:"次で終わる"},{value:"not_equals",label:"次に一致しない"},{value:"not_contains",label:"次を含まない"}],Tp=[{value:"equals",label:"次に一致する"},{value:"greater_than",label:"次より大きい"},{value:"less_than",label:"次より小さい"},{value:"greater_than_or_equal",label:"次以上"},{value:"less_than_or_equal",label:"次以下"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],Zp=[{value:"equals",label:"次に一致する"},{value:"before",label:"次より前"},{value:"after",label:"次より後"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],Bp=[{value:"equals",label:"次に一致する"},{value:"not_equals",label:"次に一致しない"},{value:"in",label:"次のいずれかに一致する"},{value:"not_in",label:"次のいずれにも一致しない"}],Pp={text_basic:[zp[0],zp[1],zp[2]],text_search:[zp[1],zp[0],zp[5]],selection_basic:[Bp[0],Bp[1]],selection_multiple:[Bp[2],Bp[0],Bp[3]],date_basic:[Zp[0],Zp[2],Zp[1]],number_basic:[Tp[0],Tp[1],Tp[2],Tp[3],Tp[4]]},_p=e=>{const t=Pp[e];return t?[...t]:[]},Gp=(e,t)=>({value:e,label:t}),Yp=(...e)=>e.flat(),Fp=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),jp=(e,t)=>Object.assign(Object.assign({},e),{label:t}),Wp=(e,t)=>{const n=_p(e);return Fp(n,t)},Xp=(e,t)=>t.map((t=>e.find((e=>e.value===t)))).filter((e=>void 0!==e)),Jp=(e,t)=>t.map((t=>e[t])).filter((e=>void 0!==e)),Up=(e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof n[0])return((e,t,n)=>{switch(t){case"equals":return e===n;case"not_equals":return e!==n;default:return!1}})(e,t,n[0]);if("between"===t||"not_between"===t){if(n.length<2)return!1;if("boolean"==typeof e)return!1;return((e,t,n,r)=>{if(Vp(String(e))&&Vp(n)&&Vp(r)){const i=Hp(String(e)),o=Hp(n),a=Hp(r);if(i&&o&&a){const e=Rp(i),n=Rp(o),r=Rp(a),l=e>=n&&e<=r;return"between"===t?l:!l}}const i=Number(e),o=Number(n),a=Number(r);if(!isNaN(i)&&!isNaN(o)&&!isNaN(a)){const e=i>=o&&i<=a;return"between"===t?e:!e}return!1})(e,t,"string"==typeof n[0]?n[0]:String(n[0]),"string"==typeof n[1]?n[1]:String(n[1]))}if("before"===t||"after"===t){if("boolean"==typeof e)return!1;return((e,t,n)=>{if(Vp(String(e))&&Vp(n)){const r=Hp(String(e)),i=Hp(n);if(r&&i){const e=Rp(r),n=Rp(i);return"before"===t?e<n:e>n}}const r=Number(e),i=Number(n);return!isNaN(r)&&!isNaN(i)&&("before"===t?r<i:r>i)})(e,t,"string"==typeof n[0]?n[0]:String(n[0]))}if("equals"===t||"not_equals"===t){if("boolean"==typeof e)return!1;if(n.length>1){const r=String(e).toLowerCase(),i=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"equals"===t?i:!i}return((e,t,n)=>{if(Vp(String(e))&&Vp(n)){const r=Hp(String(e)),i=Hp(n);if(r&&i){const e=Np(r,i);return"equals"===t?e:!e}}const r=String(e).toLowerCase()===n.toLowerCase();return"equals"===t?r:!r})(e,t,"string"==typeof n[0]?n[0]:String(n[0]||""))}const r="string"==typeof n[0]?n[0]:String(n[0]||"");if("contains"===t||"not_contains"===t||"starts_with"===t||"ends_with"===t)return((e,t,n)=>{const r=e.toLowerCase(),i=n.trim();if(("contains"===t||"not_contains"===t)&&i.includes(",")){const e=hd(i);return"contains"===t?e.some((e=>r.includes(e.toLowerCase()))):!e.some((e=>r.includes(e.toLowerCase())))}const o=i.toLowerCase();switch(t){case"contains":return r.includes(o);case"not_contains":return!r.includes(o);case"starts_with":return r.startsWith(o);case"ends_with":return r.endsWith(o);default:return!1}})(String(e),t,r);if("in"===t||"not_in"===t){const r=String(e).toLowerCase(),i=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"in"===t?i:!i}if("greater_than"===t||"less_than"===t||"greater_than_or_equal"===t||"less_than_or_equal"===t){const n=Number(e);if(!isNaN(n))return((e,t,n)=>{const r=Number(n);if(isNaN(r))return!1;switch(t){case"greater_than":return e>r;case"less_than":return e<r;case"greater_than_or_equal":return e>=r;case"less_than_or_equal":return e<=r;default:return!1}})(n,t,r)}return!0},Qp=(e,t,n,r)=>r.length?e.filter((e=>{const i=e[t];return Up(i,n,r)})):e,qp=(e,t)=>t.reduce(((e,t)=>Qp(e,t.field,t.operator,t.values)),e),Kp=(e,t,n,r)=>{const i=n.filter((e=>e.values&&e.values.length>0));return 0!==i.length&&i.every((n=>{var i;const{conditionKey:o,operator:a,values:l}=n,s=null==r?void 0:r[t],c=null===(i=null==s?void 0:s.multiConditionConfigs)||void 0===i?void 0:i.find((e=>e.conditionKey===o)),d=((e,t,n,r)=>{const i=e[r||`${t}Attr`];if(i&&"object"==typeof i&&n in i)return i[n]})(e,t,o,null==c?void 0:c.valueSource);return(null==c?void 0:c.customOperator)?c.customOperator(l,a,d):Up(d,a,l)}))},em=(e,t)=>({value:e,label:t}),tm=(...e)=>e.flat(),nm=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),rm=(e,t)=>Object.assign(Object.assign({},e),{label:t}),im=(e,t)=>t.map((t=>e.find((e=>e.value===t)))).filter((e=>void 0!==e)),om=(e,t)=>t.map((t=>e[t])).filter((e=>void 0!==e)),am=e=>e.map((e=>e.value)),lm=e=>e.map((e=>e.label)),sm=(e,t)=>t.map((t=>{const n=e.find((e=>e.value===t));return(null==n?void 0:n.label)||t})),cm=(...e)=>{const t=e.flat().filter(((e,t,n)=>t===n.findIndex((t=>t.value===e.value))));return t},dm=(e,t="label")=>[...e].sort(((e,n)=>e[t].localeCompare(n[t]))),um=x.div`
1096
+ `,Uu=e.forwardRef((function({children:t,size:n="md"},r){const i=J();return e.createElement(re,{ref:r,display:"flex",alignItems:"center"},e.createElement(Ys,{pr:.5},e.createElement(ee,{name:"alert",type:"fill",color:i.palette.danger.base,size:"sm"===n?"sm-md":n})),e.createElement(Ju,{color:i.palette.danger.base,size:n},t))})),Qu=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l}=e;return"checkbox"===t?n:"radio"===t?[r]:l?[i,o]:[a]},qu=(e,t)=>{const n=Ke(e).find((e=>e.value===t));return(null==n?void 0:n.label)||t},Ku=e=>{const{conditionConfig:t,inputType:n,operator:r,values:i,dateFormat:o}=e;return i.map((e=>{if("checkbox"===n||"radio"===n){const n=((e,t)=>{if(t){const n=e.operators.find((e=>e.value===t));if(null==n?void 0:n.options)return n.options}return e.options||[]})(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n&&o){const t=String(e);if(!t||""===t.trim())return t;const n=Ts(t,"YYYY-MM-DD");return n.isValid()?n.format(o):t}return String(e)}))},ep=e=>{const{inputType:t,operator:n,selectedValues:r,selectedRadioValue:i,startDate:o,endDate:a,value:l,isRangeOperator:s,customValidation:c}=e;if("checkbox"===t){if(0===r.length)return{isValid:!1,errorMessage:"少なくとも1つの項目を選択してください"}}else if("radio"===t){if(""===i||null==i)return{isValid:!1,errorMessage:"項目を選択してください"}}else if(s){if(!o||!a)return{isValid:!1,errorMessage:"開始日と終了日の両方を選択してください"}}else if(!l||""===l.trim())return{isValid:!1,errorMessage:"date"===t?"日付を選択してください":"値を入力してください"};if(c){let e;return e="checkbox"===t?r:"radio"===t?[i]:s?[o,a]:[l],c(e,n)}return s&&new Date(o)>new Date(a)?{isValid:!1,errorMessage:"開始日は終了日より前である必要があります"}:{isValid:!0,errorMessage:""}},tp=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l}=e;return"checkbox"===t?n.length>0:"radio"===t?""!==r&&null!=r:l?!(!i||!o):!(!a||""===a.trim())},np=e=>!1!==e.required,rp=(e,t)=>{const n=Qe(t,e.conditionKey);return n?{condition:e,conditionConfig:n}:null},ip=e=>{const{condition:t,conditionConfig:n}=e,r=et(n,t.operator),i=tt(n,t.operator);return tp({inputType:r,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:i})},op=e=>{const{condition:t,conditionConfig:n}=e,r=et(n,t.operator),i=tt(n,t.operator);return ep({inputType:r,operator:t.operator,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:i,customValidation:n.customValidation})},ap={MENU_WIDTH:160,CONFIG_PANEL_WIDTH:264,DEFAULT_MENU_POSITION:24,TAG_SPACING:8,TAG_OFFSET_MULTIPLE:40,ESTIMATED_TAG_WIDTH:120,ICON_AREA_WIDTH:24,CLEAR_BUTTON_WIDTH:16,FALLBACK_POSITION_X:80,FALLBACK_POSITION_Y:148,CONFIG_PANEL_HEADER_HEIGHT:60,CONFIG_PANEL_BUTTON_HEIGHT:50,CONFIG_PANEL_PADDING:16,CONFIG_PANEL_MIN_CONTENT_HEIGHT:200,TRANSITION_DURATION:200,MIN_VALUE_LENGTH:1},lp="[data-tag]",sp='[role="menu"]',cp='[data-advanced-filter-trigger="true"]',dp='[role="button"]',up=({options:e,selectedValues:n,onValueToggle:r})=>t.createElement(bt,null,e.map((e=>t.createElement(ro,{key:String(e.value),checked:n.includes(e.value),onChange:t=>r(e.value,t)},e.label))));up.displayName="CheckboxValueInput";const pp=({options:e,selectedRadioValue:n,onRadioChange:r})=>t.createElement(bt,null,e.map((e=>t.createElement(ro,{key:String(e.value),checked:n===e.value,onChange:t=>{t&&r(e.value)}},e.label))));pp.displayName="RadioValueInput";const mp=640,hp=["日","月","火","水","木","金","土"],gp={components:{ConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FullSizeConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FileUploader:{defaultProps:{title:"ファイルをドラッグ&ドロップ、またはここをクリック"}},ItemEmpty:{defaultProps:{title:"見つかりませんでした。"}},Select:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません"}},CreatableSelect:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません",addMessage:"次の文字列を追加する"}},MultipleFilter:{defaultProps:{placeholder:"新しいフィルターを追加してください"}},FilterCard:{defaultProps:{applyButtonTitle:"適用",inputErrorText:"入力してください",formPlaceholder:"検索",sectionTitle:"セクション"}},EditFilterCard:{defaultProps:{}},DatePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...hp]}}},DateRangePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...hp]},applyButtonText:"適用",cancelButtonText:"キャンセル"}},WeekTime:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},WeekTimeSelector:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},DualListBox:{defaultProps:{selectedItemTitle:"個選択済み"}}}},fp={components:{ConfirmModal:{defaultProps:{confirmText:"确认",cancelText:"取消"}},FullSizeConfirmModal:{defaultProps:{confirmText:"确认",cancelText:"取消"}},FileUploader:{defaultProps:{title:"把文件拖入, 同样支持点击上传。"}},ItemEmpty:{defaultProps:{title:"未找到。"}}}},bp={components:{DatePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}}},DateRangePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},applyButtonText:"Apply",cancelButtonText:"Cancel"}},WeekTime:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},WeekTimeSelector:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},DualListBox:{defaultProps:{selectedItemTitle:"selected"}}}},vp=e.createContext({locale:bp}),xp=({locale:t,children:n})=>e.createElement(vp.Provider,{value:{locale:t}},n);function yp(e){var n,r;const{name:i,props:o}=e,a=t.useContext(vp).locale,l=Object.assign({},o);if(!a||!a.components)return l;const s=null===(r=null===(n=a.components)||void 0===n?void 0:n[i])||void 0===r?void 0:r.defaultProps;for(const e in s)void 0===l[e]&&(l[e]=s[e]);return l}const wp=n((function(e,n){const i=yp({props:e,name:"DatePicker"}),{date:o,format:l="YYYY-MM-DD",disabled:s=!1,size:d="medium",variant:u="light",width:p,monthFormat:m,weekConfig:h,showDateFields:g=!1,showTimeFields:f=!1,timeFieldProps:b,useCalendarRange:v=!1,isOutsideRange:x,error:y=!1,errorText:w,defaultPresetButton:C,presetButtons:E,onPresetButtonClick:I,onDateChange:k,onDatesChange:M,endDate:A}=i,$=J(),[D,L]=r(!1),{context:O,refs:S,strategy:V,x:H,y:R}=Ni({placement:"bottom-start",open:D,onOpenChange:L,middleware:[zn(10),Nn(),Tn({padding:8})]}),N=Hi(O),z=Fi(O),{getReferenceProps:T,getFloatingProps:Z}=Ti([N,z]),B=c((()=>{s||L((e=>!e))}),[s]),P=c((e=>{k(e),L(!1)}),[k]),_=a((()=>t.createElement(ee,{name:"date_range",color:s?$.palette.neutral.base:$.palette.text.accent})),[s,$]),G=a((()=>"100%"===p||"string"==typeof p&&p.includes("100%")?{width:"100%"}:{width:"fit-content"}),[p]);return t.createElement(re,{ref:n,style:G},t.createElement("div",Object.assign({ref:S.setReference},T()),t.createElement($E,{date:o,format:l,error:y,errorText:w,disabled:s,size:d,variant:u,width:p,append:_,onDateChange:k,onAppendClick:B})),D&&t.createElement(ki,null,t.createElement($i,{context:O,modal:!1,initialFocus:-1,returnFocus:!1},v?t.createElement(Wh,Object.assign({ref:S.setFloating,startDate:o,endDate:A||o,monthFormat:m,weekConfig:h,defaultPresetButton:C,presetButtons:E,showDateFields:g,showTimeFields:f,timeFieldProps:b,dateFieldFormat:l,isOutsideRange:x,style:{position:V,top:null!=R?R:0,left:null!=H?H:0,zIndex:$.depth.calendarRange,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:I,onDatesChange:M},Z())):t.createElement(kh,Object.assign({ref:S.setFloating,date:o,monthFormat:m,weekConfig:h,defaultPresetButton:C,presetButtons:E,showDateFields:g,showTimeFields:f,timeFieldProps:b,dateFieldFormat:l,isOutsideRange:x,style:{position:V,top:null!=R?R:0,left:null!=H?H:0,zIndex:$.depth.calendar,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:I,onDateChange:P},Z())))))}));var Cp=u(wp);const Ep=({startDate:e,endDate:n,onStartDateChange:r,onEndDateChange:i,format:o="YYYY-MM-DD"})=>{const l=a((()=>{if(e&&""!==e.trim()){const t=Ts(e,"YYYY-MM-DD");return t.isValid()?t:Ts()}return Ts()}),[e]),s=a((()=>{if(n&&""!==n.trim()){const e=Ts(n,"YYYY-MM-DD");return e.isValid()?e:Ts()}return Ts()}),[n]);return t.createElement(ut,null,t.createElement(mt,null,t.createElement(ft,{htmlFor:"start-date-picker"},"開始日"),t.createElement(Cp,{date:l,format:o,variant:"dark",width:"100%",onDateChange:e=>{r(e.format("YYYY-MM-DD"))}})),t.createElement(mt,null,t.createElement(ft,{htmlFor:"end-date-picker"},"終了日"),t.createElement(Cp,{date:s,format:o,variant:"dark",width:"100%",onDateChange:e=>{i(e.format("YYYY-MM-DD"))}})))};Ep.displayName="DateRangeInput";const Ip=({inputType:e,value:n,placeholder:r,onValueChange:i,onKeyDown:o,format:l="YYYY-MM-DD"})=>{const s=a((()=>{if("date"===e&&n&&""!==n.trim()){const e=Ts(n,"YYYY-MM-DD");return e.isValid()?e:Ts()}return Ts()}),[e,n]),c=e=>{const t=e.format("YYYY-MM-DD");i(t)};return"date"===e?t.createElement(gt,null,t.createElement(Cp,{date:s,format:l,variant:"dark",width:"100%",onDateChange:c})):t.createElement(ht,null,t.createElement(hs,{type:"text",value:n,placeholder:r,fullWidth:!0,variant:"dark",onChange:e=>i(e.target.value),onKeyDown:o}))};Ip.displayName="TextValueInput";const kp=({filterConfig:e,operator:n,value:r,selectedValues:i,selectedRadioValue:o,startDate:a,endDate:l,onValueChange:s,onValueToggle:c,onRadioChange:d,onStartDateChange:u,onEndDateChange:p,onKeyDown:m,isRangeOperator:h})=>{const g=ze(e,n);return"checkbox"===g?t.createElement(up,{options:Ze(e,n),selectedValues:i,onValueToggle:c}):"radio"===g?t.createElement(pp,{options:Ze(e,n),selectedRadioValue:o,onRadioChange:d}):h(n)?t.createElement(Ep,{startDate:a,endDate:l,format:Be(e),onStartDateChange:u,onEndDateChange:p}):t.createElement(Ip,{inputType:g,value:r,placeholder:Te(e),format:"date"===g?Be(e):void 0,onValueChange:s,onKeyDown:m})};kp.displayName="ConfigPanelValueInput";const Mp=(e,t,n)=>{if(!t)return((e,t)=>{const n=qe(e),r=et(e,n);let i="",o="",a="";return tt(e,n)?(o=t,a=t):"date"===r&&(i=t),{id:`condition_${e.conditionKey}`,conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:n,value:i,selectedValues:[],selectedRadioValue:"",startDate:o,endDate:a}})(e,n);let r="",i=[],o="",a="",l="";if((t.isRange||!1)&&t.values.length>=2)a="string"==typeof t.values[0]?t.values[0]:"",l="string"==typeof t.values[1]?t.values[1]:"";else if(t.values.length>0){const e=t.values[0];"string"==typeof e&&(r=e),i=t.values,o=e}return{id:`condition_${e.conditionKey}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:t.operator,value:r,selectedValues:i,selectedRadioValue:o,startDate:a,endDate:l}},Ap=({filterConfig:e,multiConditionState:n,onKeyDown:r})=>{const{conditions:i,updateConditionOperator:o,updateConditionValue:a,updateConditionSelectedValues:l,updateConditionSelectedRadioValue:s,updateConditionStartDate:c,updateConditionEndDate:d}=n,u=Ue(e);return t.createElement("div",null,u.map(((n,p)=>{const m=i.find((e=>e.conditionKey===n.conditionKey));if(!m)return null;const h=et(n,m.operator),g=tt(n,m.operator),f=u.length>=2;return t.createElement("div",{key:m.id},p>0&&t.createElement(Hs,null),f&&t.createElement(Os,null,n.conditionLabel),t.createElement($t,null,t.createElement(Fu,{value:m.operator,variant:"dark",onChange:e=>{"string"==typeof e&&o(m.id,e)}},Ke(n).map((e=>t.createElement(ju,{key:e.value,value:e.value},e.label))))),t.createElement($t,null,t.createElement(kp,{endDate:m.endDate,filterConfig:e?Object.assign(Object.assign({},e),{operators:Ke(n),inputType:h,options:n.options}):void 0,isRangeOperator:()=>g,operator:m.operator,selectedRadioValue:m.selectedRadioValue,selectedValues:m.selectedValues,startDate:m.startDate,value:m.value,onEndDateChange:e=>{d(m.id,e)},onKeyDown:r,onRadioChange:e=>{s(m.id,e)},onStartDateChange:e=>{c(m.id,e)},onValueChange:e=>{a(m.id,e)},onValueToggle:(e,t)=>{const n=[...m.selectedValues];if(t)n.push(e);else{const t=n.indexOf(e);t>-1&&n.splice(t,1)}l(m.id,n)}})))})))};Ap.displayName="MultiConditionInput";const $p=({filterType:e,isOpen:n,onApply:i,onCancel:l,editingFilter:s,filterConfig:d,savedCoordinates:u})=>{const p=(e=>void 0!==(null==e?void 0:e.multiConditionConfigs)&&e.multiConditionConfigs.length>0)(d),[m,h]=r(""),g=c((()=>h("")),[]),f=c((e=>{const t=Ne(d).find((t=>t.value===e));return(null==t?void 0:t.isRange)||!1}),[d]),b=((e,t,n,i)=>{const[a,l]=r(Re(e)),[s,d]=r(""),[u,p]=r([]),[m,h]=r(""),[g,f]=r(""),[b,v]=r("");o((()=>{if(t)l(t.operator),d("string"==typeof t.values[0]?t.values[0]:""),p(t.values),h(t.values[0]||""),n&&n(t.operator)?(f("string"==typeof t.values[0]?t.values[0]:""),v("string"==typeof t.values[1]?t.values[1]:"")):(f(""),v(""));else{const t=Re(e);l(t);const r=ze(e,t),i=Ts().format("YYYY-MM-DD");n&&n(t)?(f(i),v(i),d("")):"date"===r?(d(i),f(""),v("")):(d(""),f(""),v("")),p([]),h("")}}),[t,n,e]);const x=c((e=>{d(e),null==i||i()}),[i]),y=c(((e,t)=>{p(t?t=>[...t,e]:t=>t.filter((t=>t!==e))),null==i||i()}),[i]),w=c((e=>{h(e),null==i||i()}),[i]),C=c((e=>{f(e),null==i||i()}),[i]),E=c((e=>{v(e),null==i||i()}),[i]);return{operator:a,value:s,selectedValues:u,selectedRadioValue:m,startDate:g,endDate:b,setOperator:l,setValue:d,setSelectedValues:p,setSelectedRadioValue:h,setStartDate:f,setEndDate:v,handleValueChange:x,handleValueToggle:y,handleRadioChange:w,handleStartDateChange:C,handleEndDateChange:E}})(d,s||void 0,f,g),v=((e,t,n)=>{const i=a((()=>Ue(e)),[e]),[l,s]=r([]);o((()=>{var e;if(0===i.length)return;const n=Ts().format("YYYY-MM-DD"),r=new Map((null===(e=null==t?void 0:t.conditions)||void 0===e?void 0:e.map((e=>[e.conditionKey,e])))||[]),o=i.map((e=>Mp(e,r.get(e.conditionKey),n)));s(o)}),[t,i]);const d=c((()=>{if(0===i.length)return;const e=new Set(l.map((e=>e.conditionKey))),t=i.find((t=>!e.has(t.conditionKey)))||i[0],r=qe(t),o=et(t,r),a=Ts().format("YYYY-MM-DD");let c="",d="",u="";tt(t,r)?(d=a,u=a):"date"===o&&(c=a);const p={id:`condition_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:r,value:c,selectedValues:[],selectedRadioValue:"",startDate:d,endDate:u};s((e=>[...e,p])),null==n||n()}),[i,l,n]),u=c((e=>{s((t=>t.filter((t=>t.id!==e)))),null==n||n()}),[n]),p=c(((e,t,r)=>{const o=i.find((e=>e.conditionKey===t));if(!o)return;const a=qe(o),l=et(o,a),c=Ts().format("YYYY-MM-DD");let d="",u="",p="";tt(o,a)?(u=c,p=c):"date"===l&&(d=c),s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{conditionKey:t,conditionLabel:r,operator:a,value:d,selectedValues:[],selectedRadioValue:"",startDate:u,endDate:p}):n)))),null==n||n()}),[i,n]),m=c(((e,t)=>{s((n=>n.map((n=>{if(n.id!==e)return n;const r=i.find((e=>e.conditionKey===n.conditionKey));if(!r)return n;const o=et(r,t),a=Ts().format("YYYY-MM-DD"),l=tt(r,t);let s=n.value,c=n.startDate,d=n.endDate,u=n.selectedValues,p=n.selectedRadioValue;return l?(c&&""!==c.trim()||(c=a),d&&""!==d.trim()||(d=a),s="",u=[],p=""):"date"===o?(s&&""!==s.trim()||(s=a),c="",d="",u=[],p=""):(c="",d=""),Object.assign(Object.assign({},n),{operator:t,value:s,startDate:c,endDate:d,selectedValues:u,selectedRadioValue:p})})))),null==n||n()}),[i,n]),h=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{value:t}):n)))),null==n||n()}),[n]),g=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedValues:t}):n)))),null==n||n()}),[n]),f=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedRadioValue:t}):n)))),null==n||n()}),[n]),b=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{startDate:t}):n)))),null==n||n()}),[n]),v=c(((e,t)=>{s((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{endDate:t}):n)))),null==n||n()}),[n]),x=c((e=>l.find((t=>t.id===e))),[l]);return{conditions:l,addCondition:d,removeCondition:u,updateConditionKey:p,updateConditionOperator:m,updateConditionValue:h,updateConditionSelectedValues:g,updateConditionSelectedRadioValue:f,updateConditionStartDate:b,updateConditionEndDate:v,getConditionById:x}})(d,s||null,g),x=c((()=>((e,t)=>{if(0===e.length)return{isValid:!1,errorMessage:"少なくとも1つの条件を設定してください"};if(!e.some((e=>{const n=rp(e,t);return!!n&&ip(n)})))return{isValid:!1,errorMessage:"少なくとも1つの条件を入力してください"};for(const n of e){const e=rp(n,t);if(!e)return{isValid:!1,errorMessage:`条件設定 ${n.conditionKey} が見つかりません`};if(!np(e.conditionConfig))continue;const r=op(e);if(!r.isValid)return{isValid:!1,errorMessage:`${n.conditionLabel}: ${r.errorMessage}`}}return{isValid:!0,errorMessage:""}})(v.conditions,d)),[v.conditions,d]),y=c((()=>((e,t)=>0!==e.length&&(!!e.some((e=>{const n=rp(e,t);return!!n&&ip(n)}))&&e.every((e=>{const n=rp(e,t);return!!n&&(!np(n.conditionConfig)||ip(n))}))))(v.conditions,d)),[v.conditions,d]),{validateInput:w,canApply:C}=(({filterConfig:e,operator:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l})=>({validateInput:c((()=>{const s=ze(e,t);return ep({inputType:s,operator:t,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l(t),customValidation:null==e?void 0:e.customValidation})}),[e,t,n,r,i,o,a,l]),canApply:c((()=>{const s=ze(e,t);return tp({inputType:s,selectedValues:n,selectedRadioValue:r,startDate:i,endDate:o,value:a,isRangeOperator:l(t)})}),[e,n,r,t,i,o,a,l])}))({filterConfig:d,operator:b.operator,selectedValues:b.selectedValues,selectedRadioValue:b.selectedRadioValue,startDate:b.startDate,endDate:b.endDate,value:b.value,isRangeOperator:f}),{refs:E,floatingStyles:I,getFloatingProps:k,isPositioned:M,contentMaxHeight:A}=(({isOpen:e,savedCoordinates:t,onCancel:n})=>{const[i,a]=r(!1),[l,s]=r(300),{refs:c,floatingStyles:d,context:u}=Ni({open:e,onOpenChange:e=>{e||n()},placement:"bottom-start",middleware:[Tn({padding:8,crossAxis:!1}),Zn({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){const r=Math.max(ap.CONFIG_PANEL_MIN_CONTENT_HEIGHT,t-ap.CONFIG_PANEL_HEADER_HEIGHT-ap.CONFIG_PANEL_BUTTON_HEIGHT-ap.CONFIG_PANEL_PADDING);s(r),Object.assign(n.floating.style,{maxWidth:`${Math.max(0,e)}px`})}}})]}),p=Hi(u,{outsidePress:e=>!e.target.closest("[data-tag]")}),{getFloatingProps:m}=Ti([p]);return o((()=>{if(t&&e){const e={getBoundingClientRect:()=>({width:0,height:0,x:t.x,y:t.y,top:t.y,left:t.x,right:t.x,bottom:t.y})};c.setReference(e),a(!0)}}),[t,e,c]),o((()=>{e||a(!1)}),[e]),{refs:c,floatingStyles:d,getFloatingProps:m,isPositioned:i,contentMaxHeight:l,context:u}})({isOpen:n,savedCoordinates:u||null,onCancel:l}),$=c((()=>{if(p){const e=x();if(!e.isValid)return void h(e.errorMessage);h("");const t=(e=>{const{conditions:t,filterConfig:n}=e,r=[],i=[];for(const e of t)try{const t=Qe(n,e.conditionKey);if(!t){i.push(`条件設定 ${e.conditionKey} が見つかりません`);continue}const o=et(t,e.operator),a=tt(t,e.operator),l=Qu({inputType:o,selectedValues:e.selectedValues,selectedRadioValue:e.selectedRadioValue,startDate:e.startDate,endDate:e.endDate,value:e.value,isRangeOperator:a});if(!l||0===l.length||!l.some((e=>""!==e&&null!=e)))continue;const s=qu(t,e.operator),c=Ku({conditionConfig:t,inputType:o,operator:e.operator,values:l,dateFormat:n?Be(n):void 0});r.push({conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:e.operator,operatorLabel:s,values:l,valueLabels:c,isRange:a})}catch(t){const n=t instanceof Error?t.message:"不明なエラーが発生しました";i.push(`条件 ${e.conditionLabel} の処理中にエラーが発生しました: ${n}`)}return{conditions:r,errors:i}})({conditions:v.conditions,filterConfig:d});if(t.errors.length>0)return void h(t.errors.join("\n"));i({operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions})}else{const e=w();if(!e.isValid)return void h(e.errorMessage);h("");const t=ze(d,b.operator),n=Qu({inputType:t,selectedValues:b.selectedValues,selectedRadioValue:b.selectedRadioValue,startDate:b.startDate,endDate:b.endDate,value:b.value,isRangeOperator:f(b.operator)}),r=((e,t)=>{var n;return e&&(null===(n=Ne(e).find((e=>e.value===t)))||void 0===n?void 0:n.label)||t})(d,b.operator),o=(e=>{const{filterConfig:t,inputType:n,operator:r,values:i}=e;return i.map((e=>{if("checkbox"===n||"radio"===n){const n=Ze(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n){const n=Be(t),r=String(e);if(!r||""===r.trim())return r;const i=Ts(r,"YYYY-MM-DD");return i.isValid()?i.format(n):r}return String(e)}))})({filterConfig:d,inputType:t,operator:b.operator,values:n});i({operator:b.operator,operatorLabel:r,values:n,valueLabels:o,isRange:f(b.operator)})}}),[p,d,v,b,w,x,i,f]),{handleKeyDown:D}=(({isOpen:e,canApply:t,handleApply:n,onCancel:r,floatingRef:i})=>{const a=c((e=>{if("Enter"===e.key&&!e.shiftKey&&!e.ctrlKey&&!e.altKey){if(e.isComposing||229===e.keyCode)return void e.preventDefault();e.preventDefault(),t()&&n()}}),[t,n]);return o((()=>{const t=t=>{"Escape"===t.key&&e&&r()};return e&&document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[e,r]),o((()=>{if(!e)return;const t=e=>{var t;const n=e.target;(null===(t=i.current)||void 0===t?void 0:t.contains(n))&&a(e)};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[e,a,i]),{handleKeyDown:e=>{a(e)}}})({isOpen:n,canApply:p?y:C,handleApply:$,onCancel:l,floatingRef:E.floating}),L=a((()=>{if(p)return!1;return"text"===ze(d,b.operator)&&("contains"===b.operator||"not_contains"===b.operator)}),[d,b.operator,p]);return t.createElement(It,Object.assign({ref:E.setFloating,$isOpen:n,$isPositioned:M,style:I,tabIndex:-1,onKeyDown:D},k()),t.createElement(kt,null,t.createElement(Mt,null,e)),t.createElement(At,{style:{maxHeight:`${A}px`}},p?t.createElement(Ap,{filterConfig:d,multiConditionState:v,onKeyDown:D}):t.createElement(t.Fragment,null,t.createElement($t,null,t.createElement(Fu,{value:b.operator,variant:"dark",onChange:e=>{if("string"!=typeof e)return;g();const t=e;b.setOperator(t);const n=Ts().format("YYYY-MM-DD"),r=(e=>{const{filterConfig:t,newOperator:n,isRangeOperator:r,currentStartDate:i,currentEndDate:o,currentValue:a,todayString:l}=e;if(r(n))return{startDate:i&&""!==i.trim()?void 0:l,endDate:o&&""!==o.trim()?void 0:l};{const e={startDate:"",endDate:""};return"date"!==ze(t,n)||a&&""!==a.trim()||(e.value=l),e}})({filterConfig:d,newOperator:t,isRangeOperator:f,currentStartDate:b.startDate,currentEndDate:b.endDate,currentValue:b.value,todayString:n});void 0!==r.startDate&&b.setStartDate(r.startDate),void 0!==r.endDate&&b.setEndDate(r.endDate),void 0!==r.value&&b.setValue(r.value)}},Ne(d).map((e=>t.createElement(ju,{key:e.value,value:e.value},e.label))))),t.createElement($t,null,t.createElement(kp,{endDate:b.endDate,filterConfig:d,isRangeOperator:f,operator:b.operator,selectedRadioValue:b.selectedRadioValue,selectedValues:b.selectedValues,startDate:b.startDate,value:b.value,onEndDateChange:b.handleEndDateChange,onKeyDown:D,onRadioChange:b.handleRadioChange,onStartDateChange:b.handleStartDateChange,onValueChange:b.handleValueChange,onValueToggle:b.handleValueToggle}),L&&t.createElement(Vs,{prepend:t.createElement(ee,{name:"question"})},"カンマ区切りで複数ワードをOR検索できます。")))),m&&t.createElement(Dt,null,t.createElement(Uu,{size:"sm"},m)),t.createElement(Lt,null,t.createElement(Rs,null,t.createElement(rc,{type:"button",size:"small",color:"clear",onClick:l},"キャンセル"),t.createElement(rc,{type:"button",size:"small",disabled:p?!y():!C(),onClick:$},"適用"))))};$p.displayName="AdvancedFilterConfigPanel";const Dp=({types:e,onFiltersChange:t,initialAppliedFilters:n})=>{const[a,l]=r(null),[s,c]=r(!1),[d,u]=r((()=>null!=n?n:[])),[p,m]=r(null),[h,g]=r(!1),f=i(null),[b,v]=r(24),[x,y]=r(null),w=i(t);w.current=t;const C=i(p);C.current=p;const E=i(d);E.current=d,o((()=>{var t;const n=new Set(e.map((e=>e.type))),r=E.current,i=r.filter((e=>n.has(e.type)));if(i.length!==r.length){u(i),null===(t=w.current)||void 0===t||t.call(w,i);const e=C.current;e&&!n.has(e.type)&&(m(null),c(!1),l(null))}}),[e]);return{selectedType:a,isConfigPanelOpen:s,appliedFilters:d,editingFilter:p,isMenuOpen:h,menuPosition:b,savedMenuCoordinates:x,triggerRef:f,setSelectedType:l,setIsConfigPanelOpen:c,setAppliedFilters:u,setEditingFilter:m,setIsMenuOpen:g,setMenuPosition:v,setSavedMenuCoordinates:y,handleTypeSelect:e=>{l(e),c(!0)},handleConfigApply:n=>{let r;if(p){const e=((e,t)=>t.conditions&&t.conditions.length>0?Object.assign(Object.assign({},e),{operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions}):Object.assign(Object.assign({},e),{operator:t.operator,operatorLabel:t.operatorLabel,values:t.values,valueLabels:t.valueLabels,isRange:t.isRange,conditions:void 0}))(p,n);r=d.map((t=>t.id===p.id?e:t)),m(null)}else{const t=Xe(e,a),i=((e,t,n)=>n.conditions&&n.conditions.length>0?{id:He(),type:e,typeLabel:t,operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:n.conditions}:{id:He(),type:e,typeLabel:t,operator:n.operator,operatorLabel:n.operatorLabel,values:n.values,valueLabels:n.valueLabels,isRange:n.isRange})(a,t,n);r=[...d,i]}u(r),null==t||t(r),c(!1),l(null)},handleRemoveFilter:e=>{const n=((e,t)=>e.filter((e=>e.id!==t)))(d,e);u(n),null==t||t(n),p&&p.id===e&&(m(null),c(!1),l(null))},handleClearAll:()=>{const e=[];u(e),null==t||t(e),m(null),c(!1),l(null),g(!1)},handleConfigCancel:()=>{c(!1),l(null),m(null)},handleEditFilter:e=>{p&&p.id===e.id||(h&&g(!1),m(e),l(e.type),c(!0))}}};class Lp{static calculateMenuPosition(){const e=document.querySelectorAll(lp);if(0===e.length)return ap.DEFAULT_MENU_POSITION;const t=e[0].closest(dp);if(!t)return ap.DEFAULT_MENU_POSITION;const n=e[e.length-1].getBoundingClientRect(),r=t.getBoundingClientRect();let i=n.right-r.left+ap.TAG_SPACING;return e.length>=1&&(i+=ap.TAG_OFFSET_MULTIPLE),this.calculateSafePosition(i)}static calculateSafePosition(e){const t=window.innerWidth,n=Math.max(ap.MENU_WIDTH,ap.CONFIG_PANEL_WIDTH);return e+n>t-16?Math.max(0,t-n-16):e}static calculateConfigPanelPosition(e,t,n){const r=t.findIndex((t=>t.id===e.id));if(-1===r)return this.getFallbackPosition();const i=document.querySelectorAll(lp);let o=null;for(const t of Array.from(i)){if(t.getAttribute("data-tag")===e.id){o=t;break}}let a=null==n?void 0:n.current;if(!a){const e=document.querySelector(cp);e&&(a=e)}return o&&a?this.calculateFromActualElements(o,a):a?this.calculateFromTrigger(a,r):this.getFallbackPosition(r)}static calculateFromActualElements(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{position:r.left-n.left,coordinates:{x:r.left,y:r.bottom+16}}}static calculateFromTrigger(e,t){const n=e.getBoundingClientRect(),r=n.left+ap.ICON_AREA_WIDTH+t*ap.ESTIMATED_TAG_WIDTH;return{position:r-n.left,coordinates:{x:r,y:n.bottom+ap.TAG_SPACING}}}static getFallbackPosition(e=0){const t=ap.FALLBACK_POSITION_X+e*ap.ESTIMATED_TAG_WIDTH;return{position:t,coordinates:{x:t,y:ap.FALLBACK_POSITION_Y}}}static getSavedCoordinates(){const e=document.querySelector(sp);if(!e)return null;const t=e.getBoundingClientRect();return{x:t.left,y:t.top}}}const Op=({setMenuPosition:e})=>{const t=c((()=>{const t=Lp.calculateMenuPosition();e(t)}),[e]);return{handleMenuOpen:t}},Sp=({types:e,placeholder:n="フィルターを追加",disabled:r=!1,filterConfigs:i={},size:o="medium",variant:a="light",width:l="100%",onFiltersChange:s,initialAppliedFilters:c})=>{const{selectedType:d,isConfigPanelOpen:u,appliedFilters:p,editingFilter:m,isMenuOpen:h,menuPosition:g,savedMenuCoordinates:f,triggerRef:b,setMenuPosition:v,setSavedMenuCoordinates:x,setIsMenuOpen:y,handleTypeSelect:w,handleConfigApply:C,handleRemoveFilter:E,handleClearAll:I,handleConfigCancel:k,handleEditFilter:M}=Dp({types:e,onFiltersChange:s,initialAppliedFilters:c}),{handleMenuOpen:A}=Op({setMenuPosition:v});t.useLayoutEffect((()=>{if(m){const{position:e,coordinates:t}=Lp.calculateConfigPanelPosition(m,p,b);v(e),x(t)}}),[m,p,b,v,x]);const $=We(e,p);return t.createElement("div",null,$.length>0&&t.createElement(Ls,null,t.createElement(Ds,{open:h,trigger:t.createElement(Ot,{ref:b,placeholder:n,disabled:r,isOpen:h,appliedFilters:p,size:o,variant:a,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),minWidth:ap.MENU_WIDTH,placement:"bottom-start",middleware:[zn({mainAxis:8,crossAxis:g}),Tn({padding:8}),Zn({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){Object.assign(n.floating.style,{width:"max-content",minWidth:`${ap.MENU_WIDTH}px`,maxWidth:`${Math.max(0,e)}px`,maxHeight:`${Math.max(0,t)}px`});const r=n.floating.getBoundingClientRect();x({x:r.left,y:r.top})}}})],onOpenChange:e=>{y(e),e&&A()}},$.map((e=>t.createElement(dt,{key:e.type,disabled:e.disabled,closeOnClick:!0,onClick:()=>w(e.type)},e.label))))),0===$.length&&t.createElement(Ot,{placeholder:"すべてのフィルターが適用済み",disabled:!0,appliedFilters:p,size:o,variant:a,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),u&&d&&f&&t.createElement($p,{filterType:Xe(e,d),isOpen:u,editingFilter:m,filterConfig:i[d],savedCoordinates:f,onApply:C,onCancel:k}))};Sp.displayName="AdvancedFilter";const Vp=e=>{if(e instanceof Date)return!isNaN(e.getTime());if("number"==typeof e){const t=new Date(e);return!isNaN(t.getTime())}if("string"==typeof e){if(""===e.trim())return!1;return Ts(e).isValid()}return!1},Hp=e=>{if(e instanceof Date)return isNaN(e.getTime())?null:e;if("number"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("string"==typeof e){const t=Ts(e);if(t.isValid())return t.toDate()}return null},Rp=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Np=(e,t)=>0===((e,t)=>{const n=Rp(e),r=Rp(t);return n.getTime()-r.getTime()})(e,t),zp=[{value:"equals",label:"次に一致する"},{value:"contains",label:"次を含む"},{value:"starts_with",label:"次で始まる"},{value:"ends_with",label:"次で終わる"},{value:"not_equals",label:"次に一致しない"},{value:"not_contains",label:"次を含まない"}],Tp=[{value:"equals",label:"次に一致する"},{value:"greater_than",label:"次より大きい"},{value:"less_than",label:"次より小さい"},{value:"greater_than_or_equal",label:"次以上"},{value:"less_than_or_equal",label:"次以下"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],Zp=[{value:"equals",label:"次に一致する"},{value:"before",label:"次より前"},{value:"after",label:"次より後"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],Bp=[{value:"equals",label:"次に一致する"},{value:"not_equals",label:"次に一致しない"},{value:"in",label:"次のいずれかに一致する"},{value:"not_in",label:"次のいずれにも一致しない"}],Pp={text_basic:[zp[0],zp[1],zp[2]],text_search:[zp[1],zp[0],zp[5]],selection_basic:[Bp[0],Bp[1]],selection_multiple:[Bp[2],Bp[0],Bp[3]],date_basic:[Zp[0],Zp[2],Zp[1]],number_basic:[Tp[0],Tp[1],Tp[2],Tp[3],Tp[4]]},_p=e=>{const t=Pp[e];return t?[...t]:[]},Gp=(e,t)=>({value:e,label:t}),Yp=(...e)=>e.flat(),Fp=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),jp=(e,t)=>Object.assign(Object.assign({},e),{label:t}),Wp=(e,t)=>{const n=_p(e);return Fp(n,t)},Xp=(e,t)=>t.map((t=>e.find((e=>e.value===t)))).filter((e=>void 0!==e)),Jp=(e,t)=>t.map((t=>e[t])).filter((e=>void 0!==e)),Up=(e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof n[0])return((e,t,n)=>{switch(t){case"equals":return e===n;case"not_equals":return e!==n;default:return!1}})(e,t,n[0]);if("between"===t||"not_between"===t){if(n.length<2)return!1;if("boolean"==typeof e)return!1;return((e,t,n,r)=>{if(Vp(String(e))&&Vp(n)&&Vp(r)){const i=Hp(String(e)),o=Hp(n),a=Hp(r);if(i&&o&&a){const e=Rp(i),n=Rp(o),r=Rp(a),l=e>=n&&e<=r;return"between"===t?l:!l}}const i=Number(e),o=Number(n),a=Number(r);if(!isNaN(i)&&!isNaN(o)&&!isNaN(a)){const e=i>=o&&i<=a;return"between"===t?e:!e}return!1})(e,t,"string"==typeof n[0]?n[0]:String(n[0]),"string"==typeof n[1]?n[1]:String(n[1]))}if("before"===t||"after"===t){if("boolean"==typeof e)return!1;return((e,t,n)=>{if(Vp(String(e))&&Vp(n)){const r=Hp(String(e)),i=Hp(n);if(r&&i){const e=Rp(r),n=Rp(i);return"before"===t?e<n:e>n}}const r=Number(e),i=Number(n);return!isNaN(r)&&!isNaN(i)&&("before"===t?r<i:r>i)})(e,t,"string"==typeof n[0]?n[0]:String(n[0]))}if("equals"===t||"not_equals"===t){if("boolean"==typeof e)return!1;if(n.length>1){const r=String(e).toLowerCase(),i=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"equals"===t?i:!i}return((e,t,n)=>{if(Vp(String(e))&&Vp(n)){const r=Hp(String(e)),i=Hp(n);if(r&&i){const e=Np(r,i);return"equals"===t?e:!e}}const r=String(e).toLowerCase()===n.toLowerCase();return"equals"===t?r:!r})(e,t,"string"==typeof n[0]?n[0]:String(n[0]||""))}const r="string"==typeof n[0]?n[0]:String(n[0]||"");if("contains"===t||"not_contains"===t||"starts_with"===t||"ends_with"===t)return((e,t,n)=>{const r=e.toLowerCase(),i=n.trim();if(("contains"===t||"not_contains"===t)&&i.includes(",")){const e=hd(i);return"contains"===t?e.some((e=>r.includes(e.toLowerCase()))):!e.some((e=>r.includes(e.toLowerCase())))}const o=i.toLowerCase();switch(t){case"contains":return r.includes(o);case"not_contains":return!r.includes(o);case"starts_with":return r.startsWith(o);case"ends_with":return r.endsWith(o);default:return!1}})(String(e),t,r);if("in"===t||"not_in"===t){const r=String(e).toLowerCase(),i=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"in"===t?i:!i}if("greater_than"===t||"less_than"===t||"greater_than_or_equal"===t||"less_than_or_equal"===t){const n=Number(e);if(!isNaN(n))return((e,t,n)=>{const r=Number(n);if(isNaN(r))return!1;switch(t){case"greater_than":return e>r;case"less_than":return e<r;case"greater_than_or_equal":return e>=r;case"less_than_or_equal":return e<=r;default:return!1}})(n,t,r)}return!0},Qp=(e,t,n,r)=>r.length?e.filter((e=>{const i=e[t];return Up(i,n,r)})):e,qp=(e,t)=>t.reduce(((e,t)=>Qp(e,t.field,t.operator,t.values)),e),Kp=(e,t,n,r)=>{const i=n.filter((e=>e.values&&e.values.length>0));return 0!==i.length&&i.every((n=>{var i;const{conditionKey:o,operator:a,values:l}=n,s=null==r?void 0:r[t],c=null===(i=null==s?void 0:s.multiConditionConfigs)||void 0===i?void 0:i.find((e=>e.conditionKey===o)),d=((e,t,n,r)=>{const i=e[r||`${t}Attr`];if(i&&"object"==typeof i&&n in i)return i[n]})(e,t,o,null==c?void 0:c.valueSource);return(null==c?void 0:c.customOperator)?c.customOperator(l,a,d):Up(d,a,l)}))},em=(e,t)=>({value:e,label:t}),tm=(...e)=>e.flat(),nm=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),rm=(e,t)=>Object.assign(Object.assign({},e),{label:t}),im=(e,t)=>t.map((t=>e.find((e=>e.value===t)))).filter((e=>void 0!==e)),om=(e,t)=>t.map((t=>e[t])).filter((e=>void 0!==e)),am=e=>e.map((e=>e.value)),lm=e=>e.map((e=>e.label)),sm=(e,t)=>t.map((t=>{const n=e.find((e=>e.value===t));return(null==n?void 0:n.label)||t})),cm=(...e)=>{const t=e.flat().filter(((e,t,n)=>t===n.findIndex((t=>t.value===e.value))));return t},dm=(e,t="label")=>[...e].sort(((e,n)=>e[t].localeCompare(n[t]))),um=x.div`
1097
1097
  position: fixed;
1098
1098
  display: flex;
1099
1099
  align-items: center;