super-select-react 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.9.0 - 2026-07-04
4
+
5
+ First public release.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Super Select contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Super Select
2
+
3
+ Super Select is a drop-in replacement for the native `<select>` in React.
4
+
5
+ It keeps the familiar parts of native selects: `<option>` and `<optgroup>` children, `name`, `multiple`, `required`,
6
+ `disabled`, `value`, `defaultValue`, and `onChange`. The value model and form behavior stay close to the platform, even
7
+ when the rendered UI is not the browser's native select.
8
+
9
+ The default mode is a searchable modal inspired by Android's select pattern: the field stays compact in the form, then
10
+ selection happens in a focused surface. The goal is one select format that works well with mouse, keyboard, and touch,
11
+ on desktop or mobile.
12
+
13
+ Super Select adds a few custom props to the standard select API:
14
+
15
+ - `optionSource` provides options from an API or other data source, including search, pagination, and selected value resolution.
16
+ - `mode` controls how the field is rendered: modal picker, inline option list, toggle buttons, or native `<select>`.
17
+ - `onValueChange` gives you the selected value directly when you do not need the full `onChange` event.
18
+ - `customization` changes the rendered UI with classes, styles, or replacement components while keeping the selection
19
+ behavior in Super Select.
20
+
21
+ See the [documentation and live examples](https://22222.github.io/super-select-react/) for complete usage details.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install super-select-react
27
+ ```
28
+
29
+ ## Basic Usage
30
+
31
+ ```tsx
32
+ import { SuperSelect } from "super-select-react";
33
+ import "super-select-react/style.css";
34
+
35
+ export function PersonField() {
36
+ return (
37
+ <SuperSelect name="person">
38
+ <option value="robert-balboa">Robert Balboa</option>
39
+ <option value="adrian-pennino">Adrian Pennino</option>
40
+ <option value="apollo-creed">Apollo Creed</option>
41
+ </SuperSelect>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## Modes
47
+
48
+ The same field can be rendered in different ways:
49
+
50
+ ```tsx
51
+ <SuperSelect mode="modal" />
52
+ <SuperSelect mode="option-list" />
53
+ <SuperSelect mode="toggle-button" />
54
+ <SuperSelect mode="native" />
55
+ ```
56
+
57
+ `modal` is the default. `option-list` renders inline radios or checkboxes. `toggle-button` renders local options as a
58
+ compact button group. `native` renders a real browser `<select>`.
59
+
60
+ ## Async Options
61
+
62
+ If your options come from an API or other data source, pass an `optionSource`.
63
+
64
+ ```tsx
65
+ import { useMemo } from "react";
66
+ import { createOptionSource, SuperSelect } from "super-select-react";
67
+
68
+ export function PersonSourceField() {
69
+ const peopleSource = useMemo(
70
+ () =>
71
+ createOptionSource({
72
+ fetch: async ({ values, search = "", offset = 0, limit = 100, signal }) => {
73
+ const query = values
74
+ ? values.map((value) => `ids=${encodeURIComponent(value)}`).join("&")
75
+ : `search=${encodeURIComponent(search)}&offset=${offset}&limit=${limit}`;
76
+ const response = await fetch(`/api/people?${query}`, { signal });
77
+ if (!response.ok) {
78
+ throw new Error(`Unable to load people: ${response.status}`);
79
+ }
80
+ const data = await response.json();
81
+ return {
82
+ options: data.items.map((person: { id: string; name: string }) => ({
83
+ value: person.id,
84
+ label: person.name,
85
+ })),
86
+ hasMore: data.hasMore,
87
+ };
88
+ },
89
+ }),
90
+ [],
91
+ );
92
+
93
+ return <SuperSelect name="person" optionSource={peopleSource} />;
94
+ }
95
+ ```
96
+
97
+ Super Select sends `values` when it needs to resolve labels for already-selected options, such as a saved value that is
98
+ not on the first page. Handle that request so those options come back even when they would not match the current search.
99
+
100
+ ## Customization
101
+
102
+ Super Select is not tied to a UI framework. You can use the default CSS, adapt it to your own classes, or replace pieces
103
+ of the rendered UI for libraries like Bootstrap, Mantine, or Material UI.
104
+
105
+ ## More Information
106
+
107
+ - Read the [full documentation and live examples](https://22222.github.io/super-select-react/).
108
+ - View the [source code and issue tracker](https://github.com/22222/super-select-react).
109
+ - For design goals and contribution guidance, see [CONTRIBUTING.md](CONTRIBUTING.md).
110
+
111
+ ## License
112
+
113
+ Super Select is available under either the [MIT License](LICENSE) or [The Unlicense](UNLICENSE), at your choice.
package/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org/>
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");function u(...e){return e.filter(Boolean).join(` `)}function d({className:e,style:t,disabled:n,tabIndex:r,title:i,onClick:a,customization:o}){let s=o?.classNamePrefix??`super-select`,c=s.length>0?`${s}__`:``;return(0,l.jsx)(`button`,{type:`button`,className:u(`${c}btn-close`,e),style:t,disabled:n,onClick:a,tabIndex:r,title:i,children:(0,l.jsx)(`span`,{className:`${c}visually-hidden`,children:o?.content??(0,l.jsx)(l.Fragment,{children:`×`})})})}function f({customization:e,headerContent:t,footerContent:n,children:r,open:i,className:a,ref:o,...s}){let f=e?.classNamePrefix??`super-select`,p=f.length>0?`${f}__`:``,m=(0,c.useRef)(null),{onClose:h,onCancel:g,onClick:_,...v}=s,y=e?.closeButton?.component??d,b=(0,c.useCallback)(e=>{if(m.current=e,o){if(typeof o==`function`){o(e);return}o.current=e}},[o]);(0,c.useEffect)(()=>{let e=m.current;e&&(i&&!e.open&&e.showModal(),!i&&e.open&&e.close())},[i]);let x=(0,c.useCallback)(()=>{let e=m.current;e?.open&&e.close()},[]);return(0,l.jsx)(`dialog`,{...v,ref:b,"aria-modal":`true`,onClose:h,onCancel:e=>{g&&(e.preventDefault(),g())},onClick:_,className:u(`${p}modal`,`${p}border-0`,`${p}bg-transparent`,`${p}fade`,i?`${p}show`:void 0,i?`${p}d-block`:void 0,a),children:(0,l.jsx)(`div`,{className:u(`${p}modal-dialog`,`${p}modal-dialog-scrollable`,e?.dialog?.className),style:e?.dialog?.style,children:(0,l.jsxs)(`div`,{className:u(`${p}modal-content`,e?.content?.className),style:e?.content?.style,children:[(0,l.jsxs)(`div`,{className:u(`${p}modal-header`,e?.header?.className),style:e?.header?.style,children:[t,(0,l.jsx)(y,{className:e?.closeButton?.className,style:e?.closeButton?.style,title:e?.closeButton?.title,onClick:x,tabIndex:-1,customization:{classNamePrefix:f,content:e?.closeButton?.content}})]}),(0,l.jsx)(`div`,{className:u(`${p}modal-body`,e?.body?.className),style:e?.body?.style,children:r}),n&&(0,l.jsx)(`div`,{className:u(`${p}modal-footer`,e?.footer?.className),style:e?.footer?.style,children:n})]})})})}var p=`−`,m=`↻`;function h({className:e,style:t,onRetry:n,customization:r}){let i=r?.classNamePrefix??`super-select`,a=i.length>0?`${i}__`:``;return(0,l.jsxs)(`div`,{className:u(`${a}alert`,`${a}alert-info`,n&&`${a}alert-dismissible`,e),style:t,children:[r?.content??(0,l.jsx)(`span`,{"aria-hidden":!0,children:p}),` `,n&&(0,l.jsx)(`button`,{type:`button`,className:u(`${a}btn`,`${a}btn-outline-secondary`,`${a}btn-sm`,r?.retryButton?.className),style:r?.retryButton?.style,title:r?.retryButton?.title,onClick:n,children:r?.retryButton?.content??m})]})}var g=`+`;function _({className:e,style:t,disabled:n,onLoadMore:r,customization:i}){let a=i?.classNamePrefix??`super-select`,o=a.length>0?`${a}__`:``;return r?(0,l.jsx)(`button`,{type:`button`,className:u(`${o}btn`,`${o}btn-outline-secondary`,`${o}btn-sm`,e,i?.loadMoreButton?.className),style:t||i?.loadMoreButton?.style?{...t,...i?.loadMoreButton?.style}:void 0,title:i?.loadMoreButton?.title,onClick:r,disabled:n,children:i?.loadMoreButton?.content??g}):(0,l.jsx)(`div`,{className:u(`${o}text-body-secondary`,`${o}overflow-indicator`,e,i?.overflowIndicator?.className),style:t||i?.overflowIndicator?.style?{...t,...i?.overflowIndicator?.style}:void 0,title:i?.overflowIndicator?.title,children:i?.overflowIndicator?.content??(0,l.jsx)(l.Fragment,{children:`…`})})}function v(e){return Array.isArray(e)?e.map(String):typeof e==`string`&&e.length>0?[e]:typeof e==`number`?[String(e)]:[]}function y({autoComplete:e,autoFocus:t,className:n,disabled:r,form:i,id:a,multiple:o,name:s,required:d,style:f,tabIndex:p,title:m,options:h,value:g,onValueChange:_,onOptionClick:y,onOptionKeyDown:x,indicator:S,customization:C,ref:w,...T}){let E=C?.classNamePrefix??`super-select`,D=E.length>0?`${E}__`:``,O=(0,c.useRef)(null),[k,A]=(0,c.useState)(void 0),j=(0,c.useId)(),M=(0,c.useMemo)(()=>h.find(e=>e.hidden)?h.filter(e=>!e.hidden):h,[h]),N=(0,c.useMemo)(()=>b(M),[M]),P=(0,c.useMemo)(()=>N.length>1?N.flatMap(e=>e.options):M,[N,M]),F=(0,c.useMemo)(()=>{let e=v(g);return o?e:e.slice(0,1)},[o,g]),I=(0,c.useMemo)(()=>new Set(F),[F]),L=(0,c.useMemo)(()=>P.find(e=>!e.disabled)?.value,[P]),R=(0,c.useMemo)(()=>{if(!(p===void 0||p===-1))return o?L:P.find(e=>I.has(e.value)&&!e.disabled)?.value??L},[L,o,P,I,p]),z=(0,c.useMemo)(()=>new Set(P.map(e=>e.value)),[P]),B=(0,c.useMemo)(()=>s?F.filter(e=>!z.has(e)):[],[z,s,F]),V=(0,c.useMemo)(()=>{if(t)return P.find(e=>!(r||e.disabled))?.value},[t,r,P]),H=(0,c.useMemo)(()=>P.find(e=>e.value===k&&!e.disabled)?.value||P.find(e=>I.has(e.value)&&!e.disabled)?.value||L,[L,k,P,I]);(0,c.useEffect)(()=>{!H||k===void 0||O.current?.scrollIntoView({block:`nearest`})},[H,k]);let U=e=>{r||_(o?F.includes(e)?F.filter(t=>t!==e):[...F,e]:[e])},ee=o?s:s??`option-list-${j}`,W=T[`aria-label`]??s;return(0,l.jsxs)(`fieldset`,{ref:w,...T,id:a,role:o?`group`:`radiogroup`,"aria-label":W,"aria-disabled":r||void 0,"aria-required":d||void 0,disabled:r,className:u(`${D}list-group`,n),style:f,title:m,tabIndex:-1,children:[N.map((t,n)=>(0,l.jsxs)(`div`,{children:[t.label?(0,l.jsx)(`div`,{className:u(`${D}list-group-item`,`${D}list-group-item-secondary`,C?.groupHeader?.className),style:C?.groupHeader?.style,children:t.label}):null,t.options.map(t=>{let n=I.has(t.value),a=r||t.disabled;return(0,l.jsxs)(`label`,{ref:e=>{t.value===H?O.current=e:O.current===e&&(O.current=null)},className:u(`${D}list-group-item`,`${D}list-group-item-action`,n?`${D}active`:void 0,t.value===H?`${D}focus-ring`:void 0,a?`${D}disabled`:void 0,C?.optionItem?.className),style:C?.optionItem?.style,onClick:()=>{a||A(t.value)},children:[(0,l.jsx)(`input`,{type:o?`checkbox`:`radio`,name:ee,value:t.value,checked:n,disabled:a,form:i,autoComplete:e,autoFocus:t.value===V,tabIndex:p===void 0?void 0:p===-1?-1:t.value===R?p:-1,onClick:y,onKeyDown:x,onChange:()=>U(t.value),onFocus:()=>{a||A(t.value)},className:u(`${D}form-check-input`,`${D}me-1`)}),(0,l.jsx)(`span`,{className:`${D}form-check-label`,children:t.children??t.label})]},t.value)})]},t.label||`group-${n}`)),B.map(e=>(0,l.jsx)(`input`,{type:`hidden`,name:s,value:e,form:i,disabled:r},`hidden-selected-${e}`)),S?(0,l.jsx)(`div`,{className:u(`${D}list-group-item`),children:S}):null]})}function b(e){let t=[],n;for(let r of e){let e=r.groupLabel??``;if(n&&n.label===e){n.options.push(r);continue}if(n=t.find(t=>t.label===e),n){n.options.push(r);continue}n={label:e,options:[r]},t.push(n)}return t}var x=`⏳`,S=150;function C({className:e,style:t,title:n,inline:r,content:i,customization:a}){let o=a?.classNamePrefix??`super-select`,s=o.length>0?`${o}__`:``,d=r?`span`:`div`,[f,p]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let e=window.setTimeout(()=>p(!0),S);return()=>window.clearTimeout(e)},[]),(0,l.jsx)(d,{className:u(`${s}spinner-border`,`${s}spinner-border-sm`,`${s}fade`,f?`${s}show`:void 0,e),style:t,title:n,role:`status`,children:(0,l.jsx)(`span`,{className:`${s}visually-hidden`,children:i??(0,l.jsx)(l.Fragment,{children:x})})})}function w({className:e,style:t,search:n,onSearchChange:r,isSearching:i,disabled:a,ref:o,onKeyDown:s,customization:c}){let d=c?.classNamePrefix??`super-select`,f=d.length>0?`${d}__`:``,p=c?.pendingIndicator?.component??C;return(0,l.jsxs)(`div`,{className:u(`${f}input-group`,e),style:t,children:[(0,l.jsx)(`input`,{ref:o,type:`search`,value:n??``,onChange:e=>r(e.target.value),onKeyDown:s,className:`${f}form-control`,disabled:a,placeholder:c?.placeholder,title:c?.title,"aria-label":c?.title}),i&&(0,l.jsx)(`div`,{className:`${f}input-group-text`,children:(0,l.jsx)(p,{inline:!0,className:c?.pendingIndicator?.className,style:c?.pendingIndicator?.style,title:c?.pendingIndicator?.title,content:c?.pendingIndicator?.content,customization:c?{classNamePrefix:d}:void 0})})]})}var T=class{defaultQueryData;cacheByValue=new Map;getAll(){let e=new Map;if(this.defaultQueryData)for(let t of this.defaultQueryData.options)e.set(t.value,t);for(let t of this.cacheByValue.values())e.set(t.value,t);return Array.from(e.values())}getByValue(e){let t=this.cacheByValue.get(e);return!t&&this.defaultQueryData&&(t=this.defaultQueryData.options.find(t=>t.value===e)),t}hasDefault(){return!!this.defaultQueryData}getByPageQuery(e){if(!this.defaultQueryData||e&&(e.search||e.offset&&e.offset>0||e.after))return;let t=this.defaultQueryData.options,n=this.defaultQueryData.hasMore;if(e?.limit!==void 0){if(this.defaultQueryData.limit!==void 0&&this.defaultQueryData.limit<e.limit)return;e.limit<t.length&&(t=t.slice(0,e.limit),n=!0)}return{options:t,hasMore:n}}tryResolveValues(e){if(!e||this.cacheByValue.size===0&&!this.defaultQueryData)return{options:void 0,missingValues:e};let t=[],n=[];for(let r of e){let e=this.getByValue(r);e?t.push(e):n.push(r)}return{options:t,missingValues:n}}set(e){if(e)for(let t of e){if(this.cacheByValue.size>=1e3)break;this.cacheByValue.set(t.value,t)}}setQueryResult(e,t){return(!t||!t.search&&!t.offset&&!t.after)&&e.options&&e.options.length>0?(this.defaultQueryData={options:e.options,hasMore:e.hasMore,limit:t?.limit},!0):!1}clear(){this.defaultQueryData=void 0,this.cacheByValue.clear()}},E=class{fetcher;runChain=Promise.resolve();pendingQueryRuns=[];constructor(e){this.fetcher=e}fetch(e){let t=e?.signal,n={...e,values:e?.values?[...e.values]:void 0};for(let e=0;e<this.pendingQueryRuns.length;e++){let r=this.pendingQueryRuns[e],i=r.query.values,a=n.values,o=!1;if(i===a)o=!0;else if(i&&a&&i.length===a.length){o=!0;for(let e=0;e<i.length;e++)if(i[e]!==a[e]){o=!1;break}}if(r.query.search===n.search&&r.query.offset===n.offset&&r.query.after===n.after&&r.query.limit===n.limit&&o)return this.createSubscriberPromise(r,n,t);let s=!!r.query.values&&!r.query.search&&r.query.offset===void 0&&r.query.after===void 0&&r.query.limit===void 0,c=!!n.values&&!n.search&&n.offset===void 0&&n.after===void 0&&n.limit===void 0;if((e>0||!r.started)&&s&&c){let e=Array.from(new Set([...r.query.values,...n.values]));return e.length!==r.query.values.length&&(r.query={values:e}),this.createSubscriberPromise(r,n,t)}}let r=new AbortController,i={query:n,promise:Promise.resolve({options:[]}),abortController:r,subscribers:new Set,started:!1},a=this.runSequentially(()=>(i.started=!0,this.fetcher({...i.query,signal:r.signal})));i.promise=a,this.pendingQueryRuns.push(i);let o=()=>{let e=this.pendingQueryRuns.findIndex(e=>e.promise===a);e>=0&&this.pendingQueryRuns.splice(e,1)};return a.then(o,o),this.createSubscriberPromise(i,n,t)}createSubscriberPromise(e,t,n){let r={query:t,signal:n,aborted:!1};e.subscribers.add(r);let i,a=new Promise((t,a)=>{if(n){if(i=()=>{r.aborted=!0,this.abortUnderlyingRequestIfUnused(e),a(new DOMException(`The operation was aborted.`,`AbortError`))},n.aborted){i();return}n.addEventListener(`abort`,i,{once:!0})}});return(n?Promise.race([e.promise,a]):e.promise).then(e=>this.filterResultForSubscriber(e,r.query)).finally(()=>{e.subscribers.delete(r),n&&i&&n.removeEventListener(`abort`,i),this.abortUnderlyingRequestIfUnused(e)})}filterResultForSubscriber(e,t){if(!t.values||t.search||t.offset!==void 0||t.after!==void 0||t.limit!==void 0)return e;let n=new Set(t.values),r=new Map(t.values.map((e,t)=>[e,t]));return{...e,options:e.options.filter(e=>n.has(e.value)).sort((e,t)=>(r.get(e.value)??0)-(r.get(t.value)??0))}}abortUnderlyingRequestIfUnused(e){if(e.subscribers.size===0){e.abortController.abort();return}Array.from(e.subscribers).every(e=>e.aborted)&&e.abortController.abort()}runSequentially(e){let t=this.runChain.then(e,e);return this.runChain=t.then(()=>void 0,()=>void 0),t}},D=class extends Error{userMessage;code;httpStatus;constructor(e,t){super(e,{cause:t?.cause}),this.name=`OptionSourceError`,this.userMessage=t?.userMessage,this.code=t?.code,this.httpStatus=t?.httpStatus,this.cause=t?.cause}};function O(e){return e instanceof D?!0:!(!e||typeof e!=`object`||`message`in e&&typeof e.message!=`string`&&e.message!==void 0||`userMessage`in e&&typeof e.userMessage!=`string`&&e.userMessage!==void 0||`code`in e&&typeof e.code!=`string`&&e.code!==void 0||`httpStatus`in e&&typeof e.httpStatus!=`number`&&e.httpStatus!==void 0)}var k=`An error occurred fetching options`;function A(e){if(e instanceof D)return e;if(!e)return new D(k);if(typeof e==`string`)return new D(e);if(typeof e!=`object`)return new D(k);if(`name`in e&&e.name===`AbortError`)return e;let t;t=`message`in e&&typeof e.message==`string`?e.message??k:k;let n;if(O(e)?n=e:(n={},`userMessage`in e&&typeof e.userMessage==`string`&&(n.userMessage=e.userMessage),`code`in e&&typeof e.code==`string`&&(n.code=e.code),`httpStatus`in e&&typeof e.httpStatus==`number`&&(n.httpStatus=e.httpStatus),`cause`in e&&(n.cause=e.cause)),n.httpStatus&&!n.code){let e;n.httpStatus===401?e=`unauthorized`:n.httpStatus===403?e=`forbidden`:n.httpStatus===404?e=`not-found`:n.httpStatus===408?e=`timeout`:n.httpStatus===429?e=`rate-limited`:n.httpStatus>=500&&n.httpStatus<=599&&(e=`server`),e&&(n={...n,code:e})}return e instanceof Error&&(!n.cause||e.cause===n.cause)&&(n={...n,cause:e}),new D(t,n)}var j=class e{innerFetcher;fetcher;cache;constructor(e){this.innerFetcher=e.fetch,this.fetcher=new E(this.innerFetcher),this.cache=e.noCache?void 0:new T}async getOptionPage(e){if(this.cache){let t=this.cache.getByPageQuery(e);if(t)return{...t,nextPage:this.createFetchNextPage(t,e)}}try{let t=await this.fetcher.fetch(e);return this.cache&&this.cache.setQueryResult(t,e),{...t,nextPage:this.createFetchNextPage(t,e)}}catch(e){throw A(e)}}createFetchNextPage(e,t){if(!e||e.hasMore!==!0)return;let n=(t?.offset??0)+e.options.length,r=e.options.length>0?e.options[e.options.length-1]:void 0,i={search:t?.search,offset:n,after:r,limit:t?.limit};return e=>this.getOptionPage({...i,limit:e?.limit??i.limit,signal:e?.signal})}async resolveValues(e,t){if(!e||e.length===0)return[];let n=Array.from(new Set(e)),r=n,i;if(this.cache){if(!this.cache.hasDefault())try{let e=await this.fetcher.fetch({signal:t});this.cache.setQueryResult(e,void 0)}catch(e){if(t?.aborted)throw A(e)}let{options:e,missingValues:n}=this.cache.tryResolveValues(r);e&&(i=e,r=n)}let a=[];if(r&&r.length>0){let e=new Set(r),n={values:r,signal:t};for(;e.size>0;){let i;try{i=await this.fetcher.fetch(n)}catch(e){throw A(e)}let o=i.options,s=0;for(let t of o)e.delete(t.value)&&(a.push(t),s++);if(i.hasMore!==!0||s===0)break;n={values:r,offset:(n.offset??0)+o.length,after:o[o.length-1],signal:t}}this.cache&&this.cache.set(a)}let o=new Map([...i??[],...a].map(e=>[e.value,e]));return n.flatMap(e=>{let t=o.get(e);return t?[t]:[]})}getCachedOptions(){return this.cache?.getAll()}clearCache(){this.cache?.clear()}withNoCache(){return this.cache?new e({fetch:this.innerFetcher,noCache:!0}):this}};function M(e){if(typeof e==`function`)return new j({fetch:e});if(N(e))return e;if(P(e))return new j(e);throw Error(`Invalid option source init.`)}function N(e){return!e||typeof e!=`object`?!1:`getOptionPage`in e&&typeof e.getOptionPage==`function`&&`resolveValues`in e&&typeof e.resolveValues==`function`}function P(e){return!e||typeof e!=`object`?!1:`fetch`in e&&typeof e.fetch==`function`}function F(e,t){let n=[],r=new Set;for(let t of e)r.has(t.value)||(r.add(t.value),n.push(t));for(let e of t)r.has(e.value)||(r.add(e.value),n.push(e));return n}var I=2,L=250;function R({optionSource:e,staticOptions:t,searchMatcher:n,maxAdditionalPages:r=I,value:i,defaultValue:a,multiple:o,isOptionListActive:s=!0}){let l=s&&!!e,u=i!==void 0,[d,f]=(0,c.useState)(()=>{let e=v(u?i:a);return o?e:e.slice(0,1)}),p=(0,c.useMemo)(()=>{let e=v(u?i:d);return o?e:e.slice(0,1)},[u,o,d,i]),[m,h]=(0,c.useState)(``),[g,_]=(0,c.useState)(()=>l?``:void 0),[y,b]=(0,c.useState)({items:[],result:void 0,error:void 0,isPending:l,additionalPagesLoaded:0,lastAttemptedQuery:l?{search:void 0,initiatedBySearch:!1}:void 0}),[x,S]=(0,c.useState)(0),[C,w]=(0,c.useState)(()=>[...p]),[T,E]=(0,c.useState)({key:``,options:[],error:void 0}),[D,O]=(0,c.useState)(!1),k=(0,c.useRef)(void 0),j=(0,c.useRef)(void 0),M=(0,c.useRef)(void 0),N=(0,c.useRef)(new Map),P=(0,c.useRef)({isOptionListActive:s,optionSource:e}),R=(0,c.useMemo)(()=>JSON.stringify(p),[p]),z=s&&!!e&&g===void 0&&y.result===void 0&&y.error===void 0,H=!z&&!y.isPending&&y.error===void 0,U=y.error!==void 0,ee=(0,c.useCallback)(e=>{let t=o?e:e.slice(0,1);u||f(t)},[u,o]);(0,c.useEffect)(()=>{let t=P.current,n=s!==t.isOptionListActive,r=e!==t.optionSource;if(!n&&!r)return;P.current={isOptionListActive:s,optionSource:e},(!s||r)&&(k.current?.abort(),k.current=void 0,j.current?.abort(),j.current=void 0);let i=!1;return queueMicrotask(()=>{if(!i){if(!s){b(e=>({...e,isPending:!1}));return}if(h(``),w(p),_(``),e){b(e=>({...e,items:[],result:void 0,error:void 0,isPending:!0,additionalPagesLoaded:0,lastAttemptedQuery:{search:void 0,initiatedBySearch:!1}}));return}b(e=>({...e,error:void 0,isPending:!1}))}}),()=>{i=!0}},[s,e,p]),(0,c.useEffect)(()=>{if(!s||m===g)return;let t=window.setTimeout(()=>{e&&(b(e=>({...e,isPending:!0,error:void 0,lastAttemptedQuery:{search:m||void 0,initiatedBySearch:!0}})),S(e=>e+1)),_(m)},L);return()=>{window.clearTimeout(t)}},[g,s,e,m]),(0,c.useEffect)(()=>{if(!s||!e||g===void 0)return;let t=!1;k.current?.abort();let n=new AbortController;k.current=n;let r=g?{search:g,signal:n.signal}:{signal:n.signal};return e.getOptionPage(r).then(e=>{t||b(t=>({...t,items:e.options,result:e,error:void 0,isPending:!1,additionalPagesLoaded:0}))}).catch(e=>{t||n.signal.aborted||b(t=>({...t,items:[],result:void 0,isPending:!1,error:A(e)}))}),()=>{t=!0,n.abort(),k.current===n&&(k.current=void 0)}},[g,s,e,x]);let W=(0,c.useCallback)(e=>{w(e=>{if(p.length===0)return e;let t=[...e],n=new Set(e);for(let e of p)n.has(e)||(n.add(e),t.push(e));return t}),h(e)},[p]),te=(0,c.useCallback)(()=>{!e||!s||(b(e=>({...e,items:[],result:void 0,error:void 0,isPending:!0,additionalPagesLoaded:0,lastAttemptedQuery:{search:g,initiatedBySearch:!!e.lastAttemptedQuery?.initiatedBySearch}})),S(e=>e+1),_(e=>e??``))},[g,s,e]),G=!!y.result?.nextPage&&y.additionalPagesLoaded<r&&y.items.length>0&&H&&!y.isPending,K=!!y.result?.nextPage&&y.items.length>0&&H,ne=(0,c.useCallback)(()=>{if(!y.result?.nextPage||!G||y.isPending)return;b(e=>({...e,isPending:!0,lastAttemptedQuery:{search:g,initiatedBySearch:!1}})),j.current?.abort();let e=new AbortController;j.current=e,y.result.nextPage({signal:e.signal}).then(t=>{j.current===e&&b(e=>({...e,items:[...e.items,...t.options],result:t,additionalPagesLoaded:e.additionalPagesLoaded+1,error:void 0,isPending:!1}))}).catch(t=>{e.signal.aborted||j.current!==e||b(e=>({...e,error:A(t),isPending:!1}))}).finally(()=>{j.current===e&&(j.current=void 0)})},[G,g,y.isPending,y.result]);(0,c.useEffect)(()=>{let e=new Map;for(let n of t)e.has(n.value)||e.set(n.value,n);N.current=e},[e,t]);let q=g??``,J=(0,c.useMemo)(()=>B(t.find(e=>e.hidden)?t.filter(e=>!e.hidden):t,q,n),[q,n,t]),Y=(0,c.useMemo)(()=>{if(!e)return J;let t=y.items.find(e=>e.hidden)?y.items.filter(e=>!e.hidden):y.items;return F(J,t)},[J,e,y.items]);(0,c.useEffect)(()=>{if(!(!e||Y.length===0))for(let e of Y)N.current.has(e.value)||N.current.set(e.value,e)},[e,Y]),(0,c.useEffect)(()=>{if(!e||p.length===0)return;let t=!1;M.current?.abort();let n=new AbortController;M.current=n;let r=JSON.stringify(p),i=N.current,a=new Map;for(let e of p){let t=i.get(e);t&&a.set(e,t)}let o=p.filter(e=>!a.has(e));if(o.length===0){M.current=void 0,queueMicrotask(()=>{t||(O(!1),E({key:r,options:p.map(e=>a.get(e)).filter(e=>e!==void 0),error:void 0}))});return}return queueMicrotask(()=>{O(!0)}),e.resolveValues(o,n.signal).then(e=>{if(t)return;let n=new Map(e.map(e=>[e.value,e]));for(let t of e)i.set(t.value,t);let o=p.map(e=>a.get(e)??n.get(e)).filter(e=>e!==void 0),s=p.filter(e=>!n.has(e)).filter(e=>!a.has(e));O(!1),E({key:r,options:o,error:s.length>0?A(Error()):void 0})}).catch(e=>{t||n.signal.aborted||(O(!1),E({key:r,options:[],error:A(e)}))}),()=>{t=!0,n.abort(),M.current===n&&(M.current=void 0)}},[e,p]);let re=(0,c.useMemo)(()=>{if(e)return p.length===0||T.key!==R?[]:T.options;let n=new Map(t.map(e=>[e.value,e]));return p.map(e=>n.get(e)||{value:e,label:``,disabled:!1})},[e,T.key,T.options,p,R,t]),ie=(0,c.useMemo)(()=>{if(U)return y.error??A()},[U,y.error]),X=q.trim().length>0&&!(y.isPending&&y.lastAttemptedQuery?.initiatedBySearch),ae=(0,c.useMemo)(()=>{if(C.length===0)return[];let e=new Set(C),t=new Map;for(let n of Y)e.has(n.value)&&t.set(n.value,n);for(let n of re)e.has(n.value)&&t.set(n.value,n);return C.map(e=>t.get(e)).filter(e=>e!==void 0)},[re,C,Y]),Z=(0,c.useMemo)(()=>ie&&(y.lastAttemptedQuery?.initiatedBySearch||Y.length===0)?[]:V(Y,C,e?ae:void 0,X),[X,e,ie,y.lastAttemptedQuery?.initiatedBySearch,ae,C,Y]),oe=(0,c.useMemo)(()=>{if(!(!e||p.length===0||T.key!==R||T.error===void 0))return T.error},[e,T.error,T.key,p.length,R]),Q=s&&!!e&&(z||y.isPending),se=Q&&!!y.lastAttemptedQuery?.initiatedBySearch,$=!!e&&p.length>0&&D;return(0,c.useEffect)(()=>()=>{k.current?.abort(),j.current?.abort(),M.current?.abort()},[]),{searchValue:m,selectedValues:p,options:Z,isOptionsPending:Q,isSearching:se,isResolveValuesPending:$,optionsError:ie,resolveValuesError:oe,canLoadMore:G,hasMore:K,handleSelectedValuesChange:ee,handleSearchChange:W,handleRetryOptions:e?te:void 0,handleLoadMore:ne}}function z(e,t){let n=t.trim().toLowerCase();return n?e.label.toLowerCase().includes(n):!0}function B(e,t,n){return t.trim()?n?e.filter(e=>n(e,t)):e.filter(e=>z(e,t)):e}function V(e,t,n,r){if(!t||t.length===0||r)return e;let i=new Set(t),a=e.filter(e=>i.has(e.value)),o=new Set(a.map(e=>e.value)),s=[];for(let e of n??[])!i.has(e.value)||o.has(e.value)||(o.add(e.value),s.push(e));let c=e.filter(e=>!o.has(e.value));return a.length===0&&s.length===0?e:[...a,...s,...c]}function H(e){let{value:t,disabled:n,...r}=e;return{addEventListener:()=>void 0,removeEventListener:()=>void 0,dispatchEvent:()=>!0,...U(t),disabled:n??!1,...r}}function U(e){let t,n=[];typeof e==`string`?(t=e,n.push({value:e,label:``,selected:!0,disabled:!1})):Array.isArray(e)?(t=e[0]??``,n.push(...e.map(e=>({value:e,label:``,selected:!0,disabled:!1})))):t=``;let r=Object.assign(n,{selectedIndex:n.length>0?0:-1,item:e=>n[e]??null,namedItem:()=>null,length:n.length,[Symbol.iterator]:n[Symbol.iterator].bind(n)});return{value:t,selectedOptions:r}}function ee(e){return G(`change`,e)}function W(e,t){let n=G(`input`,e),r={...n.nativeEvent,data:t.data,dataTransfer:null,detail:0,inputType:`insertText`,isComposing:!1,view:null,which:0,getTargetRanges:()=>[],initUIEvent:()=>void 0};return{...n,nativeEvent:r,data:t.data}}function te(e){return G(`invalid`,e)}function G(e,t){let n=e,r=!1,i=!0,a=!0,o={get type(){return n},currentTarget:t,target:t,get cancelable(){return a},get defaultPrevented(){return r},preventDefault(){r=!0},get bubbles(){return i},stopPropagation(){i=!1},eventPhase:Event.NONE,isTrusted:!0,timeStamp:Date.now(),get cancelBubble(){return!i},set cancelBubble(e){i=!e},composed:!1,get returnValue(){return!r},set returnValue(e){r=!e},srcElement:t,composedPath(){return[t]},initEvent(e,t,r){n=e,i=t??!1,a=r??!0},stopImmediatePropagation(){i=!1},AT_TARGET:Event.AT_TARGET,BUBBLING_PHASE:Event.BUBBLING_PHASE,CAPTURING_PHASE:Event.CAPTURING_PHASE,NONE:Event.NONE};return{get type(){return n},currentTarget:t,target:t,get cancelable(){return a},get defaultPrevented(){return r},preventDefault(){r=!0},get bubbles(){return i},stopPropagation(){i=!1},eventPhase:Event.NONE,isTrusted:!0,timeStamp:o.timeStamp,nativeEvent:o,isDefaultPrevented(){return r},isPropagationStopped(){return!i},persist:()=>void 0}}function K(e,t){let n=Object.create(e);return Object.defineProperties(n,{currentTarget:{get(){return t}},target:{get(){return t}}}),n}function ne(e,t){let n={};for(let r of Object.keys(t)){let i=t[r];typeof i==`function`&&(n[r]=(t=>{i(K(t,e))}))}return n}var q=`⚠`,J=`↻`;function Y({className:e,style:t,message:n,inline:r,onRetry:i,customization:a}){let o=a?.classNamePrefix??`super-select`,s=o.length>0?`${o}__`:``;return(0,l.jsxs)(r?`span`:`div`,{className:u(`${s}alert`,`${s}alert-danger`,i&&`${s}alert-dismissible`,r&&`${s}d-block`,e),style:t,children:[a?.icon??(0,l.jsx)(`span`,{"aria-hidden":!!n,children:q}),` `,n&&(0,l.jsx)(l.Fragment,{children:n}),` `,i&&(0,l.jsx)(`button`,{type:`button`,className:u(`${s}btn`,`${s}btn-outline-secondary`,`${s}btn-sm`,a?.retryButton?.className),style:a?.retryButton?.style,title:a?.retryButton?.title,onClick:i,children:a?.retryButton?.content??J})]})}function re({form:e,onReset:t}){let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=n.current?.form,r=e?.ownerDocument.defaultView;if(!e||!r)return;let i=n=>{n.target===e&&!n.defaultPrevented&&t()};return r.addEventListener(`reset`,i),()=>r.removeEventListener(`reset`,i)},[e,t]),(0,l.jsx)(`input`,{ref:n,type:`hidden`,form:e})}function ie(e){return X(e,new Set)}function X(e,t){let n=[];for(let r of c.Children.toArray(e))if((0,c.isValidElement)(r)){if(r.type===c.Fragment){let e=r;n.push(...X(e.props.children,t));continue}if(r.type===`option`){let e=r,i=Z(e.props.children),a=e.props.value===void 0?i:String(e.props.value);if(t.has(a))continue;t.add(a);let o=e.props.label===void 0?i:String(e.props.label),s=e.props,c=Object.entries(s).reduce((e,[t,n])=>(!t.startsWith(`data-`)||n===void 0||(e[t.slice(5)]=n),e),{}),l=e.props.data===void 0?Object.keys(c).length>0?c:void 0:{...c,value:e.props.data};n.push({value:a,label:o,children:ae(e.props.children)?e.props.children:void 0,disabled:!!e.props.disabled,hidden:!!e.props.hidden,data:l});continue}if(r.type===`optgroup`){let e=r,i=String(e.props.label??``),a=c.Children.toArray(e.props.children);for(let e of a){let r=X(e,t);for(let e of r)e.groupLabel=i,n.push(e)}}}return n}function ae(e){return e==null||typeof e==`boolean`||typeof e==`string`||typeof e==`number`?!1:Array.isArray(e)?e.some(e=>ae(e)):!0}function Z(e){return e==null||typeof e==`boolean`?``:typeof e==`string`?e:typeof e==`number`?String(e):Array.isArray(e)?e.map(e=>Z(e)).join(``):(0,c.isValidElement)(e)?Z(e.props.children):``}function oe({ref:e,customization:t,children:n,className:r,...i}){let a=t?.classNamePrefix??`super-select`,o=a.length>0?`${a}__`:``;return(0,l.jsx)(`button`,{ref:e,type:`button`,className:u(`${o}form-select`,`${o}text-start`,r),...i,children:n})}var Q=`✓`;function se({className:e,style:t,disabled:n,title:r,onClick:i,customization:a}){let o=a?.classNamePrefix??`super-select`,s=o.length>0?`${o}__`:``;return(0,l.jsx)(`button`,{type:`button`,className:u(`${s}btn`,`${s}btn-secondary`,e),style:t,onClick:i,disabled:n,title:r,children:a?.content??Q})}function $({customization:e,selectedOptions:t,className:n,style:r}){let i=e?.classNamePrefix??`super-select`,a=i.length>0?`${i}__`:``;return t.length>1?(0,l.jsx)(`ul`,{className:u(`${a}list-inline`,`${a}d-inline`,n),style:r,children:t.map(e=>(0,l.jsx)(`li`,{className:`${a}list-inline-item`,children:e.children??e.label},e.value))}):(0,l.jsx)(`span`,{className:n,style:r,children:t[0]?.children??t[0]?.label??e?.placeholder??``})}function ce({optionSource:e,children:t,customization:n,ref:r,multiple:i,disabled:a,required:o,value:s,defaultValue:d,name:f,id:p,form:m,autoFocus:h,autoComplete:g,onInput:_,onInvalid:y,onChange:b,onValueChange:x,className:S,style:w,...T}){let[E,D]=(0,c.useState)(!1),[O,k]=(0,c.useState)(!1),A=(0,c.useMemo)(()=>ie(t),[t]),j=s!==void 0,M=(0,c.useRef)(d),N=R({optionSource:e,staticOptions:A,searchMatcher:n?.searchMatcher,maxAdditionalPages:n?.maxAdditionalPages,value:s,defaultValue:d,multiple:i,isOptionListActive:E}),P=(0,c.useCallback)(()=>{a||D(!0)},[a]),F=(0,c.useCallback)(()=>{D(!1)},[]),I=(0,c.useCallback)(()=>{if(j)return;let e=v(M.current);N.handleSelectedValuesChange(i?e:e.slice(0,1)),k(!1)},[N,j,i,k]),L=(0,c.useCallback)(e=>{if(a)return;N.handleSelectedValuesChange(e),(!o||e.length>0)&&k(!1);let t=H({id:p,name:f,value:i?e:e[0]??``,multiple:i,disabled:a,required:o});_&&_(W(t,{data:``})),b&&b(ee(t)),x&&x(i?e:e[0]??``)},[N,a,p,i,f,b,_,x,o,k]),z=(0,c.useCallback)(e=>{let t=Array.from(e.currentTarget.selectedOptions).map(e=>e?.value??``),n=i?t:t.length>0?[t[0]??``]:e.currentTarget.value===``?[]:[e.currentTarget.value];L(n)},[L,i]),B=(0,c.useMemo)(()=>{if(N.selectedValues.length===0)return[];let e=new Map;for(let t of A)e.has(t.value)||e.set(t.value,t);for(let t of N.options)e.set(t.value,t);let t=N.selectedValues.map(t=>e.get(t)).filter(e=>e!==void 0);return t.length>0?t:le(N.selectedValues,A)},[N.options,N.selectedValues,A]),V=(0,c.useMemo)(()=>H({id:p,name:f,value:i?N.selectedValues:N.selectedValues[0]??``,multiple:i,disabled:a,required:o}),[N.selectedValues,a,p,i,f,o]),U={...T,size:void 0},G=T[`aria-label`],K=T[`aria-labelledby`]??(G?void 0:p),q=ne(V,U),J=(0,c.useCallback)(e=>{P(),q.onClick?.(e)},[P,q]),X=(0,c.useCallback)(e=>{e.preventDefault(),k(!0),y&&y(te(V))},[V,y,k]),ae=O&&!!o&&N.selectedValues.length===0,Z=n?.classNamePrefix??`super-select`,Q=Z.length>0?`${Z}__`:``,se=(0,c.useMemo)(()=>A.find(e=>e.value===``)?.label,[A]),ce=n?.modalSelectButton?.selectedContent?.placeholder??se,de=B.length>0,fe=!!N.resolveValuesError,pe=fe||ae,me=n?.errorIndicator?.component??Y,he=n?.pendingIndicator?.component??C,ge=n?.modalSelectButton?.component??oe,_e=n?.modalSelectButton?.selectedContent?.component??$;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ge,{...U,...q,id:p,autoFocus:h,"aria-haspopup":`dialog`,"aria-expanded":E,"aria-busy":N.isResolveValuesPending||void 0,"aria-invalid":pe||void 0,disabled:a,className:u(a?`${Q}disabled`:void 0,pe?`${Q}is-invalid`:void 0,S,n?.modalSelectButton?.className),style:w&&n?.modalSelectButton?.style?{...w,...n.modalSelectButton.style}:w??n?.modalSelectButton?.style,onClick:J,ref:r,customization:{classNamePrefix:Z},children:fe&&N.resolveValuesError?(0,l.jsx)(me,{inline:!0,className:n?.errorIndicator?.className,style:n?.errorIndicator?.style,error:N.resolveValuesError,message:N.resolveValuesError.userMessage??n?.errorIndicator?.defaultMessage,customization:{classNamePrefix:Z,icon:n?.errorIndicator?.icon}}):N.isResolveValuesPending?(0,l.jsx)(he,{inline:!0,className:n?.pendingIndicator?.className,style:n?.pendingIndicator?.style,title:n?.pendingIndicator?.title,content:n?.pendingIndicator?.content,customization:{classNamePrefix:Z}}):(0,l.jsx)(_e,{selectedOptions:B,className:u(!de||fe?`${Q}text-body-secondary`:void 0,n?.modalSelectButton?.selectedContent?.className),style:n?.modalSelectButton?.selectedContent?.style,customization:{classNamePrefix:Z,placeholder:ce}})}),(0,l.jsx)(ue,{customization:n,isOpen:E,dir:T.dir,lang:T.lang,ariaLabel:G,ariaLabelledBy:K,onClose:F,searchValue:N.searchValue,onSearchChange:N.handleSearchChange,options:N.options,selectedValues:N.selectedValues,multiple:i,isOptionsPending:N.isOptionsPending,isSearching:N.isSearching,isResolveValuesPending:N.isResolveValuesPending,onRefresh:N.handleRetryOptions,optionsError:N.optionsError,onOptionListChange:z,canLoadMore:N.canLoadMore,hasMore:N.hasMore,onLoadMore:N.handleLoadMore}),f||o?(0,l.jsx)(`select`,{name:f,form:m,autoComplete:g,...T,required:o,disabled:a,onInvalid:X,multiple:i,value:i?N.selectedValues:N.selectedValues[0]??``,onChange:()=>void 0,"aria-hidden":!0,hidden:!0,tabIndex:-1,className:`${Q}visually-hidden`,children:N.selectedValues.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))}):null,j?null:(0,l.jsx)(re,{form:m,onReset:I})]})}function le(e,t){if(e.length===0)return[];let n=new Map(t.map(e=>[e.value,e]));return e.map(e=>n.get(e)).filter(e=>e!==void 0)}function ue({customization:e,isOpen:t,dir:n,lang:r,ariaLabel:i,ariaLabelledBy:a,onClose:o,searchValue:s,onSearchChange:u,options:d,selectedValues:p,multiple:m,isOptionsPending:g,isSearching:b,isResolveValuesPending:x,onRefresh:S,optionsError:T,onOptionListChange:E,canLoadMore:D,onLoadMore:O,hasMore:k}){let A=e?.classNamePrefix??`super-select`,j=A.length>0?`${A}__`:``,M=e?.searchInput?.component??w,N=e?.modal?.okButton?.component??se,P=e?.modal?.component??f,F=e?.optionListInput?.component??y,I=e?.errorIndicator?.component??Y,L=e?.emptyIndicator?.component??h,R=e?.moreIndicator?.component??_,z=e?.pendingIndicator?.component??C,B=(0,c.useRef)(null),V=(0,c.useRef)(!1),U=!!b,W=!!(g||x),te=(0,c.useMemo)(()=>{let e=v(p);return m?e:e.slice(0,1)},[m,p]),G=d.length>0,K=W,ne=T,q=!!ne,J=!q&&!K&&!G,re=!q&&!K&&!J&&!!k;(0,c.useEffect)(()=>{if(!t)return;let e=B.current;if(!e)return;let n=window.setTimeout(()=>{e.focus()},0);return()=>{window.clearTimeout(n)}},[t]);let ie=(0,c.useCallback)(e=>{if(e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;if(e.key===`Enter`){e.preventDefault();return}let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(!t)return;let n=e.currentTarget.closest([`.${j}modal-content`,`[class*='modal-content']`,`[class*='modal-body']`,`dialog`,`[role='dialog']`,`[aria-modal='true']`].join(`,`))??e.currentTarget.parentElement;if(!n)return;let r=n.querySelector([`[role='listbox']`,`[role='radiogroup']`,`[role='group']`,`fieldset`,`[class*='modal-body']`].join(`,`))??n,i=Array.from(r.querySelectorAll([`input[type='radio']:not(:disabled):not([tabindex='-1'])`,`input[type='checkbox']:not(:disabled):not([tabindex='-1'])`,`[role='radio']:not([aria-disabled='true']):not([tabindex='-1'])`,`[role='checkbox']:not([aria-disabled='true']):not([tabindex='-1'])`,`[role='option']:not([aria-disabled='true']):not([tabindex='-1'])`].join(`,`))).filter(e=>{if(e.hidden||e.getAttribute(`aria-hidden`)===`true`)return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`}),a=t>0?i[0]:i[i.length-1];a&&(e.preventDefault(),a.focus())},[j]),X=(0,c.useCallback)(e=>{if(E(e),!m){if(V.current){V.current=!1;return}o()}},[m,o,E]),ae=(0,c.useCallback)(e=>{let t=m?e:e.slice(0,1),n=H({value:m?t:t[0]??``,multiple:m});X(ee(n))},[X,m]),Z=(0,c.useCallback)(e=>{if(m||e.detail<=0)return;V.current=!1;let t=e.currentTarget,n;n=`checked`in t&&typeof t.checked==`boolean`?t.checked:`selected`in t&&typeof t.selected==`boolean`?t.selected:!1,n&&o()},[m,o]),oe=(0,c.useCallback)(e=>{if(!m){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowLeft`||e.key===`ArrowRight`){V.current=!0;return}if(V.current=!1,e.key===`Enter`||e.key===` `||e.key===`Spacebar`){let t=e.currentTarget,n;n=`checked`in t&&typeof t.checked==`boolean`?t.checked:`selected`in t&&typeof t.selected==`boolean`?t.selected:!1,n&&(e.preventDefault(),e.stopPropagation(),o())}}},[m,o]),Q;return Q=K?(0,l.jsx)(z,{inline:!0,className:e?.pendingIndicator?.className,style:e?.pendingIndicator?.style,title:e?.pendingIndicator?.title,content:e?.pendingIndicator?.content,customization:{classNamePrefix:A}}):q?(0,l.jsx)(I,{className:e?.errorIndicator?.className,style:e?.errorIndicator?.style,error:ne,message:ne?.userMessage??e?.errorIndicator?.defaultMessage,onRetry:S,customization:{classNamePrefix:A,icon:e?.errorIndicator?.icon,retryButton:e?.errorIndicator?.retryButton}}):J?(0,l.jsx)(L,{className:e?.emptyIndicator?.className,style:e?.emptyIndicator?.style,onRetry:S,customization:{classNamePrefix:A,content:e?.emptyIndicator?.content,retryButton:e?.emptyIndicator?.retryButton}}):re?(0,l.jsx)(R,{onLoadMore:D?O:void 0,className:e?.moreIndicator?.className,style:e?.moreIndicator?.style,disabled:W,customization:{classNamePrefix:A,loadMoreButton:e?.moreIndicator?.loadMoreButton,overflowIndicator:e?.moreIndicator?.overflowIndicator}}):void 0,(0,l.jsx)(P,{open:t,dir:n,lang:r,"aria-label":i,"aria-labelledby":a,"aria-busy":g||x||void 0,className:e?.modal?.className,style:e?.modal?.style,customization:{classNamePrefix:A,dialog:e?.modal?.dialog,content:e?.modal?.content,header:e?.modal?.header,body:e?.modal?.body,footer:e?.modal?.footer,closeButton:e?.modal?.closeButton},onClose:()=>{o()},onCancel:o,onClick:e=>{e.target===e.currentTarget&&o()},headerContent:(0,l.jsx)(M,{ref:B,className:e?.searchInput?.className,style:e?.searchInput?.style,search:s,onSearchChange:e=>u(e??``),onKeyDown:ie,isSearching:U,customization:{classNamePrefix:A,placeholder:e?.searchInput?.placeholder,title:e?.searchInput?.title,pendingIndicator:{className:e?.pendingIndicator?.className,style:e?.pendingIndicator?.style,title:e?.pendingIndicator?.title,content:e?.pendingIndicator?.content,component:e?.pendingIndicator?.component}}}),footerContent:m?(0,l.jsx)(N,{className:e?.modal?.okButton?.className,style:e?.modal?.okButton?.style,title:e?.modal?.okButton?.title,onClick:o,customization:{classNamePrefix:A,content:e?.modal?.okButton?.content}}):void 0,children:(0,l.jsx)(F,{options:d,value:te,onValueChange:ae,multiple:m,form:``,onKeyDown:e=>{if(e.key===`Enter`&&e.preventDefault(),e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowLeft`||e.key===`ArrowRight`){V.current=!0;return}V.current=!1},onOptionClick:Z,onOptionKeyDown:oe,customization:{classNamePrefix:A,optionItem:e?.optionListInput?.optionItem,groupHeader:e?.optionListInput?.groupHeader},className:e?.optionListInput?.className,style:e?.optionListInput?.style,"aria-busy":W,indicator:Q})})}function de({searchInput:e,optionList:t,className:n,customization:r,ref:i,children:a,...o}){let s=r?.classNamePrefix??`super-select`;return(0,l.jsxs)(`div`,{ref:i,...o,className:u(s,n),children:[e,t,a]})}function fe({optionSource:e,children:t,customization:n,ref:r,onBlur:i,onFocus:a,onClick:o,onMouseDown:s,onMouseUp:d,onPointerDown:f,onPointerUp:p,onContextMenu:m,onKeyDown:g,onKeyUp:b,onBeforeInput:x,onSelect:S,onCompositionStart:T,onCompositionUpdate:E,onCompositionEnd:D,onChange:O,onInput:k,onInvalid:A,onValueChange:j,className:M,style:N,...P}){let F=(0,c.useMemo)(()=>ie(t),[t]),I=(0,c.useRef)(null),L=n?.searchInput?.component??w,z=n?.classNamePrefix??`super-select`,B=z.length>0?`${z}__`:``,{multiple:V,disabled:U,value:G,defaultValue:K}=P,q=G!==void 0,J=(0,c.useRef)(K),X=R({optionSource:e,staticOptions:F,searchMatcher:n?.searchMatcher,maxAdditionalPages:n?.maxAdditionalPages,value:G,defaultValue:K,multiple:V}),ae=(0,c.useCallback)(e=>{if(r){if(typeof r==`function`){r(e);return}r.current=e}},[r]),Z=(0,c.useMemo)(()=>V?X.selectedValues:X.selectedValues.slice(0,1),[X.selectedValues,V]),oe=(0,c.useCallback)(()=>{if(!q){let e=v(J.current);X.handleSelectedValuesChange(V?e:e.slice(0,1))}},[X,q,V]),Q=(0,c.useCallback)(e=>{e.preventDefault(),A&&A(te(H({id:P.id,name:P.name,value:V?Z:Z[0]??``,multiple:V,disabled:U,required:P.required})))},[U,V,A,P,Z]),se=(0,c.useMemo)(()=>H({id:P.id,name:P.name,value:V?Z:Z[0]??``,multiple:V,disabled:U,required:P.required}),[U,V,P.id,P.name,P.required,Z]),$={...P,value:void 0,defaultValue:void 0,size:void 0},ce=$,le=ne(se,{...$,onFocus:a,onBlur:i,onClick:o,onMouseDown:s,onMouseUp:d,onPointerDown:f,onPointerUp:p,onContextMenu:m,onKeyDown:g,onKeyUp:b,onBeforeInput:x,onSelect:S,onCompositionStart:T,onCompositionUpdate:E,onCompositionEnd:D}),ue=!!e,fe=X.isOptionsPending||X.isResolveValuesPending,pe=X.options.length>0,me=X.optionsError,he=!!me,ge=fe,_e=!he&&!ge&&!pe,ve=!he&&!ge&&!_e&&!!X.hasMore,ye=U||fe,be=n?.optionList?.component??de,xe=n?.optionListInput?.component??y,Se=n?.errorIndicator?.component??Y,Ce=n?.emptyIndicator?.component??h,we=n?.moreIndicator?.component??_,Te=n?.pendingIndicator?.component??C,Ee;Ee=ge?(0,l.jsx)(Te,{inline:!0,className:n?.pendingIndicator?.className,style:n?.pendingIndicator?.style,title:n?.pendingIndicator?.title,content:n?.pendingIndicator?.content,customization:{classNamePrefix:z}}):he?(0,l.jsx)(Se,{className:n?.errorIndicator?.className,style:n?.errorIndicator?.style,error:me,message:me?.userMessage??n?.errorIndicator?.defaultMessage,onRetry:X.handleRetryOptions,customization:{classNamePrefix:z,icon:n?.errorIndicator?.icon,retryButton:n?.errorIndicator?.retryButton}}):_e?(0,l.jsx)(Ce,{className:n?.emptyIndicator?.className,style:n?.emptyIndicator?.style,onRetry:X.handleRetryOptions,customization:{classNamePrefix:z,content:n?.emptyIndicator?.content,retryButton:n?.emptyIndicator?.retryButton}}):ve?(0,l.jsx)(we,{onLoadMore:X.canLoadMore?X.handleLoadMore:void 0,className:n?.moreIndicator?.className,style:n?.moreIndicator?.style,disabled:ye,customization:{classNamePrefix:z,loadMoreButton:n?.moreIndicator?.loadMoreButton,overflowIndicator:n?.moreIndicator?.overflowIndicator}}):void 0;let De=(0,c.useCallback)(e=>{let t=V?e:e.slice(0,1);X.handleSelectedValuesChange(t);let n=H({id:P.id,name:P.name,multiple:V,disabled:U,required:P.required,value:V?t:t[0]??``});k&&k(W(n,{data:``})),O&&O(ee(n)),j&&j(V?t:t[0]??``)},[X,U,V,O,k,j,P]),Oe=(0,c.useCallback)(e=>{if(e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(!t)return;let n=I.current;if(!n)return;let r=n.querySelector([`[role='listbox']`,`[role='radiogroup']`,`[role='group']`,`fieldset`,`[class*='list-group']`].join(`,`))??n,i=Array.from(r.querySelectorAll([`input[type='radio']:not(:disabled):not([tabindex='-1'])`,`input[type='checkbox']:not(:disabled):not([tabindex='-1'])`,`[role='radio']:not([aria-disabled='true']):not([tabindex='-1'])`,`[role='checkbox']:not([aria-disabled='true']):not([tabindex='-1'])`,`[role='option']:not([aria-disabled='true']):not([tabindex='-1'])`].join(`,`))).filter(e=>{if(e.hidden||e.getAttribute(`aria-hidden`)===`true`)return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`}),a=t>0?i[0]:i[i.length-1];a&&(e.preventDefault(),a.focus())},[]);return(0,l.jsxs)(be,{ref:I,className:u(n?.optionList?.className,M),style:N&&n?.optionList?.style?{...N,...n.optionList.style}:N??n?.optionList?.style,"aria-label":P[`aria-label`]??P.name,dir:P.dir,lang:P.lang,customization:{classNamePrefix:z},searchInput:ue?(0,l.jsx)(L,{className:n?.searchInput?.className,style:n?.searchInput?.style,search:X.searchValue,onSearchChange:e=>X.handleSearchChange(e??``),onKeyDown:Oe,disabled:U,isSearching:X.isSearching,customization:{classNamePrefix:z,placeholder:n?.searchInput?.placeholder,title:n?.searchInput?.title,pendingIndicator:{className:n?.pendingIndicator?.className,style:n?.pendingIndicator?.style,title:n?.pendingIndicator?.title,content:n?.pendingIndicator?.content,component:n?.pendingIndicator?.component}}}):void 0,optionList:(0,l.jsx)(xe,{...ce,...le,ref:ae,id:P.id,name:P.name,multiple:V,disabled:U,required:P.required,form:P.form,autoComplete:P.autoComplete,autoFocus:P.autoFocus,tabIndex:P.tabIndex,title:P.title,options:X.options,value:Z,onValueChange:De,className:n?.optionListInput?.className,style:n?.optionListInput?.style,customization:{classNamePrefix:z,optionItem:n?.optionListInput?.optionItem,groupHeader:n?.optionListInput?.groupHeader},"aria-busy":fe,indicator:Ee}),children:[P.required?(0,l.jsx)(`input`,{type:`checkbox`,checked:Z.length>0,required:!0,disabled:U,form:P.form,tabIndex:-1,"aria-hidden":!0,onChange:()=>void 0,onInvalid:Q,hidden:!0,className:`${B}visually-hidden`}):null,q?null:(0,l.jsx)(re,{form:P.form,onReset:oe})]})}function pe({autoComplete:e,autoFocus:t,className:n,customization:r,disabled:i,form:a,id:o,multiple:s,name:d,onValueToggle:f,options:p,value:m,required:h,style:g,tabIndex:_,title:v,ref:y,...b}){let x=r?.classNamePrefix??`super-select`,S=x.length>0?`${x}__`:``,C=(0,c.useMemo)(()=>new Set(m),[m]),w=(0,c.useMemo)(()=>p.find(e=>e.hidden)?p.filter(e=>!e.hidden):p,[p]),T=(0,c.useMemo)(()=>{if(t)return w.find(e=>!(i||e.disabled))?.value},[t,i,w]),E=(0,c.useMemo)(()=>me(w),[w]),D=b[`aria-label`]??d;return(0,l.jsx)(`fieldset`,{ref:y,...b,id:o,disabled:i,role:s?`group`:`radiogroup`,"aria-disabled":i||void 0,"aria-required":h||void 0,"aria-label":D,className:u(x,`${S}btn-toolbar`,n),style:g,title:v,tabIndex:_,children:E.map(({label:t,options:n})=>(0,l.jsx)(`div`,{className:u(`${S}btn-group`,r?.buttonGroup?.className),style:r?.buttonGroup?.style,children:n.map(t=>{let n=C.has(t.value),o=i||t.disabled,c=s?`checkbox`:`radio`;return(0,l.jsxs)(`label`,{className:u(`${S}btn`,`${S}btn-outline-secondary`,n&&`${S}active`,o&&`${S}disabled`,r?.button?.className),style:r?.button?.style,children:[(0,l.jsx)(`input`,{value:t.value,className:`${S}btn-check`,checked:n,autoComplete:e,autoFocus:t.value===T,disabled:o,form:a,name:d,type:c,onChange:()=>f(t.value),onClick:e=>{s||!n||o||(e.preventDefault(),window.setTimeout(()=>{f(t.value)},0))}}),(0,l.jsx)(`span`,{children:t.children??t.label})]},t.value)})},t))})}function me(e){let t=[],n;for(let r of e){let e=r.groupLabel??``;if(n&&n.label===e){n.options.push(r);continue}if(n=t.find(t=>t.label===e),n){n.options.push(r);continue}n={label:e,options:[r]},t.push(n)}return t}function he({autoComplete:e,autoFocus:t,children:n,className:r,customization:i,defaultValue:a,disabled:o,form:s,id:u,multiple:d,name:f,required:p,style:m,tabIndex:h,title:g,value:_,onChange:y,onInput:b,onValueChange:x,onInvalid:S,ref:C,...w}){let T=(0,c.useMemo)(()=>ie(n),[n]),E=_!==void 0,D=(0,c.useRef)(a),[O,k]=(0,c.useState)(()=>{let e=v(E?_:a);return d?e:e.slice(0,1)}),A=(0,c.useMemo)(()=>E?v(_):O,[O,E,_]),j=(0,c.useId)(),M=d?f:f??`_toggle-button-select-${j}`,N=i?.classNamePrefix??`super-select`,P=N.length>0?`${N}__`:``,F=(0,c.useCallback)(e=>H({id:u,name:f,multiple:d,disabled:o,required:p,value:d?e:e[0]}),[u,f,d,p,o]),I=(0,c.useCallback)(e=>{e.preventDefault(),S&&S(te(F(A)))},[F,S,A]),L=(0,c.useCallback)(()=>{if(!E){let e=v(D.current);k(d?e:e.slice(0,1))}},[E,d]),R=(0,c.useCallback)(e=>{if(o)return;let t;t=d?A.includes(e)?A.filter(t=>t!==e):[...A,e]:A.includes(e)?[]:[e],E||k(t);let n=F(t);b&&b(W(n,{data:``})),y&&y(ee(n)),x&&x(d?t:t[0]??``)},[F,o,E,d,y,b,x,A]),z=!!p,B=i?.component??pe,V={...w,size:void 0},U=V,G=ne(F(A),V);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(B,{...U,...G,autoComplete:e,autoFocus:t,className:r,customization:i,disabled:o,form:s,id:u,multiple:d,name:M,value:A,onValueToggle:R,options:T,required:p,style:m,tabIndex:h,title:g,ref:C}),z?(0,l.jsx)(`input`,{type:`checkbox`,checked:A.length>0,required:!0,disabled:o,form:s,tabIndex:-1,"aria-hidden":!0,hidden:!0,onChange:()=>void 0,onInvalid:I,className:`${P}visually-hidden`}):null,E?null:(0,l.jsx)(re,{form:s,onReset:L})]})}function ge({"aria-busy":e,"aria-describedby":t,"aria-label":n,"aria-labelledby":r,accessKey:i,children:a,className:o,dir:s,hidden:c,id:d,lang:f,style:p,tabIndex:m,title:h,customization:g}){let _=g?.classNamePrefix??`super-select`,v=_.length>0?`${_}__`:``;return(0,l.jsx)(`div`,{id:d,"aria-busy":e,"aria-describedby":t,"aria-label":n,"aria-labelledby":r,accessKey:i,className:u(`${v}list-group`,o),dir:s,hidden:c,lang:f,style:p,tabIndex:m,title:h,children:(0,l.jsx)(`div`,{className:`${v}list-group-item`,children:a})})}function _e({mode:e,optionSource:t,customization:n,ref:r,children:i,multiple:a,disabled:o,required:s,value:d,defaultValue:f,onChange:p,onInvalid:m,onValueChange:h,className:g,style:_,...y}){let b=typeof e==`function`?void 0:e,x=typeof e==`function`?e:void 0,S=!!t&&(!!x||b!==void 0&&!be(b)),[w,T]=(0,c.useState)(0),E=(0,c.useMemo)(()=>({optionSource:t,retryCount:w,shouldLoadOptions:S}),[w,t,S]),[D,O]=(0,c.useState)(()=>S?we(E):Se);(0,c.useEffect)(()=>{if(!t||!S)return;let e=new AbortController,n=!1;return Promise.resolve().then(()=>{if(!(n||e.signal.aborted))return O(we(E)),t.getOptionPage({signal:e.signal})}).then(t=>{!t||n||e.signal.aborted||O({loadKey:E,options:t.options,hasMore:!!t.hasMore,isPending:!1,error:void 0})}).catch(t=>{n||e.signal.aborted||O({loadKey:E,options:[],hasMore:!1,isPending:!1,error:A(t)})}),()=>{n=!0,e.abort()}},[t,E,S]);let k=(0,c.useMemo)(()=>ie(i),[i]),j=Se;S&&(j=D.loadKey===E?D:we(E));let M=(0,c.useMemo)(()=>F(k,j.options),[j.options,k]),N=(0,c.useMemo)(()=>{if(b)return b;if(x){let e=x({options:M,hasMore:j.hasMore,multiple:!!a,disabled:!!o,required:!!s,optionSource:t,error:j.error});if(e)return e}return`modal`},[o,M,x,a,t,b,s,j.error,j.hasMore]),P=d!==void 0,I=(0,c.useRef)(f),[L,R]=(0,c.useState)(void 0),[z,B]=(0,c.useState)(0),V=(0,c.useCallback)(e=>{let t=Array.from(e.currentTarget.selectedOptions).map(e=>e?.value??``),n=[];a&&t.length>0?n=t:e.currentTarget.value&&e.currentTarget.value.length>0&&(n=[e.currentTarget.value]),P||R(a?n:n[0]??``),h&&h(a?n:n[0]??``),p&&p(e)},[P,a,p,h]),U=S&&!j.isPending&&j.error===void 0&&(!be(N)||!j.hasMore),ee=t&&be(N)&&!U?t:void 0,W=U?xe(i,k,j.options):i,G=L===void 0?f:L,K=(0,c.useMemo)(()=>{let e=v(P?d:G);return a?e:e.slice(0,1)},[G,P,a,d]),ne=(0,c.useCallback)(()=>{T(e=>e+1)},[]),q=(0,c.useCallback)(()=>{P||(R(I.current),B(e=>e+1))},[P]),J=n?.classNamePrefix??`super-select`,X=J.length>0?`${J}__`:``,ae=n?.fallback?.component??ge,Z=n?.pendingIndicator?.component??C,oe=n?.errorIndicator?.component??Y,Q=u(g,n?.fallback?.className),se=_&&n?.fallback?.style?{..._,...n.fallback.style}:_??n?.fallback?.style,$;S&&j.isPending?$=(0,l.jsx)(Z,{inline:!0,className:n?.pendingIndicator?.className,style:n?.pendingIndicator?.style,title:n?.pendingIndicator?.title,content:n?.pendingIndicator?.content,customization:{classNamePrefix:J}}):S&&j.error&&($=(0,l.jsx)(oe,{className:n?.errorIndicator?.className,style:n?.errorIndicator?.style,error:j.error,message:j.error.userMessage??n?.errorIndicator?.defaultMessage,onRetry:ne,customization:{classNamePrefix:J,icon:n?.errorIndicator?.icon,retryButton:n?.errorIndicator?.retryButton}}));let ce=y.name&&K.length>0?a?K.map((e,t)=>(0,l.jsx)(`input`,{type:`hidden`,name:y.name,value:e,form:y.form,disabled:o},`super-select-async-hidden-value-${e}-${t}`)):(0,l.jsx)(`input`,{type:`hidden`,name:y.name,value:K[0]??``,form:y.form,disabled:o}):null;return $?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ae,{id:y.id,"aria-busy":j.isPending||void 0,"aria-describedby":y[`aria-describedby`],"aria-label":y[`aria-label`],"aria-labelledby":y[`aria-labelledby`],accessKey:y.accessKey,className:Q,dir:y.dir,hidden:y.hidden,lang:y.lang,style:se,tabIndex:y.tabIndex,title:y.title,customization:{classNamePrefix:J},children:$}),ce,s?(0,l.jsx)(`select`,{required:!0,disabled:o,form:y.form,multiple:a,value:a?K:K[0]??``,onChange:()=>void 0,onInvalid:e=>{e.preventDefault(),m&&m(te(H({id:y.id,name:y.name,value:a?K:K[0]??``,multiple:a,disabled:o,required:s})))},"aria-hidden":!0,tabIndex:-1,className:`${X}visually-hidden`,children:K.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))}):null,P?null:(0,l.jsx)(re,{form:y.form,onReset:q})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ve,{ref:r,...y,mode:N,className:g,style:_,multiple:a,disabled:o,required:s,value:d,defaultValue:P?void 0:G,onChange:V,onInvalid:m,optionSource:ee,customization:n,children:W},z),P?null:(0,l.jsx)(re,{form:y.form,onReset:q})]})}function ve({mode:e,onChange:t,optionSource:n,customization:r,children:i,ref:a,...o}){let s=r?.classNamePrefix??`super-select`;if(e===`option-list`)return(0,l.jsx)(fe,{ref:a,...o,onChange:t,optionSource:n,customization:r,children:i});if(e===`toggle-button`)return(0,l.jsx)(he,{ref:a,...o,className:r?.toggleButtonInput?.className??o.className,style:o.style&&r?.toggleButtonInput?.style?{...o.style,...r.toggleButtonInput.style}:o.style??r?.toggleButtonInput?.style,onChange:t,customization:r?{classNamePrefix:s,...r.toggleButtonInput}:void 0,children:i});if(e===`native`){let e=s.length>0?`${s}__`:``,n=r?.selectInput?.component??ye,c=r?.selectInput?.className??o.className;return n===ye&&(c=u(`${e}form-select`,c)),(0,l.jsx)(n,{ref:a,...o,className:c,style:o.style&&r?.selectInput?.style?{...o.style,...r.selectInput.style}:o.style??r?.selectInput?.style,onChange:t,children:i})}return(0,l.jsx)(ce,{ref:a,...o,onChange:t,optionSource:n,customization:r,children:i})}function ye({ref:e,...t}){return(0,l.jsx)(`select`,{ref:e,...t})}function be(e){return e===`modal`||e===`option-list`}function xe(e,t,n){if(n.length===0)return e;let r=[],i=new Set(t.map(e=>e.value));for(let e of n)i.has(e.value)||(i.add(e.value),r.push(e));if(r.length===0)return e;let a=[],o=0,s=0;for(;o<r.length;){let e=r[o],t=e.groupLabel;if(!t){a.push((0,l.jsx)(`option`,{value:e.value,disabled:e.disabled,hidden:e.hidden,label:e.label,children:e.children??e.label},`super-select-async-option-${s}-${e.value}`)),o+=1,s+=1;continue}let n=[];for(;o<r.length&&r[o].groupLabel===t;)n.push(r[o]),o+=1,s+=1;a.push((0,l.jsx)(`optgroup`,{label:t,children:n.map((e,t)=>(0,l.jsx)(`option`,{value:e.value,disabled:e.disabled,hidden:e.hidden,label:e.label,children:e.children??e.label},`super-select-async-group-option-${s}-${t}-${e.value}`))},`super-select-async-group-${s}-${t}`))}if(!e)return a;let u=c.Children.toArray(e);return u.length===0?a:[...u,...a]}var Se={options:[],hasMore:!1,isPending:!1,error:void 0},Ce={options:[],hasMore:!1,isPending:!0,error:void 0};function we(e){return{...Ce,loadKey:e}}exports.CloseButton=d,exports.EmptyIndicator=h,exports.ErrorIndicator=Y,exports.Fallback=ge,exports.Modal=f,exports.ModalSelect=ce,exports.ModalSelectButton=oe,exports.MoreIndicator=_,exports.OkButton=se,exports.OptionList=de,exports.OptionListInput=y,exports.OptionListSelect=fe,exports.OptionSource=j,exports.OptionSourceError=D,exports.PendingIndicator=C,exports.SearchInput=w,exports.SelectedContent=$,exports.SuperSelect=_e,exports.ToggleButtonInput=pe,exports.ToggleButtonSelect=he,exports.convertToOptionSourceError=A,exports.createOptionSource=M,exports.isOptionSourceErrorLike=O;
@@ -0,0 +1,2 @@
1
+ .super-select__form-select[aria-haspopup=dialog]{color:#1f2730;width:100%;min-width:0;max-width:100%;min-height:52px;font:inherit;text-align:start;cursor:pointer;background:#f8fafb;border:1px solid #8b959f;border-radius:14px;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;font-size:1rem;line-height:1.25;transition:border-color .12s,box-shadow .12s,background-color .12s;display:inline-flex}.super-select__form-select[aria-haspopup=dialog]:hover:not(:disabled){border-color:#616b75}.super-select__form-select[aria-haspopup=dialog]:focus-visible{border-color:#0d6efd;outline:none;box-shadow:0 0 0 3px #0d6efd47}.super-select__form-select[aria-haspopup=dialog]:disabled{cursor:not-allowed;color:#747e89;background:#eff2f4;border-color:#c8ced6}.super-select__form-select[aria-haspopup=dialog].super-select__disabled{cursor:default;background:#f4f7f9;border-color:#a6afb9}.super-select__form-select[aria-haspopup=dialog]>.super-select__alert,.super-select__form-select[aria-haspopup=dialog]>.super-select__list-inline,.super-select__form-select[aria-haspopup=dialog]>span{flex:auto;min-width:0}.super-select__form-select[aria-haspopup=dialog]>.super-select__spinner-border{flex:none}.super-select__form-select[aria-haspopup=dialog]>span{white-space:normal;overflow-wrap:anywhere;line-height:1.35;display:block}.super-select__list-inline{margin:0;padding:0;list-style:none}.super-select__list-inline-item{display:inline}.super-select__list-inline-item+.super-select__list-inline-item:before{content:"";vertical-align:middle;background:color-mix(in srgb, currentColor 42%, transparent);border-radius:999px;width:2px;height:16px;margin:0 10px;display:inline-block;transform:translateY(-1px)}.super-select__form-select[aria-haspopup=dialog]:after{content:"";color:#3f4854;vertical-align:.255em;border:.3em solid #0000;border-top-color:currentColor;border-bottom:0;flex:none;justify-content:center;align-items:center;width:0;height:0;margin-inline-start:.255em;transition:transform .14s;display:inline-flex}.super-select__form-select[aria-haspopup=dialog].super-select__is-invalid{color:#7c1d18;background:#fff4f4;border-color:#c5221f}.super-select__form-select[aria-haspopup=dialog].super-select__is-invalid:hover:not(:disabled){border-color:#a61b18}.super-select__form-select[aria-haspopup=dialog].super-select__is-invalid:after{color:#a61b18}.super-select__form-select[aria-haspopup=dialog].super-select__disabled:after{color:#6b7480}.super-select__form-select[aria-haspopup=dialog] .super-select__alert{background:0 0;border:0;border-radius:0;flex-direction:row;justify-content:flex-start;align-items:center;gap:8px;width:100%;margin:0;padding:0;display:inline-flex}.super-select__form-select[aria-haspopup=dialog] .super-select__alert p{text-align:start;white-space:nowrap;text-overflow:ellipsis;flex:auto;min-width:0;line-height:1.4;display:block;overflow:hidden}.super-select__form-select[aria-haspopup=dialog][aria-expanded=true]:after{transform:rotate(180deg)}.super-select__modal{color:#18202a;background:#fff;border:none;border-radius:16px;width:min(560px,100vw - 32px);max-height:min(88vh,680px);padding:0;box-shadow:0 16px 32px #00000038,0 3px 12px #00000029}.super-select__modal.super-select__show{display:block}.super-select__modal::backdrop{background:#0000005c}.super-select__modal-dialog{width:100%;max-height:inherit;margin:0}.super-select__modal-dialog-scrollable{max-height:inherit}.super-select__modal-content{max-height:inherit;border-radius:inherit;background:inherit;color:inherit;flex-direction:column;display:flex;overflow:hidden}.super-select__modal-header{border-bottom:1px solid #e5e9ed;flex-wrap:wrap;align-items:center;display:flex}.super-select__modal-header>.super-select__btn-close{box-sizing:content-box;color:#000;opacity:.5;background:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/%3e%3c/svg%3e") 50%/1em no-repeat;border:0;border-radius:.375rem;flex:none;width:1em;height:1em;margin:0;margin-inline-end:16px;padding:.25em}.super-select__modal-header>.super-select__btn-close:hover:not(:disabled){opacity:.75}.super-select__modal-header>.super-select__btn-close:focus-visible{opacity:1;outline:0;box-shadow:0 0 0 .25rem #0d6efd40}.super-select__modal-header>.super-select__btn-close:disabled{pointer-events:none;opacity:.25}.super-select__modal-body{flex:auto;min-height:0;padding-bottom:8px;overflow:hidden auto}.super-select__title-row{flex:0 0 100%;padding:18px 20px 4px}.super-select__title{color:#1b2733;margin:0;font-size:1.08rem;font-weight:500;line-height:1.35}.super-select__input-group{margin-bottom:.5rem}.super-select__modal-header .super-select__input-group{flex:auto;min-width:0;margin-bottom:0;padding:8px 16px 10px}.super-select__d-block{display:block}.super-select__visually-hidden{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.super-select__fade{transition:opacity .15s linear}.super-select__fade:not(.super-select__show){opacity:0}.super-select__overflow-indicator{color:#6f7a87;text-align:center;align-self:center;padding:0 0 8px}.super-select__modal-footer{border-top:1px solid #e5e9ed;justify-content:flex-end;padding:8px 20px 16px;display:flex}.super-select__btn-secondary{color:#1f2730;font:inherit;cursor:pointer;background:#fff;border:1px solid #c7ced7;border-radius:999px;justify-content:center;align-items:center;width:34px;height:34px;font-size:.95rem;font-weight:600;line-height:1;display:inline-flex}.super-select__btn-secondary:hover,.super-select__btn-secondary:focus-visible{background:#f1f3f4;border-color:#9aa4af;outline:none}.super-select__btn-secondary:active{background:#e9eef6}@media (width<=640px){.super-select__modal{inset-inline:0;border-radius:16px 16px 0 0;width:100vw;max-height:min(86vh,680px);margin:0;position:fixed;top:auto;bottom:0}.super-select__title-row{padding:18px 18px 2px}}.super-select__form-control{width:100%;min-height:2.75rem;font:inherit;color:inherit;background:#eef2f6;border:1px solid #0000;border-radius:1rem;padding:.625rem 1rem}.super-select__form-control:focus-visible{background:#fff;border-color:#0d6efd;outline:none;box-shadow:0 0 0 3px #0d6efd33}.super-select__list-group{box-sizing:border-box;min-inline-size:0;background:#fff;border:1px solid #d7dee6;border-radius:.75rem;flex-direction:column;max-height:min(52vh,410px);margin:0;padding:0;display:flex;overflow:auto}.super-select__modal-body .super-select__list-group{border:0;border-radius:0;max-height:none;padding:4px 8px 12px}.super-select__list-group-item{box-sizing:border-box;text-align:start;width:100%;max-width:100%;min-height:3rem;color:inherit;font:inherit;background:#fff;border:none;border-radius:0;align-items:center;gap:.75rem;margin:0;padding:.75rem 1rem;display:flex}.super-select__list-group-item-action{cursor:pointer}.super-select__list-group-item-action:hover:not(.super-select__disabled):not(.super-select__active),.super-select__list-group-item-action:focus-within:not(.super-select__disabled):not(.super-select__active){color:#212529;background:#f5f7fa}.super-select__focus-ring:not(.super-select__active){color:#212529;background:#eef4ff}.super-select__active{color:#fff;background:#0d6efd}.super-select__list-group .super-select__list-group-item-action.super-select__active:hover,.super-select__list-group .super-select__list-group-item-action.super-select__active:focus-within,.super-select__list-group .super-select__active.super-select__focus-ring{color:#fff;background:#0b5ed7}.super-select__active .super-select__form-check-input{accent-color:#fff}.super-select__disabled{cursor:not-allowed;opacity:.7}.super-select__list-group-item-secondary{box-sizing:border-box;letter-spacing:0;text-transform:none;color:#5c6673;background:0 0;border-top:1px solid #e8eaed;min-height:auto;margin-top:4px;padding:.875rem 1rem .375rem;font-size:.875rem;font-weight:500}.super-select__list-group-item-secondary:first-child{border-top:none;margin-top:0}.super-select__form-check-input{accent-color:#0d6efd;width:1rem;height:1rem;cursor:inherit;flex:none;margin:0}.super-select__me-1{margin-inline-end:.25rem}.super-select__form-check-label{overflow-wrap:anywhere;flex:auto;min-width:0}.super-select__alert{box-sizing:border-box;border:1px solid #0000;border-radius:.375rem;width:100%;margin:.5rem;padding:1rem;position:relative}.super-select__alert-danger{color:#842029;background:#f8d7da;border-color:#f5c2c7}.super-select__alert-secondary{color:#41464b;text-align:center;background:#e2e3e5;border-color:#d3d6d8}.super-select__d-flex{display:flex}.super-select__align-items-center{align-items:center}.super-select__flex-shrink-0{flex-shrink:0}.super-select__flex-grow-1{flex-grow:1;min-width:0}.super-select__me-2{margin-inline-end:.5rem}.super-select__icon{font-size:1.2rem;line-height:1;display:inline-block}.super-select__list-group-item>.super-select__alert{width:100%;margin:0}.super-select__btn{min-width:30px;min-height:30px;color:inherit;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:999px;justify-content:center;align-items:center;display:inline-flex}.super-select__btn-outline-secondary{border-color:color-mix(in srgb, currentColor 30%, transparent);background:color-mix(in srgb, currentColor 10%, white)}.super-select__btn-outline-secondary:hover:not(:disabled),.super-select__btn-outline-secondary:focus-visible:not(:disabled){background:color-mix(in srgb, currentColor 16%, white);outline:none}.super-select__btn-sm{min-width:30px;min-height:30px;padding:.25rem .5rem;line-height:1}.super-select__btn:disabled{opacity:.6;cursor:wait}.super-select__list-group-item>.super-select__btn,.super-select__list-group-item>.super-select__text-body-secondary{margin-inline:auto}.super-select__text-body-secondary{color:#6c757d}.super-select__small{font-size:.88rem;line-height:1.4}.super-select__spinner-border{border:2px solid #0d6efd42;border-top-color:#0d6efd;border-radius:999px;width:1rem;height:1rem;animation:.68s linear infinite option-list-select-spinner-spin;display:inline-block}.super-select__spinner-border-sm{border-width:2px;width:.9rem;height:.9rem}@keyframes option-list-select-spinner-spin{to{transform:rotate(360deg)}}.super-select__btn-toolbar{width:fit-content;max-width:100%;border:0;flex-wrap:wrap;align-items:stretch;gap:.5rem;min-inline-size:0;margin:0;padding:0;display:flex}.super-select__btn-toolbar[aria-disabled=true]{opacity:.88}.super-select__btn-toolbar>.super-select__btn-group{flex-wrap:wrap;align-items:stretch;gap:0;display:inline-flex}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn{color:#343a40;-webkit-user-select:none;user-select:none;cursor:pointer;background:#fff;border:1px solid #6c757d;border-radius:0;justify-content:center;align-items:center;gap:.5rem;min-height:2.25rem;margin-inline-start:-1px;padding:.375rem .75rem;font-size:.95rem;line-height:1.2;transition:background-color .15s,color .15s,border-color .15s,box-shadow .15s;display:inline-flex;position:relative}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn:first-child{border-start-start-radius:.375rem;border-end-start-radius:.375rem;margin-inline-start:0}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn:last-child{border-start-end-radius:.375rem;border-end-end-radius:.375rem}.super-select__btn-toolbar .super-select__btn-check{cursor:pointer;accent-color:currentColor;flex-shrink:0;width:1rem;height:1rem;margin:0;position:static}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn>span{text-align:center;line-height:1.2;display:inline-block}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn:hover:not(.super-select__active):not(.super-select__disabled){background:#e9ecef}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn:focus-within{z-index:2;outline-offset:1px;outline:2px solid #0d6efd66}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn.super-select__active{z-index:1;color:#fff;background:#0d6efd;border-color:#0d6efd}.super-select__btn-toolbar>.super-select__btn-group>.super-select__btn.super-select__disabled{cursor:not-allowed;color:#6c757d;background:#e9ecef;border-color:#adb5bd}.super-select__alert-dismissible{align-items:center;gap:.5rem;padding-inline-end:1rem;display:flex}.super-select__alert-dismissible>.super-select__btn{opacity:1;background:0 0;border:1px solid #0000;border-radius:999px;width:auto;min-width:2rem;min-height:2rem;margin-inline-start:auto;padding:.375rem;position:static;transform:none}.super-select__alert-dismissible>.super-select__btn:hover:not(:disabled),.super-select__alert-dismissible>.super-select__btn:focus-visible:not(:disabled){border-color:color-mix(in srgb, currentColor 30%, transparent);background:color-mix(in srgb, currentColor 16%, white);opacity:1}select.super-select__form-select{color:#1f2730;width:100%;min-width:0;max-width:100%;min-height:52px;font:inherit;appearance:none;background-color:#f8fafb;background-image:linear-gradient(45deg,#0000 50%,#3f4854 50%),linear-gradient(135deg,#3f4854 50%,#0000 50%);background-position:calc(100% - 20px) calc(50% - 2px),calc(100% - 14px) calc(50% - 2px);background-repeat:no-repeat;background-size:6px 6px,6px 6px;border:1px solid #8b959f;border-radius:14px;padding-block:12px;padding-inline:14px 44px;font-size:1rem;line-height:1.25;transition:border-color .12s,box-shadow .12s,background-color .12s}:is(select.super-select__form-select:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),select.super-select__form-select[dir=rtl]){background-position:14px calc(50% - 2px),20px calc(50% - 2px)}select.super-select__form-select:hover:not(:disabled){border-color:#616b75}select.super-select__form-select:focus-visible{background-color:#fff;border-color:#0d6efd;outline:none;box-shadow:0 0 0 3px #0d6efd47}select.super-select__form-select:disabled{cursor:not-allowed;color:#747e89;background-color:#eff2f4;background-image:linear-gradient(45deg,#0000 50%,#6b7480 50%),linear-gradient(135deg,#6b7480 50%,#0000 50%);border-color:#c8ced6}select.super-select__form-select:invalid{color:#7c1d18;background-color:#fff4f4;background-image:linear-gradient(45deg,#0000 50%,#a61b18 50%),linear-gradient(135deg,#a61b18 50%,#0000 50%);border-color:#c5221f}select.super-select__form-select[multiple],select.super-select__form-select[size]:not([size="1"]){background-image:none;min-height:0;padding:8px}select.super-select__form-select option{color:#1f2730}
2
+ /*$vite$:1*/