@riddix/hamh 2.1.0-alpha.425 → 2.1.0-alpha.426
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.
|
@@ -220,7 +220,7 @@ export default theme;`}function RN(e){return typeof e=="number"?`${(e*100).toFix
|
|
|
220
220
|
`));if(i[e]!=null||r[e]!=null&&r[e].parentId!==t)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${e}"`].join(`
|
|
221
221
|
`))}const BSe=[],wt={domStructure:fn(e=>e.domStructure),disabledItemFocusable:fn(e=>e.disabledItemsFocusable),itemMetaLookup:fn(e=>e.itemMetaLookup),itemOrderedChildrenIdsLookup:fn(e=>e.itemOrderedChildrenIdsLookup),itemMeta:fn((e,t)=>e.itemMetaLookup[t??Za]??null),itemOrderedChildrenIds:fn((e,t)=>e.itemOrderedChildrenIdsLookup[t??Za]??BSe),itemModel:fn((e,t)=>e.itemModelLookup[t]),isItemDisabled:fn((e,t)=>J4(e.itemMetaLookup,t)),itemIndex:fn((e,t)=>{const n=e.itemMetaLookup[t];return n==null?-1:e.itemChildrenIndexesLookup[n.parentId??Za][n.id]}),itemParentId:fn((e,t)=>e.itemMetaLookup[t]?.parentId??null),itemDepth:fn((e,t)=>e.itemMetaLookup[t]?.depth??0),canItemBeFocused:fn((e,t)=>e.disabledItemsFocusable||!J4(e.itemMetaLookup,t)),itemChildrenIndentation:fn(e=>e.itemChildrenIndentation)};class B5{constructor(t){this.store=t}static shouldRebuildItemsState=(t,n)=>["items","isItemDisabled","isItemSelectionDisabled","getItemId","getItemLabel","getItemChildren"].some(r=>{const i=r;return t[i]!==n[i]});static buildItemsStateIfNeeded=t=>{const n={},r={},i={},o={};function s(a,l,c){const u=l??Za,{metaLookup:f,modelLookup:h,orderedChildrenIds:g,childrenIndexes:y,itemsChildren:b}=MB({storeParameters:t,items:a,parentId:l,depth:c,isItemExpandable:(v,S)=>!!S&&S.length>0,otherItemsMetaLookup:n});Object.assign(n,f),Object.assign(r,h),i[u]=g,o[u]=y;for(const v of b)s(v.children||[],v.id,c+1)}return s(t.items,null,0),{itemMetaLookup:n,itemModelLookup:r,itemOrderedChildrenIdsLookup:i,itemChildrenIndexesLookup:o}};getItem=t=>wt.itemModel(this.store.state,t);getItemTree=()=>{const t=n=>{const r=wt.itemModel(this.store.state,n),i=ut({},r),o=wt.itemOrderedChildrenIds(this.store.state,n);return o.length>0?i.children=o.map(t):delete i.children,i};return wt.itemOrderedChildrenIds(this.store.state,null).map(t)};getItemOrderedChildrenIds=t=>wt.itemOrderedChildrenIds(this.store.state,t);getParentId=t=>wt.itemMeta(this.store.state,t)?.parentId||null;setIsItemDisabled=({itemId:t,shouldBeDisabled:n})=>{if(!this.store.state.itemMetaLookup[t])return;const r=ut({},this.store.state.itemMetaLookup);r[t]=ut({},r[t],{disabled:n??!r[t].disabled}),this.store.set("itemMetaLookup",r)};buildPublicAPI=()=>({getItem:this.getItem,getItemDOMElement:this.getItemDOMElement,getItemOrderedChildrenIds:this.getItemOrderedChildrenIds,getItemTree:this.getItemTree,getParentId:this.getParentId,setIsItemDisabled:this.setIsItemDisabled});getItemDOMElement=t=>{const n=wt.itemMeta(this.store.state,t);if(n==null)return null;const r=Sb.treeItemIdAttribute(this.store.state,t,n.idAttribute);return document.getElementById(r)};setItemChildren=({items:t,parentId:n,getChildrenCount:r})=>{const i=n??Za,o=n==null?-1:wt.itemDepth(this.store.state,n),{metaLookup:s,modelLookup:a,orderedChildrenIds:l,childrenIndexes:c}=MB({storeParameters:this.store.parameters,items:t,parentId:n,depth:o+1,isItemExpandable:r?u=>r(u)!==0:()=>!1,otherItemsMetaLookup:wt.itemMetaLookup(this.store.state)});this.store.update({itemModelLookup:ut({},this.store.state.itemModelLookup,a),itemMetaLookup:ut({},this.store.state.itemMetaLookup,s),itemOrderedChildrenIdsLookup:ut({},this.store.state.itemOrderedChildrenIdsLookup,{[i]:l}),itemChildrenIndexesLookup:ut({},this.store.state.itemChildrenIndexesLookup,{[i]:c})})};removeChildren=t=>{const n=this.store.state.itemMetaLookup,r=Object.keys(n).reduce((a,l)=>{const c=n[l];return c.parentId===t?a:ut({},a,{[c.id]:c})},{}),i=ut({},this.store.state.itemOrderedChildrenIdsLookup),o=ut({},this.store.state.itemChildrenIndexesLookup),s=t??Za;delete o[s],delete i[s],this.store.update({itemMetaLookup:r,itemOrderedChildrenIdsLookup:i,itemChildrenIndexesLookup:o})};handleItemClick=(t,n)=>{this.store.parameters.onItemClick?.(t,n)}}const iJ=xb(e=>e.selectedItems,e=>Array.isArray(e)?e:e!=null?[e]:[]),RB=xb(iJ,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),F7=fn((e,t)=>e.itemMetaLookup[t]?.selectable??!0),Hn={selectedItemsRaw:fn(e=>e.selectedItems),selectedItems:iJ,selectedItemsMap:RB,enabled:fn(e=>!e.disableSelection),isMultiSelectEnabled:fn(e=>e.multiSelect),isCheckboxSelectionEnabled:fn(e=>e.checkboxSelection),propagationRules:fn(e=>e.selectionPropagation),isItemSelected:fn(RB,(e,t)=>e.has(t)),isFeatureEnabledForItem:fn(F7,e=>!e.disableSelection,(e,t,n)=>t&&e),canItemBeSelected:fn(wt.isItemDisabled,F7,e=>!e.disableSelection,(e,t,n,r)=>n&&!e&&t),isItemSelectable:F7},zSe=fn((e,t)=>{if(Hn.isItemSelected(e,t))return"checked";let n=!1,r=!1;const i=s=>{s!==t&&(Hn.isItemSelected(e,s)?n=!0:r=!0),wt.itemOrderedChildrenIds(e,s).forEach(i)};return i(t),Hn.propagationRules(e).parents?n&&r?"indeterminate":n&&!r?"checked":"empty":n?"indeterminate":"empty"}),HSe=({props:e})=>{const{itemId:t}=e,{store:n}=Um(),r=Xr(n,Hn.isCheckboxSelectionEnabled),i=Xr(n,Hn.isFeatureEnabledForItem,t),o=Xr(n,Hn.canItemBeSelected,t),s=Xr(n,zSe,t);return{propsEnhancers:{root:()=>{let a;return s==="checked"?a=!0:s==="indeterminate"?a="mixed":o?a=!1:a=void 0,{"aria-checked":a}},checkbox:({externalEventHandlers:a,interactions:l})=>({tabIndex:-1,onChange:u=>{a.onChange?.(u),!u.defaultMuiPrevented&&Hn.canItemBeSelected(n.state,t)&&l.handleCheckboxSelection(u)},visible:r&&i,disabled:!o,checked:s==="checked",indeterminate:s==="indeterminate"})}}},B7=xb(e=>e.expandedItems,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),hi={expandedItemsRaw:fn(e=>e.expandedItems),expandedItemsMap:B7,flatList:xb(wt.itemOrderedChildrenIdsLookup,B7,(e,t)=>{function n(r){if(!t.has(r))return[r];const i=[r],o=e[r]||[];for(const s of o)i.push(...n(s));return i}return(e[Za]??[]).flatMap(n)}),triggerSlot:fn(e=>e.expansionTrigger),isItemExpanded:fn(B7,(e,t)=>e.has(t)),isItemExpandable:fn(wt.itemMeta,(e,t)=>e?.expandable??!1)},Kk=(e,t)=>{let n=t.length-1;for(;n>=0&&!wt.canItemBeFocused(e,t[n]);)n-=1;if(n!==-1)return t[n]},oJ=(e,t)=>{const n=wt.itemMeta(e,t);if(!n)return null;const r=wt.itemOrderedChildrenIds(e,n.parentId),i=wt.itemIndex(e,t);if(i===0)return n.parentId;let o=i-1;for(;!wt.canItemBeFocused(e,r[o])&&o>=0;)o-=1;if(o===-1)return n.parentId==null?null:oJ(e,n.parentId);let s=r[o],a=Kk(e,wt.itemOrderedChildrenIds(e,s));for(;hi.isItemExpanded(e,s)&&a!=null;)s=a,a=Kk(e,wt.itemOrderedChildrenIds(e,s));return s},z5=(e,t)=>{if(hi.isItemExpanded(e,t)){const r=wt.itemOrderedChildrenIds(e,t).find(i=>wt.canItemBeFocused(e,i));if(r!=null)return r}let n=wt.itemMeta(e,t);for(;n!=null;){const r=wt.itemOrderedChildrenIds(e,n.parentId),i=wt.itemIndex(e,n.id);if(i<r.length-1){let o=i+1;for(;!wt.canItemBeFocused(e,r[o])&&o<r.length-1;)o+=1;if(wt.canItemBeFocused(e,r[o]))return r[o]}n=wt.itemMeta(e,n.parentId)}return null},sJ=e=>{let t=null;for(;t==null||hi.isItemExpanded(e,t);){const n=wt.itemOrderedChildrenIds(e,t),r=Kk(e,n);if(r==null)return t;t=r}return t},Q4=e=>wt.itemOrderedChildrenIds(e,null).find(t=>wt.canItemBeFocused(e,t)),aJ=(e,t,n)=>{if(t===n)return[t,n];const r=wt.itemMeta(e,t),i=wt.itemMeta(e,n);if(!r||!i)return[t,n];if(r.parentId===i.id||i.parentId===r.id)return i.parentId===r.id?[r.id,i.id]:[i.id,r.id];const o=[r.id],s=[i.id];let a=r.parentId,l=i.parentId,c=s.indexOf(a)!==-1,u=o.indexOf(l)!==-1,f=!0,h=!0;for(;!u&&!c;)f&&(o.push(a),c=s.indexOf(a)!==-1,f=a!==null,!c&&f&&(a=wt.itemParentId(e,a))),h&&!c&&(s.push(l),u=o.indexOf(l)!==-1,h=l!==null,!u&&h&&(l=wt.itemParentId(e,l)));const g=c?a:l,y=wt.itemOrderedChildrenIds(e,g),b=o[o.indexOf(g)-1],v=s[s.indexOf(g)-1];return y.indexOf(b)<y.indexOf(v)?[t,n]:[n,t]},USe=(e,t,n)=>{const r=l=>{if(hi.isItemExpandable(e,l)&&hi.isItemExpanded(e,l))return wt.itemOrderedChildrenIds(e,l)[0];let c=wt.itemMeta(e,l);for(;c!=null;){const u=wt.itemOrderedChildrenIds(e,c.parentId),f=wt.itemIndex(e,c.id);if(f<u.length-1)return u[f+1];c=c.parentId?wt.itemMeta(e,c.parentId):null}throw new Error("Invalid range")},[i,o]=aJ(e,t,n),s=[i];let a=i;for(;a!==o;)a=r(a),wt.isItemDisabled(e,a)||s.push(a);return s},VSe=e=>{let t=Q4(e);const n=[];for(;t!=null;)n.push(t),t=z5(e,t);return n},Yk=(e,t)=>t!==e.closest('*[role="treeitem"]');class WSe{lastSelectedItem=null;lastSelectedRange={};constructor(t){this.store=t,t.itemPluginManager.register(HSe,null)}setSelectedItems=(t,n,r)=>{const{selectionPropagation:i=dy,selectedItems:o,onItemSelectionToggle:s,onSelectedItemsChange:a}=this.store.parameters,l=Hn.selectedItemsRaw(this.store.state);let c;const u=Hn.isMultiSelectEnabled(this.store.state);if(u&&(i.descendants||i.parents)?c=qSe({store:this.store,selectionPropagation:i,newModel:n,oldModel:l,additionalItemsToPropagate:r}):c=n,s)if(u){const f=lJ({store:this.store,newModel:c,oldModel:l});s&&(f.added.forEach(h=>{s(t,h,!0)}),f.removed.forEach(h=>{s(t,h,!1)}))}else c!==l&&(l!=null&&s(t,l,!1),c!=null&&s(t,c,!0));o===void 0&&this.store.set("selectedItems",c),a?.(t,c)};selectRange=(t,[n,r])=>{if(!Hn.isMultiSelectEnabled(this.store.state))return;let o=Hn.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length>0&&(o=o.filter(c=>!this.lastSelectedRange[c]));const s=H5(o),a=USe(this.store.state,n,r).filter(c=>Hn.isItemSelectable(this.store.state,c)),l=a.filter(c=>!s[c]);o=o.concat(l),this.setSelectedItems(t,o),this.lastSelectedRange=H5(a)};buildPublicAPI=()=>({setItemSelection:this.setItemSelection});setItemSelection=({itemId:t,event:n=null,keepExistingSelection:r=!1,shouldBeSelected:i})=>{if(!Hn.enabled(this.store.state))return;let o;const s=Hn.isMultiSelectEnabled(this.store.state);if(r){const a=Hn.selectedItems(this.store.state),l=Hn.isItemSelected(this.store.state,t);l&&(i===!1||i==null)?o=a.filter(c=>c!==t):!l&&(i===!0||i==null)?o=[t].concat(a):o=a}else i===!1||i==null&&Hn.isItemSelected(this.store.state,t)?o=s?[]:null:o=s?[t]:t;this.setSelectedItems(n,o,[t]),this.lastSelectedItem=t,this.lastSelectedRange={}};selectAllNavigableItems=t=>{if(!Hn.isMultiSelectEnabled(this.store.state))return;const r=VSe(this.store.state);this.setSelectedItems(t,r),this.lastSelectedRange=H5(r)};expandSelectionRange=(t,n)=>{if(this.lastSelectedItem!=null){const[r,i]=aJ(this.store.state,n,this.lastSelectedItem);this.selectRange(t,[r,i])}};selectRangeFromStartToItem=(t,n)=>{this.selectRange(t,[Q4(this.store.state),n])};selectRangeFromItemToEnd=(t,n)=>{this.selectRange(t,[n,sJ(this.store.state)])};selectItemFromArrowNavigation=(t,n,r)=>{if(!Hn.isMultiSelectEnabled(this.store.state))return;let o=Hn.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length===0?(o.push(r),this.lastSelectedRange={[n]:!0,[r]:!0}):(this.lastSelectedRange[n]||(this.lastSelectedRange={}),this.lastSelectedRange[r]?(o=o.filter(s=>s!==n),delete this.lastSelectedRange[n]):(o.push(r),this.lastSelectedRange[r]=!0)),this.setSelectedItems(t,o)}}function qSe({store:e,selectionPropagation:t,newModel:n,oldModel:r,additionalItemsToPropagate:i}){if(!t.descendants&&!t.parents)return n;let o=!1;const s=H5(n),a=lJ({store:e,newModel:n,oldModel:r});return i?.forEach(l=>{s[l]?a.added.includes(l)||a.added.push(l):a.removed.includes(l)||a.removed.push(l)}),a.added.forEach(l=>{if(t.descendants){const c=u=>{u!==l&&(o=!0,s[u]=!0),wt.itemOrderedChildrenIds(e.state,u).forEach(c)};c(l)}if(t.parents){const c=f=>s[f]?wt.itemOrderedChildrenIds(e.state,f).every(c):!1,u=f=>{const h=wt.itemParentId(e.state,f);if(h==null)return;wt.itemOrderedChildrenIds(e.state,h).every(c)&&(o=!0,s[h]=!0,u(h))};u(l)}}),a.removed.forEach(l=>{if(t.parents){let c=wt.itemParentId(e.state,l);for(;c!=null;)s[c]&&(o=!0,delete s[c]),c=wt.itemParentId(e.state,c)}if(t.descendants){const c=u=>{u!==l&&(o=!0,delete s[u]),wt.itemOrderedChildrenIds(e.state,u).forEach(c)};c(l)}}),o?Object.keys(s):n}function lJ({store:e,oldModel:t,newModel:n}){const r=new Map;return n.forEach(i=>{r.set(i,!0)}),{added:n.filter(i=>!Hn.isItemSelected(e.state,i)),removed:t.filter(i=>!r.has(i))}}function H5(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function GSe(e,t,n){const r=Xr(e,Sb.treeId),i=Xr(e,wt.itemChildrenIndentation),o=Xr(e,Hn.isMultiSelectEnabled);return s=>ut({ref:n,role:"tree",id:r,"aria-multiselectable":o},t,s,{style:ut({},t.style,{"--TreeView-itemChildrenIndentation":typeof i=="number"?`${i}px`:i}),onFocus:a=>{s.onFocus?.(a),e.focus.handleRootFocus(a)},onBlur:a=>{s.onBlur?.(a),e.focus.handleRootBlur(a)}})}function KSe(e){return e.replace(/["\\]/g,"\\$&")}const cJ=_.createContext(null);function uJ(e){const{children:t,itemId:n=null,idAttribute:r}=e,{store:i,rootRef:o}=Um(),s=_.useRef(new Map);_.useEffect(()=>{if(!o.current)return;const l=wt.itemOrderedChildrenIds(i.state,n??null)??[],c=KSe(r??o.current.id);if(n!=null){const g=o.current.querySelector(`*[id="${c}"][role="treeitem"]`);if(g&&g.getAttribute("aria-expanded")==="false")return}const u=o.current.querySelectorAll(`${n==null?"":`*[id="${c}"] `}[role="treeitem"]:not(*[id="${c}"] [role="treeitem"] [role="treeitem"])`),f=Array.from(u).map(g=>s.current.get(g.id));(f.length!==l.length||f.some((g,y)=>g!==l[y]))&&i.jsxItems.setJSXItemsOrderedChildrenIds(n??null,f)});const a=_.useMemo(()=>({registerChild:(l,c)=>s.current.set(l,c),unregisterChild:l=>s.current.delete(l),parentId:n}),[n]);return m.jsx(cJ.Provider,{value:a,children:t})}const e6=_.createContext(()=>-1),YSe=()=>{},Xk=typeof document<"u"?_.useLayoutEffect:YSe,XSe=[];function ZSe(e){_.useEffect(e,XSe)}function JSe(e,t){const n=mf(),r=hT(()=>new e(ut({},t,{isRtl:n}))).current;return Xk(()=>r.updateStateFromParameters(ut({},t,{isRtl:n})),[r,n,t]),ZSe(r.disposeEffect),r}class QSe{maxListeners=20;warnOnce=!1;events={};on(t,n,r={}){let i=this.events[t];i||(i={highPriority:new Map,regular:new Map},this.events[t]=i),r.isFirst?i.highPriority.set(n,!0):i.regular.set(n,!0)}removeListener(t,n){this.events[t]&&(this.events[t].regular.delete(n),this.events[t].highPriority.delete(n))}removeAllListeners(){this.events={}}emit(t,...n){const r=this.events[t];if(!r)return;const i=Array.from(r.highPriority.keys()),o=Array.from(r.regular.keys());for(let s=i.length-1;s>=0;s-=1){const a=i[s];r.highPriority.has(a)&&a.apply(this,n)}for(let s=0;s<o.length;s+=1){const a=o[s];r.regular.has(a)&&a.apply(this,n)}}once(t,n){const r=this;this.on(t,function i(...o){r.removeListener(t,i),n.apply(r,o)})}}const ewe=({isItemEditable:e,expansionTrigger:t})=>t||(e?"iconContainer":"content");function dJ(e){return{disabledItemsFocusable:e.disabledItemsFocusable??!1,domStructure:"nested",itemChildrenIndentation:e.itemChildrenIndentation??"12px",providedTreeId:e.id,expansionTrigger:ewe({isItemEditable:e.isItemEditable,expansionTrigger:e.expansionTrigger}),disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,selectionPropagation:e.selectionPropagation??dy}}function IB(e,t,n){return e!==void 0?e:t!==void 0?t:n}function twe(e){return ut({treeId:void 0,focusedItemId:null},dJ(e),B5.buildItemsStateIfNeeded(e),{expandedItems:IB(e.expandedItems,e.defaultExpandedItems,[]),selectedItems:IB(e.selectedItems,e.defaultSelectedItems,e.multiSelect?Gk:null)})}let PB=0;const nwe=()=>(PB+=1,`mui-tree-view-${PB}`);class rwe{timeoutIds=new Map;intervalIds=new Map;startTimeout=(t,n,r)=>{this.clearTimeout(t);const i=setTimeout(()=>{this.timeoutIds.delete(t),r()},n);this.timeoutIds.set(t,i)};startInterval=(t,n,r)=>{this.clearTimeout(t);const i=setInterval(r,n);this.intervalIds.set(t,i)};clearTimeout=t=>{const n=this.timeoutIds.get(t);n!=null&&(clearTimeout(n),this.timeoutIds.delete(t))};clearInterval=t=>{const n=this.intervalIds.get(t);n!=null&&(clearInterval(n),this.intervalIds.delete(t))};clearAll=()=>{this.timeoutIds.forEach(clearTimeout),this.timeoutIds.clear(),this.intervalIds.forEach(clearInterval),this.intervalIds.clear()}}class iwe{constructor(t){this.store=t}setExpandedItems=(t,n)=>{this.store.parameters.expandedItems===void 0&&this.store.set("expandedItems",n),this.store.parameters.onExpandedItemsChange?.(t,n)};isItemExpanded=t=>hi.isItemExpanded(this.store.state,t);buildPublicAPI=()=>({isItemExpanded:this.isItemExpanded,setItemExpansion:this.setItemExpansion});setItemExpansion=({itemId:t,event:n=null,shouldBeExpanded:r})=>{const i=hi.isItemExpanded(this.store.state,t),o=r??!i;if(i===o)return;const s={isExpansionPrevented:!1,shouldBeExpanded:o,itemId:t};this.store.publishEvent("beforeItemToggleExpansion",s,n),!s.isExpansionPrevented&&this.applyItemExpansion({itemId:t,event:n,shouldBeExpanded:o})};applyItemExpansion=({itemId:t,event:n,shouldBeExpanded:r})=>{const i=hi.expandedItemsRaw(this.store.state);let o;r?o=[t].concat(i):o=i.filter(s=>s!==t),this.store.parameters.onItemExpansionToggle?.(n,t,r),this.setExpandedItems(n,o)};expandAllSiblings=(t,n)=>{const r=wt.itemMeta(this.store.state,n);if(r==null)return;const o=wt.itemOrderedChildrenIds(this.store.state,r.parentId).filter(a=>hi.isItemExpandable(this.store.state,a)&&!hi.isItemExpanded(this.store.state,a)),s=hi.expandedItemsRaw(this.store.state).concat(o);o.length>0&&(this.store.parameters.onItemExpansionToggle&&o.forEach(a=>{this.store.parameters.onItemExpansionToggle(t,a,!0)}),this.setExpandedItems(t,s))};addExpandableItems=t=>{const n=ut({},this.store.state.itemMetaLookup);for(const r of t)n[r]=ut({},n[r],{expandable:!0});this.store.set("itemMetaLookup",n)}}const S0={isItemEditable:fn(e=>e.isItemEditable,wt.itemModel,(e,t,n)=>!t||e==null?!1:typeof e=="boolean"?e:e(t)),isItemBeingEdited:fn((e,t)=>t==null?!1:e.editedItemId===t),isAnyItemBeingEdited:fn(e=>!!e.editedItemId)},owe=500;class swe{typeaheadQuery="";constructor(t){this.store=t,this.labelMap=jB(wt.itemMetaLookup(this.store.state)),this.store.registerStoreEffect(wt.itemMetaLookup,(n,r)=>{this.store.shouldIgnoreItemsStateUpdate()||(this.labelMap=jB(r))})}canToggleItemSelection=t=>Hn.canItemBeSelected(this.store.state,t);canToggleItemExpansion=t=>!wt.isItemDisabled(this.store.state,t)&&hi.isItemExpandable(this.store.state,t);getFirstItemMatchingTypeaheadQuery=(t,n)=>{const r=c=>{const u=z5(this.store.state,c);return u===null?Q4(this.store.state):u},i=c=>{let u=null;const f={};let h=c.length>1?t:r(t);for(;u==null&&!f[h];)this.labelMap[h]?.startsWith(c)?u=h:(f[h]=!0,h=r(h));return u},o=n.toLowerCase(),s=`${this.typeaheadQuery}${o}`,a=i(s);if(a!=null)return this.typeaheadQuery=s,a;const l=i(o);return l!=null?(this.typeaheadQuery=o,l):(this.typeaheadQuery="",null)};updateLabelMap=t=>{this.labelMap=t(this.labelMap)};handleItemKeyDown=async(t,n)=>{if(t.defaultMuiPrevented||t.altKey||Yk(t.target,t.currentTarget))return;const r=t.ctrlKey||t.metaKey,i=t.key,o=Hn.isMultiSelectEnabled(this.store.state);switch(!0){case(i===" "&&this.canToggleItemSelection(n)):{t.preventDefault(),o&&t.shiftKey?this.store.selection.expandSelectionRange(t,n):this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:o,shouldBeSelected:void 0});break}case i==="Enter":{this.store.labelEditing?.setEditedItem&&S0.isItemEditable(this.store.state,n)&&!S0.isItemBeingEdited(this.store.state,n)?this.store.labelEditing.setEditedItem(n):this.canToggleItemExpansion(n)?(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault()):this.canToggleItemSelection(n)&&(o?(t.preventDefault(),this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:!0})):Hn.isItemSelected(this.store.state,n)||(this.store.selection.setItemSelection({event:t,itemId:n}),t.preventDefault()));break}case i==="ArrowDown":{const s=z5(this.store.state,n);s&&(t.preventDefault(),this.store.focus.focusItem(t,s),o&&t.shiftKey&&this.canToggleItemSelection(s)&&this.store.selection.selectItemFromArrowNavigation(t,n,s));break}case i==="ArrowUp":{const s=oJ(this.store.state,n);s&&(t.preventDefault(),this.store.focus.focusItem(t,s),o&&t.shiftKey&&this.canToggleItemSelection(s)&&this.store.selection.selectItemFromArrowNavigation(t,n,s));break}case(i==="ArrowRight"&&!this.store.parameters.isRtl||i==="ArrowLeft"&&this.store.parameters.isRtl):{if(r)return;if(hi.isItemExpanded(this.store.state,n)){const s=z5(this.store.state,n);s&&(this.store.focus.focusItem(t,s),t.preventDefault())}else this.canToggleItemExpansion(n)&&(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault());break}case(i==="ArrowLeft"&&!this.store.parameters.isRtl||i==="ArrowRight"&&this.store.parameters.isRtl):{if(r)return;if(this.canToggleItemExpansion(n)&&hi.isItemExpanded(this.store.state,n))this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault();else{const s=wt.itemParentId(this.store.state,n);s&&(this.store.focus.focusItem(t,s),t.preventDefault())}break}case i==="Home":{this.canToggleItemSelection(n)&&o&&r&&t.shiftKey?this.store.selection.selectRangeFromStartToItem(t,n):this.store.focus.focusItem(t,Q4(this.store.state)),t.preventDefault();break}case i==="End":{this.canToggleItemSelection(n)&&o&&r&&t.shiftKey?this.store.selection.selectRangeFromItemToEnd(t,n):this.store.focus.focusItem(t,sJ(this.store.state)),t.preventDefault();break}case i==="*":{this.store.expansion.expandAllSiblings(t,n),t.preventDefault();break}case(String.fromCharCode(t.keyCode)==="A"&&r&&o&&Hn.enabled(this.store.state)):{this.store.selection.selectAllNavigableItems(t),t.preventDefault();break}case(!r&&!t.shiftKey&&awe(i)):{this.store.timeoutManager.clearTimeout("typeahead");const s=this.getFirstItemMatchingTypeaheadQuery(n,i);s!=null?(this.store.focus.focusItem(t,s),t.preventDefault()):this.typeaheadQuery="",this.store.timeoutManager.startTimeout("typeahead",owe,()=>{this.typeaheadQuery=""});break}}}}function awe(e){return!!e&&e.length===1&&!!e.match(/\S/)}function jB(e){const t={},n=r=>{t[r.id]=r.label.toLowerCase()};return Object.values(e).forEach(n),t}const $B=xb(Hn.selectedItems,hi.expandedItemsMap,wt.itemMetaLookup,wt.disabledItemFocusable,e=>wt.itemOrderedChildrenIds(e,null),(e,t,n,r,i)=>{const o=e.find(a=>{if(!r&&J4(n,a))return!1;const l=n[a];return l&&(l.parentId==null||t.has(l.parentId))});if(o!=null)return o;const s=i.find(a=>r||!J4(n,a));return s??null}),ah={defaultFocusableItemId:$B,isItemTheDefaultFocusableItem:fn($B,(e,t)=>e===t),focusedItemId:fn(e=>e.focusedItemId),isItemFocused:fn((e,t)=>e.focusedItemId===t)};class lwe{constructor(t){this.store=t,this.store.registerStoreEffect(wt.itemMetaLookup,()=>{const n=ah.focusedItemId(t.state);if(n==null||!!wt.itemMeta(t.state,n))return;const i=ah.defaultFocusableItemId(t.state);if(i==null){this.setFocusedItemId(null);return}this.applyItemFocus(null,i)})}setFocusedItemId=t=>{ah.focusedItemId(this.store.state)!==t&&this.store.set("focusedItemId",t)};applyItemFocus=(t,n)=>{this.store.items.getItemDOMElement(n)?.focus(),this.setFocusedItemId(n),this.store.parameters.onItemFocus?.(t,n)};buildPublicAPI=()=>({focusItem:this.focusItem});focusItem=(t,n)=>{const r=wt.itemMeta(this.store.state,n);r&&(r.parentId==null||hi.isItemExpanded(this.store.state,r.parentId))&&this.applyItemFocus(t,n)};removeFocusedItem=()=>{const t=ah.focusedItemId(this.store.state);if(t==null)return;if(wt.itemMeta(this.store.state,t)){const r=this.store.items.getItemDOMElement(t);r&&r.blur()}this.setFocusedItemId(null)};handleRootFocus=t=>{if(t.defaultMuiPrevented)return;const n=ah.defaultFocusableItemId(this.store.state);t.target===t.currentTarget&&n!=null&&this.applyItemFocus(t,n)};handleRootBlur=t=>{t.defaultMuiPrevented||this.setFocusedItemId(null)}}class cwe{itemPlugins=[];itemWrappers=[];register=(t,n)=>{this.itemPlugins.push(t),n&&this.itemWrappers.push(n)};listPlugins=()=>this.itemPlugins;listWrappers=()=>this.itemWrappers}class uwe extends pT{initialParameters=null;eventManager=new QSe;timeoutManager=new rwe;itemPluginManager=new cwe;constructor(t,n,r){const i=twe(t),o=r.getInitialState(i,t);super(o),this.parameters=t,this.instanceName=n,this.mapper=r,this.items=new B5(this),this.focus=new lwe(this),this.expansion=new iwe(this),this.selection=new WSe(this),this.keyboardNavigation=new swe(this)}buildPublicAPI(){return ut({},this.items.buildPublicAPI(),this.focus.buildPublicAPI(),this.expansion.buildPublicAPI(),this.selection.buildPublicAPI())}updateStateFromParameters(t){const n=(o,s,a)=>{t[s]!==void 0&&(o[s]=t[s])},r=dJ(t);n(r,"expandedItems"),n(r,"selectedItems"),(this.state.providedTreeId!==t.id||this.state.treeId===void 0)&&(r.treeId=nwe()),!this.mapper.shouldIgnoreItemsStateUpdate(t)&&B5.shouldRebuildItemsState(t,this.parameters)&&Object.assign(r,B5.buildItemsStateIfNeeded(t));const i=this.mapper.updateStateFromParameters(r,t,n);this.update(i),this.parameters=t}disposeEffect=()=>this.timeoutManager.clearAll;shouldIgnoreItemsStateUpdate=()=>this.mapper.shouldIgnoreItemsStateUpdate(this.parameters);registerStoreEffect=(t,n)=>{let r=t(this.state);this.subscribe(i=>{const o=t(i);o!==r&&(n(r,o),r=o)})};publishEvent=(t,n,r)=>{dwe(r)&&r.isPropagationStopped()||this.eventManager.emit(t,n,r)};subscribeEvent=(t,n)=>{this.eventManager.on(t,n)}}function dwe(e){return e?.isPropagationStopped!==void 0}const LB={isEmpty:fn(e=>e.lazyLoadedItems==null?!0:Object.keys(e.lazyLoadedItems.loading).length===0&&Object.keys(e.lazyLoadedItems.errors).length===0),isItemLoading:fn((e,t)=>e.lazyLoadedItems?.loading[t??Za]??!1),itemHasError:fn((e,t)=>!!e.lazyLoadedItems?.errors[t??Za]),itemError:fn((e,t)=>e.lazyLoadedItems?.errors[t??Za])},mT=e=>Array.isArray(e)?e.length>0&&e.some(mT):!!e,fwe=({itemId:e,children:t})=>{const{store:n,publicAPI:r}=Um(),i=Xr(n,hi.isItemExpandable,e),o=Xr(n,LB.isItemLoading,e),s=Xr(n,LB.itemHasError,e),a=mT(t)||i,l=Xr(n,hi.isItemExpanded,e),c=Xr(n,ah.isItemFocused,e),u=Xr(n,Hn.isItemSelected,e),f=Xr(n,wt.isItemDisabled,e),h=Xr(n,S0.isItemBeingEdited,e),g=Xr(n,S0.isItemEditable,e),y={expandable:a,expanded:l,focused:c,selected:u,disabled:f,editing:h,editable:g,loading:o,error:s},b=O=>{if(y.disabled)return;y.focused||n.focus.focusItem(O,e);const D=Hn.isMultiSelectEnabled(n.state)&&(O.shiftKey||O.ctrlKey||O.metaKey);y.expandable&&!(D&&hi.isItemExpanded(n.state,e))&&n.expansion.setItemExpansion({event:O,itemId:e})},v=O=>{if(!Hn.canItemBeSelected(n.state,e))return;!y.focused&&!y.editing&&n.focus.focusItem(O,e),Hn.isMultiSelectEnabled(n.state)&&(O.shiftKey||O.ctrlKey||O.metaKey)?O.shiftKey?n.selection.expandSelectionRange(O,e):n.selection.setItemSelection({event:O,itemId:e,keepExistingSelection:!0}):n.selection.setItemSelection({event:O,itemId:e,shouldBeSelected:!0})},S=O=>{const D=O.nativeEvent.shiftKey,T=Hn.isMultiSelectEnabled(n.state);T&&D?n.selection.expandSelectionRange(O,e):n.selection.setItemSelection({event:O,itemId:e,keepExistingSelection:T,shouldBeSelected:O.target.checked})},C=()=>{n.labelEditing&&(h?n.labelEditing.setEditedItem(null):n.labelEditing.setEditedItem(e))};return{interactions:{handleExpansion:b,handleSelection:v,handleCheckboxSelection:S,toggleItemEditing:C,handleSaveItemLabel:(O,D)=>{n.labelEditing&&S0.isItemBeingEdited(n.state,e)&&(n.labelEditing.updateItemLabel(e,D),C(),n.focus.focusItem(O,e))},handleCancelItemLabelEditing:O=>{n.labelEditing&&S0.isItemBeingEdited(n.state,e)&&(C(),n.focus.focusItem(O,e))}},status:y,publicAPI:r}},hwe=({props:e,rootRef:t,contentRef:n})=>{const{store:r}=Um(),{children:i,disabled:o=!1,disableSelection:s=!1,label:a,itemId:l,id:c}=e,u=_.useContext(cJ);if(u==null)throw new Error(["MUI X: Could not find the Tree View Children Item context.","It looks like you rendered your component outside of a SimpleTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
222
222
|
`));const{registerChild:f,unregisterChild:h,parentId:g}=u,y=mT(i),b=_.useRef(null),v=Z4(b,n),S=Xr(r,Sb.treeItemIdAttribute,l,c);return Xk(()=>(f(S,l),()=>{h(S),h(S)}),[r,f,h,S,l]),Xk(()=>r.jsxItems.insertJSXItem({id:l,idAttribute:c,parentId:g,expandable:y,disabled:o,selectable:!s}),[r,g,l,y,o,s,c]),_.useEffect(()=>{if(a)return r.jsxItems.mapLabelFromJSX(l,(b.current?.textContent??"").toLowerCase())},[r,l,a]),{contentRef:v,rootRef:t}},pwe=({children:e,itemId:t,idAttribute:n})=>{const r=_.useContext(e6);return m.jsx(uJ,{itemId:t,idAttribute:n,children:m.jsx(e6.Provider,{value:r+1,children:e})})};class mwe{constructor(t){this.store=t,t.itemPluginManager.register(hwe,pwe)}insertJSXItem=t=>{if(this.store.state.itemMetaLookup[t.id]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${t.id}"`].join(`
|
|
223
|
-
`));return this.store.update({itemMetaLookup:ut({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:ut({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=ut({},this.store.state.itemMetaLookup),r=ut({},this.store.state.itemModelLookup);delete n[t.id],delete r[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:r})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(r=>(r[t]=n,r)),()=>{this.store.keyboardNavigation.updateLabelMap(r=>{const i=ut({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??Za;this.store.update({itemOrderedChildrenIdsLookup:ut({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:ut({},this.store.state.itemChildrenIndexesLookup,{[r]:rJ(n)})})}}const gwe={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class ywe extends uwe{jsxItems=new mwe(this);constructor(t){super(ut({},t,{items:Gk}),"SimpleTreeView",gwe)}updateStateFromParameters(t){super.updateStateFromParameters(ut({},t,{items:Gk}))}}const bwe=ZZ(),vwe=e=>{const{classes:t}=e;return _.useMemo(()=>et({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},SSe,t),[t])},xwe=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),Swe=_.forwardRef(function(t,n){const r=bwe({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=kSe(r),c=JSe(ywe,a),u=_.useRef(null),f=Z4(n,u),h=GSe(c,l,f),g=vwe(r),y=i?.root??xwe,b=Yr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:h,ownerState:r});return m.jsx(ESe,{store:c,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:u,children:m.jsx(uJ,{itemId:null,idAttribute:null,children:m.jsx(e6.Provider,{value:0,children:m.jsx(y,ut({},b))})})})}),wwe=_e(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),Cwe=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),Ewe=_e(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function Awe(e){return Qe("MuiCheckbox",e)}const z7=tt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),kwe=e=>{const{classes:t,indeterminate:n,color:r,size:i}=e,o={root:["root",n&&"indeterminate",`color${ye(r)}`,`size${ye(i)}`]},s=et(o,Awe,t);return{...t,...s}},_we=me(dT,{shouldForwardProp:e=>ro(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${ye(n.size)}`],n.color!=="default"&&t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Fn()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Fn()).map(([t])=>({props:{color:t},style:{[`&.${z7.checked}, &.${z7.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${z7.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Dwe=m.jsx(Cwe,{}),Owe=m.jsx(wwe,{}),Twe=m.jsx(Ewe,{}),Wl=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiCheckbox"}),{checkedIcon:i=Dwe,color:o="primary",icon:s=Owe,indeterminate:a=!1,indeterminateIcon:l=Twe,inputProps:c,size:u="medium",disableRipple:f=!1,className:h,slots:g={},slotProps:y={},...b}=r,v=a?l:s,S=a?l:i,C={...r,disableRipple:f,color:o,indeterminate:a,size:u},w=kwe(C),A=y.input??c,[E,O]=lt("root",{ref:n,elementType:_we,className:Oe(w.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...b},ownerState:C,additionalProps:{type:"checkbox",icon:_.cloneElement(v,{fontSize:v.props.fontSize??u}),checkedIcon:_.cloneElement(S,{fontSize:S.props.fontSize??u}),disableRipple:f,slots:g,slotProps:{input:MO(typeof A=="function"?A(C):A,{"data-indeterminate":a})}}});return m.jsx(E,{...O,classes:w})}),Mwe=(e,t,n)=>typeof n=="function"?n(e,t):n,Rwe=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=Um(),i=_.useContext(e6),o=Xr(r,Mwe,e.itemId,i),{id:s,itemId:a,label:l,children:c,rootRef:u}=e,{rootRef:f,contentRef:h,propsEnhancers:g}=t(e),{interactions:y,status:b}=fwe({itemId:a,children:c}),v=_.useRef(null),S=_.useRef(null),C=Z4(u,f,v),w=Z4(h,S),A=_.useRef(null),E=Xr(r,Hn.isCheckboxSelectionEnabled),O=Xr(r,Sb.treeItemIdAttribute,a,s),D=Xr(r,ah.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},I=ne=>ee=>{ne.onFocus?.(ee),!ee.defaultMuiPrevented&&!b.focused&&wt.canItemBeFocused(r.state,a)&&ee.currentTarget===ee.target&&r.focus.focusItem(ee,a)},F=ne=>ee=>{if(ne.onBlur?.(ee),ee.defaultMuiPrevented)return;const se=r.items.getItemDOMElement(a);b.editing||ee.relatedTarget&&Yk(ee.relatedTarget,se)&&(ee.target&&ee.target?.dataset?.element==="labelInput"&&Yk(ee.target,se)||ee.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},L=ne=>ee=>{ne.onKeyDown?.(ee),!(ee.defaultMuiPrevented||ee.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(ee,a)},R=ne=>ee=>{ne.onDoubleClick?.(ee),!ee.defaultMuiPrevented&&y.toggleItemEditing()},$=ne=>ee=>{ne.onClick?.(ee),r.items.handleItemClick(ee,a),!(ee.defaultMuiPrevented||A.current?.contains(ee.target))&&(hi.triggerSlot(r.state)==="content"&&y.handleExpansion(ee),E||y.handleSelection(ee))},j=ne=>ee=>{ne.onMouseDown?.(ee),!ee.defaultMuiPrevented&&(ee.shiftKey||ee.ctrlKey||ee.metaKey||b.disabled)&&ee.preventDefault()},z=ne=>ee=>{ne.onClick?.(ee),!ee.defaultMuiPrevented&&hi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(ee)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(ne={})=>{const ee=ut({},Yi(e),Yi(ne)),se=ut({},ee,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:O,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},ne,{style:ut({},ne.style??{},{"--TreeView-itemDepth":o}),onFocus:I(ee),onBlur:F(ee),onKeyDown:L(ee)}),ue=g.root?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getContentProps:(ne={})=>{const ee=Yi(ne),se=ut({},ee,ne,{ref:w,onClick:$(ee),onMouseDown:j(ee),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(te=>{b[te]&&(se[`data-${te}`]="")});const ue=g.content?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getGroupTransitionProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:c},ne)},getIconContainerProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,ne,{onClick:z(ee)})},getCheckboxProps:(ne={})=>{const ee=Yi(ne),se=ut({},ee,{ref:A,"aria-hidden":!0},ne),ue=g.checkbox?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getLabelProps:(ne={})=>{const ee=ut({},Yi(ne)),se=ut({},ee,{children:l},ne,{onDoubleClick:R(ee)}),ue=g.label?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ue,se)},getLabelInputProps:(ne={})=>{const ee=Yi(ne),se=g.labelInput?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ne,se)},getDragAndDropOverlayProps:(ne={})=>{const ee=Yi(ne),se=g.dragAndDropOverlay?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ne,se)},getErrorContainerProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,ne)},getLoadingContainerProps:(ne={})=>{const ee=Yi(ne);return ut({size:"12px",thickness:6},ee,ne)},rootRef:C,status:b,publicAPI:n}};function Iwe(e){return Qe("MuiTreeItem",e)}tt("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const Pwe=_e(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),jwe=_e(m.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),$we=["ownerState"];function H7(e,t,n){return e!==void 0?e:t!==void 0?t:n}function Lwe(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=eJ(),s={collapseIcon:H7(t?.collapseIcon,i.collapseIcon,jwe),expandIcon:H7(t?.expandIcon,i.expandIcon,Pwe),endIcon:H7(t?.endIcon,i.endIcon),icon:t?.icon};let a;s?.icon?a="icon":r.expandable?r.expanded?a="collapseIcon":a="expandIcon":a="endIcon";const l=s[a],c=Yr({elementType:l,externalSlotProps:f=>ut({},R4(o[a],f),R4(n?.[a],f)),ownerState:{}}),u=Qh(c,$we);return l?m.jsx(l,ut({},u)):null}const Nwe=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>$0(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Hl(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function Fwe(e){return e.action==null?null:m.jsx(Nwe,ut({},e))}function Bwe(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=Um(),s=Xr(o,Sb.treeItemIdAttribute,n,r);return m.jsx(_.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const zwe=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>ut({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),Hwe=["visible"],Uwe=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],Vwe=ZZ(),Wwe=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),qwe=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>$0(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),Gwe=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>$0(e)&&e!=="editable"})(({theme:e})=>ut({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),Kwe=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),Ywe=me(fa,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),Xwe=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),Zwe=me(zr,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),Jwe=me(_.forwardRef((e,t)=>{const{visible:n}=e,r=Qh(e,Hwe);return n?m.jsx(Wl,ut({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Qwe=e=>{const{classes:t}=eJ(),n=ut({},e,{root:Oe(e?.root,t.root),content:Oe(e?.content,t.itemContent),iconContainer:Oe(e?.iconContainer,t.itemIconContainer),checkbox:Oe(e?.checkbox,t.itemCheckbox),label:Oe(e?.label,t.itemLabel),groupTransition:Oe(e?.groupTransition,t.itemGroupTransition),labelInput:Oe(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Oe(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Oe(e?.errorIcon,t.itemErrorIcon),loadingIcon:Oe(e?.loadingIcon,t.itemLoadingIcon)});return et({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},Iwe,n)},eCe=_.forwardRef(function(t,n){const r=Vwe({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:c,slots:u={},slotProps:f={},classes:h}=r,g=Qh(r,Uwe),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:A,getLabelInputProps:E,getDragAndDropOverlayProps:O,getErrorContainerProps:D,getLoadingContainerProps:T,status:I}=Rwe({id:i,itemId:o,children:c,label:s,disabled:a,disableSelection:l}),F=Qwe(h),L=u.root??Wwe,R=Yr({elementType:L,getSlotProps:b,externalForwardedProps:g,externalSlotProps:f.root,additionalProps:{ref:n},ownerState:{},className:F.root}),$=u.content??qwe,j=Yr({elementType:$,getSlotProps:v,externalSlotProps:f.content,ownerState:{},className:Oe(F.content,I.expanded&&F.expanded,I.selected&&F.selected,I.focused&&F.focused,I.disabled&&F.disabled,I.editing&&F.editing,I.editable&&F.editable)}),z=u.iconContainer??Kwe,N=Yr({elementType:z,getSlotProps:S,externalSlotProps:f.iconContainer,ownerState:{},className:F.iconContainer}),W=u.label??Gwe,H=Yr({elementType:W,getSlotProps:w,externalSlotProps:f.label,ownerState:{},className:F.label}),U=u.checkbox??Jwe,K=Yr({elementType:U,getSlotProps:C,externalSlotProps:f.checkbox,ownerState:{},className:F.checkbox}),B=u.groupTransition??void 0,q=Yr({elementType:B,getSlotProps:A,externalSlotProps:f.groupTransition,ownerState:{},className:F.groupTransition}),X=u.labelInput??zwe,V=Yr({elementType:X,getSlotProps:E,externalSlotProps:f.labelInput,ownerState:{},className:F.labelInput}),Y=u.dragAndDropOverlay??Fwe,J=Yr({elementType:Y,getSlotProps:O,externalSlotProps:f.dragAndDropOverlay,ownerState:{},className:F.dragAndDropOverlay}),ne=u.errorIcon??Xwe,ee=Yr({elementType:ne,getSlotProps:D,externalSlotProps:f.errorIcon,ownerState:{},className:F.errorIcon}),se=u.loadingIcon??Zwe,ue=Yr({elementType:se,getSlotProps:T,externalSlotProps:f.loadingIcon,ownerState:{},className:F.loadingIcon});return m.jsx(Bwe,ut({},y(),{children:m.jsxs(L,ut({},R,{children:[m.jsxs($,ut({},j,{children:[m.jsxs(z,ut({},N,{children:[I.error&&m.jsx(ne,ut({},ee)),I.loading?m.jsx(se,ut({},ue)):m.jsx(Lwe,{status:I,slots:u,slotProps:f})]})),m.jsx(U,ut({},K)),I.editing?m.jsx(X,ut({},V)):m.jsx(W,ut({},H)),m.jsx(Y,ut({},J))]})),c&&m.jsx(Ywe,ut({as:B},q))]}))}))}),fJ=_e(m.jsx("path",{d:"M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z"})),Sw=_e(m.jsx("path",{d:"M20 19V3H4v16H2v2h20v-2zM16 9h2v2h-2zm-2 2H6V9h8zm4-4h-2V5h2zm-4-2v2H6V5zM6 19v-6h8v1.82c-.45.32-.75.84-.75 1.43 0 .97.78 1.75 1.75 1.75s1.75-.78 1.75-1.75c0-.59-.3-1.12-.75-1.43V13h2v6z"})),tCe=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"})),gT=_e(m.jsx("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5z"})),nCe=_e(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5M9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8m6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),rCe=_e(m.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),ww=_e(m.jsx("path",{d:"M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7"})),uu=_e(m.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),hJ=_e(m.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),iCe=_e(m.jsx("path",{d:"M12 11c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3m0 1c-1.84 0-3.56.5-5.03 1.37-.61.35-.97 1.02-.97 1.72V17h12v-1.91c0-.7-.36-1.36-.97-1.72C15.56 12.5 13.84 12 12 12m9.23-3.85 1.85-.77c-1.22-2.91-3.55-5.25-6.46-6.46l-.77 1.85c2.42 1.02 4.36 2.96 5.38 5.38M8.15 2.77 7.38.92C4.47 2.14 2.14 4.47.92 7.38l1.85.77c1.02-2.42 2.96-4.36 5.38-5.38M2.77 15.85l-1.85.77c1.22 2.91 3.55 5.25 6.46 6.46l.77-1.85c-2.42-1.02-4.36-2.96-5.38-5.38m13.08 5.38.77 1.85c2.91-1.22 5.25-3.55 6.46-6.46l-1.85-.77c-1.02 2.42-2.96 4.36-5.38 5.38"})),U5=_e(m.jsx("path",{d:"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13"})),Cw=_e(m.jsx("path",{d:"M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2m0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Ew=_e(m.jsx("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4m-4-2V5c0-.55.45-1 1-1s1 .45 1 1v1h-1v1h1v2h-1v1h1v1z"})),oCe=_e(m.jsx("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5m0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3"})),sCe=_e(m.jsx("path",{d:"M12 3 2 12h3v8h14v-8h3zm0 13c-1.1 0-2-.9-2-2s2-4 2-4 2 2.9 2 4-.9 2-2 2"})),yT=_e(m.jsx("path",{d:"M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8M7.83 14c.37 0 .67.26.74.62.41 2.22 2.28 2.98 3.64 2.87.43-.02.79.32.79.75 0 .4-.32.73-.72.75-2.13.13-4.62-1.09-5.19-4.12-.08-.45.28-.87.74-.87"})),aCe=_e([m.jsx("path",{d:"M4 3h6v2H4zM1 7h5v2H1zm2 12h5v2H3zm10.73-8.39c.75.23 1.3.78 1.57 1.46l4.27-7.11c.65-1.08.3-2.48-.78-3.13-.87-.52-1.99-.41-2.73.29l-3.43 3.21c-.4.37-.63.9-.63 1.45v3.93c.36-.15.98-.33 1.73-.1m-3.12 1.66c.16-.52.48-.96.89-1.27H3.28C2.02 11 1 12.02 1 13.28c0 1.02.67 1.91 1.65 2.19l4.51 1.29c.53.15 1.1.08 1.58-.21l2.69-1.61c-.77-.62-1.13-1.67-.82-2.67m11.6 6.34-2.28-4.1c-.27-.48-.73-.83-1.26-.97l-3.18-.8c.03.32 0 .66-.1.99-.32 1.06-1.28 1.77-2.39 1.77-.61 0-.99-.22-1-.22V21c-1.1 0-2 .9-2 2h6c0-1.1-.9-2-2-2v-4.28l4.61 4.61c.89.89 2.33.89 3.22 0 .72-.72.88-1.83.38-2.72"},"0"),m.jsx("path",{d:"M12.56 14.43c.79.24 1.63-.2 1.87-1 .24-.79-.2-1.63-1-1.87-.79-.24-1.63.2-1.87 1-.24.79.21 1.63 1 1.87"},"1")]),lCe=({endpoint:e})=>{const t=_.useMemo(()=>{switch(e.type.name){case"RootNode":return m.jsx(gT,{});case"Aggregator":return m.jsx(nCe,{});case"OnOffPlugInUnit":return m.jsx(oCe,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return m.jsx(ww,{});case"TemperatureSensor":return m.jsx(Ew,{});case"Thermostat":return m.jsx(fJ,{});case"Fan":return m.jsx(aCe,{});case"OnOffSensor":return m.jsx(tCe,{});case"HumiditySensor":return m.jsx(yT,{});case"WindowCovering":return m.jsx(Sw,{});case"DoorLock":return m.jsx(uu,{});case"OccupancySensor":return m.jsx(iCe,{});case"ContactSensor":return m.jsx(hJ,{});case"WaterLeakDetector":return m.jsx(sCe,{});case"Speaker":return m.jsx(Cw,{});case"RoboticVacuumCleaner":return m.jsx(U5,{});default:return m.jsx(rCe,{})}},[e]);return m.jsx(cn,{title:`${e.type.name} (${e.type.id})`,children:t})},cCe=e=>{const[t,n]=_.useState(()=>dCe(e.endpoint)),r=i=>{let o;i&&(o=fCe(i,e.endpoint)),e.onSelected(o)};return m.jsx(Swe,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:m.jsx(pJ,{endpoint:e.endpoint,sortBy:e.sortBy})})},pJ=e=>{const t=_.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=Is(r.state)??r.id.local,s=Is(i.state)??i.id.local;return o.localeCompare(s)});case"type":return n.sort((r,i)=>{const o=r.type?.name??"",s=i.type?.name??"";return o.localeCompare(s)});default:return n.sort((r,i)=>r.endpoint-i.endpoint)}},[e.endpoint.parts,e.sortBy]);return m.jsx(eCe,{itemId:e.endpoint.id.global,label:m.jsx(uCe,{endpoint:e.endpoint}),children:t.map(n=>m.jsx(pJ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},uCe=e=>m.jsxs(ce,{display:"flex",children:[m.jsx(lCe,{endpoint:e.endpoint}),m.jsx(ce,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:m.jsx(u5e,{endpoint:e.endpoint})})]});function dCe(e){const t=[e.id.global],n=[e];for(;n.length>0;){const r=n.shift();r.parts.length===1&&t.push(r.parts[0].id.global),n.push(...r.parts)}return t}function fCe(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(r.id.global===e)return r;n.push(...r.parts)}}const V5=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>V5(n))},hCe=e=>{const[t,n]=_.useState(void 0),[r,i]=_.useState("name"),[o,s]=_.useState("cards"),[a,l]=_.useState(""),[c,u]=_.useState(!1),[f,h]=_.useState(!1),[g,y]=_.useState(!1),[b,v]=_.useState(""),[S,C]=_.useState(),[w,A]=_.useState({open:!1,message:"",severity:"success"}),[E,O]=_.useState({}),D=_.useMemo(()=>{const N=V5(e.endpoint),W=[];for(const H of N){const K=H.state.homeAssistantEntity?.entity?.entity_id;K&&W.push(K)}return W},[e.endpoint]),T=_.useCallback(()=>{D.length!==0&&qZ(D).then(O).catch(()=>{})},[D]);_.useEffect(()=>{T()},[T]);const I=_.useCallback(()=>{T()},[T]),F=_.useCallback(async(N,W)=>{if(W){v(N);try{const U=(await cT(W)).mappings.find(K=>K.entityId===N);C(U)}catch{C(void 0)}y(!0)}},[]),L=_.useCallback(async N=>{if(!(!e.bridgeId||!b))try{await uT(e.bridgeId,b,N),A({open:!0,message:`Mapping saved for ${b}. Restart the bridge to apply changes.`,severity:"success"}),y(!1),e.onMappingSaved?.()}catch(W){A({open:!0,message:`Failed to save mapping: ${W}`,severity:"error"})}},[e.bridgeId,b,e.onMappingSaved]),R=_.useCallback(N=>{const H=N.state.homeAssistantEntity?.entity?.state?.state;return H==="unavailable"||H==="unknown"},[]),$=_.useMemo(()=>V5(e.endpoint).filter(R).length,[e.endpoint,R]),j=_.useMemo(()=>[...V5(e.endpoint).filter(H=>{if(f&&!R(H))return!1;const U=Is(H.state)??H.id.local,K=H.type.name,B=a.toLowerCase();return U.toLowerCase().includes(B)||K.toLowerCase().includes(B)})].sort((H,U)=>{const K=Is(H.state)??H.id.local,B=Is(U.state)??U.id.local;switch(r){case"name":return K.localeCompare(B);case"endpoint":return H.id.local.localeCompare(U.id.local);case"type":return H.type.name.localeCompare(U.type.name);default:return 0}}),[e.endpoint,a,r,f,R]),z=N=>{n(N),u(!0)};return m.jsxs(ce,{children:[m.jsxs(ce,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,children:[m.jsxs(ie,{variant:"h6",component:"span",children:["Endpoints (",j.length,")"]}),m.jsx(cn,{title:"View All Devices",children:m.jsx(_n,{component:Du,to:Pt.devices,size:"small",color:"primary",children:m.jsx(Ns,{})})})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[m.jsx(Lr,{size:"small",placeholder:"Search endpoints...",value:a,onChange:N=>l(N.target.value),sx:{flexGrow:1,maxWidth:300}}),$>0&&m.jsx(cn,{title:f?"Show all entities":`Show ${$} unavailable`,children:m.jsx(_n,{size:"small",color:f?"warning":"default",onClick:()=>h(N=>!N),children:m.jsx($Z,{badgeContent:$,color:"warning",max:99,children:m.jsx(Yd,{})})})}),m.jsxs(pa,{size:"small",sx:{minWidth:120},children:[m.jsx(sc,{id:"sort-label",children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:.5,children:[m.jsx(jZ,{fontSize:"small"})," Sort"]})}),m.jsxs(sa,{labelId:"sort-label",value:r,label:"Sort",onChange:N=>i(N.target.value),children:[m.jsx(er,{value:"name",children:"Name"}),m.jsx(er,{value:"endpoint",children:"Endpoint ID"}),m.jsx(er,{value:"type",children:"Type"})]})]}),m.jsxs(W4e,{value:o,exclusive:!0,onChange:(N,W)=>W&&s(W),size:"small",children:[m.jsx(uB,{value:"cards",children:m.jsx(cn,{title:"Card View",children:m.jsx(h5e,{})})}),m.jsx(uB,{value:"tree",children:m.jsx(cn,{title:"Tree View",children:m.jsx(p5e,{})})})]})]})]}),o==="cards"?m.jsx(dt,{container:!0,spacing:2,children:j.map(N=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(KZ,{endpoint:N,bridgeId:e.bridgeId,onClick:()=>z(N),onEditMapping:e.bridgeId?F:void 0,imageInfo:E[N.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:I})},N.id.global))}):m.jsxs(dt,{container:!0,spacing:2,children:[m.jsx(dt,{size:{xs:12,md:4},children:m.jsx(cCe,{endpoint:e.endpoint,onSelected:n,sortBy:r})}),m.jsx(dt,{size:{xs:12,md:8},children:t&&m.jsx(CB,{endpoint:t})})]}),m.jsxs(vu,{open:c,onClose:()=>u(!1),maxWidth:"md",fullWidth:!0,children:[m.jsx(Su,{children:t&&(Is(t.state)??t.id.local)}),m.jsx(xu,{children:t&&m.jsx(CB,{endpoint:t})})]}),e.bridgeId&&m.jsx(fT,{open:g,onClose:()=>y(!1),entityId:b,domain:b.split(".")[0]||"",currentMapping:S,onSave:L}),m.jsx(jO,{open:w.open,autoHideDuration:6e3,onClose:()=>A({...w,open:!1}),children:m.jsx(kn,{onClose:()=>A({...w,open:!1}),severity:w.severity,sx:{width:"100%"},children:w.message})})]})},wb=_e(m.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}));function pCe({bridgeId:e}){const[t,n]=_.useState(null),[r,i]=_.useState(!0),[o,s]=_.useState(!1),[a,l]=_.useState(null),c=_.useCallback(async()=>{try{const v=await cT(e);n(v)}catch{console.error("Failed to load entity mappings")}finally{i(!1)}},[e]);_.useEffect(()=>{c()},[c]);const u=_.useCallback(()=>{l({entityId:"",domain:""}),s(!0)},[]),f=_.useCallback((v,S)=>{const C=v.split(".")[0]||"";l({entityId:v,domain:C,config:S}),s(!0)},[]),h=_.useCallback(async v=>{try{await Y4e(e,v),await c()}catch{console.error("Failed to delete entity mapping")}},[e,c]),g=_.useCallback(async v=>{if(v.entityId)try{await uT(e,v.entityId,v),s(!1),l(null),await c()}catch{console.error("Failed to save entity mapping")}},[e,c]),y=_.useCallback(()=>{s(!1),l(null)},[]),b=t?.mappings??[];return m.jsxs(tr,{children:[m.jsxs(gr,{children:[m.jsxs(ce,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[m.jsxs(ie,{variant:"h6",children:[m.jsx(wb,{sx:{mr:1,verticalAlign:"middle"}}),"Entity Mappings"]}),m.jsx(kt,{variant:"outlined",size:"small",onClick:u,children:"Add Mapping"})]}),r&&m.jsx(ie,{color:"text.secondary",children:"Loading..."}),!r&&b.length===0&&m.jsx(ie,{color:"text.secondary",children:"No custom entity mappings configured. Use mappings to override Matter device types, set custom names, or disable specific entities."}),!r&&b.length>0&&m.jsx(fm,{children:m.jsxs(um,{size:"small",children:[m.jsx(X4,{children:m.jsxs(Os,{children:[m.jsx(Rn,{children:"Entity ID"}),m.jsx(Rn,{children:"Device Type"}),m.jsx(Rn,{children:"Custom Name"}),m.jsx(Rn,{children:"Status"}),m.jsx(Rn,{align:"right",children:"Actions"})]})}),m.jsx(dm,{children:b.map(v=>m.jsxs(Os,{children:[m.jsx(Rn,{children:m.jsx(ie,{variant:"body2",fontFamily:"monospace",children:v.entityId})}),m.jsx(Rn,{children:v.matterDeviceType||m.jsx(ie,{color:"text.secondary",variant:"body2",children:"Auto"})}),m.jsx(Rn,{children:v.customName||m.jsx(ie,{color:"text.secondary",variant:"body2",children:"—"})}),m.jsx(Rn,{children:v.disabled?m.jsx(Et,{label:"Disabled",color:"error",size:"small"}):m.jsx(Et,{label:"Enabled",color:"success",size:"small"})}),m.jsxs(Rn,{align:"right",children:[m.jsx(_n,{size:"small",onClick:()=>f(v.entityId,v),children:m.jsx(cw,{fontSize:"small"})}),m.jsx(_n,{size:"small",onClick:()=>h(v.entityId),children:m.jsx(Zd,{fontSize:"small"})})]})]},v.entityId))})]})})]}),a&&m.jsx(fT,{open:o,entityId:a.entityId,domain:a.domain,currentMapping:a.config,onSave:g,onClose:y})]})}const mCe=e=>e.bridges,bT=rw([mCe],e=>e.items),gCe=e=>rw([bT],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),yCe=rw([bT],e=>{if(!e.isInitialized)return;const t={};return(e.content?.map(r=>[r.port,r.id])??[]).forEach(([r,i])=>{t[r]=i}),t});function Vm(){return Hm(bT)}function mJ(){return Hm(yCe)}function gJ(e){const t=_.useMemo(()=>gCe(e),[e]);return Hm(t)}function bCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(HX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function vCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(VX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function xCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(WX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function SCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(UX(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function wCe(){const e=Hs();return _.useCallback(async t=>{await A2e(t),await e(Fo())},[e])}function CCe(){const e=Hs();return _.useCallback(async t=>{const n=await NX(t);return await e(Fo()),n},[e])}const ECe=e=>e.devices,ACe=e=>rw([ECe],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function kCe(e){const t=_.useMemo(()=>ACe(e),[e]);return Hm(t)}function _Ce(e,t){const[n,r]=_.useState(e);return _.useEffect(()=>{let i=e;t();const o=setInterval(()=>{i--,i===0&&(t(),i=e),r(i)},1e3);return()=>clearInterval(o)},[e,t]),n}async function DCe(e){return await(await fetch(`api/matter/bridges/${e}/devices`)).json()}const du=zm("devices/load",DCe),OCe=_e(m.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),TCe=_e(m.jsx("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93"})),MCe=({bridge:e})=>{const[t,n]=_.useState(null),r=!!t,i=hf(),o=Tu(),s=xCe(),a=SCe(),l=CCe(),c=y=>n(y.currentTarget),u=()=>n(null),f=async()=>{u(),await l(e).then(y=>o.show({message:`Synced ${y.syncedCount} devices to controllers`,severity:"success"})).catch(y=>o.show({message:`Failed to sync: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},h=async()=>{u(),await s(e).then(()=>o.show({message:"Bridge Reset successfully",severity:"success"})).catch(y=>o.show({message:`Failed to reset bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},g=async()=>{u(),await a(e).then(()=>o.show({message:"Bridge deleted successfully",severity:"success"})).then(()=>i(Pt.bridges)).catch(y=>o.show({message:`Failed to delete bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))};return m.jsxs(m.Fragment,{children:[m.jsx(_n,{onClick:c,children:m.jsx(OCe,{})}),m.jsxs(FZ,{open:r,onClose:u,anchorEl:t,children:[m.jsxs(er,{component:Du,to:Pt.editBridge(e),children:[m.jsx(Ul,{children:m.jsx(cw,{fontSize:"small"})}),m.jsx(Va,{children:"Edit"})]}),m.jsx(gi,{}),m.jsxs(er,{onClick:f,children:[m.jsx(Ul,{children:m.jsx(dw,{fontSize:"small"})}),m.jsx(Va,{children:"Force Sync"})]}),m.jsxs(er,{onClick:h,children:[m.jsx(Ul,{children:m.jsx(TCe,{fontSize:"small"})}),m.jsx(Va,{children:"Factory Reset"})]}),m.jsxs(er,{onClick:g,children:[m.jsx(Ul,{children:m.jsx(Zd,{fontSize:"small"})}),m.jsx(Va,{children:"Delete"})]})]})]})},RCe=_.memo(B3e),ICe=({failedEntities:e})=>{const[t,n]=_.useState(!1);return!e||e.length===0?null:m.jsxs(kn,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>n(!t),children:[m.jsxs(ie,{variant:"body2",children:[m.jsxs("strong",{children:[e.length," entity/entities could not be loaded."]})," ","Click to ",t?"hide":"show"," details."]}),m.jsx(fa,{in:t,children:m.jsx(bc,{dense:!0,sx:{mt:1},children:e.map(r=>m.jsxs(yf,{sx:{py:0},children:[m.jsx(Ul,{sx:{minWidth:32},children:m.jsx(iw,{color:"warning",fontSize:"small"})}),m.jsx(Va,{primary:r.entityId,secondary:r.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},r.entityId))})})]})},PCe=()=>{const e=Tu(),t=Hs(),{bridgeId:n}=mY(),[r,i]=_.useState(0),o=_.useCallback(()=>{i(g=>g+1)},[]),s=_.useCallback(()=>{t(du(n))},[t,n]),a=_Ce(10,s),{content:l,isLoading:c,error:u}=gJ(n),{content:f,error:h}=kCe(n);return _.useEffect(()=>{u&&e.show({message:u.message??"Failed to load Bridge details",severity:"error"})},[u,e]),_.useEffect(()=>{h?.message&&e.show({message:h.message,severity:"error"})},[h,e]),!l&&c?"Loading":l?m.jsxs(zt,{spacing:4,children:[m.jsx(lw,{items:[{name:"Bridges",to:Pt.bridges},{name:l.name,to:Pt.bridge(n)}]}),m.jsxs(ce,{display:"flex",justifyContent:"space-between",children:[m.jsxs(ie,{variant:"h4",children:[l.name," ",m.jsx(MZ,{status:l.status})]}),m.jsx(MCe,{bridge:n})]}),m.jsx(Z3e,{status:l.status,reason:l.statusReason}),l.failedEntities&&l.failedEntities.length>0&&m.jsx(ICe,{failedEntities:l.failedEntities}),m.jsx(jCe,{bridge:l,devices:f}),m.jsx(RCe,{bridge:l}),f&&m.jsx(f5e,{devices:f}),m.jsx(pCe,{bridgeId:n},r),f&&m.jsxs(zt,{spacing:2,children:[m.jsx(ce,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:a!=null&&m.jsx(cn,{title:"New devices and changes on labels are discovered every 30 seconds.",children:m.jsxs(ie,{variant:"body2",color:"textSecondary",children:["Refreshing states in ",a-1," seconds..."]})})}),m.jsx(hCe,{endpoint:f,bridgeId:n,onMappingSaved:o})]})]}):"Not found"};function yJ(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(yJ)}function bJ(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=bJ(n);return t}const jCe=({bridge:e,devices:t})=>{const n=Tu(),[r,i]=_.useState(!1),o=_.useMemo(()=>{if(!t||e.featureFlags?.serverMode||!yJ(t))return!1;const l=e.commissioning?.fabrics??[];if(l.length===0)return!0;const c=new Set([4937,4631,4448]);return l.some(u=>c.has(u.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),s=_.useMemo(()=>t?bJ(t)===1:!1,[t]),a=async()=>{i(!0);try{await LX({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),n.show({message:"Server Mode enabled. The bridge will restart with your vacuum as a standalone device.",severity:"success"})}catch(l){n.show({message:`Failed to enable Server Mode: ${l instanceof Error?l.message:String(l)}`,severity:"error"})}finally{i(!1)}};return o?m.jsxs(kn,{severity:"warning",icon:m.jsx(yb,{}),action:s?m.jsx(kt,{color:"warning",size:"small",variant:"outlined",onClick:a,disabled:r,startIcon:r?m.jsx(zr,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:r?"Enabling...":"Enable Server Mode"}):void 0,children:[m.jsx(q4,{children:"Server Mode Recommended for Robot Vacuums"}),m.jsxs(ie,{variant:"body2",children:["This bridge contains a robot vacuum in ",m.jsx("strong",{children:"bridged mode"}),". Apple Home and Alexa will show the bridge as an additional device, resulting in duplicate entries. Enable ",m.jsx("strong",{children:"Server Mode"})," to expose the vacuum as a standalone Matter device for full Siri/Alexa voice command support and no duplicates."]}),!s&&m.jsxs(ie,{variant:"body2",sx:{mt:1},children:[m.jsx("strong",{children:"Note:"})," Server Mode requires the vacuum to be the only device on this bridge. Please remove other entities from this bridge first, then enable Server Mode in the bridge settings."]})]}):null},vT=_e(m.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),$Ce=_e(m.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),xT=_e(m.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),LCe=_e(m.jsx("path",{d:"m7 10 5 5 5-5z"})),NCe=_e(m.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),FCe=_e(m.jsx("path",{d:"m10 17 5-5-5-5z"})),ST=_e(m.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),vJ=_e(m.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),NB=_e(m.jsx("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"})),jx=_e(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),BCe=_e(m.jsxs(_.Fragment,{children:[m.jsx("path",{fillOpacity:".3",d:"M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z"}),m.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),zCe=_e(m.jsx("path",{d:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66s.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21"})),Aw=_e(m.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"})),HCe=_e([m.jsx("path",{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"0"),m.jsx("path",{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"},"1")]),UCe=_e(m.jsx("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3m0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7m18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11m20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"})),FB=_e([m.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),m.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),m.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),VCe=_e(m.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),wT=_e(m.jsx("path",{d:"M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z"})),WCe=_e(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),qCe=_e(m.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),GCe=_e(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),KCe=_e(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),YCe=_e(m.jsx("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"})),XCe=_e(m.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),ZCe=_e(m.jsx("path",{d:"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z"})),JCe=_e(m.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),QCe=_e(m.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),e8e=_e(m.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),t8e=_e([m.jsx("path",{d:"M21 14c0-.55-.45-1-1-1h-2v2h2c.55 0 1-.45 1-1m-1 3h-2v2h2c.55 0 1-.45 1-1s-.45-1-1-1m-8-3h-2v4h2c0 1.1.9 2 2 2h3v-8h-3c-1.1 0-2 .9-2 2"},"0"),m.jsx("path",{d:"M5 13c0-1.1.9-2 2-2h1.5c1.93 0 3.5-1.57 3.5-3.5S10.43 4 8.5 4H5c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5.67 1.5 1.5S9.33 9 8.5 9H7c-2.21 0-4 1.79-4 4s1.79 4 4 4h2v-2H7c-1.1 0-2-.9-2-2"},"1")]),g1=_e(m.jsx("path",{d:"M17 10H7v2h10zm2-7h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14zm-5-5H7v2h7z"})),n8e=_e(m.jsx("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"})),r8e=_e(m.jsx("circle",{cx:"12",cy:"12",r:"8"})),i8e=_e(m.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),o8e=_e(m.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),CT=_e([m.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),m.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),m.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),m.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15.69c0 .45-.35.81-.78.81h-.44c-.44 0-.78-.36-.78-.81V16.5H7v1.19c0 .45-.35.81-.78.81h-.44c-.43 0-.78-.36-.78-.81v-6.5c.82-2.47 1.34-4.03 1.56-4.69.05-.16.12-.29.19-.4.02-.02.03-.04.05-.06.38-.53.92-.54.92-.54h8.56s.54.01.92.53c.02.03.03.05.05.07.07.11.14.24.19.4.22.66.74 2.23 1.56 4.69z"},"3")]),ET=_e(m.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),s8e=_e(m.jsx("path",{d:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"})),t6=_e(m.jsx("path",{d:"M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z"})),AT=_e(m.jsx("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"})),a8e=_e(m.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z"})),l8e=_e(m.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Zk=_e(m.jsx("path",{d:"M15 9H9v6h6zm-2 4h-2v-2h2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2zm-4 6H7V7h10z"})),c8e=_e(m.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),u8e=_e(m.jsx("path",{d:"M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z"})),xJ=_e(m.jsx("path",{d:"M8 5v14l11-7z"})),kT=_e(m.jsx("path",{d:"M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83"})),d8e=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),_T=_e(m.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),Qy=_e(m.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),BB=_e(m.jsx("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"})),n6=_e(m.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),SJ=_e(m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),f8e=_e([m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),m.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")]),wJ=_e(m.jsx("path",{d:"M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"})),e2=_e(m.jsx("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12s.45 2.1 1.17 2.83zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12s-.45 2.1-1.17 2.83zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12M6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65"})),DT=_e(m.jsx("path",{d:"M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1m-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05M12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0"})),CJ=_e(m.jsx("path",{d:"M6 6h12v12H6z"})),h8e=_e(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 14H8V8h8z"})),p8e=_e(m.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),m8e=_e(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),g8e=_e(m.jsx("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2"})),OT=_e(m.jsx("path",{d:"M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14M7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"})),TT=_e(m.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2m0 14H3V5h18z"})),y8e=_e(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),b8e=_e(m.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),v8e=_e(m.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"})),x8e=_e(m.jsx("path",{d:"M11 11V3H5c-1.1 0-2 .9-2 2v6zm2 0h8V5c0-1.1-.9-2-2-2h-6zm-2 2H3v6c0 1.1.9 2 2 2h6zm2 0v8h6c1.1 0 2-.9 2-2v-6z"}));async function S8e(){const e=await fetch("api/bridges/export");if(!e.ok)throw new Error(`Failed to export bridges: ${e.statusText}`);const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;E8e(t,r)}async function w8e(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`Failed to preview import: ${t.statusText}`);return t.json()}async function C8e(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});if(!n.ok)throw new Error(`Failed to import bridges: ${n.statusText}`);return n.json()}function E8e(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function A8e({open:e,file:t,onClose:n,onImported:r}){const[i,o]=_.useState(null),[s,a]=_.useState(new Set),[l,c]=_.useState(!1),[u,f]=_.useState(null),[h,g]=_.useState(null),[y,b]=_.useState(!1),[v,S]=_.useState(null);_.useEffect(()=>{if(!e||!t){o(null),a(new Set),f(null),g(null),S(null);return}const O=new FileReader;O.onload=async D=>{try{const T=JSON.parse(D.target?.result);f(T);const I=await w8e(T);o(I),a(new Set(I.bridges.map(F=>F.id)))}catch{g("Failed to parse import file. Please select a valid export file.")}},O.readAsText(t)},[e,t]);const C=_.useCallback(O=>{a(D=>{const T=new Set(D);return T.has(O)?T.delete(O):T.add(O),T})},[]),w=_.useCallback(()=>{i&&a(new Set(i.bridges.map(O=>O.id)))},[i]),A=_.useCallback(()=>{a(new Set)},[]),E=_.useCallback(async()=>{if(u){b(!0);try{const O=await C8e(u,{bridgeIds:Array.from(s),overwriteExisting:l}),D=[];O.imported>0&&D.push(`${O.imported} bridge(s) imported`),O.skipped>0&&D.push(`${O.skipped} skipped (already exist)`),O.errors.length>0&&D.push(`${O.errors.length} failed`),S(D.join(", ")),r()}catch(O){g(O instanceof Error?O.message:"Import failed")}finally{b(!1)}}},[u,s,l,r]);return m.jsxs(vu,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[m.jsx(Su,{children:"Import Bridges"}),m.jsxs(xu,{children:[h&&m.jsx(kn,{severity:"error",sx:{mb:2},children:h}),v&&m.jsx(kn,{severity:"success",sx:{mb:2},children:v}),i&&!v&&m.jsxs(m.Fragment,{children:[i.migrated&&m.jsxs(kn,{severity:"info",sx:{mb:2},children:["This export is from an older version (",i.sourceVersion,"). Bridges will be migrated to the current format during import."]}),m.jsxs(ie,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(i.exportedAt).toLocaleString(),i.sourceVersion&&!i.migrated&&m.jsxs(m.Fragment,{children:[" • Format: ",i.sourceVersion]})]}),m.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[m.jsx(kt,{size:"small",onClick:w,children:"Select All"}),m.jsx(kt,{size:"small",onClick:A,children:"Select None"})]}),m.jsx(bc,{dense:!0,children:i.bridges.map(O=>m.jsxs(yf,{disablePadding:!0,children:[m.jsx(Ul,{children:m.jsx(Wl,{edge:"start",checked:s.has(O.id),onChange:()=>C(O.id)})}),m.jsx(Va,{primary:O.name,secondary:m.jsxs(m.Fragment,{children:["Port ",O.port," • ",O.entityCount," filter rules",O.exists&&m.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},O.id))}),m.jsx($s,{control:m.jsx(jh,{checked:l,onChange:O=>c(O.target.checked)}),label:"Overwrite existing bridges"})]})]}),m.jsxs(Xd,{children:[m.jsx(kt,{onClick:n,children:v?"Close":"Cancel"}),!v&&m.jsx(kt,{onClick:E,variant:"contained",disabled:y||s.size===0,children:y?"Importing...":`Import ${s.size} Bridge(s)`})]})]})}function k8e(e){return Qe("MuiCardActionArea",e)}const U7=tt("MuiCardActionArea",["root","focusVisible","focusHighlight"]),_8e=e=>{const{classes:t}=e;return et({root:["root"],focusHighlight:["focusHighlight"]},k8e,t)},D8e=me(ba,{name:"MuiCardActionArea",slot:"Root"})(Ge(({theme:e})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${U7.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${U7.focusVisible} .${U7.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),O8e=me("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(Ge(({theme:e})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:e.transitions.create("opacity",{duration:e.transitions.duration.short})}))),Wm=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiCardActionArea"}),{children:i,className:o,focusVisibleClassName:s,slots:a={},slotProps:l={},...c}=r,u=r,f=_8e(u),h={slots:a,slotProps:l},[g,y]=lt("root",{elementType:D8e,externalForwardedProps:{...h,...c},shouldForwardComponentProp:!0,ownerState:u,ref:n,className:Oe(f.root,o),additionalProps:{focusVisibleClassName:Oe(s,f.focusVisible)}}),[b,v]=lt("focusHighlight",{elementType:O8e,externalForwardedProps:h,ownerState:u,className:f.focusHighlight});return m.jsxs(g,{...y,children:[i,m.jsx(b,{...v})]})}),kw="api/bridge-icons";async function T8e(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${kw}/${e}`,{method:"POST",body:n});if(!r.ok){const i=await r.json();throw new Error(i.error||"Failed to upload icon")}return r.json()}async function M8e(e){const t=await fetch(`${kw}/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to delete icon")}}async function _w(e){return(await fetch(`${kw}/${e}`,{method:"HEAD"})).ok}function t2(e){return`${kw}/${e}`}const zB={light:ww,switch:kT,climate:Ew,cover:Sw,fan:OT,lock:uu,sensor:e2,media_player:TT,vacuum:wT,remote:DT,humidifier:yT,speaker:Cw,garage:CT,door:JCe,window:x8e,motion:ZCe,battery:BCe,power:zCe,camera:HCe,default:gT},HB={light:ww,switch:kT,climate:Ew,cover:Sw,fan:OT,lock:uu,sensor:e2,binary_sensor:e2,media_player:TT,vacuum:wT,remote:DT,humidifier:yT,input_boolean:t8e,input_button:g1,button:g1,scene:g1,script:g1,automation:g1,speaker:Cw,air_quality:fJ,garage:CT},UB={light:"warning.main",switch:"info.main",climate:"error.main",cover:"success.main",fan:"info.light",lock:"secondary.main",sensor:"primary.main",binary_sensor:"primary.main",media_player:"secondary.main",vacuum:"success.main",remote:"warning.main",humidifier:"info.main"},EJ=e=>e.filter.include.find(n=>n.type===Ar.Domain)?.value??null,R8e=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return ww;if(t.includes("vacuum")||t.includes("dammsug"))return wT;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return Ew;if(t.includes("sensor"))return e2;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return Sw;if(t.includes("remote")||t.includes("fjärr"))return DT;if(t.includes("lock")||t.includes("lås"))return uu;if(t.includes("fan")||t.includes("fläkt"))return OT;if(t.includes("tv")||t.includes("media"))return TT;if(t.includes("speaker")||t.includes("högtalare"))return Cw;if(t.includes("switch")||t.includes("brytare"))return kT;if(t.includes("garage"))return CT},MT=e=>{if(e.icon&&zB[e.icon])return zB[e.icon];const t=EJ(e);if(t&&HB[t])return HB[t];const n=R8e(e.name);return n||(e.deviceCount===0?Ns:gT)},RT=e=>{const t=EJ(e);return t&&UB[t]?UB[t]:e.deviceCount===0?"text.disabled":"primary.main"},I8e=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=MT(e),r=RT(e),[i,o]=_.useState(!1);return _.useEffect(()=>{_w(e.id).then(o)},[e.id]),m.jsx(tr,{variant:"elevation",sx:{height:"100%",transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-4px)",boxShadow:4}},children:m.jsx(Wm,{component:Du,to:Pt.bridge(e.id),sx:{height:"100%"},children:m.jsx(gr,{children:m.jsxs(ce,{display:"flex",alignItems:"flex-start",gap:2,children:[i?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:m.jsx(n,{sx:{fontSize:32}})}),m.jsxs(ce,{flexGrow:1,minWidth:0,children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(ie,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),m.jsx(MZ,{status:e.status})]}),m.jsxs(zt,{spacing:1,mb:2,children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Ns,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(aZ,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(e2,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},P8e=({bridges:e})=>{const t=_.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return m.jsx(dt,{container:!0,spacing:2,children:t.map(n=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(I8e,{bridge:n})},n.id))})},Dw=_.createContext({}),IT=_.createContext({});function j8e(e){return Qe("MuiStep",e)}tt("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const $8e=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return et({root:["root",n,r&&"alternativeLabel",i&&"completed"]},j8e,t)},L8e=me("div",{name:"MuiStep",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({variants:[{props:{orientation:"horizontal"},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:"relative"}}]}),N8e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:c,expanded:u=!1,index:f,last:h,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=_.useContext(Dw);let[w=!1,A=!1,E=!1]=[i,l,c];y===f?w=i!==void 0?i:!0:!C&&y>f?A=l!==void 0?l:!0:!C&&y<f&&(E=c!==void 0?c:!0);const O=_.useMemo(()=>({index:f,last:h,expanded:u,icon:f+1,active:w,completed:A,disabled:E}),[f,h,u,w,A,E]),D={...r,active:w,orientation:S,alternativeLabel:v,completed:A,disabled:E,expanded:u,component:a},T=$8e(D),I=m.jsxs(L8e,{as:a,className:Oe(T.root,s),ref:n,ownerState:D,...g,children:[b&&v&&f!==0?b:null,o]});return m.jsx(IT.Provider,{value:O,children:b&&!v&&f!==0?m.jsxs(_.Fragment,{children:[b,I]}):I})}),F8e=_e(m.jsx("path",{d:"M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"})),B8e=_e(m.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function z8e(e){return Qe("MuiStepIcon",e)}const V7=tt("MuiStepIcon",["root","active","completed","error","text"]);var VB;const H8e=e=>{const{classes:t,active:n,completed:r,error:i}=e;return et({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},z8e,t)},W7=me(I4,{name:"MuiStepIcon",slot:"Root"})(Ge(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${V7.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${V7.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${V7.error}`]:{color:(e.vars||e).palette.error.main}}))),U8e=me("text",{name:"MuiStepIcon",slot:"Text"})(Ge(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),V8e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...c}=r,u={...r,active:i,completed:s,error:a},f=H8e(u);if(typeof l=="number"||typeof l=="string"){const h=Oe(o,f.root);return a?m.jsx(W7,{as:B8e,className:h,ref:n,ownerState:u,...c}):s?m.jsx(W7,{as:F8e,className:h,ref:n,ownerState:u,...c}):m.jsxs(W7,{className:h,ref:n,ownerState:u,...c,children:[VB||(VB=m.jsx("circle",{cx:"12",cy:"12",r:"12"})),m.jsx(U8e,{className:f.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:u,children:l})]})}return l});function W8e(e){return Qe("MuiStepLabel",e)}const Td=tt("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),q8e=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return et({root:["root",n,o&&"error",s&&"disabled",a&&"alternativeLabel"],label:["label",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],iconContainer:["iconContainer",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],labelContainer:["labelContainer",a&&"alternativeLabel"]},W8e,t)},G8e=me("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${Td.alternativeLabel}`]:{flexDirection:"column"},[`&.${Td.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),K8e=me("span",{name:"MuiStepLabel",slot:"Label"})(Ge(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${Td.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Td.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Td.alternativeLabel}`]:{marginTop:16},[`&.${Td.error}`]:{color:(e.vars||e).palette.error.main}}))),Y8e=me("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${Td.alternativeLabel}`]:{paddingRight:0}}),X8e=me("span",{name:"MuiStepLabel",slot:"LabelContainer"})(Ge(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${Td.alternativeLabel}`]:{textAlign:"center"}}))),AJ=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:c,slots:u={},slotProps:f={},StepIconComponent:h,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=_.useContext(Dw),{active:S,disabled:C,completed:w,icon:A}=_.useContext(IT),E=l||A;let O=h;E&&!O&&(O=V8e);const D={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=q8e(D),I={slots:u,slotProps:{stepIcon:g,...s,...f}},[F,L]=lt("root",{elementType:G8e,externalForwardedProps:{...I,...y},ownerState:D,ref:n,className:Oe(T.root,o)}),[R,$]=lt("label",{elementType:K8e,externalForwardedProps:I,ownerState:D}),[j,z]=lt("stepIcon",{elementType:O,externalForwardedProps:I,ownerState:D});return m.jsxs(F,{...L,children:[E||j?m.jsx(Y8e,{className:T.iconContainer,ownerState:D,children:m.jsx(j,{completed:w,active:S,error:a,icon:E,...z})}):null,m.jsxs(X8e,{className:T.labelContainer,ownerState:D,children:[i?m.jsx(R,{...$,className:Oe(T.label,$?.className),children:i}):null,c]})]})});AJ.muiName="StepLabel";function Z8e(e){return Qe("MuiStepper",e)}tt("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function J8e(e){return Qe("MuiStepConnector",e)}tt("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const Q8e=e=>{const{classes:t,orientation:n,alternativeLabel:r,active:i,completed:o,disabled:s}=e,a={root:["root",n,r&&"alternativeLabel",i&&"active",o&&"completed",s&&"disabled"],line:["line",`line${ye(n)}`]};return et(a,J8e,t)},e9e=me("div",{name:"MuiStepConnector",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({flex:"1 1 auto",variants:[{props:{orientation:"vertical"},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:"absolute",top:12,left:"calc(-50% + 20px)",right:"calc(50% + 20px)"}}]}),t9e=me("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ye(n.orientation)}`]]}})(Ge(({theme:e})=>{const t=e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[600];return{display:"block",borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:"horizontal"},style:{borderTopStyle:"solid",borderTopWidth:1}},{props:{orientation:"vertical"},style:{borderLeftStyle:"solid",borderLeftWidth:1,minHeight:24}}]}})),n9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=_.useContext(Dw),{active:l,disabled:c,completed:u}=_.useContext(IT),f={...r,alternativeLabel:s,orientation:a,active:l,completed:u,disabled:c},h=Q8e(f);return m.jsx(e9e,{className:Oe(h.root,i),ref:n,ownerState:f,...o,children:m.jsx(t9e,{className:h.line,ownerState:f})})}),r9e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return et({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},Z8e,i)},i9e=me("div",{name:"MuiStepper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.nonLinear&&t.nonLinear]}})({display:"flex",variants:[{props:{orientation:"horizontal"},style:{flexDirection:"row",alignItems:"center"}},{props:{orientation:"vertical"},style:{flexDirection:"column"}},{props:{alternativeLabel:!0},style:{alignItems:"flex-start"}}]}),o9e=m.jsx(n9e,{}),s9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:c=o9e,nonLinear:u=!1,orientation:f="horizontal",...h}=r,g={...r,nonLinear:u,alternativeLabel:o,orientation:f,component:l},y=r9e(g),b=_.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>_.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=_.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:c,nonLinear:u,orientation:f}),[i,o,c,u,f]);return m.jsx(Dw.Provider,{value:S,children:m.jsx(i9e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...h,children:v})})}),WB={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function kJ({selectedTemplate:e,onSelect:t}){return m.jsxs(ce,{children:[m.jsx(ie,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Choose a preset to pre-fill the bridge configuration with recommended settings. You can customize everything afterwards."}),m.jsx(dt,{container:!0,spacing:1.5,alignItems:"flex-start",children:TZ.map(n=>{const r=e===n.id;return m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(tr,{variant:"outlined",sx:{height:"100%",borderColor:r?"primary.main":"divider",borderWidth:r?2:1,bgcolor:r?"action.selected":"background.paper",transition:"all 0.15s ease"},children:m.jsx(Wm,{onClick:()=>t(r?null:n),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:m.jsxs(gr,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[m.jsx(ie,{fontSize:20,children:WB[n.icon]??WB.default}),m.jsx(ie,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&m.jsx(Mu,{color:"primary",sx:{fontSize:18}})]}),m.jsx(ie,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:r?"none":2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&m.jsx(Et,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&m.jsx(Et,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const q7=["Template","Bridge Info","Entity Filter","Feature Flags","Review & Create"],a9e=[{key:"autoComposedDevices",label:"Auto Compose Devices",description:"Combine related entities (battery, humidity, pressure, power, energy) from the same HA device into a single Matter endpoint."},{key:"autoForceSync",label:"Auto Force Sync",description:"Periodically push all device states to controllers. Recommended for Google Home and Alexa to prevent devices from going offline."},{key:"coverSwapOpenClose",label:"Invert Cover Direction",description:"Swap open/close direction for covers. Use this if your covers show the wrong position in Matter controllers."},{key:"includeHiddenEntities",label:"Include Hidden Entities",description:"Also expose entities that are marked as hidden in Home Assistant."}];function _J({open:e,onClose:t,onComplete:n}){const[r,i]=_.useState(0),[o,s]=_.useState(!1),[a,l]=_.useState(5540),[c,u]=_.useState([]),[f,h]=_.useState(),[g,y]=_.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[b,v]=_.useState(!0),[S,C]=_.useState("*"),[w,A]=_.useState(""),[E,O]=_.useState(null),D=_.useCallback(async()=>{try{const U=await fetch("api/matter/next-port");if(U.ok){const K=await U.json();l(K.port),y(B=>({...B,port:K.port}))}}catch{}},[]);_.useEffect(()=>{e&&(D(),i(0),u([]),h(void 0),y({name:"",port:a,serverMode:!1,filter:{include:[],exclude:[]}}),v(!0),C("*"),A(""),O(null))},[e,D,a]);const T=_.useCallback(U=>{if(h(U??void 0),U){y(q=>({...q,name:U.name,serverMode:U.featureFlags?.serverMode??!1,icon:U.icon,featureFlags:U.featureFlags,filter:{...U.filter}}));const K=U.filter.include;if(K.length>0)if(v(!1),U.featureFlags?.serverMode){const q=K.map(X=>X.type===Ar.Domain?`${X.value}.*`:X.value);C(q.join(", "))}else C(K.map(q=>q.value).join(", "));const B=U.filter.exclude;A(B.map(q=>q.value).join(", "))}else y(K=>({...K,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),v(!0),C("*"),A("")},[]),I=()=>{if(r===0&&O(null),r===1){if(!g.name.trim()){O("Please enter a bridge name");return}O(null)}if(r===2){let U,K;if(f&&!g.serverMode)U=[...f.filter.include],K=[...f.filter.exclude];else{const B=b?[S||"*"]:S.split(",").map(X=>X.trim()).filter(Boolean),q=w.split(",").map(X=>X.trim()).filter(Boolean);U=B.map(X=>({type:Ar.Pattern,value:X})),K=q.map(X=>({type:Ar.Pattern,value:X}))}y(B=>({...B,filter:{include:U,exclude:K}}))}i(U=>U+1)},F=()=>{i(U=>U-1),O(null)},L=async()=>{await R();const U=a+c.length+1;u(K=>[...K,g]),h(void 0),y({name:"",port:U,serverMode:!1,filter:{include:[],exclude:[]}}),i(0),v(!0),C("*"),A("")},R=async()=>{s(!0),O(null);try{const U={...g.featureFlags,...g.serverMode?{serverMode:!0}:{}},K=Object.keys(U).length>0,B={name:g.name,port:g.port,filter:g.filter,featureFlags:K?U:void 0,icon:g.icon};return await $X(B),!0}catch(U){return O(U instanceof Error?U.message:"Failed to create bridge"),!1}finally{s(!1)}},$=async()=>{await R()&&(n(),t())},j=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Choose a template to get started quickly, or skip to create a custom bridge."}),m.jsx(ce,{sx:{mt:2},children:m.jsx(kJ,{selectedTemplate:f?.id,onSelect:T})})]}),z=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:f?`Template "${f.name}" applied. Customize the name and port below.`:"Give your bridge a name and port."}),m.jsx(Lr,{fullWidth:!0,label:"Bridge Name",value:g.name,onChange:U=>y(K=>({...K,name:U.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!E,helperText:E}),m.jsx(Lr,{fullWidth:!0,label:"Port",type:"number",value:g.port,onChange:U=>y(K=>({...K,port:parseInt(U.target.value,10)||5540})),margin:"normal",helperText:"Automatically assigned to next available port"}),m.jsx(cn,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:m.jsx($s,{control:m.jsx(Wl,{checked:g.serverMode,onChange:U=>y(K=>({...K,serverMode:U.target.checked})),icon:m.jsx(U5,{}),checkedIcon:m.jsx(U5,{color:"primary"})}),label:"Server Mode (for Robot Vacuums)",sx:{mt:1}})}),g.serverMode&&m.jsxs(kn,{severity:"info",sx:{mt:1},children:[m.jsx("strong",{children:"Server Mode enabled:"})," This bridge will expose a single device as a standalone Matter device. Add only ONE device (e.g., your vacuum) to this bridge. This is required for Apple Home Siri commands and Alexa discovery."]}),c.length>0&&m.jsxs(ce,{sx:{mt:2},children:[m.jsxs(ie,{variant:"subtitle2",color:"text.secondary",children:["Bridges to create (",c.length,"):"]}),m.jsx(ce,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:c.map(U=>m.jsx(Et,{label:`${U.name} (:${U.port})`,size:"small"},U.port))})]})]}),N=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:f?`Filter is pre-configured from the "${f.name}" template. You can adjust it below.`:"Configure which entities should be included in this bridge."}),g.serverMode&&m.jsxs(kn,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",m.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",m.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!f&&m.jsx($s,{control:m.jsx(jh,{checked:b,onChange:U=>v(U.target.checked)}),label:"Include all entities (wildcard)"}),m.jsx(Lr,{fullWidth:!0,label:g.serverMode?"Entity ID":b&&!f?"Include Pattern":"Entity Filters",value:f&&!g.serverMode?f.filter.include.map(U=>`${U.type}:${U.value}`).join(", "):S,onChange:U=>C(U.target.value),margin:"normal",placeholder:b?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:g.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":f?"Pre-configured by template. Edit in the full editor after creation.":b?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!f&&!g.serverMode}),!f&&m.jsx(Lr,{fullWidth:!0,label:"Exclude Patterns (optional)",value:w,onChange:U=>A(U.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:"Patterns to exclude, comma-separated"})]}),W=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Configure optional feature flags for this bridge."}),a9e.map(U=>m.jsxs(ce,{sx:{mt:1},children:[m.jsx($s,{control:m.jsx(jh,{checked:g.featureFlags?.[U.key]===!0,onChange:K=>y(B=>({...B,featureFlags:{...B.featureFlags,[U.key]:K.target.checked}}))}),label:U.label}),m.jsx(ie,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:U.description})]},U.key))]}),H=()=>{const U=Object.entries(g.featureFlags??{}).filter(([,K])=>K===!0);return m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Review your bridge configuration:"}),m.jsx(tr,{variant:"outlined",sx:{mt:2},children:m.jsxs(gr,{children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(Ns,{}),m.jsx(ie,{variant:"h6",children:g.name})]}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Port: ",g.port]}),f&&m.jsx(Et,{label:`Template: ${f.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),g.serverMode&&m.jsx(Et,{icon:m.jsx(U5,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),U.length>0&&m.jsx(ce,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:U.filter(([K])=>K!=="serverMode").map(([K])=>m.jsx(Et,{label:K,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},K))}),m.jsxs(ie,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",g.filter.include.length>0?g.filter.include.map(K=>`${K.type}:${K.value}`).join(", "):S||"*"]}),E&&m.jsx(ie,{variant:"body2",color:"error",sx:{mt:1},children:E}),(w||g.filter.exclude.length>0)&&m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",g.filter.exclude.length>0?g.filter.exclude.map(K=>K.value).join(", "):w]})]})}),c.length>0&&m.jsx(ce,{sx:{mt:2},children:m.jsxs(ie,{variant:"subtitle2",children:[c.length," bridge(s) already created in this session"]})})]})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[m.jsx(Su,{children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(wb,{}),m.jsx("span",{children:"Bridge Setup Wizard"})]})}),m.jsxs(xu,{children:[m.jsx(s9e,{activeStep:r,sx:{mt:1},children:q7.map(U=>m.jsx(N8e,{children:m.jsx(AJ,{children:U})},U))}),r===0&&j(),r===1&&z(),r===2&&N(),r===3&&W(),r===4&&H()]}),m.jsxs(Xd,{sx:{px:3,pb:2},children:[m.jsx(kt,{onClick:t,disabled:o,children:"Cancel"}),m.jsx(ce,{sx:{flex:1}}),r>0&&m.jsx(kt,{onClick:F,startIcon:m.jsx($Ce,{}),disabled:o,children:"Back"}),r<q7.length-1&&m.jsx(kt,{variant:"contained",onClick:I,endIcon:m.jsx(NCe,{}),disabled:o,children:r===0&&!f?"Skip Template":"Next"}),r===q7.length-1&&m.jsxs(m.Fragment,{children:[m.jsx(kt,{variant:"outlined",onClick:L,startIcon:m.jsx(fc,{}),disabled:o,children:"Add Another"}),m.jsx(kt,{variant:"contained",onClick:$,startIcon:o?m.jsx(zr,{size:16}):m.jsx(VCe,{}),disabled:o,children:o?"Creating...":"Create Bridge"})]})]})]})}const l9e=()=>{const e=Tu(),t=Hs(),{content:n,isLoading:r,error:i}=Vm(),[o,s]=_.useState(null),[a,l]=_.useState(!1),[c,u]=_.useState(!1),[f,h]=_.useState(!1),g=_.useRef(null),y=_.useCallback(async()=>{try{await S8e()}catch(A){e.show({message:A instanceof Error?A.message:"Export failed",severity:"error"})}},[e]),b=_.useCallback(()=>{g.current?.click()},[]),v=_.useCallback(A=>{const E=A.target.files?.[0];E&&(s(E),l(!0)),A.target.value=""},[]),S=_.useCallback(()=>{l(!1),s(null)},[]),C=_.useCallback(()=>{t(Fo())},[t]),w=_.useCallback(async A=>{h(!0);try{const E={start:"Started",stop:"Stopped",restart:"Restarted"},D=await{start:FX,stop:BX,restart:zX}[A]();e.show({message:`${E[A]} ${D.count} bridge(s)`,severity:"success"}),t(Fo())}catch(E){e.show({message:E instanceof Error?E.message:`${A} failed`,severity:"error"})}finally{h(!1)}},[e,t]);return _.useEffect(()=>{i&&e.show({message:i.message??"Could not load bridges",severity:"error"})},[i,e]),m.jsxs(m.Fragment,{children:[m.jsx(ZO,{sx:A=>({zIndex:A.zIndex.drawer+1}),open:r||f,children:(r||f)&&m.jsx(zr,{color:"inherit"})}),m.jsx(zt,{spacing:4,children:n&&m.jsxs(m.Fragment,{children:[m.jsxs(ce,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[n.length>=1&&m.jsxs(m.Fragment,{children:[m.jsx(kt,{onClick:()=>w("start"),startIcon:m.jsx(xJ,{}),variant:"outlined",size:"small",color:"success",disabled:f,children:"Start All"}),m.jsx(kt,{onClick:()=>w("stop"),startIcon:m.jsx(CJ,{}),variant:"outlined",size:"small",color:"error",disabled:f,children:"Stop All"}),m.jsx(kt,{onClick:()=>w("restart"),startIcon:m.jsx(Qy,{}),variant:"outlined",size:"small",color:"warning",disabled:f,children:"Restart All"}),m.jsx(gi,{orientation:"vertical",flexItem:!0})]}),m.jsx(kt,{onClick:b,startIcon:m.jsx(QCe,{}),variant:"outlined",children:"Import"}),m.jsx(kt,{onClick:y,startIcon:m.jsx(b8e,{}),variant:"outlined",disabled:n.length===0,children:"Export All"}),m.jsx(kt,{onClick:()=>u(!0),startIcon:m.jsx(vJ,{}),variant:"outlined",children:"Wizard"}),m.jsx(kt,{component:Du,to:Pt.createBridge,endIcon:m.jsx(fc,{}),variant:"outlined",children:"Create new bridge"}),m.jsx("input",{type:"file",ref:g,onChange:v,accept:".json",style:{display:"none"}})]}),m.jsx(P8e,{bridges:n})]})}),m.jsx(A8e,{open:a,file:o,onClose:S,onImported:C}),m.jsx(_J,{open:c,onClose:()=>u(!1),onComplete:()=>t(Fo())})]})},c9e=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function $x({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=m.jsx(gr,{sx:{py:2,"&:last-child":{pb:2}},children:m.jsxs(ce,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[m.jsx(rl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),m.jsxs(ce,{sx:{minWidth:0},children:[m.jsx(ie,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),m.jsx(ie,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&m.jsx(ie,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return m.jsx(tr,{variant:"outlined",sx:{height:"100%"},children:o?m.jsx(Wm,{onClick:o,sx:{height:"100%"},children:s}):s})}function u9e({bridge:e,onClick:t}){const{content:n}=Vm(),r=n?.find(a=>a.id===e.id),[i,o]=_.useState(!1);_.useEffect(()=>{_w(e.id).then(o)},[e.id]);const s=e.status==="running"?"success":e.status==="failed"?"error":"default";return m.jsx(tr,{variant:"outlined",children:m.jsx(Wm,{onClick:t,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1.5,children:[i?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):r&&m.jsx(rl,{sx:{bgcolor:RT(r),width:36,height:36},children:(()=>{const a=MT(r);return m.jsx(a,{sx:{fontSize:20}})})()}),m.jsxs(ce,{flex:1,minWidth:0,children:[m.jsx(ie,{variant:"subtitle2",noWrap:!0,children:e.name}),m.jsxs(zt,{direction:"row",spacing:.5,alignItems:"center",children:[m.jsx(Et,{label:e.status,size:"small",color:s,sx:{height:18,fontSize:"0.65rem"}}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:[e.deviceCount," devices"]}),e.fabricCount>0&&m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," fabrics"]})]})]}),e.failedEntityCount>0&&m.jsx(Et,{icon:m.jsx(iw,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function sd({title:e,icon:t,onClick:n}){return m.jsx(tr,{variant:"outlined",children:m.jsx(Wm,{onClick:n,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1.5,children:[m.jsx(rl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),m.jsx(ie,{variant:"subtitle2",children:e})]})})})})}const d9e=()=>{const e=hf(),t=Hs(),[n,r]=_.useState(null),[i,o]=_.useState(!0),[s,a]=_.useState(!1),[l,c]=_.useState(!1),u=_.useRef(!1),f=_.useCallback(async()=>{try{const S=await fetch("/api/health/detailed");S.ok&&r(await S.json())}catch{}finally{o(!1)}},[]);_.useEffect(()=>{f();const S=setInterval(f,15e3);return()=>clearInterval(S)},[f]);const h=_.useMemo(()=>n?.bridgeDetails.reduce((S,C)=>S+C.deviceCount,0)??0,[n]),g=_.useMemo(()=>n?.bridgeDetails?n.bridgeDetails.reduce((S,C)=>S+C.fabricCount,0):0,[n]),y=_.useMemo(()=>n?.bridgeDetails.reduce((S,C)=>S+C.failedEntityCount,0)??0,[n]);if(i)return m.jsx(ce,{display:"flex",justifyContent:"center",p:8,children:m.jsx(zr,{})});const b=n?.services.bridges,v=n?.services.homeAssistant.connected??!1;return m.jsxs(ce,{sx:{p:2},children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,mb:3,children:[m.jsx(ET,{color:"primary",fontSize:"large"}),m.jsx(ie,{variant:"h5",fontWeight:600,children:"Dashboard"})]}),m.jsxs(dt,{container:!0,spacing:2,sx:{mb:3},children:[m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Bridges",value:b?.total??0,icon:m.jsx(t6,{}),color:"#4caf50",subtitle:b?`${b.running} running${b.failed>0?` · ${b.failed} failed`:""}`:void 0,onClick:()=>e(Pt.bridges)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Devices",value:h,icon:m.jsx(Ns,{}),color:"#2196f3",subtitle:y>0?`${y} failed`:void 0,onClick:()=>e(Pt.devices)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Fabrics",value:g,icon:m.jsx(Jy,{}),color:"#9c27b0",onClick:()=>e(Pt.networkMap)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"HA Connection",value:v?"Online":"Offline",icon:v?m.jsx(Mu,{}):m.jsx(vf,{}),color:v?"#4caf50":"#f44336",subtitle:n?.uptime!=null?`Uptime ${c9e(n.uptime)}`:void 0})})]}),m.jsx(gi,{sx:{mb:3}}),m.jsx(ce,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:m.jsx(ie,{variant:"h6",children:"Bridges"})}),m.jsxs(zt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[m.jsx(kt,{variant:"contained",startIcon:m.jsx(vJ,{}),onClick:()=>a(!0),size:"large",children:"Bridge Wizard"}),m.jsx(kt,{variant:"outlined",startIcon:m.jsx(fc,{}),onClick:()=>e(Pt.createBridge),size:"large",children:"Create Bridge"}),m.jsx(gi,{orientation:"vertical",flexItem:!0}),m.jsx(kt,{variant:"outlined",color:"success",startIcon:m.jsx(xJ,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await FX(),await f()}finally{c(!1),u.current=!1}}},children:"Start All"}),m.jsx(kt,{variant:"outlined",color:"error",startIcon:m.jsx(CJ,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await BX(),await f()}finally{c(!1),u.current=!1}}},children:"Stop All"}),m.jsx(kt,{variant:"outlined",color:"warning",startIcon:m.jsx(Qy,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await zX(),await f()}finally{c(!1),u.current=!1}}},children:"Restart All"})]}),n?.bridgeDetails&&n.bridgeDetails.length>0?m.jsx(dt,{container:!0,spacing:1.5,children:[...n.bridgeDetails].sort((S,C)=>S.name.localeCompare(C.name,void 0,{sensitivity:"base"})).map(S=>m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(u9e,{bridge:S,onClick:()=>e(Pt.bridge(S.id))})},S.id))}):m.jsx(tr,{variant:"outlined",children:m.jsx(gr,{sx:{textAlign:"center",py:4},children:m.jsx(ie,{color:"text.secondary",children:"No bridges configured yet. Use the Bridge Wizard or create one manually."})})}),m.jsx(gi,{sx:{my:3}}),m.jsx(ie,{variant:"h6",sx:{mb:2},children:"Quick Navigation"}),m.jsxs(dt,{container:!0,spacing:1.5,children:[m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Bridges",icon:m.jsx(t6,{sx:{fontSize:20}}),onClick:()=>e(Pt.bridges)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"All Devices",icon:m.jsx(Ns,{sx:{fontSize:20}}),onClick:()=>e(Pt.devices)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Network Map",icon:m.jsx(vT,{sx:{fontSize:20}}),onClick:()=>e(Pt.networkMap)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Health Dashboard",icon:m.jsx(eT,{sx:{fontSize:20}}),onClick:()=>e(Pt.health)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Startup Order",icon:m.jsx(yb,{sx:{fontSize:20}}),onClick:()=>e(Pt.startup)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Lock Credentials",icon:m.jsx(uu,{sx:{fontSize:20}}),onClick:()=>e(Pt.lockCredentials)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Filter Reference",icon:m.jsx(AT,{sx:{fontSize:20}}),onClick:()=>e(Pt.labels)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Settings",icon:m.jsx(wb,{sx:{fontSize:20}}),onClick:()=>e(Pt.settings)})})]}),m.jsx(_J,{open:s,onClose:()=>a(!1),onComplete:()=>{t(Fo()),f()}})]})};function f9e(e){return Qe("MuiPagination",e)}tt("MuiPagination",["root","ul","outlined","text"]);function h9e(e={}){const{boundaryCount:t=1,componentName:n="usePagination",count:r=1,defaultPage:i=1,disabled:o=!1,hideNextButton:s=!1,hidePrevButton:a=!1,onChange:l,page:c,showFirstButton:u=!1,showLastButton:f=!1,siblingCount:h=1,...g}=e,[y,b]=Ya({controlled:c,default:i,name:n,state:"page"}),v=(I,F)=>{c||b(F),l&&l(I,F)},S=(I,F)=>{const L=F-I+1;return Array.from({length:L},(R,$)=>I+$)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),A=Math.max(Math.min(y-h,r-t-h*2-1),t+2),E=Math.min(Math.max(y+h,t+h*2+2),r-t-1),O=[...u?["first"]:[],...a?[]:["previous"],...C,...A>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(A,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...f?["last"]:[]],D=I=>{switch(I){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:O.map(I=>typeof I=="number"?{onClick:F=>{v(F,I)},type:"page",page:I,selected:I===y,disabled:o,"aria-current":I===y?"page":void 0}:{onClick:F=>{v(F,D(I))},type:I,page:D(I),selected:!1,disabled:o||!I.includes("ellipsis")&&(I==="next"||I==="last"?y>=r:y<=1)}),...g}}function p9e(e){return Qe("MuiPaginationItem",e)}const Mo=tt("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),m9e=_e(m.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),g9e=_e(m.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),y9e=_e(m.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),b9e=_e(m.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),DJ=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ye(n.size)}`],n.variant==="text"&&t[`text${ye(n.color)}`],n.variant==="outlined"&&t[`outlined${ye(n.color)}`],n.shape==="rounded"&&t.rounded,n.type==="page"&&t.page,(n.type==="start-ellipsis"||n.type==="end-ellipsis")&&t.ellipsis,(n.type==="previous"||n.type==="next")&&t.previousNext,(n.type==="first"||n.type==="last")&&t.firstLast]},v9e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,c={root:["root",`size${ye(o)}`,l,s,n!=="standard"&&`color${ye(n)}`,n!=="standard"&&`${l}${ye(n)}`,r&&"disabled",i&&"selected",{page:"page",first:"firstLast",last:"firstLast","start-ellipsis":"ellipsis","end-ellipsis":"ellipsis",previous:"previousNext",next:"previousNext"}[a]],icon:["icon"]};return et(c,p9e,t)},x9e=me("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:DJ})(Ge(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,height:"auto",[`&.${Mo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),S9e=me(ba,{name:"MuiPaginationItem",slot:"Root",overridesResolver:DJ})(Ge(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,height:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,[`&.${Mo.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Mo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},transition:e.transitions.create(["color","background-color"],{duration:e.transitions.duration.short}),"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Mo.selected}`]:{backgroundColor:(e.vars||e).palette.action.selected,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Mo.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Mo.disabled}`]:{opacity:1,color:(e.vars||e).palette.action.disabled,backgroundColor:(e.vars||e).palette.action.selected}},variants:[{props:{size:"small"},style:{minWidth:26,height:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,height:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}},{props:{shape:"rounded"},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:{variant:"outlined"},style:{border:e.vars?`1px solid ${e.alpha(e.vars.palette.common.onBackground,.23)}`:`1px solid ${e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${Mo.selected}`]:{[`&.${Mo.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Mo.selected}`]:{[`&.${Mo.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Fn(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Mo.selected}`]:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}},[`&.${Mo.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Mo.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Fn(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Mo.selected}`]:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.5)}`,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.activatedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Mo.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),w9e=me("div",{name:"MuiPaginationItem",slot:"Icon"})(Ge(({theme:e})=>({fontSize:e.typography.pxToRem(20),margin:"0 -8px",variants:[{props:{size:"small"},style:{fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:e.typography.pxToRem(22)}}]}))),C9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:c,selected:u=!1,shape:f="circular",size:h="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:u,shape:f,size:h,type:b,variant:v},w=mf(),A=v9e(C),E={slots:{previous:g.previous??a.previous,next:g.next??a.next,first:g.first??a.first,last:g.last??a.last},slotProps:y},[O,D]=lt("previous",{elementType:y9e,externalForwardedProps:E,ownerState:C}),[T,I]=lt("next",{elementType:b9e,externalForwardedProps:E,ownerState:C}),[F,L]=lt("first",{elementType:m9e,externalForwardedProps:E,ownerState:C}),[R,$]=lt("last",{elementType:g9e,externalForwardedProps:E,ownerState:C}),j=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:O,next:T,first:F,last:R}[j],N={previous:D,next:I,first:L,last:$}[j];return b==="start-ellipsis"||b==="end-ellipsis"?m.jsx(x9e,{ref:n,ownerState:C,className:Oe(A.root,i),children:"…"}):m.jsxs(S9e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(A.root,i),...S,children:[b==="page"&&c,z?m.jsx(w9e,{...N,className:A.icon,as:z}):null]})}),E9e=e=>{const{classes:t,variant:n}=e;return et({root:["root",n],ul:["ul"]},f9e,t)},A9e=me("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),k9e=me("ul",{name:"MuiPagination",slot:"Ul"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"});function _9e(e,t,n){return e==="page"?`${n?"":"Go to "}page ${t}`:`Go to ${e} page`}const D9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:c=!1,getItemAriaLabel:u=_9e,hideNextButton:f=!1,hidePrevButton:h=!1,onChange:g,page:y,renderItem:b=F=>m.jsx(C9e,{...F}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:A="medium",variant:E="text",...O}=r,{items:D}=h9e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:c,getItemAriaLabel:u,hideNextButton:f,hidePrevButton:h,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:A,variant:E},I=E9e(T);return m.jsx(A9e,{"aria-label":"pagination navigation",className:Oe(I.root,o),ownerState:T,ref:n,...O,children:m.jsx(k9e,{className:I.ul,ownerState:T,children:D.map((F,L)=>m.jsx("li",{children:b({...F,color:s,"aria-label":u(F.type,F.page,F.selected),shape:v,size:A,variant:E})},L))})})}),qB=[10,25,50,100],GB="hamh-devices-page-size",O9e=()=>{const e=Hs(),{content:t,isLoading:n}=Vm(),[r,i]=_.useState(""),[o,s]=_.useState(""),[a,l]=_.useState(""),[c,u]=_.useState("name"),[f,h]=_.useState("asc"),[g,y]=_.useState(1),[b,v]=_.useState(()=>{const Z=localStorage.getItem(GB);if(!Z)return 12;if(Z==="all")return 0;const re=parseInt(Z,10);return re>0?re:12}),[S,C]=_.useState(""),w=_.useCallback(Z=>{v(Z),localStorage.setItem(GB,Z===0?"all":String(Z)),y(1)},[]),[A,E]=_.useState(!1),[O,D]=_.useState(""),[T,I]=_.useState(""),[F,L]=_.useState(),[R,$]=_.useState({open:!1,message:"",severity:"success"});_.useEffect(()=>{e(Fo())},[e]),_.useEffect(()=>{t&&t.forEach(Z=>{e(du(Z.id))})},[e,t]);const j=Hm(Z=>Z.devices.byBridge),z=_.useCallback((Z,re,oe)=>{const de=[];if(!Z.parts||Z.parts.length===0)Z.endpoint!==0&&de.push({bridgeId:re,bridgeName:oe,endpoint:Z});else for(const be of Z.parts)de.push(...z(be,re,oe));return de},[]),N=_.useMemo(()=>{const Z=[];return(t||[]).forEach(re=>{const de=j[re.id]?.content;de&&Z.push(...z(de,re.id,re.name))}),Z},[t,j,z]),[W,H]=_.useState({}),U=_.useMemo(()=>{const Z=[];for(const re of N){const de=re.endpoint.state.homeAssistantEntity?.entity?.entity_id;de&&Z.push(de)}return Z},[N]),K=_.useCallback(()=>{U.length!==0&&qZ(U).then(H).catch(()=>{})},[U]);_.useEffect(()=>{K()},[K]);const B=_.useCallback(()=>{K()},[K]),q=n||t&&t.length>0&&N.length===0,X=_.useMemo(()=>N.filter(Z=>{const re=Is(Z.endpoint.state)??Z.endpoint.id.local,oe=Z.endpoint.type.name,de=re.toLowerCase().includes(r.toLowerCase())||Z.bridgeName.toLowerCase().includes(r.toLowerCase())||oe.toLowerCase().includes(r.toLowerCase()),be=!o||Z.bridgeId===o;return de&&be&&(!a||oe===a)}),[N,r,o,a]),V=_.useMemo(()=>[...X].sort((re,oe)=>{const de=Is(re.endpoint.state)??re.endpoint.id.local,be=Is(oe.endpoint.state)??oe.endpoint.id.local;let je=0;switch(c){case"name":je=de.localeCompare(be);break;case"type":je=re.endpoint.type.name.localeCompare(oe.endpoint.type.name),je===0&&(je=de.localeCompare(be));break;case"bridge":je=re.bridgeName.localeCompare(oe.bridgeName),je===0&&(je=de.localeCompare(be));break}return f==="asc"?je:-je}),[X,c,f]),Y=b===0?1:Math.ceil(V.length/b),J=b===0?V:V.slice((g-1)*b,g*b),ne=_.useMemo(()=>{const Z=new Set(N.map(re=>re.endpoint.type.name));return Array.from(Z).sort()},[N]),ee=_.useMemo(()=>t?[...t].sort((Z,re)=>{const oe=Z.name.localeCompare(re.name);return f==="asc"?oe:-oe}):[],[t,f]),se=_.useCallback(()=>{e(Fo())},[e]),ue=_.useCallback(async(Z,re)=>{D(Z),I(re);try{const de=(await cT(re)).mappings.find(be=>be.entityId===Z);L(de)}catch{L(void 0)}E(!0)},[]),te=_.useCallback(async Z=>{if(!(!T||!O))try{await uT(T,O,Z),$({open:!0,message:`Mapping saved for ${O}. Restart the bridge to apply changes.`,severity:"success"}),E(!1)}catch(re){$({open:!0,message:`Failed to save mapping: ${re}`,severity:"error"})}},[T,O]);return q?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(zr,{})}):m.jsxs(ce,{sx:{p:2},children:[m.jsxs(ie,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[m.jsx(Ns,{}),"All Devices",m.jsx(kt,{variant:"outlined",startIcon:m.jsx(_T,{}),onClick:se,sx:{ml:"auto"},children:"Refresh"})]}),m.jsx(tr,{sx:{mb:3},children:m.jsx(gr,{children:m.jsxs(zt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[m.jsx(Lr,{label:"Search devices...",value:r,onChange:Z=>i(Z.target.value),sx:{flexGrow:1}}),m.jsxs(pa,{sx:{minWidth:200},children:[m.jsx(sc,{children:"Bridge"}),m.jsxs(sa,{value:o,label:"Bridge",onChange:Z=>s(Z.target.value),children:[m.jsx(er,{value:"",children:"All Bridges"}),ee.map(Z=>m.jsx(er,{value:Z.id,children:Z.name},Z.id))]})]}),m.jsxs(pa,{sx:{minWidth:200},children:[m.jsx(sc,{children:"Device Type"}),m.jsxs(sa,{value:a,label:"Device Type",onChange:Z=>l(Z.target.value),children:[m.jsx(er,{value:"",children:"All Types"}),ne.map(Z=>m.jsx(er,{value:Z,children:Z},Z))]})]}),m.jsxs(pa,{sx:{minWidth:150},children:[m.jsx(sc,{children:"Sort By"}),m.jsxs(sa,{value:c,label:"Sort By",onChange:Z=>u(Z.target.value),children:[m.jsx(er,{value:"bridge",children:"Bridge"}),m.jsx(er,{value:"type",children:"Device Type"}),m.jsx(er,{value:"name",children:"Name"})]})]}),m.jsx(cn,{title:f==="asc"?"Ascending":"Descending",children:m.jsx(_n,{onClick:()=>h(Z=>Z==="asc"?"desc":"asc"),color:"primary",children:f==="asc"?m.jsx(ST,{}):m.jsx(xT,{})})})]})})}),m.jsx(dt,{container:!0,spacing:2,children:J.map(Z=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(KZ,{endpoint:Z.endpoint,bridgeName:Z.bridgeName,bridgeId:Z.bridgeId,onEditMapping:ue,imageInfo:W[Z.endpoint.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:B})},`${Z.bridgeId}-${Z.endpoint.id.global}`))}),m.jsxs(ce,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[m.jsxs(zt,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),m.jsxs(sa,{value:b===0?"all":qB.includes(b)?String(b):"",onChange:Z=>{const re=Z.target.value;C(""),w(re==="all"?0:parseInt(re,10))},displayEmpty:!0,renderValue:Z=>Z==="all"?"All":Z===""?String(b):Z,size:"small",sx:{minWidth:80},children:[qB.map(Z=>m.jsx(er,{value:String(Z),children:Z},Z)),m.jsx(er,{value:"all",children:"All"})]}),m.jsx(Lr,{size:"small",type:"number",placeholder:"Custom",value:S,onChange:Z=>C(Z.target.value),onBlur:()=>{const Z=parseInt(S,10);Z>0&&w(Z),C("")},onKeyDown:Z=>{if(Z.key==="Enter"){const re=parseInt(S,10);re>0&&w(re),C("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),Y>1&&m.jsx(D9e,{count:Y,page:g,onChange:(Z,re)=>y(re),color:"primary"}),m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:X.length===N.length?`${N.length} device${N.length!==1?"s":""}`:`${X.length} of ${N.length} devices`})]}),X.length===0&&m.jsxs(ce,{sx:{textAlign:"center",py:8},children:[m.jsx(ie,{variant:"h6",color:"text.secondary",children:"No devices found"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),m.jsx(fT,{open:A,entityId:O,domain:O.split(".")[0]||"",currentMapping:F,onSave:te,onClose:()=>E(!1)}),m.jsx(jO,{open:R.open,autoHideDuration:6e3,onClose:()=>$(Z=>({...Z,open:!1})),children:m.jsx(kn,{onClose:()=>$(Z=>({...Z,open:!1})),severity:R.severity,sx:{width:"100%"},children:R.message})})]})};function hn(e){return typeof e!="object"||e===null||typeof e.lastModified=="number"&&typeof File<"u"&&e instanceof File||typeof e.getMonth=="function"&&typeof Date<"u"&&e instanceof Date?!1:!Array.isArray(e)}function T9e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),hn(e.additionalItems)}function KB(e){if(e==="")return;if(e===null)return null;if(/\.$/.test(e)||/\.0$/.test(e)||/\.\d*0$/.test(e))return e;const t=Number(e);return typeof t=="number"&&!Number.isNaN(t)?t:e}const fu="__additional_property",n2="additionalProperties",wu="allOf",Pn="anyOf",Sa="const",Ow="default",PT="dependencies",M9e="enum",po="__errors",pr="$id",jT="if",$h="items",R9e="_$junk_option_schema_id$_",W5="$name",nn="oneOf",Jk="patternProperties",Un="properties",G7="readonly",OJ="required",r6="submitButtonOptions",mr="$ref",U1="$schema",TJ="root",MJ="_",I9e=["discriminator","propertyName"],YB="formContext",P9e="layoutGridLookupMap",$T="__rjsf_additionalProperties",RJ="__rjsf_rootSchema",j9e="ui:field",LT="ui:widget",$d="ui:options",Qk="ui:globalOptions",$9e="ui:definitions",L9e="https://json-schema.org/draft/2019-09/schema",q5="https://json-schema.org/draft/2020-12/schema";function $t(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===LT&&hn(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===$d&&hn(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function IJ(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=$t(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var PJ=typeof global=="object"&&global&&global.Object===Object&&global,N9e=typeof self=="object"&&self&&self.Object===Object&&self,vc=PJ||N9e||Function("return this")(),wa=vc.Symbol,jJ=Object.prototype,F9e=jJ.hasOwnProperty,B9e=jJ.toString,y1=wa?wa.toStringTag:void 0;function z9e(e){var t=F9e.call(e,y1),n=e[y1];try{e[y1]=void 0;var r=!0}catch{}var i=B9e.call(e);return r&&(t?e[y1]=n:delete e[y1]),i}var H9e=Object.prototype,U9e=H9e.toString;function V9e(e){return U9e.call(e)}var W9e="[object Null]",q9e="[object Undefined]",XB=wa?wa.toStringTag:void 0;function Ru(e){return e==null?e===void 0?q9e:W9e:XB&&XB in Object(e)?z9e(e):V9e(e)}function $J(e,t){return function(n){return e(t(n))}}var Tw=$J(Object.getPrototypeOf,Object);function Ca(e){return e!=null&&typeof e=="object"}var G9e="[object Object]",K9e=Function.prototype,Y9e=Object.prototype,LJ=K9e.toString,X9e=Y9e.hasOwnProperty,Z9e=LJ.call(Object);function Jd(e){if(!Ca(e)||Ru(e)!=G9e)return!1;var t=Tw(e);if(t===null)return!0;var n=X9e.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&LJ.call(n)==Z9e}function e_(e){const t={[po]:[],addError(n){this[po].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:e_(r)}),t);if(Jd(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:e_(n[i])}),t)}return t}function J9e(){this.__data__=[],this.size=0}function Cb(e,t){return e===t||e!==e&&t!==t}function Mw(e,t){for(var n=e.length;n--;)if(Cb(e[n][0],t))return n;return-1}var Q9e=Array.prototype,e7e=Q9e.splice;function t7e(e){var t=this.__data__,n=Mw(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():e7e.call(t,n,1),--this.size,!0}function n7e(e){var t=this.__data__,n=Mw(t,e);return n<0?void 0:t[n][1]}function r7e(e){return Mw(this.__data__,e)>-1}function i7e(e,t){var n=this.__data__,r=Mw(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Iu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Iu.prototype.clear=J9e;Iu.prototype.delete=t7e;Iu.prototype.get=n7e;Iu.prototype.has=r7e;Iu.prototype.set=i7e;function o7e(){this.__data__=new Iu,this.size=0}function s7e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function a7e(e){return this.__data__.get(e)}function l7e(e){return this.__data__.has(e)}function Bn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var c7e="[object AsyncFunction]",u7e="[object Function]",d7e="[object GeneratorFunction]",f7e="[object Proxy]";function Eb(e){if(!Bn(e))return!1;var t=Ru(e);return t==u7e||t==d7e||t==c7e||t==f7e}var K7=vc["__core-js_shared__"],ZB=(function(){var e=/[^.]+$/.exec(K7&&K7.keys&&K7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function h7e(e){return!!ZB&&ZB in e}var p7e=Function.prototype,m7e=p7e.toString;function ep(e){if(e!=null){try{return m7e.call(e)}catch{}try{return e+""}catch{}}return""}var g7e=/[\\^$.*+?()[\]{}|]/g,y7e=/^\[object .+?Constructor\]$/,b7e=Function.prototype,v7e=Object.prototype,x7e=b7e.toString,S7e=v7e.hasOwnProperty,w7e=RegExp("^"+x7e.call(S7e).replace(g7e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function C7e(e){if(!Bn(e)||h7e(e))return!1;var t=Eb(e)?w7e:y7e;return t.test(ep(e))}function E7e(e,t){return e?.[t]}function tp(e,t){var n=E7e(e,t);return C7e(n)?n:void 0}var r2=tp(vc,"Map"),i2=tp(Object,"create");function A7e(){this.__data__=i2?i2(null):{},this.size=0}function k7e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _7e="__lodash_hash_undefined__",D7e=Object.prototype,O7e=D7e.hasOwnProperty;function T7e(e){var t=this.__data__;if(i2){var n=t[e];return n===_7e?void 0:n}return O7e.call(t,e)?t[e]:void 0}var M7e=Object.prototype,R7e=M7e.hasOwnProperty;function I7e(e){var t=this.__data__;return i2?t[e]!==void 0:R7e.call(t,e)}var P7e="__lodash_hash_undefined__";function j7e(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=i2&&t===void 0?P7e:t,this}function Lh(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Lh.prototype.clear=A7e;Lh.prototype.delete=k7e;Lh.prototype.get=T7e;Lh.prototype.has=I7e;Lh.prototype.set=j7e;function $7e(){this.size=0,this.__data__={hash:new Lh,map:new(r2||Iu),string:new Lh}}function L7e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Rw(e,t){var n=e.__data__;return L7e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function N7e(e){var t=Rw(this,e).delete(e);return this.size-=t?1:0,t}function F7e(e){return Rw(this,e).get(e)}function B7e(e){return Rw(this,e).has(e)}function z7e(e,t){var n=Rw(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Pu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pu.prototype.clear=$7e;Pu.prototype.delete=N7e;Pu.prototype.get=F7e;Pu.prototype.has=B7e;Pu.prototype.set=z7e;var H7e=200;function U7e(e,t){var n=this.__data__;if(n instanceof Iu){var r=n.__data__;if(!r2||r.length<H7e-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pu(r)}return n.set(e,t),this.size=n.size,this}function Ja(e){var t=this.__data__=new Iu(e);this.size=t.size}Ja.prototype.clear=o7e;Ja.prototype.delete=s7e;Ja.prototype.get=a7e;Ja.prototype.has=l7e;Ja.prototype.set=U7e;var V7e="__lodash_hash_undefined__";function W7e(e){return this.__data__.set(e,V7e),this}function q7e(e){return this.__data__.has(e)}function Nh(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Pu;++t<n;)this.add(e[t])}Nh.prototype.add=Nh.prototype.push=W7e;Nh.prototype.has=q7e;function G7e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function o2(e,t){return e.has(t)}var K7e=1,Y7e=2;function NJ(e,t,n,r,i,o){var s=n&K7e,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var f=-1,h=!0,g=n&Y7e?new Nh:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var y=e[f],b=t[f];if(r)var v=s?r(b,y,f,t,e,o):r(y,b,f,e,t,o);if(v!==void 0){if(v)continue;h=!1;break}if(g){if(!G7e(t,function(S,C){if(!o2(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){h=!1;break}}else if(!(y===b||i(y,b,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var i6=vc.Uint8Array;function X7e(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function NT(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Z7e=1,J7e=2,Q7e="[object Boolean]",eEe="[object Date]",tEe="[object Error]",nEe="[object Map]",rEe="[object Number]",iEe="[object RegExp]",oEe="[object Set]",sEe="[object String]",aEe="[object Symbol]",lEe="[object ArrayBuffer]",cEe="[object DataView]",JB=wa?wa.prototype:void 0,Y7=JB?JB.valueOf:void 0;function uEe(e,t,n,r,i,o,s){switch(n){case cEe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case lEe:return!(e.byteLength!=t.byteLength||!o(new i6(e),new i6(t)));case Q7e:case eEe:case rEe:return Cb(+e,+t);case tEe:return e.name==t.name&&e.message==t.message;case iEe:case sEe:return e==t+"";case nEe:var a=X7e;case oEe:var l=r&Z7e;if(a||(a=NT),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=J7e,s.set(e,t);var u=NJ(a(e),a(t),r,i,o,s);return s.delete(e),u;case aEe:if(Y7)return Y7.call(e)==Y7.call(t)}return!1}function FT(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Fi=Array.isArray;function FJ(e,t,n){var r=t(e);return Fi(e)?r:FT(r,n(e))}function dEe(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function BJ(){return[]}var fEe=Object.prototype,hEe=fEe.propertyIsEnumerable,QB=Object.getOwnPropertySymbols,BT=QB?function(e){return e==null?[]:(e=Object(e),dEe(QB(e),function(t){return hEe.call(e,t)}))}:BJ;function zJ(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var pEe="[object Arguments]";function ez(e){return Ca(e)&&Ru(e)==pEe}var HJ=Object.prototype,mEe=HJ.hasOwnProperty,gEe=HJ.propertyIsEnumerable,hm=ez((function(){return arguments})())?ez:function(e){return Ca(e)&&mEe.call(e,"callee")&&!gEe.call(e,"callee")};function yEe(){return!1}var UJ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tz=UJ&&typeof module=="object"&&module&&!module.nodeType&&module,bEe=tz&&tz.exports===UJ,nz=bEe?vc.Buffer:void 0,vEe=nz?nz.isBuffer:void 0,Fh=vEe||yEe,xEe=9007199254740991,SEe=/^(?:0|[1-9]\d*)$/;function Iw(e,t){var n=typeof e;return t=t??xEe,!!t&&(n=="number"||n!="symbol"&&SEe.test(e))&&e>-1&&e%1==0&&e<t}var wEe=9007199254740991;function zT(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=wEe}var CEe="[object Arguments]",EEe="[object Array]",AEe="[object Boolean]",kEe="[object Date]",_Ee="[object Error]",DEe="[object Function]",OEe="[object Map]",TEe="[object Number]",MEe="[object Object]",REe="[object RegExp]",IEe="[object Set]",PEe="[object String]",jEe="[object WeakMap]",$Ee="[object ArrayBuffer]",LEe="[object DataView]",NEe="[object Float32Array]",FEe="[object Float64Array]",BEe="[object Int8Array]",zEe="[object Int16Array]",HEe="[object Int32Array]",UEe="[object Uint8Array]",VEe="[object Uint8ClampedArray]",WEe="[object Uint16Array]",qEe="[object Uint32Array]",$r={};$r[NEe]=$r[FEe]=$r[BEe]=$r[zEe]=$r[HEe]=$r[UEe]=$r[VEe]=$r[WEe]=$r[qEe]=!0;$r[CEe]=$r[EEe]=$r[$Ee]=$r[AEe]=$r[LEe]=$r[kEe]=$r[_Ee]=$r[DEe]=$r[OEe]=$r[TEe]=$r[MEe]=$r[REe]=$r[IEe]=$r[PEe]=$r[jEe]=!1;function GEe(e){return Ca(e)&&zT(e.length)&&!!$r[Ru(e)]}function HT(e){return function(t){return e(t)}}var VJ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fy=VJ&&typeof module=="object"&&module&&!module.nodeType&&module,KEe=fy&&fy.exports===VJ,X7=KEe&&PJ.process,pm=(function(){try{var e=fy&&fy.require&&fy.require("util").types;return e||X7&&X7.binding&&X7.binding("util")}catch{}})(),rz=pm&&pm.isTypedArray,Ab=rz?HT(rz):GEe,YEe=Object.prototype,XEe=YEe.hasOwnProperty;function WJ(e,t){var n=Fi(e),r=!n&&hm(e),i=!n&&!r&&Fh(e),o=!n&&!r&&!i&&Ab(e),s=n||r||i||o,a=s?zJ(e.length,String):[],l=a.length;for(var c in e)(t||XEe.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Iw(c,l)))&&a.push(c);return a}var ZEe=Object.prototype;function Pw(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ZEe;return e===n}var JEe=$J(Object.keys,Object),QEe=Object.prototype,eAe=QEe.hasOwnProperty;function qJ(e){if(!Pw(e))return JEe(e);var t=[];for(var n in Object(e))eAe.call(e,n)&&n!="constructor"&&t.push(n);return t}function np(e){return e!=null&&zT(e.length)&&!Eb(e)}function za(e){return np(e)?WJ(e):qJ(e)}function t_(e){return FJ(e,za,BT)}var tAe=1,nAe=Object.prototype,rAe=nAe.hasOwnProperty;function iAe(e,t,n,r,i,o){var s=n&tAe,a=t_(e),l=a.length,c=t_(t),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in t:rAe.call(t,h)))return!1}var g=o.get(e),y=o.get(t);if(g&&y)return g==t&&y==e;var b=!0;o.set(e,t),o.set(t,e);for(var v=s;++f<l;){h=a[f];var S=e[h],C=t[h];if(r)var w=s?r(C,S,h,t,e,o):r(S,C,h,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=h=="constructor")}if(b&&!v){var A=e.constructor,E=t.constructor;A!=E&&"constructor"in e&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var n_=tp(vc,"DataView"),r_=tp(vc,"Promise"),N0=tp(vc,"Set"),i_=tp(vc,"WeakMap"),iz="[object Map]",oAe="[object Object]",oz="[object Promise]",sz="[object Set]",az="[object WeakMap]",lz="[object DataView]",sAe=ep(n_),aAe=ep(r2),lAe=ep(r_),cAe=ep(N0),uAe=ep(i_),ia=Ru;(n_&&ia(new n_(new ArrayBuffer(1)))!=lz||r2&&ia(new r2)!=iz||r_&&ia(r_.resolve())!=oz||N0&&ia(new N0)!=sz||i_&&ia(new i_)!=az)&&(ia=function(e){var t=Ru(e),n=t==oAe?e.constructor:void 0,r=n?ep(n):"";if(r)switch(r){case sAe:return lz;case aAe:return iz;case lAe:return oz;case cAe:return sz;case uAe:return az}return t});var dAe=1,cz="[object Arguments]",uz="[object Array]",Lx="[object Object]",fAe=Object.prototype,dz=fAe.hasOwnProperty;function hAe(e,t,n,r,i,o){var s=Fi(e),a=Fi(t),l=s?uz:ia(e),c=a?uz:ia(t);l=l==cz?Lx:l,c=c==cz?Lx:c;var u=l==Lx,f=c==Lx,h=l==c;if(h&&Fh(e)){if(!Fh(t))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new Ja),s||Ab(e)?NJ(e,t,n,r,i,o):uEe(e,t,l,n,r,i,o);if(!(n&dAe)){var g=u&&dz.call(e,"__wrapped__"),y=f&&dz.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new Ja),i(b,v,n,r,o)}}return h?(o||(o=new Ja),iAe(e,t,n,r,i,o)):!1}function kb(e,t,n,r,i){return e===t?!0:e==null||t==null||!Ca(e)&&!Ca(t)?e!==e&&t!==t:hAe(e,t,n,r,kb,i)}function pAe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?kb(e,t,void 0,n):!!r}function _r(e,t){return pAe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var mAe="[object Symbol]";function _b(e){return typeof e=="symbol"||Ca(e)&&Ru(e)==mAe}var gAe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yAe=/^\w*$/;function UT(e,t){if(Fi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||_b(e)?!0:yAe.test(e)||!gAe.test(e)||t!=null&&e in Object(t)}var bAe="Expected a function";function VT(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(bAe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(VT.Cache||Pu),n}VT.Cache=Pu;var vAe=500;function xAe(e){var t=VT(e,function(r){return n.size===vAe&&n.clear(),r}),n=t.cache;return t}var SAe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wAe=/\\(\\)?/g,GJ=xAe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(SAe,function(n,r,i,o){t.push(i?o.replace(wAe,"$1"):r||n)}),t});function qm(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var fz=wa?wa.prototype:void 0,hz=fz?fz.toString:void 0;function KJ(e){if(typeof e=="string")return e;if(Fi(e))return qm(e,KJ)+"";if(_b(e))return hz?hz.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function WT(e){return e==null?"":KJ(e)}function Gm(e,t){return Fi(e)?e:UT(e,t)?[e]:GJ(WT(e))}function rp(e){if(typeof e=="string"||_b(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function jw(e,t){t=Gm(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[rp(t[n++])];return n&&n==r?e:void 0}function We(e,t,n){var r=e==null?void 0:jw(e,t);return r===void 0?n:r}var CAe=Object.prototype,EAe=CAe.hasOwnProperty;function AAe(e,t){return e!=null&&EAe.call(e,t)}function YJ(e,t,n){t=Gm(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=rp(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&zT(i)&&Iw(s,i)&&(Fi(e)||hm(e)))}function In(e,t){return e!=null&&YJ(e,t,AAe)}function s2(e,t){return kb(e,t)}var o6=(function(){try{var e=tp(Object,"defineProperty");return e({},"",{}),e}catch{}})();function qT(e,t,n){t=="__proto__"&&o6?o6(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var kAe=Object.prototype,_Ae=kAe.hasOwnProperty;function GT(e,t,n){var r=e[t];(!(_Ae.call(e,t)&&Cb(r,n))||n===void 0&&!(t in e))&&qT(e,t,n)}function KT(e,t,n,r){if(!Bn(e))return e;t=Gm(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=rp(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var u=a[l];c=r?r(u,l,a):void 0,c===void 0&&(c=Bn(u)?u:Iw(t[i+1])?[]:{})}GT(a,l,c),a=a[l]}return e}function cr(e,t,n){return e==null?e:KT(e,t,n)}function $w(e){return e}function XJ(e){return typeof e=="function"?e:$w}var DAe=/\s/;function OAe(e){for(var t=e.length;t--&&DAe.test(e.charAt(t)););return t}var TAe=/^\s+/;function MAe(e){return e&&e.slice(0,OAe(e)+1).replace(TAe,"")}var pz=NaN,RAe=/^[-+]0x[0-9a-f]+$/i,IAe=/^0b[01]+$/i,PAe=/^0o[0-7]+$/i,jAe=parseInt;function $Ae(e){if(typeof e=="number")return e;if(_b(e))return pz;if(Bn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Bn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=MAe(e);var n=IAe.test(e);return n||PAe.test(e)?jAe(e.slice(2),n?2:8):RAe.test(e)?pz:+e}var mz=1/0,LAe=17976931348623157e292;function NAe(e){if(!e)return e===0?e:0;if(e=$Ae(e),e===mz||e===-mz){var t=e<0?-1:1;return t*LAe}return e===e?e:0}function ZJ(e){var t=NAe(e),n=t%1;return t===t?n?t-n:t:0}var FAe=9007199254740991,Z7=4294967295,BAe=Math.min;function JJ(e,t){if(e=ZJ(e),e<1||e>FAe)return[];var n=Z7,r=BAe(e,Z7);t=XJ(t),e-=Z7;for(var i=zJ(r,t);++n<e;)t(n);return i}function YT(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var gz=Object.create,QJ=(function(){function e(){}return function(t){if(!Bn(t))return{};if(gz)return gz(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function zAe(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[++i];if(n(o[l],l,o)===!1)break}return t}}var eQ=zAe();function tQ(e,t){return e&&eQ(e,t,za)}var HAe=1,UAe=2;function VAe(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],l=e[a],c=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var u=new Ja,f;if(!(f===void 0?kb(c,l,HAe|UAe,r,u):f))return!1}}return!0}function nQ(e){return e===e&&!Bn(e)}function WAe(e){for(var t=za(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,nQ(i)]}return t}function rQ(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function qAe(e){var t=WAe(e);return t.length==1&&t[0][2]?rQ(t[0][0],t[0][1]):function(n){return n===e||VAe(n,e,t)}}function GAe(e,t){return e!=null&&t in Object(e)}function iQ(e,t){return e!=null&&YJ(e,t,GAe)}var KAe=1,YAe=2;function XAe(e,t){return UT(e)&&nQ(t)?rQ(rp(e),t):function(n){var r=We(n,e);return r===void 0&&r===t?iQ(n,e):kb(t,r,KAe|YAe)}}function ZAe(e){return function(t){return t?.[e]}}function JAe(e){return function(t){return jw(t,e)}}function QAe(e){return UT(e)?ZAe(rp(e)):JAe(e)}function XT(e){return typeof e=="function"?e:e==null?$w:typeof e=="object"?Fi(e)?XAe(e[0],e[1]):qAe(e):QAe(e)}function eke(e,t,n){var r=Fi(e),i=r||Fh(e)||Ab(e);if(t=XT(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Bn(e)?n=Eb(o)?QJ(Tw(e)):{}:n={}}return(i?YT:tQ)(e,function(s,a,l){return t(n,s,a,l)}),n}function o_(e,t,n){(n!==void 0&&!Cb(e[t],n)||n===void 0&&!(t in e))&&qT(e,t,n)}var oQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yz=oQ&&typeof module=="object"&&module&&!module.nodeType&&module,tke=yz&&yz.exports===oQ,bz=tke?vc.Buffer:void 0,vz=bz?bz.allocUnsafe:void 0;function sQ(e,t){if(t)return e.slice();var n=e.length,r=vz?vz(n):new e.constructor(n);return e.copy(r),r}function ZT(e){var t=new e.constructor(e.byteLength);return new i6(t).set(new i6(e)),t}function aQ(e,t){var n=t?ZT(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function JT(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function lQ(e){return typeof e.constructor=="function"&&!Pw(e)?QJ(Tw(e)):{}}function a2(e){return Ca(e)&&np(e)}function s_(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Km(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=void 0;l===void 0&&(l=e[a]),i?qT(n,a,l):GT(n,a,l)}return n}function nke(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var rke=Object.prototype,ike=rke.hasOwnProperty;function oke(e){if(!Bn(e))return nke(e);var t=Pw(e),n=[];for(var r in e)r=="constructor"&&(t||!ike.call(e,r))||n.push(r);return n}function Db(e){return np(e)?WJ(e,!0):oke(e)}function ske(e){return Km(e,Db(e))}function ake(e,t,n,r,i,o,s){var a=s_(e,n),l=s_(t,n),c=s.get(l);if(c){o_(e,n,c);return}var u=o?o(a,l,n+"",e,t,s):void 0,f=u===void 0;if(f){var h=Fi(l),g=!h&&Fh(l),y=!h&&!g&&Ab(l);u=l,h||g||y?Fi(a)?u=a:a2(a)?u=JT(a):g?(f=!1,u=sQ(l,!0)):y?(f=!1,u=aQ(l,!0)):u=[]:Jd(l)||hm(l)?(u=a,hm(a)?u=ske(a):(!Bn(a)||Eb(a))&&(u=lQ(l))):f=!1}f&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),o_(e,n,u)}function cQ(e,t,n,r,i){e!==t&&eQ(t,function(o,s){if(i||(i=new Ja),Bn(o))ake(e,t,s,n,cQ,r,i);else{var a=r?r(s_(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),o_(e,s,a)}},Db)}function lke(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var xz=Math.max;function uQ(e,t,n){return t=xz(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=xz(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),lke(e,this,a)}}function cke(e){return function(){return e}}var uke=o6?function(e,t){return o6(e,"toString",{configurable:!0,enumerable:!1,value:cke(t),writable:!0})}:$w,dke=800,fke=16,hke=Date.now;function pke(e){var t=0,n=0;return function(){var r=hke(),i=fke-(r-n);if(n=r,i>0){if(++t>=dke)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var dQ=pke(uke);function Lw(e,t){return dQ(uQ(e,t,$w),e+"")}function mke(e,t,n){if(!Bn(n))return!1;var r=typeof t;return(r=="number"?np(n)&&Iw(t,n.length):r=="string"&&t in n)?Cb(n[t],e):!1}function gke(e){return Lw(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&mke(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t})}var yke=gke(function(e,t,n){cQ(e,t,n)}),Sz=wa?wa.isConcatSpreadable:void 0;function bke(e){return Fi(e)||hm(e)||!!(Sz&&e&&e[Sz])}function Ob(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=bke),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Ob(a,t-1,n,r,i):FT(i,a):r||(i[i.length]=a)}return i}var vke=1/0;function xke(e){var t=e==null?0:e.length;return t?Ob(e,vke):[]}function Ske(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function wke(e){return e!==e}function Cke(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function fQ(e,t,n){return t===t?Cke(e,t,n):Ske(e,wke,n)}function QT(e,t){var n=e==null?0:e.length;return!!n&&fQ(e,t,0)>-1}function G5(){}var Eke=1/0,Ake=N0&&1/NT(new N0([,-0]))[1]==Eke?function(e){return new N0(e)}:G5,kke=200;function hQ(e,t,n){var r=-1,i=QT,o=e.length,s=!0,a=[],l=a;if(o>=kke){var c=Ake(e);if(c)return NT(c);s=!1,i=o2,l=new Nh}else l=a;e:for(;++r<o;){var u=e[r],f=u;if(u=u!==0?u:0,s&&f===f){for(var h=l.length;h--;)if(l[h]===f)continue e;a.push(u)}else i(l,f,n)||(l!==a&&l.push(f),a.push(u))}return a}function pQ(e){return e&&e.length?hQ(e):[]}var _ke="[object Map]",Dke="[object Set]",Oke=Object.prototype,Tke=Oke.hasOwnProperty;function yi(e){if(e==null)return!0;if(np(e)&&(Fi(e)||typeof e=="string"||typeof e.splice=="function"||Fh(e)||Ab(e)||hm(e)))return!e.length;var t=ia(e);if(t==_ke||t==Dke)return!e.size;if(Pw(e))return!qJ(e).length;for(var n in e)if(Tke.call(e,n))return!1;return!0}const Mke=Object.prototype;function V1(e){for(const t in e)if(Mke.hasOwnProperty.call(e,t))return!1;return!0}const Rke=["array","boolean","integer","null","number","object","string"];new Set(Rke);const Ike=["$defs","definitions","properties","patternProperties","dependencies"];new Set(Ike);const Pke=["items","allOf","oneOf","anyOf"];new Set(Pke);const jke=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(jke);function K5(e){return typeof e=="object"}function Tl(e){return K5(e)?V1(e):e===!0}function w0(e,t){return e<t?-1:e>t?1:0}function J7(e,t){const n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(n<r){const o=e;e=t,t=o,r=n}const i=new Set(e);for(let o=0;o<r;o++)i.add(t[o]);return Array.from(i)}function $ke(e,t){const n=[];if(e.length===0||t.length===0)return n;if(e.length>t.length){const i=e;e=t,t=i}const r=new Set(t);for(let i=0;i<e.length&&r.size>0;i++){const o=e[i];r.delete(o)&&n.push(o)}return n}function wz(e){return e.length===0}function Q7(e){return(t,n)=>{const r=t.length-n.length;if(r!==0)return r;for(let i=0;i<t.length;i++)if(t[i]!==n[i]){const o=e(t[i],n[i]);if(o!==0)return o}return 0}}function mQ(e,{threshold:t=12}={}){return n=>{const r=n.length;if(r===0)return n;if(r<=t){const s=[];let a=0;e:for(let l=0;l<r;l++){const c=n[l];for(let u=0;u<a;u++)if(e(c,s[u])===0)continue e;a=s.push(c)}return s}const i=n.slice().sort(e);let o=0;for(let s=1;s<r;s++)e(i[o],i[s])!==0&&++o!==s&&(i[o]=i[s]);return i.length=o+1,i}}function Lke(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const u=t;t=n,n=u;const f=i;i=o,o=f}const s=[...t].sort(e),a=[...n].sort(e);let l=0,c=0;for(;l<i&&c<o;){const u=e(s[l],a[c]);u===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,c++):u<0?l++:c++}return r}}function Nke(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const Cz=Nke,gQ=()=>0,Fke=e=>e===void 0,Bke=e=>typeof e!="object",Ez={boolean:0,number:1,string:2};function zke(e,t){const n=typeof e,r=typeof t;return n===r?w0(e,t):Ez[n]-Ez[r]}function Hke(e,t){const n=e.length;if(n===0)return t;const r=t.length;if(r===0)return e;if(r>n){const s=e;e=t,t=s}const i=new Set(e),o=t.length;for(let s=0;s<o;s++){const a=t[s];i.has(a)||e.push(a)}return e}function Nw(e,t,n=gQ){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function f0(e){return Nw(Fke,e)}function dd(e,t){return Nw(n=>n===void 0||e(n),t)}function eE(e,t){return Nw(Array.isArray,e,t)}const Ci=f0(w0),tE=dd(e=>e===0,(e,t)=>e-t);function Uke({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=Cz(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),A=Math.min(C.length,w.length);for(let E=0;E<A;E++){const O=w0(C[E],w[E]);if(O!==0)return O}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<A;E++){const O=C[E],D=b(v[O],S[O]);if(D!==0)return D}return 0}}function i(b){const v=Q7(b),S=Cz(e,mQ(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(w0);function s(b,v){if(K5(b)){if(K5(v)){const S=Object.keys(b),C=Object.keys(v),w=Hke(S,C),A=w.length;for(let E=0;E<A;E++){const O=w[E];if(b[O]===v[O])continue;const T=(y[O]??a)(b[O],v[O]);if(T!==0)return T}return 0}return v===!0&&V1(b)?0:1}return K5(v)?b===!0&&V1(v)?0:-1:w0(b,v)}const a=f0(c),l=Nw(Bke,eE(r(a),Q7(c)),zke);function c(b,v){return b===null?-1:v===null?1:l(b,v)}const u=f0(s),f=dd(V1,r(u)),h=f0(i(s)),g=dd(Tl,s),y={$id:Ci,$comment:Ci,$defs:f,$ref:Ci,$schema:Ci,const:a,contains:u,contentEncoding:Ci,contentMediaType:Ci,default:a,definitions:f,description:Ci,else:u,examples:a,exclusiveMaximum:Ci,exclusiveMinimum:Ci,format:Ci,if:u,maximum:Ci,maxItems:Ci,maxLength:Ci,maxProperties:Ci,minimum:Ci,multipleOf:Ci,not:u,pattern:Ci,propertyNames:u,readOnly:Ci,then:u,title:Ci,writeOnly:Ci,uniqueItems:dd(b=>b===!1,gQ),minLength:tE,minItems:tE,minProperties:tE,required:dd(wz,o),enum:dd(wz,i(c)),type:f0((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?w0(b,v):o(S?b:[b],C?v:[v])}),items:dd(b=>!Array.isArray(b)&&Tl(b),eE(s,Q7(s))),anyOf:h,allOf:h,oneOf:h,properties:f,patternProperties:f,additionalProperties:g,additionalItems:g,dependencies:dd(V1,r(f0(eE(s,o))))};return{compareSchemaValues:c,compareSchemaDefinitions:s}}function Az(e){return e}const yQ=(e,t)=>e?yQ(t%e,e):t,Vke=(e,t)=>Math.abs(e*t)/yQ(e,t);function Wke(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*nE(e,t,n){const r=e.length,i=t.length;if(r>0&&i>0)for(let o=0;o<r;o++){const s=e[o];for(let a=0;a<i;a++)yield n(s,t[a])}}function rE(e,t){return e||t}function kz(e){return(t,n)=>{const r={...t},i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const a=i[s];r[a]=t[a]===void 0?n[a]:e(t[a],n[a])}return r}}function qke(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function Wf(e,t,n){n===void 0||Tl(n)?delete e[t]:e[t]=n}const Gke=["properties","patternProperties","additionalProperties"];function _z(e){const t=Object.keys(e),n=t.length,r=[];for(let i=0;i<n;i++){const o=t[i];r.push({regExp:new RegExp(o),schema:e[o]})}return[r,t]}const Dz=[[],[]];function Oz(e,t,n){const r=n.length;for(let i=0;i<r;i++){const o=n[i];if(!o.regExp.test(t))continue;const s=o.schema;if(s===!1)return!0;e.push(s)}return!1}const Kke=["items","additionalItems"],Yke=["if","then","else"];function Tz(e,t){return t.if!==void 0&&(e.if=t.if),t.then!==void 0&&(e.then=t.then),t.else!==void 0&&(e.else=t.else),e}function iE(e,t){if(e===t)return e;switch(e){case"number":if(t==="integer")return"integer";case"integer":if(t==="number")return"integer";default:return}}function qf(e,t,n){return[e,t,n]}function Xke(e){const t=new Map;for(const[n,r,i]of e){const o=s=>{if(!i(s))throw new Error(`Schema keys '${n}' and '${r}' are conflicting (${n}: ${JSON.stringify(s[n])}, ${r}: ${JSON.stringify(s[r])})`)};for(const s of[[n,r],[r,n]]){let a=t.get(s[0]);a===void 0&&(a=[],t.set(s[0],a)),a.push({oppositeKey:s[1],check:o})}}return t}const Zke=[qf("minimum","maximum",e=>e.maximum>=e.minimum),qf("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),qf("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),qf("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),qf("minLength","maxLength",e=>e.maxLength>=e.minLength),qf("minItems","maxItems",e=>e.maxItems>=e.minItems),qf("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function Jke({mergePatterns:e=Wke,isSubRegExp:t=Object.is,intersectJson:n=$ke,deduplicateJsonSchemaDef:r=Az,defaultMerger:i=Az,assigners:o=[],checks:s=Zke,mergers:a}={}){function l(A){const E=A.length;let O=A[0];for(let D=1;D<E;D++){const T=S(O,A[D]);if(T===!1)return!1;Tl(T)||(O=T)}return O}function c(A,E,O,D,T,I,F){if(A.length=0,O===!1)return!1;if(A.push(O),T!==void 0){if(T===!1)return!1;A.push(T)}if(Oz(A,E,I))return!1;const R=A.length<2;if(F===!1){if(R)return;if(Oz(A,E,D))return!1}else R&&F!==void 0&&A.push(F);return A.length===1?A[0]:l(A)}function u(A,E,O,D,T,I){const F=O.length;if(F>0&&T!==!1)if(I)Object.assign(A,E);else for(let L=0;L<F;L++){const R=O[L];D.has(R)||(A[R]=S(E[R],T))}return A}const f=(A,{properties:E={},patternProperties:O,additionalProperties:D=!0},{properties:T={},patternProperties:I,additionalProperties:F=!0})=>{const L=Tl(D),R=Tl(F);if(L&&R)return Wf(A,"properties",C(E,T)),Wf(A,"patternProperties",O&&I?C(O,I):O??I),delete A.additionalProperties,A;const $=S(D,F);Wf(A,"additionalProperties",$);const j={},z=Object.keys(E),N=z.length,[W,H]=O?_z(O):Dz,[U,K]=I?_z(I):Dz,B=[],q=new Set,X=R?void 0:F;for(let se=0;se<N;se++){const ue=z[se];q.add(ue);const te=c(B,ue,E[ue],W,T[ue],U,X);te!==void 0&&(j[ue]=te)}const V=Object.keys(T),Y=V.length,J=L?void 0:D;for(let se=0;se<Y;se++){const ue=V[se];if(q.has(ue))continue;const te=c(B,ue,T[ue],U,void 0,W,J);te!==void 0&&(j[ue]=te)}Wf(A,"properties",j);let ne={};const ee=new Set;if(H.length>0&&K.length>0){const se=nE(H,K,(ue,te)=>{t(ue,te)&&ee.add(ue),t(te,ue)&&ee.add(te),ne[e(ue,te)]=S(O[ue],I[te])});for(;!se.next().done;);}return ne=u(ne,O,H,ee,F,R),ne=u(ne,I,K,ee,D,L),Wf(A,"patternProperties",ne),A},h=(A,{items:E=[],additionalItems:O},{items:D=[],additionalItems:T})=>{const I=Array.isArray(E),F=Array.isArray(D),L=[];if(A.items=L,I&&F){const[R,$,j]=E.length<D.length?[E.length,O,D]:[D.length,T,E];let z=0;for(;z<R;z++)L.push(S(E[z],D[z]));if($===!1)A.additionalItems=!1;else{const N=$===void 0||Tl($);for(;z<j.length;z++)L.push(N?j[z]:S(j[z],$));Wf(A,"additionalItems",O!==void 0&&T!==void 0?S(O,T):O??T)}}else if(I||F){const[R,$,j]=I?[E,D,O]:[D,E,T];Wf(A,"additionalItems",j&&S(j,$));for(let z=0;z<R.length;z++)L.push(S(R[z],$))}else delete A.additionalItems,A.items=S(E,D);return A},g=(A,E,O)=>{Tz(A,E);const D=Tz({},O);return A.allOf===void 0?A.allOf=[D]:A.allOf=A.allOf.concat(D),A};function y(A,E){return r(Array.from(nE(A,E,S)))}const b=qke([[Gke,f],[Kke,h],[Yke,g],...o]),v=Xke(s);function S(A,E){if(A===!1||E===!1)return!1;if(Tl(A))return Tl(E)?!0:E;if(Tl(E))return A;let O={...A};const D=new Set,T=new Set,I=Object.keys(E),F=I.length;for(let L=0;L<F;L++){const R=I[L],$=E[R];if($===void 0)continue;const j=v.get(R);if(j!==void 0){const H=j.length;for(let U=0;U<H;U++){const K=j[U];A[K.oppositeKey]!==void 0&&T.add(K.check)}}const z=A[R];if(z===void 0){O[R]=$;continue}const N=b.get(R);if(N){D.add(N);continue}const W=w[R]??i;O[R]=W(z,$)}for(const L of D)O=L(O,A,E);for(const L of T)L(O);return O}const C=kz(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(A,E)=>{if(A===E)return A;const O=Array.isArray(A),D=Array.isArray(E);if(!O&&!D){const T=iE(A,E);if(T!==void 0)return T}else if(O||D){const T=new Set;if(O&&D)for(const F of nE(A,E,iE))F!==void 0&&T.add(F);else{const F=O?A:E,L=O?E:A,R=F.length;for(let $=0;$<R;$++){const j=iE(L,F[$]);j!==void 0&&T.add(j)}}const I=T.size;if(I===1)return T.values().next().value;if(I>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${A.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(A,E)=>{const O=r([A,E]);return O.length===1?O[0]:{anyOf:O}},pattern:e,readOnly:rE,writeOnly:rE,enum:(A,E)=>{const O=n(A,E);if(O.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(A)}", "${JSON.stringify(E)}"`);return O},anyOf:y,oneOf:y,allOf:(A,E)=>r(A.concat(E)),propertyNames:S,contains:S,dependencies:kz((A,E)=>Array.isArray(A)?Array.isArray(E)?J7(A,E):S(E,{required:A}):Array.isArray(E)?S(A,{required:E}):S(A,E)),examples:(A,E)=>{if(!Array.isArray(A)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(A)}" and "${JSON.stringify(E)}"`);return J7(A,E)},multipleOf:(A,E)=>{let O=1;for(;!Number.isInteger(A)||!Number.isInteger(E);)O*=10,A*=10,E*=10;return Vke(A,E)/O},exclusiveMaximum:Math.min,maximum:Math.min,maxItems:Math.min,maxLength:Math.min,maxProperties:Math.min,exclusiveMinimum:Math.max,minimum:Math.max,minItems:Math.max,minLength:Math.max,minProperties:Math.max,uniqueItems:rE,required:J7,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function Qke(e){const t=[],n=[e];for(;n.length>0;){const r=n.pop();if(typeof r=="boolean"||r.allOf===void 0){t.push(r);continue}const{allOf:i,...o}=r;t.push(o);for(let s=i.length-1;s>=0;s--)n.push(i[s])}return t}function e_e(e){return t=>e(Qke(t))}var b1={},Mz;function t_e(){if(Mz)return b1;Mz=1;var e=/~/,t=/~[01]/g;function n(c){switch(c){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+c)}function r(c){return e.test(c)?c.replace(t,n):c}function i(c,u,f){for(var h,g,y=1,b=u.length;y<b;){if(u[y]==="constructor"||u[y]==="prototype"||u[y]==="__proto__")return c;if(h=r(u[y++]),g=b>y,typeof c[h]>"u"&&(Array.isArray(c)&&h==="-"&&(h=c.length),g&&(u[y]!==""&&u[y]<1/0||u[y]==="-"?c[h]=[]:c[h]={})),!g)break;c=c[h]}var v=c[h];return f===void 0?delete c[h]:c[h]=f,v}function o(c){if(typeof c=="string"){if(c=c.split("/"),c[0]==="")return c;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(c)){for(const u of c)if(typeof u!="string"&&typeof u!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return c}throw new Error("Invalid JSON pointer.")}function s(c,u){if(typeof c!="object")throw new Error("Invalid input object.");u=o(u);var f=u.length;if(f===1)return c;for(var h=1;h<f;){if(c=c[r(u[h++])],f===h)return c;if(typeof c!="object"||c===null)return}}function a(c,u,f){if(typeof c!="object")throw new Error("Invalid input object.");if(u=o(u),u.length===0)throw new Error("Invalid JSON pointer for set.");return i(c,u,f)}function l(c){var u=o(c);return{get:function(f){return s(f,u)},set:function(f,h){return a(f,u,h)}}}return b1.get=s,b1.set=a,b1.compile=l,b1}var n_e=t_e();const oE=cs(n_e);function r_e(e,t){return e&&Km(t,za(t),e)}function i_e(e,t){return e&&Km(t,Db(t),e)}function o_e(e,t){return Km(e,BT(e),t)}var s_e=Object.getOwnPropertySymbols,bQ=s_e?function(e){for(var t=[];e;)FT(t,BT(e)),e=Tw(e);return t}:BJ;function a_e(e,t){return Km(e,bQ(e),t)}function eM(e){return FJ(e,Db,bQ)}var l_e=Object.prototype,c_e=l_e.hasOwnProperty;function u_e(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&c_e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function d_e(e,t){var n=t?ZT(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var f_e=/\w*$/;function h_e(e){var t=new e.constructor(e.source,f_e.exec(e));return t.lastIndex=e.lastIndex,t}var Rz=wa?wa.prototype:void 0,Iz=Rz?Rz.valueOf:void 0;function p_e(e){return Iz?Object(Iz.call(e)):{}}var m_e="[object Boolean]",g_e="[object Date]",y_e="[object Map]",b_e="[object Number]",v_e="[object RegExp]",x_e="[object Set]",S_e="[object String]",w_e="[object Symbol]",C_e="[object ArrayBuffer]",E_e="[object DataView]",A_e="[object Float32Array]",k_e="[object Float64Array]",__e="[object Int8Array]",D_e="[object Int16Array]",O_e="[object Int32Array]",T_e="[object Uint8Array]",M_e="[object Uint8ClampedArray]",R_e="[object Uint16Array]",I_e="[object Uint32Array]";function P_e(e,t,n){var r=e.constructor;switch(t){case C_e:return ZT(e);case m_e:case g_e:return new r(+e);case E_e:return d_e(e,n);case A_e:case k_e:case __e:case D_e:case O_e:case T_e:case M_e:case R_e:case I_e:return aQ(e,n);case y_e:return new r;case b_e:case S_e:return new r(e);case v_e:return h_e(e);case x_e:return new r;case w_e:return p_e(e)}}var j_e="[object Map]";function $_e(e){return Ca(e)&&ia(e)==j_e}var Pz=pm&&pm.isMap,L_e=Pz?HT(Pz):$_e,N_e="[object Set]";function F_e(e){return Ca(e)&&ia(e)==N_e}var jz=pm&&pm.isSet,B_e=jz?HT(jz):F_e,z_e=1,H_e=2,U_e=4,vQ="[object Arguments]",V_e="[object Array]",W_e="[object Boolean]",q_e="[object Date]",G_e="[object Error]",xQ="[object Function]",K_e="[object GeneratorFunction]",Y_e="[object Map]",X_e="[object Number]",SQ="[object Object]",Z_e="[object RegExp]",J_e="[object Set]",Q_e="[object String]",eDe="[object Symbol]",tDe="[object WeakMap]",nDe="[object ArrayBuffer]",rDe="[object DataView]",iDe="[object Float32Array]",oDe="[object Float64Array]",sDe="[object Int8Array]",aDe="[object Int16Array]",lDe="[object Int32Array]",cDe="[object Uint8Array]",uDe="[object Uint8ClampedArray]",dDe="[object Uint16Array]",fDe="[object Uint32Array]",Er={};Er[vQ]=Er[V_e]=Er[nDe]=Er[rDe]=Er[W_e]=Er[q_e]=Er[iDe]=Er[oDe]=Er[sDe]=Er[aDe]=Er[lDe]=Er[Y_e]=Er[X_e]=Er[SQ]=Er[Z_e]=Er[J_e]=Er[Q_e]=Er[eDe]=Er[cDe]=Er[uDe]=Er[dDe]=Er[fDe]=!0;Er[G_e]=Er[xQ]=Er[tDe]=!1;function hy(e,t,n,r,i,o){var s,a=t&z_e,l=t&H_e,c=t&U_e;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Bn(e))return e;var u=Fi(e);if(u){if(s=u_e(e),!a)return JT(e,s)}else{var f=ia(e),h=f==xQ||f==K_e;if(Fh(e))return sQ(e,a);if(f==SQ||f==vQ||h&&!i){if(s=l||h?{}:lQ(e),!a)return l?a_e(e,i_e(s,e)):o_e(e,r_e(s,e))}else{if(!Er[f])return i?e:{};s=P_e(e,f,a)}}o||(o=new Ja);var g=o.get(e);if(g)return g;o.set(e,s),B_e(e)?e.forEach(function(v){s.add(hy(v,t,n,v,e,o))}):L_e(e)&&e.forEach(function(v,S){s.set(S,hy(v,t,n,S,e,o))});var y=c?l?eM:t_:l?Db:za,b=u?void 0:y(e);return YT(b||e,function(v,S){b&&(S=v,v=e[S]),GT(s,S,hy(v,t,n,S,e,o))}),s}function wQ(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function hDe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function pDe(e,t){return t.length<2?e:jw(e,hDe(t,0,-1))}var mDe=Object.prototype,gDe=mDe.hasOwnProperty;function CQ(e,t){t=Gm(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!gDe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var s=pDe(e,t);return s==null||delete s[rp(wQ(t))]}function yDe(e){return Jd(e)?void 0:e}function a_(e){var t=e==null?0:e.length;return t?Ob(e,1):[]}function EQ(e){return dQ(uQ(e,void 0,a_),e+"")}var bDe=1,vDe=2,xDe=4,l2=EQ(function(e,t){var n={};if(e==null)return n;var r=!1;t=qm(t,function(o){return o=Gm(o,e),r||(r=o.length>1),o}),Km(e,eM(e),n),r&&(n=hy(n,bDe|vDe|xDe,yDe));for(var i=t.length;i--;)CQ(n,t[i]);return n}),v1={exports:{}},sE,$z;function AQ(){if($z)return sE;$z=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(h){let g="",y=0,b=0;for(b=0;b<h.length;b++)if(y=h[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b];break}for(b+=1;b<h.length;b++){if(y=h[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function o(h,g,y){if(h.length){const b=n(h);if(b!=="")g.push(b);else return y.error=!0,!1;h.length=0}return!0}function s(h){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let A=0;A<h.length;A++){const E=h[A];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}A>0&&h[A-1]===":"&&(S=!0),b.push(":");continue}else if(E==="%"){if(!w(v,b,y))break;w=i}else{v.push(E);continue}}return v.length&&(w===i?y.zone=v.join(""):C?b.push(v.join("")):b.push(n(v))),y.address=b.join(""),y}function a(h){if(l(h,":")<2)return{host:h,isIPV6:!1};const g=s(h);if(g.error)return{host:h,isIPV6:!1};{let y=g.address,b=g.address;return g.zone&&(y+="%"+g.zone,b+="%25"+g.zone),{host:y,isIPV6:!0,escapedHost:b}}}function l(h,g){let y=0;for(let b=0;b<h.length;b++)h[b]===g&&y++;return y}function c(h){let g=h;const y=[];let b=-1,v=0;for(;v=g.length;){if(v===1){if(g===".")break;if(g==="/"){y.push("/");break}else{y.push(g);break}}else if(v===2){if(g[0]==="."){if(g[1]===".")break;if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&(g[1]==="."||g[1]==="/")){y.push("/");break}}else if(v===3&&g==="/.."){y.length!==0&&y.pop(),y.push("/");break}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."&&g[3]==="/"){g=g.slice(3),y.length!==0&&y.pop();continue}}if((b=g.indexOf("/",1))===-1){y.push(g);break}else y.push(g.slice(0,b)),g=g.slice(b)}return y.join("")}function u(h,g){const y=g!==!0?escape:unescape;return h.scheme!==void 0&&(h.scheme=y(h.scheme)),h.userinfo!==void 0&&(h.userinfo=y(h.userinfo)),h.host!==void 0&&(h.host=y(h.host)),h.path!==void 0&&(h.path=y(h.path)),h.query!==void 0&&(h.query=y(h.query)),h.fragment!==void 0&&(h.fragment=y(h.fragment)),h}function f(h){const g=[];if(h.userinfo!==void 0&&(g.push(h.userinfo),g.push("@")),h.host!==void 0){let y=unescape(h.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=h.host}g.push(y)}return(typeof h.port=="number"||typeof h.port=="string")&&(g.push(":"),g.push(String(h.port))),g.length?g.join(""):void 0}return sE={nonSimpleDomain:r,recomposeAuthority:f,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},sE}var aE,Lz;function SDe(){if(Lz)return aE;Lz=1;const{isUUID:e}=AQ(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(E){return n.indexOf(E)!==-1}function i(E){return E.secure===!0?!0:E.secure===!1?!1:E.scheme?E.scheme.length===3&&(E.scheme[0]==="w"||E.scheme[0]==="W")&&(E.scheme[1]==="s"||E.scheme[1]==="S")&&(E.scheme[2]==="s"||E.scheme[2]==="S"):!1}function o(E){return E.host||(E.error=E.error||"HTTP URIs must have a host."),E}function s(E){const O=String(E.scheme).toLowerCase()==="https";return(E.port===(O?443:80)||E.port==="")&&(E.port=void 0),E.path||(E.path="/"),E}function a(E){return E.secure=i(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E}function l(E){if((E.port===(i(E)?443:80)||E.port==="")&&(E.port=void 0),typeof E.secure=="boolean"&&(E.scheme=E.secure?"wss":"ws",E.secure=void 0),E.resourceName){const[O,D]=E.resourceName.split("?");E.path=O&&O!=="/"?O:void 0,E.query=D,E.resourceName=void 0}return E.fragment=void 0,E}function c(E,O){if(!E.path)return E.error="URN can not be parsed",E;const D=E.path.match(t);if(D){const T=O.scheme||E.scheme||"urn";E.nid=D[1].toLowerCase(),E.nss=D[2];const I=`${T}:${O.nid||E.nid}`,F=A(I);E.path=void 0,F&&(E=F.parse(E,O))}else E.error=E.error||"URN can not be parsed.";return E}function u(E,O){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const D=O.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),I=`${D}:${O.nid||T}`,F=A(I);F&&(E=F.serialize(E,O));const L=E,R=E.nss;return L.path=`${T||O.nid}:${R}`,O.skipEscape=!0,L}function f(E,O){const D=E;return D.uuid=D.nss,D.nss=void 0,!O.tolerant&&(!D.uuid||!e(D.uuid))&&(D.error=D.error||"UUID is not valid."),D}function h(E){const O=E;return O.nss=(E.uuid||"").toLowerCase(),O}const g={scheme:"http",domainHost:!0,parse:o,serialize:s},y={scheme:"https",domainHost:g.domainHost,parse:o,serialize:s},b={scheme:"ws",domainHost:!0,parse:a,serialize:l},v={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},w={http:g,https:y,ws:b,wss:v,urn:{scheme:"urn",parse:c,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(w,null);function A(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return aE={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:A},aE}var Nz;function kQ(){if(Nz)return v1.exports;Nz=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=AQ(),{SCHEMES:s,getSchemeHandler:a}=SDe();function l(v,S){return typeof v=="string"?v=h(y(v,S),S):typeof v=="object"&&(v=y(h(v,S),S)),v}function c(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},A=u(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,h(A,w)}function u(v,S,C,w){const A={};return w||(v=y(h(v,C),C),S=y(h(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(A.scheme=S.scheme,A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.path?(S.path[0]==="/"?A.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?A.path="/"+S.path:v.path?A.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:A.path=S.path,A.path=t(A.path)),A.query=S.query):(A.path=v.path,S.query!==void 0?A.query=S.query:A.query=v.query),A.userinfo=v.userinfo,A.host=v.host,A.port=v.port),A.scheme=v.scheme),A.fragment=S.fragment,A}function f(v,S,C){return typeof v=="string"?(v=unescape(v),v=h(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=h(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=h(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=h(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function h(v,S){const C={host:v.host,scheme:v.scheme,userinfo:v.userinfo,port:v.port,path:v.path,query:v.query,nid:v.nid,nss:v.nss,uuid:v.uuid,fragment:v.fragment,reference:v.reference,resourceName:v.resourceName,secure:v.secure,error:""},w=Object.assign({},S),A=[],E=a(w.scheme||C.scheme);E&&E.serialize&&E.serialize(C,w),C.path!==void 0&&(w.skipEscape?C.path=unescape(C.path):(C.path=escape(C.path),C.scheme!==void 0&&(C.path=C.path.split("%3A").join(":")))),w.reference!=="suffix"&&C.scheme&&A.push(C.scheme,":");const O=n(C);if(O!==void 0&&(w.reference!=="suffix"&&A.push("//"),A.push(O),C.path&&C.path[0]!=="/"&&A.push("/")),C.path!==void 0){let D=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(D=t(D)),O===void 0&&D[0]==="/"&&D[1]==="/"&&(D="/%2F"+D.slice(2)),A.push(D)}return C.query!==void 0&&A.push("?",C.query),C.fragment!==void 0&&A.push("#",C.fragment),A.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(v,S){const C=Object.assign({},S),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let A=!1;C.reference==="suffix"&&(C.scheme?v=C.scheme+":"+v:v="//"+v);const E=v.match(g);if(E){if(w.scheme=E[1],w.userinfo=E[3],w.host=E[4],w.port=parseInt(E[5],10),w.path=E[6]||"",w.query=E[7],w.fragment=E[8],isNaN(w.port)&&(w.port=E[5]),w.host)if(i(w.host)===!1){const T=e(w.host);w.host=T.host.toLowerCase(),A=T.isIPV6}else A=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==w.reference&&(w.error=w.error||"URI is not a "+C.reference+" reference.");const O=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!O||!O.unicodeSupport)&&w.host&&(C.domainHost||O&&O.domainHost)&&A===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(D){w.error=w.error||"Host's domain name can not be converted to ASCII: "+D}(!O||O&&!O.skipNormalize)&&(v.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),O&&O.parse&&O.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:c,resolveComponent:u,equal:f,serialize:h,parse:y};return v1.exports=b,v1.exports.default=b,v1.exports.fastUri=b,v1.exports}var wDe=kQ();const tM=cs(wDe);function s6(e,t){if(pr in e&&tM.equal(e[pr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Bn(r)){const i=s6(r,t);if(i!==void 0)return i}}else if(Bn(n)){const r=s6(n,t);if(r!==void 0)return r}}function l_(e,t){const n=We(e,pr,t);mr in e&&(e={...e,[mr]:tM.resolve(n,e[mr])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Bn(o)?l_(o,n):o)}:Bn(i)&&(e={...e,[r]:l_(i,n)});return e}function nM(e,t){const n=t[e];return[l2(t,[e]),n]}function _Q(e,t={},n=[],r=We(t,[pr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||pr in t&&t[pr]===r?o=oE.get(t,a):t[U1]===q5&&(o=s6(t,r.replace(/\/$/,"")),o!==void 0&&(o=oE.get(o,a)))}else if(t[U1]===q5){const a=r?tM.resolve(r,i):i,[l,...c]=a.replace(/#\/?$/,"").split("#");o=s6(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[pr],yi(c)||(o=oE.get(o,decodeURIComponent(c.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[mr];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[u,...f]=n,h=[...f,i,u].join(" -> ");throw new Error(`Definition for ${u} contains a circular reference through ${h}`)}const[a,l]=nM(mr,o),c=_Q(l,t,[...n,i],r);return Object.keys(a).length>0?t[U1]===L9e||t[U1]===q5?{[wu]:[a,c]}:{...a,...c}:c}return o}function rM(e,t={},n=We(t,[pr])){return _Q(e,t,[],n)}var CDe="[object String]";function Qd(e){return typeof e=="string"||!Fi(e)&&Ca(e)&&Ru(e)==CDe}function hc(e){let t;const n=We(e,I9e);return Qd(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function c2(e){return Array.isArray(e)?"array":typeof e=="string"?"string":e==null?"null":typeof e=="boolean"?"boolean":isNaN(e)?typeof e=="object"?"object":"string":"number"}var EDe=Lw(function(e){return hQ(Ob(e,1,a2,!0))});function il(e){let{type:t}=e;return!t&&e.const?c2(e.const):!t&&e.enum?"string":!t&&(e.properties||e.additionalProperties||e.patternProperties)?"object":(Array.isArray(t)&&(t.length===2&&t.includes("null")?t=t.find(n=>n!=="null"):t=t[0]),t)}function Cu(e,t){const n=Object.assign({},e);return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];return e&&i in e&&hn(s)?r[i]=Cu(o,s):e&&t&&(il(e)==="object"||il(t)==="object")&&i===OJ&&Array.isArray(o)&&Array.isArray(s)?r[i]=EDe(o,s):r[i]=s,r},n)}var ADe="[object Number]";function DQ(e){return typeof e=="number"||Ca(e)&&Ru(e)==ADe}function OQ(e,t,n){var r;if(e&&n){const i=We(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=We(s,[Un,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function iM(e,t,n,r,i){if(t===void 0)return 0;const o=OQ(t,n,i);if(DQ(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&In(a,[Un,i])){const l=We(t,i),c=We(a,[Un,i],{});if(e.isValid(c,l,r))return s}else if(a[Un]){const l={anyOf:Object.keys(a[Un]).map(u=>({required:[u]}))};let c;if(a.anyOf){const{...u}=a;u.allOf?u.allOf=u.allOf.slice():u.allOf=[],u.allOf.push(l),c=u}else c=Object.assign({},a,l);if(delete c.required,e.isValid(c,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function yo(e,t,n={},r,i,o=!1){return ql(e,t,n,r,void 0,void 0,i,o)[0]}function kDe(e,t,n,r,i,o,s){const{if:a,then:l,else:c,...u}=t,f=e.isValid(a,o||{},n);let h=[u],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(ql(e,l,n,o,r,i,s))),c&&typeof c!="boolean"&&(g=g.concat(ql(e,c,n,o,r,i,s)));else{const y=f?l:c;y&&typeof y!="boolean"&&(g=g.concat(ql(e,y,n,o,r,i,s)))}return g.length&&(h=g.map(y=>Cu(u,y))),h.flatMap(y=>ql(e,y,n,o,r,i,s))}function TQ(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>JJ(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function MQ(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(cr(n,[r],e.patternProperties[r]),n),{})}function _De(e,t,n,r,i,o,s,a){const l=RQ(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(PT in t)return IQ(e,t,n,r,i,o,s).flatMap(u=>ql(e,u,n,o,r,i,s));if(wu in t&&Array.isArray(t[wu])){const c=t.allOf.map(f=>ql(e,f,n,o,r,i,s));return TQ(c).map(f=>({...t,allOf:f}))}return[t]}function RQ(e,t,n,r,i,o,s,a){const l=F0(t,n,i,void 0,a);return l!==t?ql(e,l,n,o,r,i,s,a):[t]}function F0(e,t,n,r,i){if(!hn(e))return e;let o=e;if(mr in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...rM(s,t,r),...a},pr in o&&(r=o[pr])}if(Un in o){const s=[],a=eke(o[Un],(l,c,u)=>{const f=[...n];l[u]=F0(c,t,f,r,i),s.push(f)},{});yke(n,pQ(xke(s))),o={...o,[Un]:a}}if($h in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:F0(o.items,t,n,r,i)}),i){let s,a;Pn in e&&Array.isArray(e[Pn])?(s=Pn,a=o[Pn]):nn in e&&Array.isArray(e[nn])&&(s=nn,a=o[nn]),s&&a&&(o={...o,[s]:a.map(l=>F0(l,t,n,r,i))})}return _r(e,o)?e:o}function DDe(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&hn(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(Jk in o){const l=MQ(o,a);if(!yi(l)){o.properties[a]=yo(e,{[wu]:Object.values(l)},n,We(s,[a]),i),cr(o.properties,[a,fu],!0);return}}if(n2 in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?mr in o.additionalProperties?l=yo(e,{[mr]:We(o.additionalProperties,[mr])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Pn in o.additionalProperties||nn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:c2(We(s,[a]))}:l={type:c2(We(s,[a]))},o.properties[a]=l,cr(o.properties,[a,fu],!0)}else o.properties[a]={type:"null"},cr(o.properties,[a,fu],!0)}}),o}const{compareSchemaDefinitions:ODe,compareSchemaValues:TDe}=Uke(),{mergeArrayOfSchemaDefinitions:MDe}=Jke({intersectJson:Lke(TDe),deduplicateJsonSchemaDef:mQ(ODe)}),RDe=e_e(MDe);function IDe(e){return RDe(e)}function ql(e,t,n,r,i=!1,o=[],s,a){return hn(t)?_De(e,t,n,i,o,r,s,a).flatMap(c=>{var u;let f=c;if(jT in f)return kDe(e,f,n,i,o,r,s);if(wu in f){if(i){const{allOf:g,...y}=f;return[...g,y]}try{const g=[],y=[];(u=f.allOf)===null||u===void 0||u.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(f={...f,allOf:y}),f=s?s(f):IDe(f),g.length&&(f.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
|
|
223
|
+
`));return this.store.update({itemMetaLookup:ut({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:ut({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=ut({},this.store.state.itemMetaLookup),r=ut({},this.store.state.itemModelLookup);delete n[t.id],delete r[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:r})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(r=>(r[t]=n,r)),()=>{this.store.keyboardNavigation.updateLabelMap(r=>{const i=ut({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??Za;this.store.update({itemOrderedChildrenIdsLookup:ut({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:ut({},this.store.state.itemChildrenIndexesLookup,{[r]:rJ(n)})})}}const gwe={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class ywe extends uwe{jsxItems=new mwe(this);constructor(t){super(ut({},t,{items:Gk}),"SimpleTreeView",gwe)}updateStateFromParameters(t){super.updateStateFromParameters(ut({},t,{items:Gk}))}}const bwe=ZZ(),vwe=e=>{const{classes:t}=e;return _.useMemo(()=>et({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},SSe,t),[t])},xwe=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),Swe=_.forwardRef(function(t,n){const r=bwe({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=kSe(r),c=JSe(ywe,a),u=_.useRef(null),f=Z4(n,u),h=GSe(c,l,f),g=vwe(r),y=i?.root??xwe,b=Yr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:h,ownerState:r});return m.jsx(ESe,{store:c,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:u,children:m.jsx(uJ,{itemId:null,idAttribute:null,children:m.jsx(e6.Provider,{value:0,children:m.jsx(y,ut({},b))})})})}),wwe=_e(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),Cwe=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),Ewe=_e(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function Awe(e){return Qe("MuiCheckbox",e)}const z7=tt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),kwe=e=>{const{classes:t,indeterminate:n,color:r,size:i}=e,o={root:["root",n&&"indeterminate",`color${ye(r)}`,`size${ye(i)}`]},s=et(o,Awe,t);return{...t,...s}},_we=me(dT,{shouldForwardProp:e=>ro(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${ye(n.size)}`],n.color!=="default"&&t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Fn()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Fn()).map(([t])=>({props:{color:t},style:{[`&.${z7.checked}, &.${z7.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${z7.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Dwe=m.jsx(Cwe,{}),Owe=m.jsx(wwe,{}),Twe=m.jsx(Ewe,{}),Wl=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiCheckbox"}),{checkedIcon:i=Dwe,color:o="primary",icon:s=Owe,indeterminate:a=!1,indeterminateIcon:l=Twe,inputProps:c,size:u="medium",disableRipple:f=!1,className:h,slots:g={},slotProps:y={},...b}=r,v=a?l:s,S=a?l:i,C={...r,disableRipple:f,color:o,indeterminate:a,size:u},w=kwe(C),A=y.input??c,[E,O]=lt("root",{ref:n,elementType:_we,className:Oe(w.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...b},ownerState:C,additionalProps:{type:"checkbox",icon:_.cloneElement(v,{fontSize:v.props.fontSize??u}),checkedIcon:_.cloneElement(S,{fontSize:S.props.fontSize??u}),disableRipple:f,slots:g,slotProps:{input:MO(typeof A=="function"?A(C):A,{"data-indeterminate":a})}}});return m.jsx(E,{...O,classes:w})}),Mwe=(e,t,n)=>typeof n=="function"?n(e,t):n,Rwe=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=Um(),i=_.useContext(e6),o=Xr(r,Mwe,e.itemId,i),{id:s,itemId:a,label:l,children:c,rootRef:u}=e,{rootRef:f,contentRef:h,propsEnhancers:g}=t(e),{interactions:y,status:b}=fwe({itemId:a,children:c}),v=_.useRef(null),S=_.useRef(null),C=Z4(u,f,v),w=Z4(h,S),A=_.useRef(null),E=Xr(r,Hn.isCheckboxSelectionEnabled),O=Xr(r,Sb.treeItemIdAttribute,a,s),D=Xr(r,ah.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},I=ne=>ee=>{ne.onFocus?.(ee),!ee.defaultMuiPrevented&&!b.focused&&wt.canItemBeFocused(r.state,a)&&ee.currentTarget===ee.target&&r.focus.focusItem(ee,a)},F=ne=>ee=>{if(ne.onBlur?.(ee),ee.defaultMuiPrevented)return;const se=r.items.getItemDOMElement(a);b.editing||ee.relatedTarget&&Yk(ee.relatedTarget,se)&&(ee.target&&ee.target?.dataset?.element==="labelInput"&&Yk(ee.target,se)||ee.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},L=ne=>ee=>{ne.onKeyDown?.(ee),!(ee.defaultMuiPrevented||ee.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(ee,a)},R=ne=>ee=>{ne.onDoubleClick?.(ee),!ee.defaultMuiPrevented&&y.toggleItemEditing()},$=ne=>ee=>{ne.onClick?.(ee),r.items.handleItemClick(ee,a),!(ee.defaultMuiPrevented||A.current?.contains(ee.target))&&(hi.triggerSlot(r.state)==="content"&&y.handleExpansion(ee),E||y.handleSelection(ee))},j=ne=>ee=>{ne.onMouseDown?.(ee),!ee.defaultMuiPrevented&&(ee.shiftKey||ee.ctrlKey||ee.metaKey||b.disabled)&&ee.preventDefault()},z=ne=>ee=>{ne.onClick?.(ee),!ee.defaultMuiPrevented&&hi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(ee)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(ne={})=>{const ee=ut({},Yi(e),Yi(ne)),se=ut({},ee,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:O,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},ne,{style:ut({},ne.style??{},{"--TreeView-itemDepth":o}),onFocus:I(ee),onBlur:F(ee),onKeyDown:L(ee)}),ue=g.root?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getContentProps:(ne={})=>{const ee=Yi(ne),se=ut({},ee,ne,{ref:w,onClick:$(ee),onMouseDown:j(ee),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(te=>{b[te]&&(se[`data-${te}`]="")});const ue=g.content?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getGroupTransitionProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:c},ne)},getIconContainerProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,ne,{onClick:z(ee)})},getCheckboxProps:(ne={})=>{const ee=Yi(ne),se=ut({},ee,{ref:A,"aria-hidden":!0},ne),ue=g.checkbox?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},se,ue)},getLabelProps:(ne={})=>{const ee=ut({},Yi(ne)),se=ut({},ee,{children:l},ne,{onDoubleClick:R(ee)}),ue=g.label?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ue,se)},getLabelInputProps:(ne={})=>{const ee=Yi(ne),se=g.labelInput?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ne,se)},getDragAndDropOverlayProps:(ne={})=>{const ee=Yi(ne),se=g.dragAndDropOverlay?.(ut({},T,{externalEventHandlers:ee}))??{};return ut({},ne,se)},getErrorContainerProps:(ne={})=>{const ee=Yi(ne);return ut({},ee,ne)},getLoadingContainerProps:(ne={})=>{const ee=Yi(ne);return ut({size:"12px",thickness:6},ee,ne)},rootRef:C,status:b,publicAPI:n}};function Iwe(e){return Qe("MuiTreeItem",e)}tt("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const Pwe=_e(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),jwe=_e(m.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),$we=["ownerState"];function H7(e,t,n){return e!==void 0?e:t!==void 0?t:n}function Lwe(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=eJ(),s={collapseIcon:H7(t?.collapseIcon,i.collapseIcon,jwe),expandIcon:H7(t?.expandIcon,i.expandIcon,Pwe),endIcon:H7(t?.endIcon,i.endIcon),icon:t?.icon};let a;s?.icon?a="icon":r.expandable?r.expanded?a="collapseIcon":a="expandIcon":a="endIcon";const l=s[a],c=Yr({elementType:l,externalSlotProps:f=>ut({},R4(o[a],f),R4(n?.[a],f)),ownerState:{}}),u=Qh(c,$we);return l?m.jsx(l,ut({},u)):null}const Nwe=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>$0(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Hl(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function Fwe(e){return e.action==null?null:m.jsx(Nwe,ut({},e))}function Bwe(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=Um(),s=Xr(o,Sb.treeItemIdAttribute,n,r);return m.jsx(_.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const zwe=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>ut({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),Hwe=["visible"],Uwe=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],Vwe=ZZ(),Wwe=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),qwe=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>$0(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Hl(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),Gwe=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>$0(e)&&e!=="editable"})(({theme:e})=>ut({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),Kwe=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),Ywe=me(fa,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),Xwe=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),Zwe=me(zr,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),Jwe=me(_.forwardRef((e,t)=>{const{visible:n}=e,r=Qh(e,Hwe);return n?m.jsx(Wl,ut({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Qwe=e=>{const{classes:t}=eJ(),n=ut({},e,{root:Oe(e?.root,t.root),content:Oe(e?.content,t.itemContent),iconContainer:Oe(e?.iconContainer,t.itemIconContainer),checkbox:Oe(e?.checkbox,t.itemCheckbox),label:Oe(e?.label,t.itemLabel),groupTransition:Oe(e?.groupTransition,t.itemGroupTransition),labelInput:Oe(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Oe(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Oe(e?.errorIcon,t.itemErrorIcon),loadingIcon:Oe(e?.loadingIcon,t.itemLoadingIcon)});return et({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},Iwe,n)},eCe=_.forwardRef(function(t,n){const r=Vwe({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:c,slots:u={},slotProps:f={},classes:h}=r,g=Qh(r,Uwe),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:A,getLabelInputProps:E,getDragAndDropOverlayProps:O,getErrorContainerProps:D,getLoadingContainerProps:T,status:I}=Rwe({id:i,itemId:o,children:c,label:s,disabled:a,disableSelection:l}),F=Qwe(h),L=u.root??Wwe,R=Yr({elementType:L,getSlotProps:b,externalForwardedProps:g,externalSlotProps:f.root,additionalProps:{ref:n},ownerState:{},className:F.root}),$=u.content??qwe,j=Yr({elementType:$,getSlotProps:v,externalSlotProps:f.content,ownerState:{},className:Oe(F.content,I.expanded&&F.expanded,I.selected&&F.selected,I.focused&&F.focused,I.disabled&&F.disabled,I.editing&&F.editing,I.editable&&F.editable)}),z=u.iconContainer??Kwe,N=Yr({elementType:z,getSlotProps:S,externalSlotProps:f.iconContainer,ownerState:{},className:F.iconContainer}),W=u.label??Gwe,H=Yr({elementType:W,getSlotProps:w,externalSlotProps:f.label,ownerState:{},className:F.label}),U=u.checkbox??Jwe,K=Yr({elementType:U,getSlotProps:C,externalSlotProps:f.checkbox,ownerState:{},className:F.checkbox}),B=u.groupTransition??void 0,q=Yr({elementType:B,getSlotProps:A,externalSlotProps:f.groupTransition,ownerState:{},className:F.groupTransition}),X=u.labelInput??zwe,V=Yr({elementType:X,getSlotProps:E,externalSlotProps:f.labelInput,ownerState:{},className:F.labelInput}),Y=u.dragAndDropOverlay??Fwe,J=Yr({elementType:Y,getSlotProps:O,externalSlotProps:f.dragAndDropOverlay,ownerState:{},className:F.dragAndDropOverlay}),ne=u.errorIcon??Xwe,ee=Yr({elementType:ne,getSlotProps:D,externalSlotProps:f.errorIcon,ownerState:{},className:F.errorIcon}),se=u.loadingIcon??Zwe,ue=Yr({elementType:se,getSlotProps:T,externalSlotProps:f.loadingIcon,ownerState:{},className:F.loadingIcon});return m.jsx(Bwe,ut({},y(),{children:m.jsxs(L,ut({},R,{children:[m.jsxs($,ut({},j,{children:[m.jsxs(z,ut({},N,{children:[I.error&&m.jsx(ne,ut({},ee)),I.loading?m.jsx(se,ut({},ue)):m.jsx(Lwe,{status:I,slots:u,slotProps:f})]})),m.jsx(U,ut({},K)),I.editing?m.jsx(X,ut({},V)):m.jsx(W,ut({},H)),m.jsx(Y,ut({},J))]})),c&&m.jsx(Ywe,ut({as:B},q))]}))}))}),fJ=_e(m.jsx("path",{d:"M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z"})),Sw=_e(m.jsx("path",{d:"M20 19V3H4v16H2v2h20v-2zM16 9h2v2h-2zm-2 2H6V9h8zm4-4h-2V5h2zm-4-2v2H6V5zM6 19v-6h8v1.82c-.45.32-.75.84-.75 1.43 0 .97.78 1.75 1.75 1.75s1.75-.78 1.75-1.75c0-.59-.3-1.12-.75-1.43V13h2v6z"})),tCe=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"})),gT=_e(m.jsx("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5z"})),nCe=_e(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5M9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8m6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),rCe=_e(m.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),ww=_e(m.jsx("path",{d:"M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7"})),uu=_e(m.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),hJ=_e(m.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),iCe=_e(m.jsx("path",{d:"M12 11c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3m0 1c-1.84 0-3.56.5-5.03 1.37-.61.35-.97 1.02-.97 1.72V17h12v-1.91c0-.7-.36-1.36-.97-1.72C15.56 12.5 13.84 12 12 12m9.23-3.85 1.85-.77c-1.22-2.91-3.55-5.25-6.46-6.46l-.77 1.85c2.42 1.02 4.36 2.96 5.38 5.38M8.15 2.77 7.38.92C4.47 2.14 2.14 4.47.92 7.38l1.85.77c1.02-2.42 2.96-4.36 5.38-5.38M2.77 15.85l-1.85.77c1.22 2.91 3.55 5.25 6.46 6.46l.77-1.85c-2.42-1.02-4.36-2.96-5.38-5.38m13.08 5.38.77 1.85c2.91-1.22 5.25-3.55 6.46-6.46l-1.85-.77c-1.02 2.42-2.96 4.36-5.38 5.38"})),U5=_e(m.jsx("path",{d:"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13"})),Cw=_e(m.jsx("path",{d:"M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2m0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Ew=_e(m.jsx("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4m-4-2V5c0-.55.45-1 1-1s1 .45 1 1v1h-1v1h1v2h-1v1h1v1z"})),oCe=_e(m.jsx("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5m0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3"})),sCe=_e(m.jsx("path",{d:"M12 3 2 12h3v8h14v-8h3zm0 13c-1.1 0-2-.9-2-2s2-4 2-4 2 2.9 2 4-.9 2-2 2"})),yT=_e(m.jsx("path",{d:"M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8M7.83 14c.37 0 .67.26.74.62.41 2.22 2.28 2.98 3.64 2.87.43-.02.79.32.79.75 0 .4-.32.73-.72.75-2.13.13-4.62-1.09-5.19-4.12-.08-.45.28-.87.74-.87"})),aCe=_e([m.jsx("path",{d:"M4 3h6v2H4zM1 7h5v2H1zm2 12h5v2H3zm10.73-8.39c.75.23 1.3.78 1.57 1.46l4.27-7.11c.65-1.08.3-2.48-.78-3.13-.87-.52-1.99-.41-2.73.29l-3.43 3.21c-.4.37-.63.9-.63 1.45v3.93c.36-.15.98-.33 1.73-.1m-3.12 1.66c.16-.52.48-.96.89-1.27H3.28C2.02 11 1 12.02 1 13.28c0 1.02.67 1.91 1.65 2.19l4.51 1.29c.53.15 1.1.08 1.58-.21l2.69-1.61c-.77-.62-1.13-1.67-.82-2.67m11.6 6.34-2.28-4.1c-.27-.48-.73-.83-1.26-.97l-3.18-.8c.03.32 0 .66-.1.99-.32 1.06-1.28 1.77-2.39 1.77-.61 0-.99-.22-1-.22V21c-1.1 0-2 .9-2 2h6c0-1.1-.9-2-2-2v-4.28l4.61 4.61c.89.89 2.33.89 3.22 0 .72-.72.88-1.83.38-2.72"},"0"),m.jsx("path",{d:"M12.56 14.43c.79.24 1.63-.2 1.87-1 .24-.79-.2-1.63-1-1.87-.79-.24-1.63.2-1.87 1-.24.79.21 1.63 1 1.87"},"1")]),lCe=({endpoint:e})=>{const t=_.useMemo(()=>{switch(e.type.name){case"RootNode":return m.jsx(gT,{});case"Aggregator":return m.jsx(nCe,{});case"OnOffPlugInUnit":return m.jsx(oCe,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return m.jsx(ww,{});case"TemperatureSensor":return m.jsx(Ew,{});case"Thermostat":return m.jsx(fJ,{});case"Fan":return m.jsx(aCe,{});case"OnOffSensor":return m.jsx(tCe,{});case"HumiditySensor":return m.jsx(yT,{});case"WindowCovering":return m.jsx(Sw,{});case"DoorLock":return m.jsx(uu,{});case"OccupancySensor":return m.jsx(iCe,{});case"ContactSensor":return m.jsx(hJ,{});case"WaterLeakDetector":return m.jsx(sCe,{});case"Speaker":return m.jsx(Cw,{});case"RoboticVacuumCleaner":return m.jsx(U5,{});default:return m.jsx(rCe,{})}},[e]);return m.jsx(cn,{title:`${e.type.name} (${e.type.id})`,children:t})},cCe=e=>{const[t,n]=_.useState(()=>dCe(e.endpoint)),r=i=>{let o;i&&(o=fCe(i,e.endpoint)),e.onSelected(o)};return m.jsx(Swe,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:m.jsx(pJ,{endpoint:e.endpoint,sortBy:e.sortBy})})},pJ=e=>{const t=_.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=Is(r.state)??r.id.local,s=Is(i.state)??i.id.local;return o.localeCompare(s)});case"type":return n.sort((r,i)=>{const o=r.type?.name??"",s=i.type?.name??"";return o.localeCompare(s)});default:return n.sort((r,i)=>r.endpoint-i.endpoint)}},[e.endpoint.parts,e.sortBy]);return m.jsx(eCe,{itemId:e.endpoint.id.global,label:m.jsx(uCe,{endpoint:e.endpoint}),children:t.map(n=>m.jsx(pJ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},uCe=e=>m.jsxs(ce,{display:"flex",children:[m.jsx(lCe,{endpoint:e.endpoint}),m.jsx(ce,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:m.jsx(u5e,{endpoint:e.endpoint})})]});function dCe(e){const t=[e.id.global],n=[e];for(;n.length>0;){const r=n.shift();r.parts.length===1&&t.push(r.parts[0].id.global),n.push(...r.parts)}return t}function fCe(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(r.id.global===e)return r;n.push(...r.parts)}}const V5=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>V5(n))},hCe=e=>{const[t,n]=_.useState(void 0),[r,i]=_.useState("name"),[o,s]=_.useState("cards"),[a,l]=_.useState(""),[c,u]=_.useState(!1),[f,h]=_.useState(!1),[g,y]=_.useState(!1),[b,v]=_.useState(""),[S,C]=_.useState(),[w,A]=_.useState({open:!1,message:"",severity:"success"}),[E,O]=_.useState({}),D=_.useMemo(()=>{const N=V5(e.endpoint),W=[];for(const H of N){const K=H.state.homeAssistantEntity?.entity?.entity_id;K&&W.push(K)}return W},[e.endpoint]),T=_.useCallback(()=>{D.length!==0&&qZ(D).then(O).catch(()=>{})},[D]);_.useEffect(()=>{T()},[T]);const I=_.useCallback(()=>{T()},[T]),F=_.useCallback(async(N,W)=>{if(W){v(N);try{const U=(await cT(W)).mappings.find(K=>K.entityId===N);C(U)}catch{C(void 0)}y(!0)}},[]),L=_.useCallback(async N=>{if(!(!e.bridgeId||!b))try{await uT(e.bridgeId,b,N),A({open:!0,message:`Mapping saved for ${b}. Restart the bridge to apply changes.`,severity:"success"}),y(!1),e.onMappingSaved?.()}catch(W){A({open:!0,message:`Failed to save mapping: ${W}`,severity:"error"})}},[e.bridgeId,b,e.onMappingSaved]),R=_.useCallback(N=>{const H=N.state.homeAssistantEntity?.entity?.state?.state;return H==="unavailable"||H==="unknown"},[]),$=_.useMemo(()=>V5(e.endpoint).filter(R).length,[e.endpoint,R]),j=_.useMemo(()=>[...V5(e.endpoint).filter(H=>{if(f&&!R(H))return!1;const U=Is(H.state)??H.id.local,K=H.type.name,B=a.toLowerCase();return U.toLowerCase().includes(B)||K.toLowerCase().includes(B)})].sort((H,U)=>{const K=Is(H.state)??H.id.local,B=Is(U.state)??U.id.local;switch(r){case"name":return K.localeCompare(B);case"endpoint":return H.id.local.localeCompare(U.id.local);case"type":return H.type.name.localeCompare(U.type.name);default:return 0}}),[e.endpoint,a,r,f,R]),z=N=>{n(N),u(!0)};return m.jsxs(ce,{children:[m.jsxs(ce,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,children:[m.jsxs(ie,{variant:"h6",component:"span",children:["Endpoints (",j.length,")"]}),m.jsx(cn,{title:"View All Devices",children:m.jsx(_n,{component:Du,to:Pt.devices,size:"small",color:"primary",children:m.jsx(Ns,{})})})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[m.jsx(Lr,{size:"small",placeholder:"Search endpoints...",value:a,onChange:N=>l(N.target.value),sx:{flexGrow:1,maxWidth:300}}),$>0&&m.jsx(cn,{title:f?"Show all entities":`Show ${$} unavailable`,children:m.jsx(_n,{size:"small",color:f?"warning":"default",onClick:()=>h(N=>!N),children:m.jsx($Z,{badgeContent:$,color:"warning",max:99,children:m.jsx(Yd,{})})})}),m.jsxs(pa,{size:"small",sx:{minWidth:120},children:[m.jsx(sc,{id:"sort-label",children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:.5,children:[m.jsx(jZ,{fontSize:"small"})," Sort"]})}),m.jsxs(sa,{labelId:"sort-label",value:r,label:"Sort",onChange:N=>i(N.target.value),children:[m.jsx(er,{value:"name",children:"Name"}),m.jsx(er,{value:"endpoint",children:"Endpoint ID"}),m.jsx(er,{value:"type",children:"Type"})]})]}),m.jsxs(W4e,{value:o,exclusive:!0,onChange:(N,W)=>W&&s(W),size:"small",children:[m.jsx(uB,{value:"cards",children:m.jsx(cn,{title:"Card View",children:m.jsx(h5e,{})})}),m.jsx(uB,{value:"tree",children:m.jsx(cn,{title:"Tree View",children:m.jsx(p5e,{})})})]})]})]}),o==="cards"?m.jsx(dt,{container:!0,spacing:2,children:j.map(N=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(KZ,{endpoint:N,bridgeId:e.bridgeId,onClick:()=>z(N),onEditMapping:e.bridgeId?F:void 0,imageInfo:E[N.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:I})},N.id.global))}):m.jsxs(dt,{container:!0,spacing:2,children:[m.jsx(dt,{size:{xs:12,md:4},children:m.jsx(cCe,{endpoint:e.endpoint,onSelected:n,sortBy:r})}),m.jsx(dt,{size:{xs:12,md:8},children:t&&m.jsx(CB,{endpoint:t})})]}),m.jsxs(vu,{open:c,onClose:()=>u(!1),maxWidth:"md",fullWidth:!0,children:[m.jsx(Su,{children:t&&(Is(t.state)??t.id.local)}),m.jsx(xu,{children:t&&m.jsx(CB,{endpoint:t})})]}),e.bridgeId&&m.jsx(fT,{open:g,onClose:()=>y(!1),entityId:b,domain:b.split(".")[0]||"",currentMapping:S,onSave:L}),m.jsx(jO,{open:w.open,autoHideDuration:6e3,onClose:()=>A({...w,open:!1}),children:m.jsx(kn,{onClose:()=>A({...w,open:!1}),severity:w.severity,sx:{width:"100%"},children:w.message})})]})},wb=_e(m.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}));function pCe({bridgeId:e}){const[t,n]=_.useState(null),[r,i]=_.useState(!0),[o,s]=_.useState(!1),[a,l]=_.useState(null),c=_.useCallback(async()=>{try{const v=await cT(e);n(v)}catch{console.error("Failed to load entity mappings")}finally{i(!1)}},[e]);_.useEffect(()=>{c()},[c]);const u=_.useCallback(()=>{l({entityId:"",domain:""}),s(!0)},[]),f=_.useCallback((v,S)=>{const C=v.split(".")[0]||"";l({entityId:v,domain:C,config:S}),s(!0)},[]),h=_.useCallback(async v=>{try{await Y4e(e,v),await c()}catch{console.error("Failed to delete entity mapping")}},[e,c]),g=_.useCallback(async v=>{if(v.entityId)try{await uT(e,v.entityId,v),s(!1),l(null),await c()}catch{console.error("Failed to save entity mapping")}},[e,c]),y=_.useCallback(()=>{s(!1),l(null)},[]),b=t?.mappings??[];return m.jsxs(tr,{children:[m.jsxs(gr,{children:[m.jsxs(ce,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[m.jsxs(ie,{variant:"h6",children:[m.jsx(wb,{sx:{mr:1,verticalAlign:"middle"}}),"Entity Mappings"]}),m.jsx(kt,{variant:"outlined",size:"small",onClick:u,children:"Add Mapping"})]}),r&&m.jsx(ie,{color:"text.secondary",children:"Loading..."}),!r&&b.length===0&&m.jsx(ie,{color:"text.secondary",children:"No custom entity mappings configured. Use mappings to override Matter device types, set custom names, or disable specific entities."}),!r&&b.length>0&&m.jsx(fm,{children:m.jsxs(um,{size:"small",children:[m.jsx(X4,{children:m.jsxs(Os,{children:[m.jsx(Rn,{children:"Entity ID"}),m.jsx(Rn,{children:"Device Type"}),m.jsx(Rn,{children:"Custom Name"}),m.jsx(Rn,{children:"Status"}),m.jsx(Rn,{align:"right",children:"Actions"})]})}),m.jsx(dm,{children:b.map(v=>m.jsxs(Os,{children:[m.jsx(Rn,{children:m.jsx(ie,{variant:"body2",fontFamily:"monospace",children:v.entityId})}),m.jsx(Rn,{children:v.matterDeviceType||m.jsx(ie,{color:"text.secondary",variant:"body2",children:"Auto"})}),m.jsx(Rn,{children:v.customName||m.jsx(ie,{color:"text.secondary",variant:"body2",children:"—"})}),m.jsx(Rn,{children:v.disabled?m.jsx(Et,{label:"Disabled",color:"error",size:"small"}):m.jsx(Et,{label:"Enabled",color:"success",size:"small"})}),m.jsxs(Rn,{align:"right",children:[m.jsx(_n,{size:"small",onClick:()=>f(v.entityId,v),children:m.jsx(cw,{fontSize:"small"})}),m.jsx(_n,{size:"small",onClick:()=>h(v.entityId),children:m.jsx(Zd,{fontSize:"small"})})]})]},v.entityId))})]})})]}),a&&m.jsx(fT,{open:o,entityId:a.entityId,domain:a.domain,currentMapping:a.config,onSave:g,onClose:y})]})}const mCe=e=>e.bridges,bT=rw([mCe],e=>e.items),gCe=e=>rw([bT],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),yCe=rw([bT],e=>{if(!e.isInitialized)return;const t={};return(e.content?.map(r=>[r.port,r.id])??[]).forEach(([r,i])=>{t[r]=i}),t});function Vm(){return Hm(bT)}function mJ(){return Hm(yCe)}function gJ(e){const t=_.useMemo(()=>gCe(e),[e]);return Hm(t)}function bCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(HX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function vCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(VX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function xCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(WX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function SCe(){const e=Hs();return _.useCallback(async t=>{const n=await e(UX(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function wCe(){const e=Hs();return _.useCallback(async t=>{await A2e(t),await e(Fo())},[e])}function CCe(){const e=Hs();return _.useCallback(async t=>{const n=await NX(t);return await e(Fo()),n},[e])}const ECe=e=>e.devices,ACe=e=>rw([ECe],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function kCe(e){const t=_.useMemo(()=>ACe(e),[e]);return Hm(t)}function _Ce(e,t){const[n,r]=_.useState(e);return _.useEffect(()=>{let i=e;t();const o=setInterval(()=>{i--,i===0&&(t(),i=e),r(i)},1e3);return()=>clearInterval(o)},[e,t]),n}async function DCe(e){return await(await fetch(`api/matter/bridges/${e}/devices`)).json()}const du=zm("devices/load",DCe),OCe=_e(m.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),TCe=_e(m.jsx("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93"})),MCe=({bridge:e})=>{const[t,n]=_.useState(null),r=!!t,i=hf(),o=Tu(),s=xCe(),a=SCe(),l=CCe(),c=y=>n(y.currentTarget),u=()=>n(null),f=async()=>{u(),await l(e).then(y=>o.show({message:`Synced ${y.syncedCount} devices to controllers`,severity:"success"})).catch(y=>o.show({message:`Failed to sync: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},h=async()=>{u(),await s(e).then(()=>o.show({message:"Bridge Reset successfully",severity:"success"})).catch(y=>o.show({message:`Failed to reset bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},g=async()=>{u(),await a(e).then(()=>o.show({message:"Bridge deleted successfully",severity:"success"})).then(()=>i(Pt.bridges)).catch(y=>o.show({message:`Failed to delete bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))};return m.jsxs(m.Fragment,{children:[m.jsx(_n,{onClick:c,children:m.jsx(OCe,{})}),m.jsxs(FZ,{open:r,onClose:u,anchorEl:t,children:[m.jsxs(er,{component:Du,to:Pt.editBridge(e),children:[m.jsx(Ul,{children:m.jsx(cw,{fontSize:"small"})}),m.jsx(Va,{children:"Edit"})]}),m.jsx(gi,{}),m.jsxs(er,{onClick:f,children:[m.jsx(Ul,{children:m.jsx(dw,{fontSize:"small"})}),m.jsx(Va,{children:"Force Sync"})]}),m.jsxs(er,{onClick:h,children:[m.jsx(Ul,{children:m.jsx(TCe,{fontSize:"small"})}),m.jsx(Va,{children:"Factory Reset"})]}),m.jsxs(er,{onClick:g,children:[m.jsx(Ul,{children:m.jsx(Zd,{fontSize:"small"})}),m.jsx(Va,{children:"Delete"})]})]})]})},RCe=_.memo(B3e),ICe=({failedEntities:e})=>{const[t,n]=_.useState(!1);return!e||e.length===0?null:m.jsxs(kn,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>n(!t),children:[m.jsxs(ie,{variant:"body2",children:[m.jsxs("strong",{children:[e.length," entity/entities could not be loaded."]})," ","Click to ",t?"hide":"show"," details."]}),m.jsx(fa,{in:t,children:m.jsx(bc,{dense:!0,sx:{mt:1},children:e.map(r=>m.jsxs(yf,{sx:{py:0},children:[m.jsx(Ul,{sx:{minWidth:32},children:m.jsx(iw,{color:"warning",fontSize:"small"})}),m.jsx(Va,{primary:r.entityId,secondary:r.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},r.entityId))})})]})},PCe=()=>{const e=Tu(),t=Hs(),{bridgeId:n}=mY(),[r,i]=_.useState(0),o=_.useCallback(()=>{i(g=>g+1)},[]),s=_.useCallback(()=>{t(du(n))},[t,n]),a=_Ce(10,s),{content:l,isLoading:c,error:u}=gJ(n),{content:f,error:h}=kCe(n);return _.useEffect(()=>{u&&e.show({message:u.message??"Failed to load Bridge details",severity:"error"})},[u,e]),_.useEffect(()=>{h?.message&&e.show({message:h.message,severity:"error"})},[h,e]),!l&&c?"Loading":l?m.jsxs(zt,{spacing:4,children:[m.jsx(lw,{items:[{name:"Bridges",to:Pt.bridges},{name:l.name,to:Pt.bridge(n)}]}),m.jsxs(ce,{display:"flex",justifyContent:"space-between",children:[m.jsxs(ie,{variant:"h4",children:[l.name," ",m.jsx(MZ,{status:l.status})]}),m.jsx(MCe,{bridge:n})]}),m.jsx(Z3e,{status:l.status,reason:l.statusReason}),l.failedEntities&&l.failedEntities.length>0&&m.jsx(ICe,{failedEntities:l.failedEntities}),m.jsx(jCe,{bridge:l,devices:f}),m.jsx(RCe,{bridge:l}),f&&m.jsx(f5e,{devices:f}),m.jsx(pCe,{bridgeId:n},r),f&&m.jsxs(zt,{spacing:2,children:[m.jsx(ce,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:a!=null&&m.jsx(cn,{title:"New devices and changes on labels are discovered every 30 seconds.",children:m.jsxs(ie,{variant:"body2",color:"textSecondary",children:["Refreshing states in ",a-1," seconds..."]})})}),m.jsx(hCe,{endpoint:f,bridgeId:n,onMappingSaved:o})]})]}):"Not found"};function yJ(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(yJ)}function bJ(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=bJ(n);return t}const jCe=({bridge:e,devices:t})=>{const n=Tu(),[r,i]=_.useState(!1),o=_.useMemo(()=>{if(!t||e.featureFlags?.serverMode||!yJ(t))return!1;const l=e.commissioning?.fabrics??[];if(l.length===0)return!0;const c=new Set([4937,4631,4448]);return l.some(u=>c.has(u.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),s=_.useMemo(()=>t?bJ(t)===1:!1,[t]),a=async()=>{i(!0);try{await LX({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),n.show({message:"Server Mode enabled. The bridge will restart with your vacuum as a standalone device.",severity:"success"})}catch(l){n.show({message:`Failed to enable Server Mode: ${l instanceof Error?l.message:String(l)}`,severity:"error"})}finally{i(!1)}};return o?m.jsxs(kn,{severity:"warning",icon:m.jsx(yb,{}),action:s?m.jsx(kt,{color:"warning",size:"small",variant:"outlined",onClick:a,disabled:r,startIcon:r?m.jsx(zr,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:r?"Enabling...":"Enable Server Mode"}):void 0,children:[m.jsx(q4,{children:"Server Mode Recommended for Robot Vacuums"}),m.jsxs(ie,{variant:"body2",children:["This bridge contains a robot vacuum in ",m.jsx("strong",{children:"bridged mode"}),". Apple Home and Alexa will show the bridge as an additional device, resulting in duplicate entries. Enable ",m.jsx("strong",{children:"Server Mode"})," to expose the vacuum as a standalone Matter device for full Siri/Alexa voice command support and no duplicates."]}),!s&&m.jsxs(ie,{variant:"body2",sx:{mt:1},children:[m.jsx("strong",{children:"Note:"})," Server Mode requires the vacuum to be the only device on this bridge. Please remove other entities from this bridge first, then enable Server Mode in the bridge settings."]})]}):null},vT=_e(m.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),$Ce=_e(m.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),xT=_e(m.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),LCe=_e(m.jsx("path",{d:"m7 10 5 5 5-5z"})),NCe=_e(m.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),FCe=_e(m.jsx("path",{d:"m10 17 5-5-5-5z"})),ST=_e(m.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),vJ=_e(m.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),NB=_e(m.jsx("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"})),jx=_e(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),BCe=_e(m.jsxs(_.Fragment,{children:[m.jsx("path",{fillOpacity:".3",d:"M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z"}),m.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),zCe=_e(m.jsx("path",{d:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66s.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21"})),Aw=_e(m.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"})),HCe=_e([m.jsx("path",{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"0"),m.jsx("path",{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"},"1")]),UCe=_e(m.jsx("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3m0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7m18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11m20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"})),FB=_e([m.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),m.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),m.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),VCe=_e(m.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),wT=_e(m.jsx("path",{d:"M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z"})),WCe=_e(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),qCe=_e(m.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),GCe=_e(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),KCe=_e(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),YCe=_e(m.jsx("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"})),XCe=_e(m.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),ZCe=_e(m.jsx("path",{d:"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z"})),JCe=_e(m.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),QCe=_e(m.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),e8e=_e(m.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),t8e=_e([m.jsx("path",{d:"M21 14c0-.55-.45-1-1-1h-2v2h2c.55 0 1-.45 1-1m-1 3h-2v2h2c.55 0 1-.45 1-1s-.45-1-1-1m-8-3h-2v4h2c0 1.1.9 2 2 2h3v-8h-3c-1.1 0-2 .9-2 2"},"0"),m.jsx("path",{d:"M5 13c0-1.1.9-2 2-2h1.5c1.93 0 3.5-1.57 3.5-3.5S10.43 4 8.5 4H5c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5.67 1.5 1.5S9.33 9 8.5 9H7c-2.21 0-4 1.79-4 4s1.79 4 4 4h2v-2H7c-1.1 0-2-.9-2-2"},"1")]),g1=_e(m.jsx("path",{d:"M17 10H7v2h10zm2-7h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14zm-5-5H7v2h7z"})),n8e=_e(m.jsx("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"})),r8e=_e(m.jsx("circle",{cx:"12",cy:"12",r:"8"})),i8e=_e(m.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),o8e=_e(m.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),CT=_e([m.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),m.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),m.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),m.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15.69c0 .45-.35.81-.78.81h-.44c-.44 0-.78-.36-.78-.81V16.5H7v1.19c0 .45-.35.81-.78.81h-.44c-.43 0-.78-.36-.78-.81v-6.5c.82-2.47 1.34-4.03 1.56-4.69.05-.16.12-.29.19-.4.02-.02.03-.04.05-.06.38-.53.92-.54.92-.54h8.56s.54.01.92.53c.02.03.03.05.05.07.07.11.14.24.19.4.22.66.74 2.23 1.56 4.69z"},"3")]),ET=_e(m.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),s8e=_e(m.jsx("path",{d:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"})),t6=_e(m.jsx("path",{d:"M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z"})),AT=_e(m.jsx("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"})),a8e=_e(m.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z"})),l8e=_e(m.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Zk=_e(m.jsx("path",{d:"M15 9H9v6h6zm-2 4h-2v-2h2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2zm-4 6H7V7h10z"})),c8e=_e(m.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),u8e=_e(m.jsx("path",{d:"M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z"})),xJ=_e(m.jsx("path",{d:"M8 5v14l11-7z"})),kT=_e(m.jsx("path",{d:"M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83"})),d8e=_e(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),_T=_e(m.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),Qy=_e(m.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),BB=_e(m.jsx("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"})),n6=_e(m.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),SJ=_e(m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),f8e=_e([m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),m.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")]),wJ=_e(m.jsx("path",{d:"M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"})),e2=_e(m.jsx("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12s.45 2.1 1.17 2.83zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12s-.45 2.1-1.17 2.83zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12M6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65"})),DT=_e(m.jsx("path",{d:"M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1m-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05M12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0"})),CJ=_e(m.jsx("path",{d:"M6 6h12v12H6z"})),h8e=_e(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 14H8V8h8z"})),p8e=_e(m.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),m8e=_e(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),g8e=_e(m.jsx("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2"})),OT=_e(m.jsx("path",{d:"M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14M7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"})),TT=_e(m.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2m0 14H3V5h18z"})),y8e=_e(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),b8e=_e(m.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),v8e=_e(m.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"})),x8e=_e(m.jsx("path",{d:"M11 11V3H5c-1.1 0-2 .9-2 2v6zm2 0h8V5c0-1.1-.9-2-2-2h-6zm-2 2H3v6c0 1.1.9 2 2 2h6zm2 0v8h6c1.1 0 2-.9 2-2v-6z"}));async function S8e(){const e=await fetch("api/bridges/export");if(!e.ok)throw new Error(`Failed to export bridges: ${e.statusText}`);const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;E8e(t,r)}async function w8e(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`Failed to preview import: ${t.statusText}`);return t.json()}async function C8e(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});if(!n.ok)throw new Error(`Failed to import bridges: ${n.statusText}`);return n.json()}function E8e(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function A8e({open:e,file:t,onClose:n,onImported:r}){const[i,o]=_.useState(null),[s,a]=_.useState(new Set),[l,c]=_.useState(!1),[u,f]=_.useState(null),[h,g]=_.useState(null),[y,b]=_.useState(!1),[v,S]=_.useState(null);_.useEffect(()=>{if(!e||!t){o(null),a(new Set),f(null),g(null),S(null);return}const O=new FileReader;O.onload=async D=>{try{const T=JSON.parse(D.target?.result);f(T);const I=await w8e(T);o(I),a(new Set(I.bridges.map(F=>F.id)))}catch{g("Failed to parse import file. Please select a valid export file.")}},O.readAsText(t)},[e,t]);const C=_.useCallback(O=>{a(D=>{const T=new Set(D);return T.has(O)?T.delete(O):T.add(O),T})},[]),w=_.useCallback(()=>{i&&a(new Set(i.bridges.map(O=>O.id)))},[i]),A=_.useCallback(()=>{a(new Set)},[]),E=_.useCallback(async()=>{if(u){b(!0);try{const O=await C8e(u,{bridgeIds:Array.from(s),overwriteExisting:l}),D=[];O.imported>0&&D.push(`${O.imported} bridge(s) imported`),O.skipped>0&&D.push(`${O.skipped} skipped (already exist)`),O.errors.length>0&&D.push(`${O.errors.length} failed`),S(D.join(", ")),r()}catch(O){g(O instanceof Error?O.message:"Import failed")}finally{b(!1)}}},[u,s,l,r]);return m.jsxs(vu,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[m.jsx(Su,{children:"Import Bridges"}),m.jsxs(xu,{children:[h&&m.jsx(kn,{severity:"error",sx:{mb:2},children:h}),v&&m.jsx(kn,{severity:"success",sx:{mb:2},children:v}),i&&!v&&m.jsxs(m.Fragment,{children:[i.migrated&&m.jsxs(kn,{severity:"info",sx:{mb:2},children:["This export is from an older version (",i.sourceVersion,"). Bridges will be migrated to the current format during import."]}),m.jsxs(ie,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(i.exportedAt).toLocaleString(),i.sourceVersion&&!i.migrated&&m.jsxs(m.Fragment,{children:[" • Format: ",i.sourceVersion]})]}),m.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[m.jsx(kt,{size:"small",onClick:w,children:"Select All"}),m.jsx(kt,{size:"small",onClick:A,children:"Select None"})]}),m.jsx(bc,{dense:!0,children:i.bridges.map(O=>m.jsxs(yf,{disablePadding:!0,children:[m.jsx(Ul,{children:m.jsx(Wl,{edge:"start",checked:s.has(O.id),onChange:()=>C(O.id)})}),m.jsx(Va,{primary:O.name,secondary:m.jsxs(m.Fragment,{children:["Port ",O.port," • ",O.entityCount," filter rules",O.exists&&m.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},O.id))}),m.jsx($s,{control:m.jsx(jh,{checked:l,onChange:O=>c(O.target.checked)}),label:"Overwrite existing bridges"})]})]}),m.jsxs(Xd,{children:[m.jsx(kt,{onClick:n,children:v?"Close":"Cancel"}),!v&&m.jsx(kt,{onClick:E,variant:"contained",disabled:y||s.size===0,children:y?"Importing...":`Import ${s.size} Bridge(s)`})]})]})}function k8e(e){return Qe("MuiCardActionArea",e)}const U7=tt("MuiCardActionArea",["root","focusVisible","focusHighlight"]),_8e=e=>{const{classes:t}=e;return et({root:["root"],focusHighlight:["focusHighlight"]},k8e,t)},D8e=me(ba,{name:"MuiCardActionArea",slot:"Root"})(Ge(({theme:e})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${U7.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${U7.focusVisible} .${U7.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),O8e=me("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(Ge(({theme:e})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:e.transitions.create("opacity",{duration:e.transitions.duration.short})}))),Wm=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiCardActionArea"}),{children:i,className:o,focusVisibleClassName:s,slots:a={},slotProps:l={},...c}=r,u=r,f=_8e(u),h={slots:a,slotProps:l},[g,y]=lt("root",{elementType:D8e,externalForwardedProps:{...h,...c},shouldForwardComponentProp:!0,ownerState:u,ref:n,className:Oe(f.root,o),additionalProps:{focusVisibleClassName:Oe(s,f.focusVisible)}}),[b,v]=lt("focusHighlight",{elementType:O8e,externalForwardedProps:h,ownerState:u,className:f.focusHighlight});return m.jsxs(g,{...y,children:[i,m.jsx(b,{...v})]})}),kw="api/bridge-icons";async function T8e(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${kw}/${e}`,{method:"POST",body:n});if(!r.ok){const i=await r.json();throw new Error(i.error||"Failed to upload icon")}return r.json()}async function M8e(e){const t=await fetch(`${kw}/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to delete icon")}}async function _w(e){return(await fetch(`${kw}/${e}`,{method:"HEAD"})).ok}function t2(e){return`${kw}/${e}`}const zB={light:ww,switch:kT,climate:Ew,cover:Sw,fan:OT,lock:uu,sensor:e2,media_player:TT,vacuum:wT,remote:DT,humidifier:yT,speaker:Cw,garage:CT,door:JCe,window:x8e,motion:ZCe,battery:BCe,power:zCe,camera:HCe,default:gT},HB={light:ww,switch:kT,climate:Ew,cover:Sw,fan:OT,lock:uu,sensor:e2,binary_sensor:e2,media_player:TT,vacuum:wT,remote:DT,humidifier:yT,input_boolean:t8e,input_button:g1,button:g1,scene:g1,script:g1,automation:g1,speaker:Cw,air_quality:fJ,garage:CT},UB={light:"warning.main",switch:"info.main",climate:"error.main",cover:"success.main",fan:"info.light",lock:"secondary.main",sensor:"primary.main",binary_sensor:"primary.main",media_player:"secondary.main",vacuum:"success.main",remote:"warning.main",humidifier:"info.main"},EJ=e=>e.filter.include.find(n=>n.type===Ar.Domain)?.value??null,R8e=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return ww;if(t.includes("vacuum")||t.includes("dammsug"))return wT;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return Ew;if(t.includes("sensor"))return e2;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return Sw;if(t.includes("remote")||t.includes("fjärr"))return DT;if(t.includes("lock")||t.includes("lås"))return uu;if(t.includes("fan")||t.includes("fläkt"))return OT;if(t.includes("tv")||t.includes("media"))return TT;if(t.includes("speaker")||t.includes("högtalare"))return Cw;if(t.includes("switch")||t.includes("brytare"))return kT;if(t.includes("garage"))return CT},MT=e=>{if(e.icon&&zB[e.icon])return zB[e.icon];const t=EJ(e);if(t&&HB[t])return HB[t];const n=R8e(e.name);return n||(e.deviceCount===0?Ns:gT)},RT=e=>{const t=EJ(e);return t&&UB[t]?UB[t]:e.deviceCount===0?"text.disabled":"primary.main"},I8e=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=MT(e),r=RT(e),[i,o]=_.useState(!1);return _.useEffect(()=>{_w(e.id).then(o)},[e.id]),m.jsx(tr,{variant:"elevation",sx:{height:"100%",transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-4px)",boxShadow:4}},children:m.jsx(Wm,{component:Du,to:Pt.bridge(e.id),sx:{height:"100%"},children:m.jsx(gr,{children:m.jsxs(ce,{display:"flex",alignItems:"flex-start",gap:2,children:[i?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:m.jsx(n,{sx:{fontSize:32}})}),m.jsxs(ce,{flexGrow:1,minWidth:0,children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(ie,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),m.jsx(MZ,{status:e.status})]}),m.jsxs(zt,{spacing:1,mb:2,children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Ns,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(aZ,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(e2,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},P8e=({bridges:e})=>{const t=_.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return m.jsx(dt,{container:!0,spacing:2,children:t.map(n=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(I8e,{bridge:n})},n.id))})},Dw=_.createContext({}),IT=_.createContext({});function j8e(e){return Qe("MuiStep",e)}tt("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const $8e=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return et({root:["root",n,r&&"alternativeLabel",i&&"completed"]},j8e,t)},L8e=me("div",{name:"MuiStep",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({variants:[{props:{orientation:"horizontal"},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:"relative"}}]}),N8e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:c,expanded:u=!1,index:f,last:h,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=_.useContext(Dw);let[w=!1,A=!1,E=!1]=[i,l,c];y===f?w=i!==void 0?i:!0:!C&&y>f?A=l!==void 0?l:!0:!C&&y<f&&(E=c!==void 0?c:!0);const O=_.useMemo(()=>({index:f,last:h,expanded:u,icon:f+1,active:w,completed:A,disabled:E}),[f,h,u,w,A,E]),D={...r,active:w,orientation:S,alternativeLabel:v,completed:A,disabled:E,expanded:u,component:a},T=$8e(D),I=m.jsxs(L8e,{as:a,className:Oe(T.root,s),ref:n,ownerState:D,...g,children:[b&&v&&f!==0?b:null,o]});return m.jsx(IT.Provider,{value:O,children:b&&!v&&f!==0?m.jsxs(_.Fragment,{children:[b,I]}):I})}),F8e=_e(m.jsx("path",{d:"M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"})),B8e=_e(m.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function z8e(e){return Qe("MuiStepIcon",e)}const V7=tt("MuiStepIcon",["root","active","completed","error","text"]);var VB;const H8e=e=>{const{classes:t,active:n,completed:r,error:i}=e;return et({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},z8e,t)},W7=me(I4,{name:"MuiStepIcon",slot:"Root"})(Ge(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${V7.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${V7.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${V7.error}`]:{color:(e.vars||e).palette.error.main}}))),U8e=me("text",{name:"MuiStepIcon",slot:"Text"})(Ge(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),V8e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...c}=r,u={...r,active:i,completed:s,error:a},f=H8e(u);if(typeof l=="number"||typeof l=="string"){const h=Oe(o,f.root);return a?m.jsx(W7,{as:B8e,className:h,ref:n,ownerState:u,...c}):s?m.jsx(W7,{as:F8e,className:h,ref:n,ownerState:u,...c}):m.jsxs(W7,{className:h,ref:n,ownerState:u,...c,children:[VB||(VB=m.jsx("circle",{cx:"12",cy:"12",r:"12"})),m.jsx(U8e,{className:f.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:u,children:l})]})}return l});function W8e(e){return Qe("MuiStepLabel",e)}const Td=tt("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),q8e=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return et({root:["root",n,o&&"error",s&&"disabled",a&&"alternativeLabel"],label:["label",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],iconContainer:["iconContainer",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],labelContainer:["labelContainer",a&&"alternativeLabel"]},W8e,t)},G8e=me("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${Td.alternativeLabel}`]:{flexDirection:"column"},[`&.${Td.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),K8e=me("span",{name:"MuiStepLabel",slot:"Label"})(Ge(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${Td.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Td.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Td.alternativeLabel}`]:{marginTop:16},[`&.${Td.error}`]:{color:(e.vars||e).palette.error.main}}))),Y8e=me("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${Td.alternativeLabel}`]:{paddingRight:0}}),X8e=me("span",{name:"MuiStepLabel",slot:"LabelContainer"})(Ge(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${Td.alternativeLabel}`]:{textAlign:"center"}}))),AJ=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:c,slots:u={},slotProps:f={},StepIconComponent:h,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=_.useContext(Dw),{active:S,disabled:C,completed:w,icon:A}=_.useContext(IT),E=l||A;let O=h;E&&!O&&(O=V8e);const D={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=q8e(D),I={slots:u,slotProps:{stepIcon:g,...s,...f}},[F,L]=lt("root",{elementType:G8e,externalForwardedProps:{...I,...y},ownerState:D,ref:n,className:Oe(T.root,o)}),[R,$]=lt("label",{elementType:K8e,externalForwardedProps:I,ownerState:D}),[j,z]=lt("stepIcon",{elementType:O,externalForwardedProps:I,ownerState:D});return m.jsxs(F,{...L,children:[E||j?m.jsx(Y8e,{className:T.iconContainer,ownerState:D,children:m.jsx(j,{completed:w,active:S,error:a,icon:E,...z})}):null,m.jsxs(X8e,{className:T.labelContainer,ownerState:D,children:[i?m.jsx(R,{...$,className:Oe(T.label,$?.className),children:i}):null,c]})]})});AJ.muiName="StepLabel";function Z8e(e){return Qe("MuiStepper",e)}tt("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function J8e(e){return Qe("MuiStepConnector",e)}tt("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const Q8e=e=>{const{classes:t,orientation:n,alternativeLabel:r,active:i,completed:o,disabled:s}=e,a={root:["root",n,r&&"alternativeLabel",i&&"active",o&&"completed",s&&"disabled"],line:["line",`line${ye(n)}`]};return et(a,J8e,t)},e9e=me("div",{name:"MuiStepConnector",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({flex:"1 1 auto",variants:[{props:{orientation:"vertical"},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:"absolute",top:12,left:"calc(-50% + 20px)",right:"calc(50% + 20px)"}}]}),t9e=me("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ye(n.orientation)}`]]}})(Ge(({theme:e})=>{const t=e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[600];return{display:"block",borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:"horizontal"},style:{borderTopStyle:"solid",borderTopWidth:1}},{props:{orientation:"vertical"},style:{borderLeftStyle:"solid",borderLeftWidth:1,minHeight:24}}]}})),n9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=_.useContext(Dw),{active:l,disabled:c,completed:u}=_.useContext(IT),f={...r,alternativeLabel:s,orientation:a,active:l,completed:u,disabled:c},h=Q8e(f);return m.jsx(e9e,{className:Oe(h.root,i),ref:n,ownerState:f,...o,children:m.jsx(t9e,{className:h.line,ownerState:f})})}),r9e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return et({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},Z8e,i)},i9e=me("div",{name:"MuiStepper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.nonLinear&&t.nonLinear]}})({display:"flex",variants:[{props:{orientation:"horizontal"},style:{flexDirection:"row",alignItems:"center"}},{props:{orientation:"vertical"},style:{flexDirection:"column"}},{props:{alternativeLabel:!0},style:{alignItems:"flex-start"}}]}),o9e=m.jsx(n9e,{}),s9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:c=o9e,nonLinear:u=!1,orientation:f="horizontal",...h}=r,g={...r,nonLinear:u,alternativeLabel:o,orientation:f,component:l},y=r9e(g),b=_.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>_.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=_.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:c,nonLinear:u,orientation:f}),[i,o,c,u,f]);return m.jsx(Dw.Provider,{value:S,children:m.jsx(i9e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...h,children:v})})}),WB={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function kJ({selectedTemplate:e,onSelect:t}){return m.jsxs(ce,{children:[m.jsx(ie,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Choose a preset to pre-fill the bridge configuration with recommended settings. You can customize everything afterwards."}),m.jsx(dt,{container:!0,spacing:1.5,alignItems:"flex-start",children:TZ.map(n=>{const r=e===n.id;return m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(tr,{variant:"outlined",sx:{height:"100%",borderColor:r?"primary.main":"divider",borderWidth:r?2:1,bgcolor:r?"action.selected":"background.paper",transition:"all 0.15s ease"},children:m.jsx(Wm,{onClick:()=>t(r?null:n),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:m.jsxs(gr,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[m.jsx(ie,{fontSize:20,children:WB[n.icon]??WB.default}),m.jsx(ie,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&m.jsx(Mu,{color:"primary",sx:{fontSize:18}})]}),m.jsx(ie,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:r?"none":2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&m.jsx(Et,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&m.jsx(Et,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const q7=["Template","Bridge Info","Entity Filter","Feature Flags","Review & Create"],a9e=[{key:"autoComposedDevices",label:"Auto Compose Devices",description:"Combine related entities (battery, humidity, pressure, power, energy) from the same HA device into a single Matter endpoint."},{key:"autoForceSync",label:"Auto Force Sync",description:"Periodically push all device states to controllers. Recommended for Google Home and Alexa to prevent devices from going offline."},{key:"coverSwapOpenClose",label:"Invert Cover Direction",description:"Swap open/close direction for covers. Use this if your covers show the wrong position in Matter controllers."},{key:"includeHiddenEntities",label:"Include Hidden Entities",description:"Also expose entities that are marked as hidden in Home Assistant."}];function _J({open:e,onClose:t,onComplete:n}){const[r,i]=_.useState(0),[o,s]=_.useState(!1),[a,l]=_.useState(5540),[c,u]=_.useState([]),[f,h]=_.useState(),[g,y]=_.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[b,v]=_.useState(!0),[S,C]=_.useState("*"),[w,A]=_.useState(""),[E,O]=_.useState(null),D=_.useCallback(async()=>{try{const U=await fetch("api/matter/next-port");if(U.ok){const K=await U.json();l(K.port),y(B=>({...B,port:K.port}))}}catch{}},[]);_.useEffect(()=>{e&&(D(),i(0),u([]),h(void 0),y({name:"",port:a,serverMode:!1,filter:{include:[],exclude:[]}}),v(!0),C("*"),A(""),O(null))},[e,D,a]);const T=_.useCallback(U=>{if(h(U??void 0),U){y(q=>({...q,name:U.name,serverMode:U.featureFlags?.serverMode??!1,icon:U.icon,featureFlags:U.featureFlags,filter:{...U.filter}}));const K=U.filter.include;if(K.length>0)if(v(!1),U.featureFlags?.serverMode){const q=K.map(X=>X.type===Ar.Domain?`${X.value}.*`:X.value);C(q.join(", "))}else C(K.map(q=>q.value).join(", "));const B=U.filter.exclude;A(B.map(q=>q.value).join(", "))}else y(K=>({...K,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),v(!0),C("*"),A("")},[]),I=()=>{if(r===0&&O(null),r===1){if(!g.name.trim()){O("Please enter a bridge name");return}O(null)}if(r===2){let U,K;if(f&&!g.serverMode)U=[...f.filter.include],K=[...f.filter.exclude];else{const B=b?[S||"*"]:S.split(",").map(X=>X.trim()).filter(Boolean),q=w.split(",").map(X=>X.trim()).filter(Boolean);U=B.map(X=>({type:Ar.Pattern,value:X})),K=q.map(X=>({type:Ar.Pattern,value:X}))}y(B=>({...B,filter:{include:U,exclude:K}}))}i(U=>U+1)},F=()=>{i(U=>U-1),O(null)},L=async()=>{await R();const U=a+c.length+1;u(K=>[...K,g]),h(void 0),y({name:"",port:U,serverMode:!1,filter:{include:[],exclude:[]}}),i(0),v(!0),C("*"),A("")},R=async()=>{s(!0),O(null);try{const U={...g.featureFlags,...g.serverMode?{serverMode:!0}:{}},K=Object.keys(U).length>0,B={name:g.name,port:g.port,filter:g.filter,featureFlags:K?U:void 0,icon:g.icon};return await $X(B),!0}catch(U){return O(U instanceof Error?U.message:"Failed to create bridge"),!1}finally{s(!1)}},$=async()=>{await R()&&(n(),t())},j=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Choose a template to get started quickly, or skip to create a custom bridge."}),m.jsx(ce,{sx:{mt:2},children:m.jsx(kJ,{selectedTemplate:f?.id,onSelect:T})})]}),z=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:f?`Template "${f.name}" applied. Customize the name and port below.`:"Give your bridge a name and port."}),m.jsx(Lr,{fullWidth:!0,label:"Bridge Name",value:g.name,onChange:U=>y(K=>({...K,name:U.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!E,helperText:E}),m.jsx(Lr,{fullWidth:!0,label:"Port",type:"number",value:g.port,onChange:U=>y(K=>({...K,port:parseInt(U.target.value,10)||5540})),margin:"normal",helperText:"Automatically assigned to next available port"}),m.jsx(cn,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:m.jsx($s,{control:m.jsx(Wl,{checked:g.serverMode,onChange:U=>y(K=>({...K,serverMode:U.target.checked})),icon:m.jsx(U5,{}),checkedIcon:m.jsx(U5,{color:"primary"})}),label:"Server Mode (for Robot Vacuums)",sx:{mt:1}})}),g.serverMode&&m.jsxs(kn,{severity:"info",sx:{mt:1},children:[m.jsx("strong",{children:"Server Mode enabled:"})," This bridge will expose a single device as a standalone Matter device. Add only ONE device (e.g., your vacuum) to this bridge. This is required for Apple Home Siri commands and Alexa discovery."]}),c.length>0&&m.jsxs(ce,{sx:{mt:2},children:[m.jsxs(ie,{variant:"subtitle2",color:"text.secondary",children:["Bridges to create (",c.length,"):"]}),m.jsx(ce,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:c.map(U=>m.jsx(Et,{label:`${U.name} (:${U.port})`,size:"small"},U.port))})]})]}),N=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:f?`Filter is pre-configured from the "${f.name}" template. You can adjust it below.`:"Configure which entities should be included in this bridge."}),g.serverMode&&m.jsxs(kn,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",m.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",m.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!f&&m.jsx($s,{control:m.jsx(jh,{checked:b,onChange:U=>v(U.target.checked)}),label:"Include all entities (wildcard)"}),m.jsx(Lr,{fullWidth:!0,label:g.serverMode?"Entity ID":b&&!f?"Include Pattern":"Entity Filters",value:f&&!g.serverMode?f.filter.include.map(U=>`${U.type}:${U.value}`).join(", "):S,onChange:U=>C(U.target.value),margin:"normal",placeholder:b?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:g.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":f?"Pre-configured by template. Edit in the full editor after creation.":b?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!f&&!g.serverMode}),!f&&m.jsx(Lr,{fullWidth:!0,label:"Exclude Patterns (optional)",value:w,onChange:U=>A(U.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:"Patterns to exclude, comma-separated"})]}),W=()=>m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Configure optional feature flags for this bridge."}),a9e.map(U=>m.jsxs(ce,{sx:{mt:1},children:[m.jsx($s,{control:m.jsx(jh,{checked:g.featureFlags?.[U.key]===!0,onChange:K=>y(B=>({...B,featureFlags:{...B.featureFlags,[U.key]:K.target.checked}}))}),label:U.label}),m.jsx(ie,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:U.description})]},U.key))]}),H=()=>{const U=Object.entries(g.featureFlags??{}).filter(([,K])=>K===!0);return m.jsxs(ce,{sx:{mt:2},children:[m.jsx(ie,{variant:"body1",gutterBottom:!0,children:"Review your bridge configuration:"}),m.jsx(tr,{variant:"outlined",sx:{mt:2},children:m.jsxs(gr,{children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(Ns,{}),m.jsx(ie,{variant:"h6",children:g.name})]}),m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Port: ",g.port]}),f&&m.jsx(Et,{label:`Template: ${f.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),g.serverMode&&m.jsx(Et,{icon:m.jsx(U5,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),U.length>0&&m.jsx(ce,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:U.filter(([K])=>K!=="serverMode").map(([K])=>m.jsx(Et,{label:K,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},K))}),m.jsxs(ie,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",g.filter.include.length>0?g.filter.include.map(K=>`${K.type}:${K.value}`).join(", "):S||"*"]}),E&&m.jsx(ie,{variant:"body2",color:"error",sx:{mt:1},children:E}),(w||g.filter.exclude.length>0)&&m.jsxs(ie,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",g.filter.exclude.length>0?g.filter.exclude.map(K=>K.value).join(", "):w]})]})}),c.length>0&&m.jsx(ce,{sx:{mt:2},children:m.jsxs(ie,{variant:"subtitle2",children:[c.length," bridge(s) already created in this session"]})})]})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[m.jsx(Su,{children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(wb,{}),m.jsx("span",{children:"Bridge Setup Wizard"})]})}),m.jsxs(xu,{children:[m.jsx(s9e,{activeStep:r,sx:{mt:1},children:q7.map(U=>m.jsx(N8e,{children:m.jsx(AJ,{children:U})},U))}),r===0&&j(),r===1&&z(),r===2&&N(),r===3&&W(),r===4&&H()]}),m.jsxs(Xd,{sx:{px:3,pb:2},children:[m.jsx(kt,{onClick:t,disabled:o,children:"Cancel"}),m.jsx(ce,{sx:{flex:1}}),r>0&&m.jsx(kt,{onClick:F,startIcon:m.jsx($Ce,{}),disabled:o,children:"Back"}),r<q7.length-1&&m.jsx(kt,{variant:"contained",onClick:I,endIcon:m.jsx(NCe,{}),disabled:o,children:r===0&&!f?"Skip Template":"Next"}),r===q7.length-1&&m.jsxs(m.Fragment,{children:[m.jsx(kt,{variant:"outlined",onClick:L,startIcon:m.jsx(fc,{}),disabled:o,children:"Add Another"}),m.jsx(kt,{variant:"contained",onClick:$,startIcon:o?m.jsx(zr,{size:16}):m.jsx(VCe,{}),disabled:o,children:o?"Creating...":"Create Bridge"})]})]})]})}const l9e=()=>{const e=Tu(),t=Hs(),{content:n,isLoading:r,error:i}=Vm(),[o,s]=_.useState(null),[a,l]=_.useState(!1),[c,u]=_.useState(!1),[f,h]=_.useState(!1),g=_.useRef(null),y=_.useCallback(async()=>{try{await S8e()}catch(A){e.show({message:A instanceof Error?A.message:"Export failed",severity:"error"})}},[e]),b=_.useCallback(()=>{g.current?.click()},[]),v=_.useCallback(A=>{const E=A.target.files?.[0];E&&(s(E),l(!0)),A.target.value=""},[]),S=_.useCallback(()=>{l(!1),s(null)},[]),C=_.useCallback(()=>{t(Fo())},[t]),w=_.useCallback(async A=>{h(!0);try{const E={start:"Started",stop:"Stopped",restart:"Restarted"},D=await{start:FX,stop:BX,restart:zX}[A]();e.show({message:`${E[A]} ${D.count} bridge(s)`,severity:"success"}),t(Fo())}catch(E){e.show({message:E instanceof Error?E.message:`${A} failed`,severity:"error"})}finally{h(!1)}},[e,t]);return _.useEffect(()=>{i&&e.show({message:i.message??"Could not load bridges",severity:"error"})},[i,e]),m.jsxs(m.Fragment,{children:[m.jsx(ZO,{sx:A=>({zIndex:A.zIndex.drawer+1}),open:r||f,children:(r||f)&&m.jsx(zr,{color:"inherit"})}),m.jsx(zt,{spacing:4,children:n&&m.jsxs(m.Fragment,{children:[m.jsxs(ce,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[n.length>=1&&m.jsxs(m.Fragment,{children:[m.jsx(kt,{onClick:()=>w("start"),startIcon:m.jsx(xJ,{}),variant:"outlined",size:"small",color:"success",disabled:f,children:"Start All"}),m.jsx(kt,{onClick:()=>w("stop"),startIcon:m.jsx(CJ,{}),variant:"outlined",size:"small",color:"error",disabled:f,children:"Stop All"}),m.jsx(kt,{onClick:()=>w("restart"),startIcon:m.jsx(Qy,{}),variant:"outlined",size:"small",color:"warning",disabled:f,children:"Restart All"}),m.jsx(gi,{orientation:"vertical",flexItem:!0})]}),m.jsx(kt,{onClick:b,startIcon:m.jsx(QCe,{}),variant:"outlined",children:"Import"}),m.jsx(kt,{onClick:y,startIcon:m.jsx(b8e,{}),variant:"outlined",disabled:n.length===0,children:"Export All"}),m.jsx(kt,{onClick:()=>u(!0),startIcon:m.jsx(vJ,{}),variant:"outlined",children:"Wizard"}),m.jsx(kt,{component:Du,to:Pt.createBridge,endIcon:m.jsx(fc,{}),variant:"outlined",children:"Create new bridge"}),m.jsx("input",{type:"file",ref:g,onChange:v,accept:".json",style:{display:"none"}})]}),m.jsx(P8e,{bridges:n})]})}),m.jsx(A8e,{open:a,file:o,onClose:S,onImported:C}),m.jsx(_J,{open:c,onClose:()=>u(!1),onComplete:()=>t(Fo())})]})},c9e=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function $x({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=m.jsx(gr,{sx:{py:2,"&:last-child":{pb:2}},children:m.jsxs(ce,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[m.jsx(rl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),m.jsxs(ce,{sx:{minWidth:0},children:[m.jsx(ie,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),m.jsx(ie,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&m.jsx(ie,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return m.jsx(tr,{variant:"outlined",sx:{height:"100%"},children:o?m.jsx(Wm,{onClick:o,sx:{height:"100%"},children:s}):s})}function u9e({bridge:e,onClick:t}){const{content:n}=Vm(),r=n?.find(a=>a.id===e.id),[i,o]=_.useState(!1);_.useEffect(()=>{_w(e.id).then(o)},[e.id]);const s=e.status==="running"?"success":e.status==="failed"?"error":"default";return m.jsx(tr,{variant:"outlined",children:m.jsx(Wm,{onClick:t,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1.5,children:[i?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):r&&m.jsx(rl,{sx:{bgcolor:RT(r),width:36,height:36},children:(()=>{const a=MT(r);return m.jsx(a,{sx:{fontSize:20}})})()}),m.jsxs(ce,{flex:1,minWidth:0,children:[m.jsx(ie,{variant:"subtitle2",noWrap:!0,children:e.name}),m.jsxs(zt,{direction:"row",spacing:.5,alignItems:"center",children:[m.jsx(Et,{label:e.status,size:"small",color:s,sx:{height:18,fontSize:"0.65rem"}}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:[e.deviceCount," devices"]}),e.fabricCount>0&&m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," fabrics"]})]})]}),e.failedEntityCount>0&&m.jsx(Et,{icon:m.jsx(iw,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function sd({title:e,icon:t,onClick:n}){return m.jsx(tr,{variant:"outlined",children:m.jsx(Wm,{onClick:n,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(ce,{display:"flex",alignItems:"center",gap:1.5,children:[m.jsx(rl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),m.jsx(ie,{variant:"subtitle2",children:e})]})})})})}const d9e=()=>{const e=hf(),t=Hs(),[n,r]=_.useState(null),[i,o]=_.useState(!0),[s,a]=_.useState(!1),[l,c]=_.useState(!1),u=_.useRef(!1),f=_.useCallback(async()=>{try{const S=await fetch("api/health/detailed");S.ok&&r(await S.json())}catch{}finally{o(!1)}},[]);_.useEffect(()=>{f();const S=setInterval(f,15e3);return()=>clearInterval(S)},[f]);const h=_.useMemo(()=>n?.bridgeDetails.reduce((S,C)=>S+C.deviceCount,0)??0,[n]),g=_.useMemo(()=>n?.bridgeDetails?n.bridgeDetails.reduce((S,C)=>S+C.fabricCount,0):0,[n]),y=_.useMemo(()=>n?.bridgeDetails.reduce((S,C)=>S+C.failedEntityCount,0)??0,[n]);if(i)return m.jsx(ce,{display:"flex",justifyContent:"center",p:8,children:m.jsx(zr,{})});const b=n?.services.bridges,v=n?.services.homeAssistant.connected??!1;return m.jsxs(ce,{sx:{p:2},children:[m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,mb:3,children:[m.jsx(ET,{color:"primary",fontSize:"large"}),m.jsx(ie,{variant:"h5",fontWeight:600,children:"Dashboard"})]}),m.jsxs(dt,{container:!0,spacing:2,sx:{mb:3},children:[m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Bridges",value:b?.total??0,icon:m.jsx(t6,{}),color:"#4caf50",subtitle:b?`${b.running} running${b.failed>0?` · ${b.failed} failed`:""}`:void 0,onClick:()=>e(Pt.bridges)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Devices",value:h,icon:m.jsx(Ns,{}),color:"#2196f3",subtitle:y>0?`${y} failed`:void 0,onClick:()=>e(Pt.devices)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"Fabrics",value:g,icon:m.jsx(Jy,{}),color:"#9c27b0",onClick:()=>e(Pt.networkMap)})}),m.jsx(dt,{size:{xs:6,sm:3},children:m.jsx($x,{title:"HA Connection",value:v?"Online":"Offline",icon:v?m.jsx(Mu,{}):m.jsx(vf,{}),color:v?"#4caf50":"#f44336",subtitle:n?.uptime!=null?`Uptime ${c9e(n.uptime)}`:void 0})})]}),m.jsx(gi,{sx:{mb:3}}),m.jsx(ce,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:m.jsx(ie,{variant:"h6",children:"Bridges"})}),m.jsxs(zt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[m.jsx(kt,{variant:"contained",startIcon:m.jsx(vJ,{}),onClick:()=>a(!0),size:"large",children:"Bridge Wizard"}),m.jsx(kt,{variant:"outlined",startIcon:m.jsx(fc,{}),onClick:()=>e(Pt.createBridge),size:"large",children:"Create Bridge"}),m.jsx(gi,{orientation:"vertical",flexItem:!0}),m.jsx(kt,{variant:"outlined",color:"success",startIcon:m.jsx(xJ,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await FX(),await f()}finally{c(!1),u.current=!1}}},children:"Start All"}),m.jsx(kt,{variant:"outlined",color:"error",startIcon:m.jsx(CJ,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await BX(),await f()}finally{c(!1),u.current=!1}}},children:"Stop All"}),m.jsx(kt,{variant:"outlined",color:"warning",startIcon:m.jsx(Qy,{}),disabled:l,onClick:async()=>{if(!u.current){u.current=!0,c(!0);try{await zX(),await f()}finally{c(!1),u.current=!1}}},children:"Restart All"})]}),n?.bridgeDetails&&n.bridgeDetails.length>0?m.jsx(dt,{container:!0,spacing:1.5,children:[...n.bridgeDetails].sort((S,C)=>S.name.localeCompare(C.name,void 0,{sensitivity:"base"})).map(S=>m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(u9e,{bridge:S,onClick:()=>e(Pt.bridge(S.id))})},S.id))}):m.jsx(tr,{variant:"outlined",children:m.jsx(gr,{sx:{textAlign:"center",py:4},children:m.jsx(ie,{color:"text.secondary",children:"No bridges configured yet. Use the Bridge Wizard or create one manually."})})}),m.jsx(gi,{sx:{my:3}}),m.jsx(ie,{variant:"h6",sx:{mb:2},children:"Quick Navigation"}),m.jsxs(dt,{container:!0,spacing:1.5,children:[m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Bridges",icon:m.jsx(t6,{sx:{fontSize:20}}),onClick:()=>e(Pt.bridges)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"All Devices",icon:m.jsx(Ns,{sx:{fontSize:20}}),onClick:()=>e(Pt.devices)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Network Map",icon:m.jsx(vT,{sx:{fontSize:20}}),onClick:()=>e(Pt.networkMap)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Health Dashboard",icon:m.jsx(eT,{sx:{fontSize:20}}),onClick:()=>e(Pt.health)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Startup Order",icon:m.jsx(yb,{sx:{fontSize:20}}),onClick:()=>e(Pt.startup)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Lock Credentials",icon:m.jsx(uu,{sx:{fontSize:20}}),onClick:()=>e(Pt.lockCredentials)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Filter Reference",icon:m.jsx(AT,{sx:{fontSize:20}}),onClick:()=>e(Pt.labels)})}),m.jsx(dt,{size:{xs:12,sm:6,md:4},children:m.jsx(sd,{title:"Settings",icon:m.jsx(wb,{sx:{fontSize:20}}),onClick:()=>e(Pt.settings)})})]}),m.jsx(_J,{open:s,onClose:()=>a(!1),onComplete:()=>{t(Fo()),f()}})]})};function f9e(e){return Qe("MuiPagination",e)}tt("MuiPagination",["root","ul","outlined","text"]);function h9e(e={}){const{boundaryCount:t=1,componentName:n="usePagination",count:r=1,defaultPage:i=1,disabled:o=!1,hideNextButton:s=!1,hidePrevButton:a=!1,onChange:l,page:c,showFirstButton:u=!1,showLastButton:f=!1,siblingCount:h=1,...g}=e,[y,b]=Ya({controlled:c,default:i,name:n,state:"page"}),v=(I,F)=>{c||b(F),l&&l(I,F)},S=(I,F)=>{const L=F-I+1;return Array.from({length:L},(R,$)=>I+$)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),A=Math.max(Math.min(y-h,r-t-h*2-1),t+2),E=Math.min(Math.max(y+h,t+h*2+2),r-t-1),O=[...u?["first"]:[],...a?[]:["previous"],...C,...A>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(A,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...f?["last"]:[]],D=I=>{switch(I){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:O.map(I=>typeof I=="number"?{onClick:F=>{v(F,I)},type:"page",page:I,selected:I===y,disabled:o,"aria-current":I===y?"page":void 0}:{onClick:F=>{v(F,D(I))},type:I,page:D(I),selected:!1,disabled:o||!I.includes("ellipsis")&&(I==="next"||I==="last"?y>=r:y<=1)}),...g}}function p9e(e){return Qe("MuiPaginationItem",e)}const Mo=tt("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),m9e=_e(m.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),g9e=_e(m.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),y9e=_e(m.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),b9e=_e(m.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),DJ=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ye(n.size)}`],n.variant==="text"&&t[`text${ye(n.color)}`],n.variant==="outlined"&&t[`outlined${ye(n.color)}`],n.shape==="rounded"&&t.rounded,n.type==="page"&&t.page,(n.type==="start-ellipsis"||n.type==="end-ellipsis")&&t.ellipsis,(n.type==="previous"||n.type==="next")&&t.previousNext,(n.type==="first"||n.type==="last")&&t.firstLast]},v9e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,c={root:["root",`size${ye(o)}`,l,s,n!=="standard"&&`color${ye(n)}`,n!=="standard"&&`${l}${ye(n)}`,r&&"disabled",i&&"selected",{page:"page",first:"firstLast",last:"firstLast","start-ellipsis":"ellipsis","end-ellipsis":"ellipsis",previous:"previousNext",next:"previousNext"}[a]],icon:["icon"]};return et(c,p9e,t)},x9e=me("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:DJ})(Ge(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,height:"auto",[`&.${Mo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),S9e=me(ba,{name:"MuiPaginationItem",slot:"Root",overridesResolver:DJ})(Ge(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,height:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,[`&.${Mo.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Mo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},transition:e.transitions.create(["color","background-color"],{duration:e.transitions.duration.short}),"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Mo.selected}`]:{backgroundColor:(e.vars||e).palette.action.selected,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Mo.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Mo.disabled}`]:{opacity:1,color:(e.vars||e).palette.action.disabled,backgroundColor:(e.vars||e).palette.action.selected}},variants:[{props:{size:"small"},style:{minWidth:26,height:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,height:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}},{props:{shape:"rounded"},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:{variant:"outlined"},style:{border:e.vars?`1px solid ${e.alpha(e.vars.palette.common.onBackground,.23)}`:`1px solid ${e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${Mo.selected}`]:{[`&.${Mo.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Mo.selected}`]:{[`&.${Mo.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Fn(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Mo.selected}`]:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}},[`&.${Mo.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Mo.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Fn(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Mo.selected}`]:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.5)}`,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.activatedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Mo.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),w9e=me("div",{name:"MuiPaginationItem",slot:"Icon"})(Ge(({theme:e})=>({fontSize:e.typography.pxToRem(20),margin:"0 -8px",variants:[{props:{size:"small"},style:{fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:e.typography.pxToRem(22)}}]}))),C9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:c,selected:u=!1,shape:f="circular",size:h="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:u,shape:f,size:h,type:b,variant:v},w=mf(),A=v9e(C),E={slots:{previous:g.previous??a.previous,next:g.next??a.next,first:g.first??a.first,last:g.last??a.last},slotProps:y},[O,D]=lt("previous",{elementType:y9e,externalForwardedProps:E,ownerState:C}),[T,I]=lt("next",{elementType:b9e,externalForwardedProps:E,ownerState:C}),[F,L]=lt("first",{elementType:m9e,externalForwardedProps:E,ownerState:C}),[R,$]=lt("last",{elementType:g9e,externalForwardedProps:E,ownerState:C}),j=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:O,next:T,first:F,last:R}[j],N={previous:D,next:I,first:L,last:$}[j];return b==="start-ellipsis"||b==="end-ellipsis"?m.jsx(x9e,{ref:n,ownerState:C,className:Oe(A.root,i),children:"…"}):m.jsxs(S9e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(A.root,i),...S,children:[b==="page"&&c,z?m.jsx(w9e,{...N,className:A.icon,as:z}):null]})}),E9e=e=>{const{classes:t,variant:n}=e;return et({root:["root",n],ul:["ul"]},f9e,t)},A9e=me("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),k9e=me("ul",{name:"MuiPagination",slot:"Ul"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"});function _9e(e,t,n){return e==="page"?`${n?"":"Go to "}page ${t}`:`Go to ${e} page`}const D9e=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:c=!1,getItemAriaLabel:u=_9e,hideNextButton:f=!1,hidePrevButton:h=!1,onChange:g,page:y,renderItem:b=F=>m.jsx(C9e,{...F}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:A="medium",variant:E="text",...O}=r,{items:D}=h9e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:c,getItemAriaLabel:u,hideNextButton:f,hidePrevButton:h,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:A,variant:E},I=E9e(T);return m.jsx(A9e,{"aria-label":"pagination navigation",className:Oe(I.root,o),ownerState:T,ref:n,...O,children:m.jsx(k9e,{className:I.ul,ownerState:T,children:D.map((F,L)=>m.jsx("li",{children:b({...F,color:s,"aria-label":u(F.type,F.page,F.selected),shape:v,size:A,variant:E})},L))})})}),qB=[10,25,50,100],GB="hamh-devices-page-size",O9e=()=>{const e=Hs(),{content:t,isLoading:n}=Vm(),[r,i]=_.useState(""),[o,s]=_.useState(""),[a,l]=_.useState(""),[c,u]=_.useState("name"),[f,h]=_.useState("asc"),[g,y]=_.useState(1),[b,v]=_.useState(()=>{const Z=localStorage.getItem(GB);if(!Z)return 12;if(Z==="all")return 0;const re=parseInt(Z,10);return re>0?re:12}),[S,C]=_.useState(""),w=_.useCallback(Z=>{v(Z),localStorage.setItem(GB,Z===0?"all":String(Z)),y(1)},[]),[A,E]=_.useState(!1),[O,D]=_.useState(""),[T,I]=_.useState(""),[F,L]=_.useState(),[R,$]=_.useState({open:!1,message:"",severity:"success"});_.useEffect(()=>{e(Fo())},[e]),_.useEffect(()=>{t&&t.forEach(Z=>{e(du(Z.id))})},[e,t]);const j=Hm(Z=>Z.devices.byBridge),z=_.useCallback((Z,re,oe)=>{const de=[];if(!Z.parts||Z.parts.length===0)Z.endpoint!==0&&de.push({bridgeId:re,bridgeName:oe,endpoint:Z});else for(const be of Z.parts)de.push(...z(be,re,oe));return de},[]),N=_.useMemo(()=>{const Z=[];return(t||[]).forEach(re=>{const de=j[re.id]?.content;de&&Z.push(...z(de,re.id,re.name))}),Z},[t,j,z]),[W,H]=_.useState({}),U=_.useMemo(()=>{const Z=[];for(const re of N){const de=re.endpoint.state.homeAssistantEntity?.entity?.entity_id;de&&Z.push(de)}return Z},[N]),K=_.useCallback(()=>{U.length!==0&&qZ(U).then(H).catch(()=>{})},[U]);_.useEffect(()=>{K()},[K]);const B=_.useCallback(()=>{K()},[K]),q=n||t&&t.length>0&&N.length===0,X=_.useMemo(()=>N.filter(Z=>{const re=Is(Z.endpoint.state)??Z.endpoint.id.local,oe=Z.endpoint.type.name,de=re.toLowerCase().includes(r.toLowerCase())||Z.bridgeName.toLowerCase().includes(r.toLowerCase())||oe.toLowerCase().includes(r.toLowerCase()),be=!o||Z.bridgeId===o;return de&&be&&(!a||oe===a)}),[N,r,o,a]),V=_.useMemo(()=>[...X].sort((re,oe)=>{const de=Is(re.endpoint.state)??re.endpoint.id.local,be=Is(oe.endpoint.state)??oe.endpoint.id.local;let je=0;switch(c){case"name":je=de.localeCompare(be);break;case"type":je=re.endpoint.type.name.localeCompare(oe.endpoint.type.name),je===0&&(je=de.localeCompare(be));break;case"bridge":je=re.bridgeName.localeCompare(oe.bridgeName),je===0&&(je=de.localeCompare(be));break}return f==="asc"?je:-je}),[X,c,f]),Y=b===0?1:Math.ceil(V.length/b),J=b===0?V:V.slice((g-1)*b,g*b),ne=_.useMemo(()=>{const Z=new Set(N.map(re=>re.endpoint.type.name));return Array.from(Z).sort()},[N]),ee=_.useMemo(()=>t?[...t].sort((Z,re)=>{const oe=Z.name.localeCompare(re.name);return f==="asc"?oe:-oe}):[],[t,f]),se=_.useCallback(()=>{e(Fo())},[e]),ue=_.useCallback(async(Z,re)=>{D(Z),I(re);try{const de=(await cT(re)).mappings.find(be=>be.entityId===Z);L(de)}catch{L(void 0)}E(!0)},[]),te=_.useCallback(async Z=>{if(!(!T||!O))try{await uT(T,O,Z),$({open:!0,message:`Mapping saved for ${O}. Restart the bridge to apply changes.`,severity:"success"}),E(!1)}catch(re){$({open:!0,message:`Failed to save mapping: ${re}`,severity:"error"})}},[T,O]);return q?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(zr,{})}):m.jsxs(ce,{sx:{p:2},children:[m.jsxs(ie,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[m.jsx(Ns,{}),"All Devices",m.jsx(kt,{variant:"outlined",startIcon:m.jsx(_T,{}),onClick:se,sx:{ml:"auto"},children:"Refresh"})]}),m.jsx(tr,{sx:{mb:3},children:m.jsx(gr,{children:m.jsxs(zt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[m.jsx(Lr,{label:"Search devices...",value:r,onChange:Z=>i(Z.target.value),sx:{flexGrow:1}}),m.jsxs(pa,{sx:{minWidth:200},children:[m.jsx(sc,{children:"Bridge"}),m.jsxs(sa,{value:o,label:"Bridge",onChange:Z=>s(Z.target.value),children:[m.jsx(er,{value:"",children:"All Bridges"}),ee.map(Z=>m.jsx(er,{value:Z.id,children:Z.name},Z.id))]})]}),m.jsxs(pa,{sx:{minWidth:200},children:[m.jsx(sc,{children:"Device Type"}),m.jsxs(sa,{value:a,label:"Device Type",onChange:Z=>l(Z.target.value),children:[m.jsx(er,{value:"",children:"All Types"}),ne.map(Z=>m.jsx(er,{value:Z,children:Z},Z))]})]}),m.jsxs(pa,{sx:{minWidth:150},children:[m.jsx(sc,{children:"Sort By"}),m.jsxs(sa,{value:c,label:"Sort By",onChange:Z=>u(Z.target.value),children:[m.jsx(er,{value:"bridge",children:"Bridge"}),m.jsx(er,{value:"type",children:"Device Type"}),m.jsx(er,{value:"name",children:"Name"})]})]}),m.jsx(cn,{title:f==="asc"?"Ascending":"Descending",children:m.jsx(_n,{onClick:()=>h(Z=>Z==="asc"?"desc":"asc"),color:"primary",children:f==="asc"?m.jsx(ST,{}):m.jsx(xT,{})})})]})})}),m.jsx(dt,{container:!0,spacing:2,children:J.map(Z=>m.jsx(dt,{size:{xs:12,sm:6,lg:4},children:m.jsx(KZ,{endpoint:Z.endpoint,bridgeName:Z.bridgeName,bridgeId:Z.bridgeId,onEditMapping:ue,imageInfo:W[Z.endpoint.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:B})},`${Z.bridgeId}-${Z.endpoint.id.global}`))}),m.jsxs(ce,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[m.jsxs(zt,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),m.jsxs(sa,{value:b===0?"all":qB.includes(b)?String(b):"",onChange:Z=>{const re=Z.target.value;C(""),w(re==="all"?0:parseInt(re,10))},displayEmpty:!0,renderValue:Z=>Z==="all"?"All":Z===""?String(b):Z,size:"small",sx:{minWidth:80},children:[qB.map(Z=>m.jsx(er,{value:String(Z),children:Z},Z)),m.jsx(er,{value:"all",children:"All"})]}),m.jsx(Lr,{size:"small",type:"number",placeholder:"Custom",value:S,onChange:Z=>C(Z.target.value),onBlur:()=>{const Z=parseInt(S,10);Z>0&&w(Z),C("")},onKeyDown:Z=>{if(Z.key==="Enter"){const re=parseInt(S,10);re>0&&w(re),C("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),Y>1&&m.jsx(D9e,{count:Y,page:g,onChange:(Z,re)=>y(re),color:"primary"}),m.jsx(ie,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:X.length===N.length?`${N.length} device${N.length!==1?"s":""}`:`${X.length} of ${N.length} devices`})]}),X.length===0&&m.jsxs(ce,{sx:{textAlign:"center",py:8},children:[m.jsx(ie,{variant:"h6",color:"text.secondary",children:"No devices found"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),m.jsx(fT,{open:A,entityId:O,domain:O.split(".")[0]||"",currentMapping:F,onSave:te,onClose:()=>E(!1)}),m.jsx(jO,{open:R.open,autoHideDuration:6e3,onClose:()=>$(Z=>({...Z,open:!1})),children:m.jsx(kn,{onClose:()=>$(Z=>({...Z,open:!1})),severity:R.severity,sx:{width:"100%"},children:R.message})})]})};function hn(e){return typeof e!="object"||e===null||typeof e.lastModified=="number"&&typeof File<"u"&&e instanceof File||typeof e.getMonth=="function"&&typeof Date<"u"&&e instanceof Date?!1:!Array.isArray(e)}function T9e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),hn(e.additionalItems)}function KB(e){if(e==="")return;if(e===null)return null;if(/\.$/.test(e)||/\.0$/.test(e)||/\.\d*0$/.test(e))return e;const t=Number(e);return typeof t=="number"&&!Number.isNaN(t)?t:e}const fu="__additional_property",n2="additionalProperties",wu="allOf",Pn="anyOf",Sa="const",Ow="default",PT="dependencies",M9e="enum",po="__errors",pr="$id",jT="if",$h="items",R9e="_$junk_option_schema_id$_",W5="$name",nn="oneOf",Jk="patternProperties",Un="properties",G7="readonly",OJ="required",r6="submitButtonOptions",mr="$ref",U1="$schema",TJ="root",MJ="_",I9e=["discriminator","propertyName"],YB="formContext",P9e="layoutGridLookupMap",$T="__rjsf_additionalProperties",RJ="__rjsf_rootSchema",j9e="ui:field",LT="ui:widget",$d="ui:options",Qk="ui:globalOptions",$9e="ui:definitions",L9e="https://json-schema.org/draft/2019-09/schema",q5="https://json-schema.org/draft/2020-12/schema";function $t(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===LT&&hn(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===$d&&hn(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function IJ(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=$t(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var PJ=typeof global=="object"&&global&&global.Object===Object&&global,N9e=typeof self=="object"&&self&&self.Object===Object&&self,vc=PJ||N9e||Function("return this")(),wa=vc.Symbol,jJ=Object.prototype,F9e=jJ.hasOwnProperty,B9e=jJ.toString,y1=wa?wa.toStringTag:void 0;function z9e(e){var t=F9e.call(e,y1),n=e[y1];try{e[y1]=void 0;var r=!0}catch{}var i=B9e.call(e);return r&&(t?e[y1]=n:delete e[y1]),i}var H9e=Object.prototype,U9e=H9e.toString;function V9e(e){return U9e.call(e)}var W9e="[object Null]",q9e="[object Undefined]",XB=wa?wa.toStringTag:void 0;function Ru(e){return e==null?e===void 0?q9e:W9e:XB&&XB in Object(e)?z9e(e):V9e(e)}function $J(e,t){return function(n){return e(t(n))}}var Tw=$J(Object.getPrototypeOf,Object);function Ca(e){return e!=null&&typeof e=="object"}var G9e="[object Object]",K9e=Function.prototype,Y9e=Object.prototype,LJ=K9e.toString,X9e=Y9e.hasOwnProperty,Z9e=LJ.call(Object);function Jd(e){if(!Ca(e)||Ru(e)!=G9e)return!1;var t=Tw(e);if(t===null)return!0;var n=X9e.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&LJ.call(n)==Z9e}function e_(e){const t={[po]:[],addError(n){this[po].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:e_(r)}),t);if(Jd(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:e_(n[i])}),t)}return t}function J9e(){this.__data__=[],this.size=0}function Cb(e,t){return e===t||e!==e&&t!==t}function Mw(e,t){for(var n=e.length;n--;)if(Cb(e[n][0],t))return n;return-1}var Q9e=Array.prototype,e7e=Q9e.splice;function t7e(e){var t=this.__data__,n=Mw(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():e7e.call(t,n,1),--this.size,!0}function n7e(e){var t=this.__data__,n=Mw(t,e);return n<0?void 0:t[n][1]}function r7e(e){return Mw(this.__data__,e)>-1}function i7e(e,t){var n=this.__data__,r=Mw(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Iu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Iu.prototype.clear=J9e;Iu.prototype.delete=t7e;Iu.prototype.get=n7e;Iu.prototype.has=r7e;Iu.prototype.set=i7e;function o7e(){this.__data__=new Iu,this.size=0}function s7e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function a7e(e){return this.__data__.get(e)}function l7e(e){return this.__data__.has(e)}function Bn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var c7e="[object AsyncFunction]",u7e="[object Function]",d7e="[object GeneratorFunction]",f7e="[object Proxy]";function Eb(e){if(!Bn(e))return!1;var t=Ru(e);return t==u7e||t==d7e||t==c7e||t==f7e}var K7=vc["__core-js_shared__"],ZB=(function(){var e=/[^.]+$/.exec(K7&&K7.keys&&K7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function h7e(e){return!!ZB&&ZB in e}var p7e=Function.prototype,m7e=p7e.toString;function ep(e){if(e!=null){try{return m7e.call(e)}catch{}try{return e+""}catch{}}return""}var g7e=/[\\^$.*+?()[\]{}|]/g,y7e=/^\[object .+?Constructor\]$/,b7e=Function.prototype,v7e=Object.prototype,x7e=b7e.toString,S7e=v7e.hasOwnProperty,w7e=RegExp("^"+x7e.call(S7e).replace(g7e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function C7e(e){if(!Bn(e)||h7e(e))return!1;var t=Eb(e)?w7e:y7e;return t.test(ep(e))}function E7e(e,t){return e?.[t]}function tp(e,t){var n=E7e(e,t);return C7e(n)?n:void 0}var r2=tp(vc,"Map"),i2=tp(Object,"create");function A7e(){this.__data__=i2?i2(null):{},this.size=0}function k7e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _7e="__lodash_hash_undefined__",D7e=Object.prototype,O7e=D7e.hasOwnProperty;function T7e(e){var t=this.__data__;if(i2){var n=t[e];return n===_7e?void 0:n}return O7e.call(t,e)?t[e]:void 0}var M7e=Object.prototype,R7e=M7e.hasOwnProperty;function I7e(e){var t=this.__data__;return i2?t[e]!==void 0:R7e.call(t,e)}var P7e="__lodash_hash_undefined__";function j7e(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=i2&&t===void 0?P7e:t,this}function Lh(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Lh.prototype.clear=A7e;Lh.prototype.delete=k7e;Lh.prototype.get=T7e;Lh.prototype.has=I7e;Lh.prototype.set=j7e;function $7e(){this.size=0,this.__data__={hash:new Lh,map:new(r2||Iu),string:new Lh}}function L7e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Rw(e,t){var n=e.__data__;return L7e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function N7e(e){var t=Rw(this,e).delete(e);return this.size-=t?1:0,t}function F7e(e){return Rw(this,e).get(e)}function B7e(e){return Rw(this,e).has(e)}function z7e(e,t){var n=Rw(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Pu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pu.prototype.clear=$7e;Pu.prototype.delete=N7e;Pu.prototype.get=F7e;Pu.prototype.has=B7e;Pu.prototype.set=z7e;var H7e=200;function U7e(e,t){var n=this.__data__;if(n instanceof Iu){var r=n.__data__;if(!r2||r.length<H7e-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pu(r)}return n.set(e,t),this.size=n.size,this}function Ja(e){var t=this.__data__=new Iu(e);this.size=t.size}Ja.prototype.clear=o7e;Ja.prototype.delete=s7e;Ja.prototype.get=a7e;Ja.prototype.has=l7e;Ja.prototype.set=U7e;var V7e="__lodash_hash_undefined__";function W7e(e){return this.__data__.set(e,V7e),this}function q7e(e){return this.__data__.has(e)}function Nh(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Pu;++t<n;)this.add(e[t])}Nh.prototype.add=Nh.prototype.push=W7e;Nh.prototype.has=q7e;function G7e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function o2(e,t){return e.has(t)}var K7e=1,Y7e=2;function NJ(e,t,n,r,i,o){var s=n&K7e,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var f=-1,h=!0,g=n&Y7e?new Nh:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var y=e[f],b=t[f];if(r)var v=s?r(b,y,f,t,e,o):r(y,b,f,e,t,o);if(v!==void 0){if(v)continue;h=!1;break}if(g){if(!G7e(t,function(S,C){if(!o2(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){h=!1;break}}else if(!(y===b||i(y,b,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var i6=vc.Uint8Array;function X7e(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function NT(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Z7e=1,J7e=2,Q7e="[object Boolean]",eEe="[object Date]",tEe="[object Error]",nEe="[object Map]",rEe="[object Number]",iEe="[object RegExp]",oEe="[object Set]",sEe="[object String]",aEe="[object Symbol]",lEe="[object ArrayBuffer]",cEe="[object DataView]",JB=wa?wa.prototype:void 0,Y7=JB?JB.valueOf:void 0;function uEe(e,t,n,r,i,o,s){switch(n){case cEe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case lEe:return!(e.byteLength!=t.byteLength||!o(new i6(e),new i6(t)));case Q7e:case eEe:case rEe:return Cb(+e,+t);case tEe:return e.name==t.name&&e.message==t.message;case iEe:case sEe:return e==t+"";case nEe:var a=X7e;case oEe:var l=r&Z7e;if(a||(a=NT),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=J7e,s.set(e,t);var u=NJ(a(e),a(t),r,i,o,s);return s.delete(e),u;case aEe:if(Y7)return Y7.call(e)==Y7.call(t)}return!1}function FT(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Fi=Array.isArray;function FJ(e,t,n){var r=t(e);return Fi(e)?r:FT(r,n(e))}function dEe(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function BJ(){return[]}var fEe=Object.prototype,hEe=fEe.propertyIsEnumerable,QB=Object.getOwnPropertySymbols,BT=QB?function(e){return e==null?[]:(e=Object(e),dEe(QB(e),function(t){return hEe.call(e,t)}))}:BJ;function zJ(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var pEe="[object Arguments]";function ez(e){return Ca(e)&&Ru(e)==pEe}var HJ=Object.prototype,mEe=HJ.hasOwnProperty,gEe=HJ.propertyIsEnumerable,hm=ez((function(){return arguments})())?ez:function(e){return Ca(e)&&mEe.call(e,"callee")&&!gEe.call(e,"callee")};function yEe(){return!1}var UJ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tz=UJ&&typeof module=="object"&&module&&!module.nodeType&&module,bEe=tz&&tz.exports===UJ,nz=bEe?vc.Buffer:void 0,vEe=nz?nz.isBuffer:void 0,Fh=vEe||yEe,xEe=9007199254740991,SEe=/^(?:0|[1-9]\d*)$/;function Iw(e,t){var n=typeof e;return t=t??xEe,!!t&&(n=="number"||n!="symbol"&&SEe.test(e))&&e>-1&&e%1==0&&e<t}var wEe=9007199254740991;function zT(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=wEe}var CEe="[object Arguments]",EEe="[object Array]",AEe="[object Boolean]",kEe="[object Date]",_Ee="[object Error]",DEe="[object Function]",OEe="[object Map]",TEe="[object Number]",MEe="[object Object]",REe="[object RegExp]",IEe="[object Set]",PEe="[object String]",jEe="[object WeakMap]",$Ee="[object ArrayBuffer]",LEe="[object DataView]",NEe="[object Float32Array]",FEe="[object Float64Array]",BEe="[object Int8Array]",zEe="[object Int16Array]",HEe="[object Int32Array]",UEe="[object Uint8Array]",VEe="[object Uint8ClampedArray]",WEe="[object Uint16Array]",qEe="[object Uint32Array]",$r={};$r[NEe]=$r[FEe]=$r[BEe]=$r[zEe]=$r[HEe]=$r[UEe]=$r[VEe]=$r[WEe]=$r[qEe]=!0;$r[CEe]=$r[EEe]=$r[$Ee]=$r[AEe]=$r[LEe]=$r[kEe]=$r[_Ee]=$r[DEe]=$r[OEe]=$r[TEe]=$r[MEe]=$r[REe]=$r[IEe]=$r[PEe]=$r[jEe]=!1;function GEe(e){return Ca(e)&&zT(e.length)&&!!$r[Ru(e)]}function HT(e){return function(t){return e(t)}}var VJ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fy=VJ&&typeof module=="object"&&module&&!module.nodeType&&module,KEe=fy&&fy.exports===VJ,X7=KEe&&PJ.process,pm=(function(){try{var e=fy&&fy.require&&fy.require("util").types;return e||X7&&X7.binding&&X7.binding("util")}catch{}})(),rz=pm&&pm.isTypedArray,Ab=rz?HT(rz):GEe,YEe=Object.prototype,XEe=YEe.hasOwnProperty;function WJ(e,t){var n=Fi(e),r=!n&&hm(e),i=!n&&!r&&Fh(e),o=!n&&!r&&!i&&Ab(e),s=n||r||i||o,a=s?zJ(e.length,String):[],l=a.length;for(var c in e)(t||XEe.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Iw(c,l)))&&a.push(c);return a}var ZEe=Object.prototype;function Pw(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ZEe;return e===n}var JEe=$J(Object.keys,Object),QEe=Object.prototype,eAe=QEe.hasOwnProperty;function qJ(e){if(!Pw(e))return JEe(e);var t=[];for(var n in Object(e))eAe.call(e,n)&&n!="constructor"&&t.push(n);return t}function np(e){return e!=null&&zT(e.length)&&!Eb(e)}function za(e){return np(e)?WJ(e):qJ(e)}function t_(e){return FJ(e,za,BT)}var tAe=1,nAe=Object.prototype,rAe=nAe.hasOwnProperty;function iAe(e,t,n,r,i,o){var s=n&tAe,a=t_(e),l=a.length,c=t_(t),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in t:rAe.call(t,h)))return!1}var g=o.get(e),y=o.get(t);if(g&&y)return g==t&&y==e;var b=!0;o.set(e,t),o.set(t,e);for(var v=s;++f<l;){h=a[f];var S=e[h],C=t[h];if(r)var w=s?r(C,S,h,t,e,o):r(S,C,h,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=h=="constructor")}if(b&&!v){var A=e.constructor,E=t.constructor;A!=E&&"constructor"in e&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var n_=tp(vc,"DataView"),r_=tp(vc,"Promise"),N0=tp(vc,"Set"),i_=tp(vc,"WeakMap"),iz="[object Map]",oAe="[object Object]",oz="[object Promise]",sz="[object Set]",az="[object WeakMap]",lz="[object DataView]",sAe=ep(n_),aAe=ep(r2),lAe=ep(r_),cAe=ep(N0),uAe=ep(i_),ia=Ru;(n_&&ia(new n_(new ArrayBuffer(1)))!=lz||r2&&ia(new r2)!=iz||r_&&ia(r_.resolve())!=oz||N0&&ia(new N0)!=sz||i_&&ia(new i_)!=az)&&(ia=function(e){var t=Ru(e),n=t==oAe?e.constructor:void 0,r=n?ep(n):"";if(r)switch(r){case sAe:return lz;case aAe:return iz;case lAe:return oz;case cAe:return sz;case uAe:return az}return t});var dAe=1,cz="[object Arguments]",uz="[object Array]",Lx="[object Object]",fAe=Object.prototype,dz=fAe.hasOwnProperty;function hAe(e,t,n,r,i,o){var s=Fi(e),a=Fi(t),l=s?uz:ia(e),c=a?uz:ia(t);l=l==cz?Lx:l,c=c==cz?Lx:c;var u=l==Lx,f=c==Lx,h=l==c;if(h&&Fh(e)){if(!Fh(t))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new Ja),s||Ab(e)?NJ(e,t,n,r,i,o):uEe(e,t,l,n,r,i,o);if(!(n&dAe)){var g=u&&dz.call(e,"__wrapped__"),y=f&&dz.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new Ja),i(b,v,n,r,o)}}return h?(o||(o=new Ja),iAe(e,t,n,r,i,o)):!1}function kb(e,t,n,r,i){return e===t?!0:e==null||t==null||!Ca(e)&&!Ca(t)?e!==e&&t!==t:hAe(e,t,n,r,kb,i)}function pAe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?kb(e,t,void 0,n):!!r}function _r(e,t){return pAe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var mAe="[object Symbol]";function _b(e){return typeof e=="symbol"||Ca(e)&&Ru(e)==mAe}var gAe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yAe=/^\w*$/;function UT(e,t){if(Fi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||_b(e)?!0:yAe.test(e)||!gAe.test(e)||t!=null&&e in Object(t)}var bAe="Expected a function";function VT(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(bAe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(VT.Cache||Pu),n}VT.Cache=Pu;var vAe=500;function xAe(e){var t=VT(e,function(r){return n.size===vAe&&n.clear(),r}),n=t.cache;return t}var SAe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wAe=/\\(\\)?/g,GJ=xAe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(SAe,function(n,r,i,o){t.push(i?o.replace(wAe,"$1"):r||n)}),t});function qm(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var fz=wa?wa.prototype:void 0,hz=fz?fz.toString:void 0;function KJ(e){if(typeof e=="string")return e;if(Fi(e))return qm(e,KJ)+"";if(_b(e))return hz?hz.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function WT(e){return e==null?"":KJ(e)}function Gm(e,t){return Fi(e)?e:UT(e,t)?[e]:GJ(WT(e))}function rp(e){if(typeof e=="string"||_b(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function jw(e,t){t=Gm(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[rp(t[n++])];return n&&n==r?e:void 0}function We(e,t,n){var r=e==null?void 0:jw(e,t);return r===void 0?n:r}var CAe=Object.prototype,EAe=CAe.hasOwnProperty;function AAe(e,t){return e!=null&&EAe.call(e,t)}function YJ(e,t,n){t=Gm(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=rp(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&zT(i)&&Iw(s,i)&&(Fi(e)||hm(e)))}function In(e,t){return e!=null&&YJ(e,t,AAe)}function s2(e,t){return kb(e,t)}var o6=(function(){try{var e=tp(Object,"defineProperty");return e({},"",{}),e}catch{}})();function qT(e,t,n){t=="__proto__"&&o6?o6(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var kAe=Object.prototype,_Ae=kAe.hasOwnProperty;function GT(e,t,n){var r=e[t];(!(_Ae.call(e,t)&&Cb(r,n))||n===void 0&&!(t in e))&&qT(e,t,n)}function KT(e,t,n,r){if(!Bn(e))return e;t=Gm(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=rp(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var u=a[l];c=r?r(u,l,a):void 0,c===void 0&&(c=Bn(u)?u:Iw(t[i+1])?[]:{})}GT(a,l,c),a=a[l]}return e}function cr(e,t,n){return e==null?e:KT(e,t,n)}function $w(e){return e}function XJ(e){return typeof e=="function"?e:$w}var DAe=/\s/;function OAe(e){for(var t=e.length;t--&&DAe.test(e.charAt(t)););return t}var TAe=/^\s+/;function MAe(e){return e&&e.slice(0,OAe(e)+1).replace(TAe,"")}var pz=NaN,RAe=/^[-+]0x[0-9a-f]+$/i,IAe=/^0b[01]+$/i,PAe=/^0o[0-7]+$/i,jAe=parseInt;function $Ae(e){if(typeof e=="number")return e;if(_b(e))return pz;if(Bn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Bn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=MAe(e);var n=IAe.test(e);return n||PAe.test(e)?jAe(e.slice(2),n?2:8):RAe.test(e)?pz:+e}var mz=1/0,LAe=17976931348623157e292;function NAe(e){if(!e)return e===0?e:0;if(e=$Ae(e),e===mz||e===-mz){var t=e<0?-1:1;return t*LAe}return e===e?e:0}function ZJ(e){var t=NAe(e),n=t%1;return t===t?n?t-n:t:0}var FAe=9007199254740991,Z7=4294967295,BAe=Math.min;function JJ(e,t){if(e=ZJ(e),e<1||e>FAe)return[];var n=Z7,r=BAe(e,Z7);t=XJ(t),e-=Z7;for(var i=zJ(r,t);++n<e;)t(n);return i}function YT(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var gz=Object.create,QJ=(function(){function e(){}return function(t){if(!Bn(t))return{};if(gz)return gz(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function zAe(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[++i];if(n(o[l],l,o)===!1)break}return t}}var eQ=zAe();function tQ(e,t){return e&&eQ(e,t,za)}var HAe=1,UAe=2;function VAe(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],l=e[a],c=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var u=new Ja,f;if(!(f===void 0?kb(c,l,HAe|UAe,r,u):f))return!1}}return!0}function nQ(e){return e===e&&!Bn(e)}function WAe(e){for(var t=za(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,nQ(i)]}return t}function rQ(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function qAe(e){var t=WAe(e);return t.length==1&&t[0][2]?rQ(t[0][0],t[0][1]):function(n){return n===e||VAe(n,e,t)}}function GAe(e,t){return e!=null&&t in Object(e)}function iQ(e,t){return e!=null&&YJ(e,t,GAe)}var KAe=1,YAe=2;function XAe(e,t){return UT(e)&&nQ(t)?rQ(rp(e),t):function(n){var r=We(n,e);return r===void 0&&r===t?iQ(n,e):kb(t,r,KAe|YAe)}}function ZAe(e){return function(t){return t?.[e]}}function JAe(e){return function(t){return jw(t,e)}}function QAe(e){return UT(e)?ZAe(rp(e)):JAe(e)}function XT(e){return typeof e=="function"?e:e==null?$w:typeof e=="object"?Fi(e)?XAe(e[0],e[1]):qAe(e):QAe(e)}function eke(e,t,n){var r=Fi(e),i=r||Fh(e)||Ab(e);if(t=XT(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Bn(e)?n=Eb(o)?QJ(Tw(e)):{}:n={}}return(i?YT:tQ)(e,function(s,a,l){return t(n,s,a,l)}),n}function o_(e,t,n){(n!==void 0&&!Cb(e[t],n)||n===void 0&&!(t in e))&&qT(e,t,n)}var oQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yz=oQ&&typeof module=="object"&&module&&!module.nodeType&&module,tke=yz&&yz.exports===oQ,bz=tke?vc.Buffer:void 0,vz=bz?bz.allocUnsafe:void 0;function sQ(e,t){if(t)return e.slice();var n=e.length,r=vz?vz(n):new e.constructor(n);return e.copy(r),r}function ZT(e){var t=new e.constructor(e.byteLength);return new i6(t).set(new i6(e)),t}function aQ(e,t){var n=t?ZT(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function JT(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function lQ(e){return typeof e.constructor=="function"&&!Pw(e)?QJ(Tw(e)):{}}function a2(e){return Ca(e)&&np(e)}function s_(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Km(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=void 0;l===void 0&&(l=e[a]),i?qT(n,a,l):GT(n,a,l)}return n}function nke(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var rke=Object.prototype,ike=rke.hasOwnProperty;function oke(e){if(!Bn(e))return nke(e);var t=Pw(e),n=[];for(var r in e)r=="constructor"&&(t||!ike.call(e,r))||n.push(r);return n}function Db(e){return np(e)?WJ(e,!0):oke(e)}function ske(e){return Km(e,Db(e))}function ake(e,t,n,r,i,o,s){var a=s_(e,n),l=s_(t,n),c=s.get(l);if(c){o_(e,n,c);return}var u=o?o(a,l,n+"",e,t,s):void 0,f=u===void 0;if(f){var h=Fi(l),g=!h&&Fh(l),y=!h&&!g&&Ab(l);u=l,h||g||y?Fi(a)?u=a:a2(a)?u=JT(a):g?(f=!1,u=sQ(l,!0)):y?(f=!1,u=aQ(l,!0)):u=[]:Jd(l)||hm(l)?(u=a,hm(a)?u=ske(a):(!Bn(a)||Eb(a))&&(u=lQ(l))):f=!1}f&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),o_(e,n,u)}function cQ(e,t,n,r,i){e!==t&&eQ(t,function(o,s){if(i||(i=new Ja),Bn(o))ake(e,t,s,n,cQ,r,i);else{var a=r?r(s_(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),o_(e,s,a)}},Db)}function lke(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var xz=Math.max;function uQ(e,t,n){return t=xz(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=xz(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),lke(e,this,a)}}function cke(e){return function(){return e}}var uke=o6?function(e,t){return o6(e,"toString",{configurable:!0,enumerable:!1,value:cke(t),writable:!0})}:$w,dke=800,fke=16,hke=Date.now;function pke(e){var t=0,n=0;return function(){var r=hke(),i=fke-(r-n);if(n=r,i>0){if(++t>=dke)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var dQ=pke(uke);function Lw(e,t){return dQ(uQ(e,t,$w),e+"")}function mke(e,t,n){if(!Bn(n))return!1;var r=typeof t;return(r=="number"?np(n)&&Iw(t,n.length):r=="string"&&t in n)?Cb(n[t],e):!1}function gke(e){return Lw(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&mke(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t})}var yke=gke(function(e,t,n){cQ(e,t,n)}),Sz=wa?wa.isConcatSpreadable:void 0;function bke(e){return Fi(e)||hm(e)||!!(Sz&&e&&e[Sz])}function Ob(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=bke),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Ob(a,t-1,n,r,i):FT(i,a):r||(i[i.length]=a)}return i}var vke=1/0;function xke(e){var t=e==null?0:e.length;return t?Ob(e,vke):[]}function Ske(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function wke(e){return e!==e}function Cke(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function fQ(e,t,n){return t===t?Cke(e,t,n):Ske(e,wke,n)}function QT(e,t){var n=e==null?0:e.length;return!!n&&fQ(e,t,0)>-1}function G5(){}var Eke=1/0,Ake=N0&&1/NT(new N0([,-0]))[1]==Eke?function(e){return new N0(e)}:G5,kke=200;function hQ(e,t,n){var r=-1,i=QT,o=e.length,s=!0,a=[],l=a;if(o>=kke){var c=Ake(e);if(c)return NT(c);s=!1,i=o2,l=new Nh}else l=a;e:for(;++r<o;){var u=e[r],f=u;if(u=u!==0?u:0,s&&f===f){for(var h=l.length;h--;)if(l[h]===f)continue e;a.push(u)}else i(l,f,n)||(l!==a&&l.push(f),a.push(u))}return a}function pQ(e){return e&&e.length?hQ(e):[]}var _ke="[object Map]",Dke="[object Set]",Oke=Object.prototype,Tke=Oke.hasOwnProperty;function yi(e){if(e==null)return!0;if(np(e)&&(Fi(e)||typeof e=="string"||typeof e.splice=="function"||Fh(e)||Ab(e)||hm(e)))return!e.length;var t=ia(e);if(t==_ke||t==Dke)return!e.size;if(Pw(e))return!qJ(e).length;for(var n in e)if(Tke.call(e,n))return!1;return!0}const Mke=Object.prototype;function V1(e){for(const t in e)if(Mke.hasOwnProperty.call(e,t))return!1;return!0}const Rke=["array","boolean","integer","null","number","object","string"];new Set(Rke);const Ike=["$defs","definitions","properties","patternProperties","dependencies"];new Set(Ike);const Pke=["items","allOf","oneOf","anyOf"];new Set(Pke);const jke=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(jke);function K5(e){return typeof e=="object"}function Tl(e){return K5(e)?V1(e):e===!0}function w0(e,t){return e<t?-1:e>t?1:0}function J7(e,t){const n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(n<r){const o=e;e=t,t=o,r=n}const i=new Set(e);for(let o=0;o<r;o++)i.add(t[o]);return Array.from(i)}function $ke(e,t){const n=[];if(e.length===0||t.length===0)return n;if(e.length>t.length){const i=e;e=t,t=i}const r=new Set(t);for(let i=0;i<e.length&&r.size>0;i++){const o=e[i];r.delete(o)&&n.push(o)}return n}function wz(e){return e.length===0}function Q7(e){return(t,n)=>{const r=t.length-n.length;if(r!==0)return r;for(let i=0;i<t.length;i++)if(t[i]!==n[i]){const o=e(t[i],n[i]);if(o!==0)return o}return 0}}function mQ(e,{threshold:t=12}={}){return n=>{const r=n.length;if(r===0)return n;if(r<=t){const s=[];let a=0;e:for(let l=0;l<r;l++){const c=n[l];for(let u=0;u<a;u++)if(e(c,s[u])===0)continue e;a=s.push(c)}return s}const i=n.slice().sort(e);let o=0;for(let s=1;s<r;s++)e(i[o],i[s])!==0&&++o!==s&&(i[o]=i[s]);return i.length=o+1,i}}function Lke(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const u=t;t=n,n=u;const f=i;i=o,o=f}const s=[...t].sort(e),a=[...n].sort(e);let l=0,c=0;for(;l<i&&c<o;){const u=e(s[l],a[c]);u===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,c++):u<0?l++:c++}return r}}function Nke(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const Cz=Nke,gQ=()=>0,Fke=e=>e===void 0,Bke=e=>typeof e!="object",Ez={boolean:0,number:1,string:2};function zke(e,t){const n=typeof e,r=typeof t;return n===r?w0(e,t):Ez[n]-Ez[r]}function Hke(e,t){const n=e.length;if(n===0)return t;const r=t.length;if(r===0)return e;if(r>n){const s=e;e=t,t=s}const i=new Set(e),o=t.length;for(let s=0;s<o;s++){const a=t[s];i.has(a)||e.push(a)}return e}function Nw(e,t,n=gQ){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function f0(e){return Nw(Fke,e)}function dd(e,t){return Nw(n=>n===void 0||e(n),t)}function eE(e,t){return Nw(Array.isArray,e,t)}const Ci=f0(w0),tE=dd(e=>e===0,(e,t)=>e-t);function Uke({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=Cz(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),A=Math.min(C.length,w.length);for(let E=0;E<A;E++){const O=w0(C[E],w[E]);if(O!==0)return O}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<A;E++){const O=C[E],D=b(v[O],S[O]);if(D!==0)return D}return 0}}function i(b){const v=Q7(b),S=Cz(e,mQ(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(w0);function s(b,v){if(K5(b)){if(K5(v)){const S=Object.keys(b),C=Object.keys(v),w=Hke(S,C),A=w.length;for(let E=0;E<A;E++){const O=w[E];if(b[O]===v[O])continue;const T=(y[O]??a)(b[O],v[O]);if(T!==0)return T}return 0}return v===!0&&V1(b)?0:1}return K5(v)?b===!0&&V1(v)?0:-1:w0(b,v)}const a=f0(c),l=Nw(Bke,eE(r(a),Q7(c)),zke);function c(b,v){return b===null?-1:v===null?1:l(b,v)}const u=f0(s),f=dd(V1,r(u)),h=f0(i(s)),g=dd(Tl,s),y={$id:Ci,$comment:Ci,$defs:f,$ref:Ci,$schema:Ci,const:a,contains:u,contentEncoding:Ci,contentMediaType:Ci,default:a,definitions:f,description:Ci,else:u,examples:a,exclusiveMaximum:Ci,exclusiveMinimum:Ci,format:Ci,if:u,maximum:Ci,maxItems:Ci,maxLength:Ci,maxProperties:Ci,minimum:Ci,multipleOf:Ci,not:u,pattern:Ci,propertyNames:u,readOnly:Ci,then:u,title:Ci,writeOnly:Ci,uniqueItems:dd(b=>b===!1,gQ),minLength:tE,minItems:tE,minProperties:tE,required:dd(wz,o),enum:dd(wz,i(c)),type:f0((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?w0(b,v):o(S?b:[b],C?v:[v])}),items:dd(b=>!Array.isArray(b)&&Tl(b),eE(s,Q7(s))),anyOf:h,allOf:h,oneOf:h,properties:f,patternProperties:f,additionalProperties:g,additionalItems:g,dependencies:dd(V1,r(f0(eE(s,o))))};return{compareSchemaValues:c,compareSchemaDefinitions:s}}function Az(e){return e}const yQ=(e,t)=>e?yQ(t%e,e):t,Vke=(e,t)=>Math.abs(e*t)/yQ(e,t);function Wke(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*nE(e,t,n){const r=e.length,i=t.length;if(r>0&&i>0)for(let o=0;o<r;o++){const s=e[o];for(let a=0;a<i;a++)yield n(s,t[a])}}function rE(e,t){return e||t}function kz(e){return(t,n)=>{const r={...t},i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const a=i[s];r[a]=t[a]===void 0?n[a]:e(t[a],n[a])}return r}}function qke(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function Wf(e,t,n){n===void 0||Tl(n)?delete e[t]:e[t]=n}const Gke=["properties","patternProperties","additionalProperties"];function _z(e){const t=Object.keys(e),n=t.length,r=[];for(let i=0;i<n;i++){const o=t[i];r.push({regExp:new RegExp(o),schema:e[o]})}return[r,t]}const Dz=[[],[]];function Oz(e,t,n){const r=n.length;for(let i=0;i<r;i++){const o=n[i];if(!o.regExp.test(t))continue;const s=o.schema;if(s===!1)return!0;e.push(s)}return!1}const Kke=["items","additionalItems"],Yke=["if","then","else"];function Tz(e,t){return t.if!==void 0&&(e.if=t.if),t.then!==void 0&&(e.then=t.then),t.else!==void 0&&(e.else=t.else),e}function iE(e,t){if(e===t)return e;switch(e){case"number":if(t==="integer")return"integer";case"integer":if(t==="number")return"integer";default:return}}function qf(e,t,n){return[e,t,n]}function Xke(e){const t=new Map;for(const[n,r,i]of e){const o=s=>{if(!i(s))throw new Error(`Schema keys '${n}' and '${r}' are conflicting (${n}: ${JSON.stringify(s[n])}, ${r}: ${JSON.stringify(s[r])})`)};for(const s of[[n,r],[r,n]]){let a=t.get(s[0]);a===void 0&&(a=[],t.set(s[0],a)),a.push({oppositeKey:s[1],check:o})}}return t}const Zke=[qf("minimum","maximum",e=>e.maximum>=e.minimum),qf("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),qf("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),qf("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),qf("minLength","maxLength",e=>e.maxLength>=e.minLength),qf("minItems","maxItems",e=>e.maxItems>=e.minItems),qf("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function Jke({mergePatterns:e=Wke,isSubRegExp:t=Object.is,intersectJson:n=$ke,deduplicateJsonSchemaDef:r=Az,defaultMerger:i=Az,assigners:o=[],checks:s=Zke,mergers:a}={}){function l(A){const E=A.length;let O=A[0];for(let D=1;D<E;D++){const T=S(O,A[D]);if(T===!1)return!1;Tl(T)||(O=T)}return O}function c(A,E,O,D,T,I,F){if(A.length=0,O===!1)return!1;if(A.push(O),T!==void 0){if(T===!1)return!1;A.push(T)}if(Oz(A,E,I))return!1;const R=A.length<2;if(F===!1){if(R)return;if(Oz(A,E,D))return!1}else R&&F!==void 0&&A.push(F);return A.length===1?A[0]:l(A)}function u(A,E,O,D,T,I){const F=O.length;if(F>0&&T!==!1)if(I)Object.assign(A,E);else for(let L=0;L<F;L++){const R=O[L];D.has(R)||(A[R]=S(E[R],T))}return A}const f=(A,{properties:E={},patternProperties:O,additionalProperties:D=!0},{properties:T={},patternProperties:I,additionalProperties:F=!0})=>{const L=Tl(D),R=Tl(F);if(L&&R)return Wf(A,"properties",C(E,T)),Wf(A,"patternProperties",O&&I?C(O,I):O??I),delete A.additionalProperties,A;const $=S(D,F);Wf(A,"additionalProperties",$);const j={},z=Object.keys(E),N=z.length,[W,H]=O?_z(O):Dz,[U,K]=I?_z(I):Dz,B=[],q=new Set,X=R?void 0:F;for(let se=0;se<N;se++){const ue=z[se];q.add(ue);const te=c(B,ue,E[ue],W,T[ue],U,X);te!==void 0&&(j[ue]=te)}const V=Object.keys(T),Y=V.length,J=L?void 0:D;for(let se=0;se<Y;se++){const ue=V[se];if(q.has(ue))continue;const te=c(B,ue,T[ue],U,void 0,W,J);te!==void 0&&(j[ue]=te)}Wf(A,"properties",j);let ne={};const ee=new Set;if(H.length>0&&K.length>0){const se=nE(H,K,(ue,te)=>{t(ue,te)&&ee.add(ue),t(te,ue)&&ee.add(te),ne[e(ue,te)]=S(O[ue],I[te])});for(;!se.next().done;);}return ne=u(ne,O,H,ee,F,R),ne=u(ne,I,K,ee,D,L),Wf(A,"patternProperties",ne),A},h=(A,{items:E=[],additionalItems:O},{items:D=[],additionalItems:T})=>{const I=Array.isArray(E),F=Array.isArray(D),L=[];if(A.items=L,I&&F){const[R,$,j]=E.length<D.length?[E.length,O,D]:[D.length,T,E];let z=0;for(;z<R;z++)L.push(S(E[z],D[z]));if($===!1)A.additionalItems=!1;else{const N=$===void 0||Tl($);for(;z<j.length;z++)L.push(N?j[z]:S(j[z],$));Wf(A,"additionalItems",O!==void 0&&T!==void 0?S(O,T):O??T)}}else if(I||F){const[R,$,j]=I?[E,D,O]:[D,E,T];Wf(A,"additionalItems",j&&S(j,$));for(let z=0;z<R.length;z++)L.push(S(R[z],$))}else delete A.additionalItems,A.items=S(E,D);return A},g=(A,E,O)=>{Tz(A,E);const D=Tz({},O);return A.allOf===void 0?A.allOf=[D]:A.allOf=A.allOf.concat(D),A};function y(A,E){return r(Array.from(nE(A,E,S)))}const b=qke([[Gke,f],[Kke,h],[Yke,g],...o]),v=Xke(s);function S(A,E){if(A===!1||E===!1)return!1;if(Tl(A))return Tl(E)?!0:E;if(Tl(E))return A;let O={...A};const D=new Set,T=new Set,I=Object.keys(E),F=I.length;for(let L=0;L<F;L++){const R=I[L],$=E[R];if($===void 0)continue;const j=v.get(R);if(j!==void 0){const H=j.length;for(let U=0;U<H;U++){const K=j[U];A[K.oppositeKey]!==void 0&&T.add(K.check)}}const z=A[R];if(z===void 0){O[R]=$;continue}const N=b.get(R);if(N){D.add(N);continue}const W=w[R]??i;O[R]=W(z,$)}for(const L of D)O=L(O,A,E);for(const L of T)L(O);return O}const C=kz(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(A,E)=>{if(A===E)return A;const O=Array.isArray(A),D=Array.isArray(E);if(!O&&!D){const T=iE(A,E);if(T!==void 0)return T}else if(O||D){const T=new Set;if(O&&D)for(const F of nE(A,E,iE))F!==void 0&&T.add(F);else{const F=O?A:E,L=O?E:A,R=F.length;for(let $=0;$<R;$++){const j=iE(L,F[$]);j!==void 0&&T.add(j)}}const I=T.size;if(I===1)return T.values().next().value;if(I>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${A.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(A,E)=>{const O=r([A,E]);return O.length===1?O[0]:{anyOf:O}},pattern:e,readOnly:rE,writeOnly:rE,enum:(A,E)=>{const O=n(A,E);if(O.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(A)}", "${JSON.stringify(E)}"`);return O},anyOf:y,oneOf:y,allOf:(A,E)=>r(A.concat(E)),propertyNames:S,contains:S,dependencies:kz((A,E)=>Array.isArray(A)?Array.isArray(E)?J7(A,E):S(E,{required:A}):Array.isArray(E)?S(A,{required:E}):S(A,E)),examples:(A,E)=>{if(!Array.isArray(A)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(A)}" and "${JSON.stringify(E)}"`);return J7(A,E)},multipleOf:(A,E)=>{let O=1;for(;!Number.isInteger(A)||!Number.isInteger(E);)O*=10,A*=10,E*=10;return Vke(A,E)/O},exclusiveMaximum:Math.min,maximum:Math.min,maxItems:Math.min,maxLength:Math.min,maxProperties:Math.min,exclusiveMinimum:Math.max,minimum:Math.max,minItems:Math.max,minLength:Math.max,minProperties:Math.max,uniqueItems:rE,required:J7,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function Qke(e){const t=[],n=[e];for(;n.length>0;){const r=n.pop();if(typeof r=="boolean"||r.allOf===void 0){t.push(r);continue}const{allOf:i,...o}=r;t.push(o);for(let s=i.length-1;s>=0;s--)n.push(i[s])}return t}function e_e(e){return t=>e(Qke(t))}var b1={},Mz;function t_e(){if(Mz)return b1;Mz=1;var e=/~/,t=/~[01]/g;function n(c){switch(c){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+c)}function r(c){return e.test(c)?c.replace(t,n):c}function i(c,u,f){for(var h,g,y=1,b=u.length;y<b;){if(u[y]==="constructor"||u[y]==="prototype"||u[y]==="__proto__")return c;if(h=r(u[y++]),g=b>y,typeof c[h]>"u"&&(Array.isArray(c)&&h==="-"&&(h=c.length),g&&(u[y]!==""&&u[y]<1/0||u[y]==="-"?c[h]=[]:c[h]={})),!g)break;c=c[h]}var v=c[h];return f===void 0?delete c[h]:c[h]=f,v}function o(c){if(typeof c=="string"){if(c=c.split("/"),c[0]==="")return c;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(c)){for(const u of c)if(typeof u!="string"&&typeof u!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return c}throw new Error("Invalid JSON pointer.")}function s(c,u){if(typeof c!="object")throw new Error("Invalid input object.");u=o(u);var f=u.length;if(f===1)return c;for(var h=1;h<f;){if(c=c[r(u[h++])],f===h)return c;if(typeof c!="object"||c===null)return}}function a(c,u,f){if(typeof c!="object")throw new Error("Invalid input object.");if(u=o(u),u.length===0)throw new Error("Invalid JSON pointer for set.");return i(c,u,f)}function l(c){var u=o(c);return{get:function(f){return s(f,u)},set:function(f,h){return a(f,u,h)}}}return b1.get=s,b1.set=a,b1.compile=l,b1}var n_e=t_e();const oE=cs(n_e);function r_e(e,t){return e&&Km(t,za(t),e)}function i_e(e,t){return e&&Km(t,Db(t),e)}function o_e(e,t){return Km(e,BT(e),t)}var s_e=Object.getOwnPropertySymbols,bQ=s_e?function(e){for(var t=[];e;)FT(t,BT(e)),e=Tw(e);return t}:BJ;function a_e(e,t){return Km(e,bQ(e),t)}function eM(e){return FJ(e,Db,bQ)}var l_e=Object.prototype,c_e=l_e.hasOwnProperty;function u_e(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&c_e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function d_e(e,t){var n=t?ZT(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var f_e=/\w*$/;function h_e(e){var t=new e.constructor(e.source,f_e.exec(e));return t.lastIndex=e.lastIndex,t}var Rz=wa?wa.prototype:void 0,Iz=Rz?Rz.valueOf:void 0;function p_e(e){return Iz?Object(Iz.call(e)):{}}var m_e="[object Boolean]",g_e="[object Date]",y_e="[object Map]",b_e="[object Number]",v_e="[object RegExp]",x_e="[object Set]",S_e="[object String]",w_e="[object Symbol]",C_e="[object ArrayBuffer]",E_e="[object DataView]",A_e="[object Float32Array]",k_e="[object Float64Array]",__e="[object Int8Array]",D_e="[object Int16Array]",O_e="[object Int32Array]",T_e="[object Uint8Array]",M_e="[object Uint8ClampedArray]",R_e="[object Uint16Array]",I_e="[object Uint32Array]";function P_e(e,t,n){var r=e.constructor;switch(t){case C_e:return ZT(e);case m_e:case g_e:return new r(+e);case E_e:return d_e(e,n);case A_e:case k_e:case __e:case D_e:case O_e:case T_e:case M_e:case R_e:case I_e:return aQ(e,n);case y_e:return new r;case b_e:case S_e:return new r(e);case v_e:return h_e(e);case x_e:return new r;case w_e:return p_e(e)}}var j_e="[object Map]";function $_e(e){return Ca(e)&&ia(e)==j_e}var Pz=pm&&pm.isMap,L_e=Pz?HT(Pz):$_e,N_e="[object Set]";function F_e(e){return Ca(e)&&ia(e)==N_e}var jz=pm&&pm.isSet,B_e=jz?HT(jz):F_e,z_e=1,H_e=2,U_e=4,vQ="[object Arguments]",V_e="[object Array]",W_e="[object Boolean]",q_e="[object Date]",G_e="[object Error]",xQ="[object Function]",K_e="[object GeneratorFunction]",Y_e="[object Map]",X_e="[object Number]",SQ="[object Object]",Z_e="[object RegExp]",J_e="[object Set]",Q_e="[object String]",eDe="[object Symbol]",tDe="[object WeakMap]",nDe="[object ArrayBuffer]",rDe="[object DataView]",iDe="[object Float32Array]",oDe="[object Float64Array]",sDe="[object Int8Array]",aDe="[object Int16Array]",lDe="[object Int32Array]",cDe="[object Uint8Array]",uDe="[object Uint8ClampedArray]",dDe="[object Uint16Array]",fDe="[object Uint32Array]",Er={};Er[vQ]=Er[V_e]=Er[nDe]=Er[rDe]=Er[W_e]=Er[q_e]=Er[iDe]=Er[oDe]=Er[sDe]=Er[aDe]=Er[lDe]=Er[Y_e]=Er[X_e]=Er[SQ]=Er[Z_e]=Er[J_e]=Er[Q_e]=Er[eDe]=Er[cDe]=Er[uDe]=Er[dDe]=Er[fDe]=!0;Er[G_e]=Er[xQ]=Er[tDe]=!1;function hy(e,t,n,r,i,o){var s,a=t&z_e,l=t&H_e,c=t&U_e;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Bn(e))return e;var u=Fi(e);if(u){if(s=u_e(e),!a)return JT(e,s)}else{var f=ia(e),h=f==xQ||f==K_e;if(Fh(e))return sQ(e,a);if(f==SQ||f==vQ||h&&!i){if(s=l||h?{}:lQ(e),!a)return l?a_e(e,i_e(s,e)):o_e(e,r_e(s,e))}else{if(!Er[f])return i?e:{};s=P_e(e,f,a)}}o||(o=new Ja);var g=o.get(e);if(g)return g;o.set(e,s),B_e(e)?e.forEach(function(v){s.add(hy(v,t,n,v,e,o))}):L_e(e)&&e.forEach(function(v,S){s.set(S,hy(v,t,n,S,e,o))});var y=c?l?eM:t_:l?Db:za,b=u?void 0:y(e);return YT(b||e,function(v,S){b&&(S=v,v=e[S]),GT(s,S,hy(v,t,n,S,e,o))}),s}function wQ(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function hDe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function pDe(e,t){return t.length<2?e:jw(e,hDe(t,0,-1))}var mDe=Object.prototype,gDe=mDe.hasOwnProperty;function CQ(e,t){t=Gm(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!gDe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var s=pDe(e,t);return s==null||delete s[rp(wQ(t))]}function yDe(e){return Jd(e)?void 0:e}function a_(e){var t=e==null?0:e.length;return t?Ob(e,1):[]}function EQ(e){return dQ(uQ(e,void 0,a_),e+"")}var bDe=1,vDe=2,xDe=4,l2=EQ(function(e,t){var n={};if(e==null)return n;var r=!1;t=qm(t,function(o){return o=Gm(o,e),r||(r=o.length>1),o}),Km(e,eM(e),n),r&&(n=hy(n,bDe|vDe|xDe,yDe));for(var i=t.length;i--;)CQ(n,t[i]);return n}),v1={exports:{}},sE,$z;function AQ(){if($z)return sE;$z=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(h){let g="",y=0,b=0;for(b=0;b<h.length;b++)if(y=h[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b];break}for(b+=1;b<h.length;b++){if(y=h[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function o(h,g,y){if(h.length){const b=n(h);if(b!=="")g.push(b);else return y.error=!0,!1;h.length=0}return!0}function s(h){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let A=0;A<h.length;A++){const E=h[A];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}A>0&&h[A-1]===":"&&(S=!0),b.push(":");continue}else if(E==="%"){if(!w(v,b,y))break;w=i}else{v.push(E);continue}}return v.length&&(w===i?y.zone=v.join(""):C?b.push(v.join("")):b.push(n(v))),y.address=b.join(""),y}function a(h){if(l(h,":")<2)return{host:h,isIPV6:!1};const g=s(h);if(g.error)return{host:h,isIPV6:!1};{let y=g.address,b=g.address;return g.zone&&(y+="%"+g.zone,b+="%25"+g.zone),{host:y,isIPV6:!0,escapedHost:b}}}function l(h,g){let y=0;for(let b=0;b<h.length;b++)h[b]===g&&y++;return y}function c(h){let g=h;const y=[];let b=-1,v=0;for(;v=g.length;){if(v===1){if(g===".")break;if(g==="/"){y.push("/");break}else{y.push(g);break}}else if(v===2){if(g[0]==="."){if(g[1]===".")break;if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&(g[1]==="."||g[1]==="/")){y.push("/");break}}else if(v===3&&g==="/.."){y.length!==0&&y.pop(),y.push("/");break}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."&&g[3]==="/"){g=g.slice(3),y.length!==0&&y.pop();continue}}if((b=g.indexOf("/",1))===-1){y.push(g);break}else y.push(g.slice(0,b)),g=g.slice(b)}return y.join("")}function u(h,g){const y=g!==!0?escape:unescape;return h.scheme!==void 0&&(h.scheme=y(h.scheme)),h.userinfo!==void 0&&(h.userinfo=y(h.userinfo)),h.host!==void 0&&(h.host=y(h.host)),h.path!==void 0&&(h.path=y(h.path)),h.query!==void 0&&(h.query=y(h.query)),h.fragment!==void 0&&(h.fragment=y(h.fragment)),h}function f(h){const g=[];if(h.userinfo!==void 0&&(g.push(h.userinfo),g.push("@")),h.host!==void 0){let y=unescape(h.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=h.host}g.push(y)}return(typeof h.port=="number"||typeof h.port=="string")&&(g.push(":"),g.push(String(h.port))),g.length?g.join(""):void 0}return sE={nonSimpleDomain:r,recomposeAuthority:f,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},sE}var aE,Lz;function SDe(){if(Lz)return aE;Lz=1;const{isUUID:e}=AQ(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(E){return n.indexOf(E)!==-1}function i(E){return E.secure===!0?!0:E.secure===!1?!1:E.scheme?E.scheme.length===3&&(E.scheme[0]==="w"||E.scheme[0]==="W")&&(E.scheme[1]==="s"||E.scheme[1]==="S")&&(E.scheme[2]==="s"||E.scheme[2]==="S"):!1}function o(E){return E.host||(E.error=E.error||"HTTP URIs must have a host."),E}function s(E){const O=String(E.scheme).toLowerCase()==="https";return(E.port===(O?443:80)||E.port==="")&&(E.port=void 0),E.path||(E.path="/"),E}function a(E){return E.secure=i(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E}function l(E){if((E.port===(i(E)?443:80)||E.port==="")&&(E.port=void 0),typeof E.secure=="boolean"&&(E.scheme=E.secure?"wss":"ws",E.secure=void 0),E.resourceName){const[O,D]=E.resourceName.split("?");E.path=O&&O!=="/"?O:void 0,E.query=D,E.resourceName=void 0}return E.fragment=void 0,E}function c(E,O){if(!E.path)return E.error="URN can not be parsed",E;const D=E.path.match(t);if(D){const T=O.scheme||E.scheme||"urn";E.nid=D[1].toLowerCase(),E.nss=D[2];const I=`${T}:${O.nid||E.nid}`,F=A(I);E.path=void 0,F&&(E=F.parse(E,O))}else E.error=E.error||"URN can not be parsed.";return E}function u(E,O){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const D=O.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),I=`${D}:${O.nid||T}`,F=A(I);F&&(E=F.serialize(E,O));const L=E,R=E.nss;return L.path=`${T||O.nid}:${R}`,O.skipEscape=!0,L}function f(E,O){const D=E;return D.uuid=D.nss,D.nss=void 0,!O.tolerant&&(!D.uuid||!e(D.uuid))&&(D.error=D.error||"UUID is not valid."),D}function h(E){const O=E;return O.nss=(E.uuid||"").toLowerCase(),O}const g={scheme:"http",domainHost:!0,parse:o,serialize:s},y={scheme:"https",domainHost:g.domainHost,parse:o,serialize:s},b={scheme:"ws",domainHost:!0,parse:a,serialize:l},v={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},w={http:g,https:y,ws:b,wss:v,urn:{scheme:"urn",parse:c,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(w,null);function A(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return aE={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:A},aE}var Nz;function kQ(){if(Nz)return v1.exports;Nz=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=AQ(),{SCHEMES:s,getSchemeHandler:a}=SDe();function l(v,S){return typeof v=="string"?v=h(y(v,S),S):typeof v=="object"&&(v=y(h(v,S),S)),v}function c(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},A=u(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,h(A,w)}function u(v,S,C,w){const A={};return w||(v=y(h(v,C),C),S=y(h(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(A.scheme=S.scheme,A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.path?(S.path[0]==="/"?A.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?A.path="/"+S.path:v.path?A.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:A.path=S.path,A.path=t(A.path)),A.query=S.query):(A.path=v.path,S.query!==void 0?A.query=S.query:A.query=v.query),A.userinfo=v.userinfo,A.host=v.host,A.port=v.port),A.scheme=v.scheme),A.fragment=S.fragment,A}function f(v,S,C){return typeof v=="string"?(v=unescape(v),v=h(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=h(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=h(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=h(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function h(v,S){const C={host:v.host,scheme:v.scheme,userinfo:v.userinfo,port:v.port,path:v.path,query:v.query,nid:v.nid,nss:v.nss,uuid:v.uuid,fragment:v.fragment,reference:v.reference,resourceName:v.resourceName,secure:v.secure,error:""},w=Object.assign({},S),A=[],E=a(w.scheme||C.scheme);E&&E.serialize&&E.serialize(C,w),C.path!==void 0&&(w.skipEscape?C.path=unescape(C.path):(C.path=escape(C.path),C.scheme!==void 0&&(C.path=C.path.split("%3A").join(":")))),w.reference!=="suffix"&&C.scheme&&A.push(C.scheme,":");const O=n(C);if(O!==void 0&&(w.reference!=="suffix"&&A.push("//"),A.push(O),C.path&&C.path[0]!=="/"&&A.push("/")),C.path!==void 0){let D=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(D=t(D)),O===void 0&&D[0]==="/"&&D[1]==="/"&&(D="/%2F"+D.slice(2)),A.push(D)}return C.query!==void 0&&A.push("?",C.query),C.fragment!==void 0&&A.push("#",C.fragment),A.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(v,S){const C=Object.assign({},S),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let A=!1;C.reference==="suffix"&&(C.scheme?v=C.scheme+":"+v:v="//"+v);const E=v.match(g);if(E){if(w.scheme=E[1],w.userinfo=E[3],w.host=E[4],w.port=parseInt(E[5],10),w.path=E[6]||"",w.query=E[7],w.fragment=E[8],isNaN(w.port)&&(w.port=E[5]),w.host)if(i(w.host)===!1){const T=e(w.host);w.host=T.host.toLowerCase(),A=T.isIPV6}else A=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==w.reference&&(w.error=w.error||"URI is not a "+C.reference+" reference.");const O=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!O||!O.unicodeSupport)&&w.host&&(C.domainHost||O&&O.domainHost)&&A===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(D){w.error=w.error||"Host's domain name can not be converted to ASCII: "+D}(!O||O&&!O.skipNormalize)&&(v.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),O&&O.parse&&O.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:c,resolveComponent:u,equal:f,serialize:h,parse:y};return v1.exports=b,v1.exports.default=b,v1.exports.fastUri=b,v1.exports}var wDe=kQ();const tM=cs(wDe);function s6(e,t){if(pr in e&&tM.equal(e[pr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Bn(r)){const i=s6(r,t);if(i!==void 0)return i}}else if(Bn(n)){const r=s6(n,t);if(r!==void 0)return r}}function l_(e,t){const n=We(e,pr,t);mr in e&&(e={...e,[mr]:tM.resolve(n,e[mr])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Bn(o)?l_(o,n):o)}:Bn(i)&&(e={...e,[r]:l_(i,n)});return e}function nM(e,t){const n=t[e];return[l2(t,[e]),n]}function _Q(e,t={},n=[],r=We(t,[pr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||pr in t&&t[pr]===r?o=oE.get(t,a):t[U1]===q5&&(o=s6(t,r.replace(/\/$/,"")),o!==void 0&&(o=oE.get(o,a)))}else if(t[U1]===q5){const a=r?tM.resolve(r,i):i,[l,...c]=a.replace(/#\/?$/,"").split("#");o=s6(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[pr],yi(c)||(o=oE.get(o,decodeURIComponent(c.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[mr];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[u,...f]=n,h=[...f,i,u].join(" -> ");throw new Error(`Definition for ${u} contains a circular reference through ${h}`)}const[a,l]=nM(mr,o),c=_Q(l,t,[...n,i],r);return Object.keys(a).length>0?t[U1]===L9e||t[U1]===q5?{[wu]:[a,c]}:{...a,...c}:c}return o}function rM(e,t={},n=We(t,[pr])){return _Q(e,t,[],n)}var CDe="[object String]";function Qd(e){return typeof e=="string"||!Fi(e)&&Ca(e)&&Ru(e)==CDe}function hc(e){let t;const n=We(e,I9e);return Qd(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function c2(e){return Array.isArray(e)?"array":typeof e=="string"?"string":e==null?"null":typeof e=="boolean"?"boolean":isNaN(e)?typeof e=="object"?"object":"string":"number"}var EDe=Lw(function(e){return hQ(Ob(e,1,a2,!0))});function il(e){let{type:t}=e;return!t&&e.const?c2(e.const):!t&&e.enum?"string":!t&&(e.properties||e.additionalProperties||e.patternProperties)?"object":(Array.isArray(t)&&(t.length===2&&t.includes("null")?t=t.find(n=>n!=="null"):t=t[0]),t)}function Cu(e,t){const n=Object.assign({},e);return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];return e&&i in e&&hn(s)?r[i]=Cu(o,s):e&&t&&(il(e)==="object"||il(t)==="object")&&i===OJ&&Array.isArray(o)&&Array.isArray(s)?r[i]=EDe(o,s):r[i]=s,r},n)}var ADe="[object Number]";function DQ(e){return typeof e=="number"||Ca(e)&&Ru(e)==ADe}function OQ(e,t,n){var r;if(e&&n){const i=We(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=We(s,[Un,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function iM(e,t,n,r,i){if(t===void 0)return 0;const o=OQ(t,n,i);if(DQ(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&In(a,[Un,i])){const l=We(t,i),c=We(a,[Un,i],{});if(e.isValid(c,l,r))return s}else if(a[Un]){const l={anyOf:Object.keys(a[Un]).map(u=>({required:[u]}))};let c;if(a.anyOf){const{...u}=a;u.allOf?u.allOf=u.allOf.slice():u.allOf=[],u.allOf.push(l),c=u}else c=Object.assign({},a,l);if(delete c.required,e.isValid(c,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function yo(e,t,n={},r,i,o=!1){return ql(e,t,n,r,void 0,void 0,i,o)[0]}function kDe(e,t,n,r,i,o,s){const{if:a,then:l,else:c,...u}=t,f=e.isValid(a,o||{},n);let h=[u],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(ql(e,l,n,o,r,i,s))),c&&typeof c!="boolean"&&(g=g.concat(ql(e,c,n,o,r,i,s)));else{const y=f?l:c;y&&typeof y!="boolean"&&(g=g.concat(ql(e,y,n,o,r,i,s)))}return g.length&&(h=g.map(y=>Cu(u,y))),h.flatMap(y=>ql(e,y,n,o,r,i,s))}function TQ(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>JJ(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function MQ(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(cr(n,[r],e.patternProperties[r]),n),{})}function _De(e,t,n,r,i,o,s,a){const l=RQ(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(PT in t)return IQ(e,t,n,r,i,o,s).flatMap(u=>ql(e,u,n,o,r,i,s));if(wu in t&&Array.isArray(t[wu])){const c=t.allOf.map(f=>ql(e,f,n,o,r,i,s));return TQ(c).map(f=>({...t,allOf:f}))}return[t]}function RQ(e,t,n,r,i,o,s,a){const l=F0(t,n,i,void 0,a);return l!==t?ql(e,l,n,o,r,i,s,a):[t]}function F0(e,t,n,r,i){if(!hn(e))return e;let o=e;if(mr in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...rM(s,t,r),...a},pr in o&&(r=o[pr])}if(Un in o){const s=[],a=eke(o[Un],(l,c,u)=>{const f=[...n];l[u]=F0(c,t,f,r,i),s.push(f)},{});yke(n,pQ(xke(s))),o={...o,[Un]:a}}if($h in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:F0(o.items,t,n,r,i)}),i){let s,a;Pn in e&&Array.isArray(e[Pn])?(s=Pn,a=o[Pn]):nn in e&&Array.isArray(e[nn])&&(s=nn,a=o[nn]),s&&a&&(o={...o,[s]:a.map(l=>F0(l,t,n,r,i))})}return _r(e,o)?e:o}function DDe(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&hn(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(Jk in o){const l=MQ(o,a);if(!yi(l)){o.properties[a]=yo(e,{[wu]:Object.values(l)},n,We(s,[a]),i),cr(o.properties,[a,fu],!0);return}}if(n2 in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?mr in o.additionalProperties?l=yo(e,{[mr]:We(o.additionalProperties,[mr])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Pn in o.additionalProperties||nn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:c2(We(s,[a]))}:l={type:c2(We(s,[a]))},o.properties[a]=l,cr(o.properties,[a,fu],!0)}else o.properties[a]={type:"null"},cr(o.properties,[a,fu],!0)}}),o}const{compareSchemaDefinitions:ODe,compareSchemaValues:TDe}=Uke(),{mergeArrayOfSchemaDefinitions:MDe}=Jke({intersectJson:Lke(TDe),deduplicateJsonSchemaDef:mQ(ODe)}),RDe=e_e(MDe);function IDe(e){return RDe(e)}function ql(e,t,n,r,i=!1,o=[],s,a){return hn(t)?_De(e,t,n,i,o,r,s,a).flatMap(c=>{var u;let f=c;if(jT in f)return kDe(e,f,n,i,o,r,s);if(wu in f){if(i){const{allOf:g,...y}=f;return[...g,y]}try{const g=[],y=[];(u=f.allOf)===null||u===void 0||u.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(f={...f,allOf:y}),f=s?s(f):IDe(f),g.length&&(f.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
|
|
224
224
|
`,g);const{allOf:y,...b}=f;return b}}return Un in f&&Jk in f&&(f=Object.keys(f.properties).reduce((g,y)=>{const b=MQ(g,y);return yi(b)||(g.properties[y]=yo(e,{allOf:[g.properties[y],...Object.values(b)]},n,We(r,[y]),s)),g},{...f,properties:{...f.properties}})),Jk in f||n2 in f&&f.additionalProperties!==!1?DDe(e,f,n,r,s):f}):[{}]}function PDe(e,t,n,r,i){let o;const{oneOf:s,anyOf:a,...l}=t;if(Array.isArray(s)?o=s:Array.isArray(a)&&(o=a),o){const c=i===void 0&&r?{}:i,u=hc(t);o=o.map(h=>F0(h,n,[]));const f=iM(e,c,o,n,u);if(r)return o.map(h=>Cu(l,h));t=Cu(l,o[f])}return[t]}function IQ(e,t,n,r,i,o,s){const{dependencies:a,...l}=t;return PDe(e,l,n,r,o).flatMap(u=>PQ(e,a,u,n,r,i,o,s))}function PQ(e,t,n,r,i,o,s,a){let l=[n];for(const c in t){if(!i&&We(s,[c])===void 0||n.properties&&!(c in n.properties))continue;const[u,f]=nM(c,t);return Array.isArray(f)?l[0]=jDe(n,f):hn(f)&&(l=$De(e,n,r,c,f,i,o,s,a)),l.flatMap(h=>PQ(e,u,h,r,i,o,s,a))}return l}function jDe(e,t){if(!t)return e;const n=Array.isArray(e.required)?Array.from(new Set([...e.required,...t])):t;return{...e,required:n}}function $De(e,t,n,r,i,o,s,a,l){return ql(e,i,n,a,o,s,l).flatMap(u=>{const{oneOf:f,...h}=u;if(t=Cu(t,h),f===void 0)return t;const g=f.map(b=>typeof b=="boolean"||!(mr in b)?[b]:RQ(e,b,n,o,s,a));return TQ(g).flatMap(b=>LDe(e,t,n,r,b,o,s,a,l))})}function LDe(e,t,n,r,i,o,s,a,l){const c=i.filter(u=>{if(typeof u=="boolean"||!u||!u.properties)return!1;const{[r]:f}=u.properties;if(f){const h={type:"object",properties:{[r]:f}};return e.isValid(h,a,n)||o}return!1});return!o&&c.length!==1?(console.warn("ignoring oneOf in dependencies because there isn't exactly one subschema that is valid"),[t]):c.flatMap(u=>{const f=u,[h]=nM(r,f.properties),g={...f,properties:h};return ql(e,g,n,a,o,s,l).map(b=>Cu(t,b))})}function W1(e,t,n,r,i,o={},s){if(Array.isArray(n[i])){const l=hc(n)||r,c=n[i].map(f=>yo(e,f,t,o,s)),u=We(o,l);if(u!==void 0)return c.find(f=>s2(We(f,[Un,l,Ow],We(f,[Un,l,Sa])),u))}}function jQ(e,t,n,r,i){let o=n;if(In(n,mr)&&(o=yo(e,n,t,void 0,i)),yi(r))return o;const s=Array.isArray(r)?r:r.split("."),[a,...l]=s;if(a&&In(o,a))return o=We(o,a),jQ(e,t,o,l,i)}function Y5(e,t,n,r,i,o){const s=jQ(e,t,n,r,o);return s===void 0?i:s}const Fz={title:"!@#$_UNKNOWN_$#@!"};function NDe(e,t,n,r,i={},o){const s=Array.isArray(r)?[...r]:r.split(".");let a=n;const l=s.pop();s.length&&s.forEach(h=>{a=Y5(e,t,a,[Un,h],{},o),In(a,nn)?a=W1(e,t,a,l,nn,We(i,h),o):In(a,Pn)&&(a=W1(e,t,a,l,Pn,We(i,h),o))}),In(a,nn)?a=W1(e,t,a,l,nn,i,o):In(a,Pn)&&(a=W1(e,t,a,l,Pn,i,o));let c=Y5(e,t,a,[Un,l],Fz,o);c===Fz&&(c=void 0);const u=Y5(e,t,a,OJ,[],o);let f;return c&&Array.isArray(u)&&(f=u.includes(l)),{field:c,isRequired:f}}function FDe(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function BDe(e,t){return function(n,r){if(n==null)return n;if(!np(n))return e(n,r);for(var i=n.length,o=-1,s=Object(n);++o<i&&r(s[o],o,s)!==!1;);return n}}var $Q=BDe(tQ);function zDe(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function HDe(e,t,n){var r=Fi(e)?FDe:zDe,i=arguments.length<3;return r(e,XT(t),n,i,$Q)}const UDe={type:"object",$id:R9e,properties:{__not_really_there__:{type:"number"}}};function c_(e,t,n,r,i){let o=0;return n&&(Bn(n.properties)?o+=HDe(n.properties,(s,a,l)=>{const c=We(r,l);if(typeof a=="boolean")return s;if(In(a,mr)){const u=yo(e,a,t,c,i);return s+c_(e,t,u,c||{},i)}if((In(a,nn)||In(a,Pn))&&c){const u=In(a,nn)?nn:Pn,f=hc(a);return s+u2(e,t,c,We(a,u),-1,f,i)}if(a.type==="object")return Bn(c)&&(s+=1),s+c_(e,t,a,c,i);if(a.type===c2(c)){let u=s+1;return a.default?u+=c===a.default?1:-1:a.const&&(u+=c===a.const?1:-1),u}return s},0):Qd(n.type)&&n.type===c2(r)&&(o+=1)),o}function u2(e,t,n,r,i=-1,o,s){const a=r.map(h=>F0(h,t,[])),l=OQ(n,r,o);if(DQ(l))return l;const c=a.reduce((h,g,y)=>(iM(e,n,[UDe,g],t,o)===1&&h.push(y),h),[]);if(c.length===1)return c[0];c.length||JJ(a.length,h=>c.push(h));const u=new Set,{bestIndex:f}=c.reduce((h,g)=>{const{bestScore:y}=h,b=a[g],v=c_(e,t,b,n,s);return u.add(v),v>y?{bestIndex:g,bestScore:v}:h},{bestIndex:i,bestScore:0});return u.size===1&&i>=0?i:f}function oM(e){return Array.isArray(e.items)&&e.items.length>0&&e.items.every(t=>hn(t))}function a6(e){return e==null}function d2(e,t,n=!1,r=!1,i=!1){if(Array.isArray(t)){const o=Array.isArray(e)?e:[],s=i?o:t,a=i?t:o,l=s.map((c,u)=>a[u]!==void 0?d2(o[u],t[u],n,r,i):c);return(n||i)&&l.length<a.length&&l.push(...a.slice(l.length)),l}if(hn(t)){const o=Object.assign({},e);return Object.keys(t).reduce((s,a)=>{var l;const c=We(t,a),u=hn(e)&&a in e,f=a in t,h=(l=We(e,a))!==null&&l!==void 0?l:{},g=u&&Object.entries(h).some(([,v])=>hn(v)),y=u&&hn(We(e,a)),b=f&&hn(c);return y&&b&&!g?(s[a]={...We(e,a),...c},s):(s[a]=d2(We(e,a),c,n,r,i&&(u||!f)),s)},o)}return r&&(e!==void 0&&a6(t)||typeof t=="number"&&isNaN(t))||i&&!a6(t)?e:t}function Bh(e,t,n=!1){return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];if(e&&i in e&&hn(s))r[i]=Bh(o,s,n);else if(n&&Array.isArray(o)&&Array.isArray(s)){let a=s;n==="preventDuplicates"&&(a=s.reduce((l,c)=>(o.includes(c)||l.push(c),l),[])),r[i]=o.concat(a)}else r[i]=s;return r},Object.assign({},e))}function LQ(e){return Array.isArray(e.enum)&&e.enum.length===1||Sa in e}function sM(e,t,n={},r){const i=yo(e,t,n,void 0,r),o=i.oneOf||i.anyOf;return Array.isArray(i.enum)?!0:Array.isArray(o)?o.every(s=>typeof s!="boolean"&&LQ(s)):!1}function aM(e,t,n,r){return!t.uniqueItems||!t.items||typeof t.items=="boolean"?!1:sM(e,t.items,n,r)}function NQ(e){const t=e[Sa],n=il(e);return hn(t)&&Qd(t?.$data)&&n!=="object"&&n!=="array"}function VDe(e){if(M9e in e&&Array.isArray(e.enum)&&e.enum.length===1)return e.enum[0];if(Sa in e)return e.const;throw new Error("schema cannot be inferred as a constant")}function mm(e,t){if(e.enum){let o;if(t){const{enumNames:s}=$t(t);o=s}return e.enum.map((s,a)=>({label:o?.[a]||String(s),value:s}))}let n,r;e.anyOf?(n=e.anyOf,r=t?.anyOf):e.oneOf&&(n=e.oneOf,r=t?.oneOf);let i=hc(e);if(t){const{optionsSchemaSelector:o=i}=$t(t);i=o}return n&&n.map((o,s)=>{const{title:a}=$t(r?.[s]),l=o;let c,u=a;if(i){const f=We(l,[Un,i],{});c=We(f,Ow,We(f,Sa)),u=u||f?.title||l.title||String(c)}else c=VDe(l),u=u||l.title||String(c);return{schema:l,label:u,value:c}})}const WDe=["string","number","integer","boolean","null"];var gm;(function(e){e[e.Ignore=0]="Ignore",e[e.Invert=1]="Invert",e[e.Fallback=2]="Fallback"})(gm||(gm={}));function lE(e,t=gm.Ignore,n=-1){if(n>=0){if(Array.isArray(e.items)&&n<e.items.length){const r=e.items[n];if(typeof r!="boolean")return r}}else if(e.items&&!Array.isArray(e.items)&&typeof e.items!="boolean")return e.items;return t!==gm.Ignore&&hn(e.additionalItems)?e.additionalItems:{}}function FQ(e,t){const{default:n,type:r}=e;return Array.isArray(r)&&r.includes("null")&&yi(t)&&n===null?null:t}function Bz(e,t,n,r,i,o=[],s={},a=!1,l=!1){const{emptyObjectFields:c="populateAllDefaults"}=s;if(r===!0||a)e[t]=n;else if(r==="excludeObjectChildren")(l&&n!==void 0||!hn(n)||!yi(n))&&(e[t]=n);else if(c!=="skipDefaults"){const u=i===void 0?o.includes(t):i;hn(n)?c==="skipEmptyDefaults"?yi(n)||(e[t]=n):(!yi(n)||o.includes(t))&&(u||c!=="populateRequiredDefaults")&&(e[t]=n):n!==void 0&&(c==="populateAllDefaults"||c==="skipEmptyDefaults"||u&&o.includes(t))&&(e[t]=n)}}function Ld(e,t,n={}){const{parentDefaults:r,rawFormData:i,rootSchema:o={},includeUndefinedValues:s=!1,_recurseList:a=[],experimental_defaultFormStateBehavior:l=void 0,experimental_customMergeAllOf:c=void 0,required:u,shouldMergeDefaultsIntoFormData:f=!1,initialDefaultsGenerated:h}=n;let g=hn(i)?i:{};const y=hn(t)?t:{};let b=r,v=null,S=l,C=a;if(y[Sa]!==void 0&&l?.constAsDefaults!=="never"&&!NQ(y))b=y[Sa];else if(hn(b)&&hn(y.default)&&!y[Pn]&&!y[nn]&&!y[mr])b=Bh(b,y.default);else if(Ow in y&&!y[Pn]&&!y[nn]&&!y[mr])b=y.default;else if(mr in y){const E=y[mr];a.includes(E)||(C=a.concat(E),v=rM(E,o));const O=i===void 0||hn(i)&&yi(i);v&&!b&&O&&(b=y.default),f&&v&&!hn(i)&&(g=i)}else if(PT in y){const E={...zz(e,y,n,b),...g};v=IQ(e,y,o,!1,[],E,c)[0]}else if(oM(y))b=y.items.map((E,O)=>Ld(e,E,{rootSchema:o,includeUndefinedValues:s,_recurseList:a,experimental_defaultFormStateBehavior:l,experimental_customMergeAllOf:c,parentDefaults:Array.isArray(r)?r[O]:void 0,rawFormData:g,required:u,shouldMergeDefaultsIntoFormData:f}));else if(nn in y){const{oneOf:E,...O}=y;if(E.length===0)return;const D=hc(y),{type:T="null"}=O;!Array.isArray(T)&&WDe.includes(T)&&S?.constAsDefaults==="skipOneOf"&&(S={...S,constAsDefaults:"never"}),v=E[u2(e,o,i??y.default,E,0,D,c)],v=Cu(O,v)}else if(Pn in y){const{anyOf:E,...O}=y;if(E.length===0)return;const D=hc(y);v=E[u2(e,o,i??y.default,E,0,D,c)],v=Cu(O,v)}if(v)return Ld(e,v,{rootSchema:o,includeUndefinedValues:s,_recurseList:C,experimental_defaultFormStateBehavior:S,experimental_customMergeAllOf:c,parentDefaults:b,rawFormData:i??g,required:u,shouldMergeDefaultsIntoFormData:f,initialDefaultsGenerated:h});b===void 0&&(b=y.default);const w=zz(e,y,n,b);let A=w??b;if(f){const{arrayMinItems:E={}}=l||{},{mergeExtraDefaults:O}=E,D=qDe(e,y,o,i,l,c);(!hn(i)||wu in y)&&(A=d2(A,D,O,!0))}return A}function qDe(e,t,n,r,i,o){const s=!LQ(t)&&sM(e,t,n,o);let a=r;if(s){const c=mm(t);a=c?.some(f=>_r(f.value,r))?r:void 0}return t[Sa]&&i?.constAsDefaults==="always"&&(a=t.const),a}function GDe(e,t,{rawFormData:n,rootSchema:r={},includeUndefinedValues:i=!1,_recurseList:o=[],experimental_defaultFormStateBehavior:s=void 0,experimental_customMergeAllOf:a=void 0,required:l,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}={},f){{const h=hn(n)?n:{},g=t,b=s?.allOf==="populateDefaults"&&wu in g||s?.emptyObjectFields!=="skipEmptyDefaults"&&jT in g?yo(e,g,r,h,a):g,v=b[Sa],S=Object.keys(b.properties||{}).reduce((C,w)=>{var A;const E=We(b,[Un,w],{}),O=hn(v)&&v[w]!==void 0,D=(hn(E)&&Sa in E||O)&&s?.constAsDefaults!=="never"&&!NQ(E),T=Ld(e,E,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:We(f,[w]),rawFormData:We(h,[w]),required:(A=b.required)===null||A===void 0?void 0:A.includes(w),shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u});return Bz(C,w,T,i,l,b.required,s,D,E?.type==="null"),C},{});if(b.additionalProperties&&!u){const C=hn(b.additionalProperties)?b.additionalProperties:{},w=new Set;hn(f)&&Object.keys(f).filter(E=>!b.properties||!b.properties[E]).forEach(E=>w.add(E));const A=[];Object.keys(h).filter(E=>!b.properties||!b.properties[E]).forEach(E=>{w.add(E),A.push(E)}),w.forEach(E=>{var O;const D=Ld(e,C,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:We(f,[E]),rawFormData:We(h,[E]),required:(O=b.required)===null||O===void 0?void 0:O.includes(E),shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u});Bz(S,E,D,i,l,A)})}return FQ(t,S)}}function KDe(e,t,{rawFormData:n,rootSchema:r={},_recurseList:i=[],experimental_defaultFormStateBehavior:o=void 0,experimental_customMergeAllOf:s=void 0,required:a,requiredAsRoot:l=!1,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}={},f){var h,g;const y=t,b=(h=o?.arrayMinItems)!==null&&h!==void 0?h:{},{populate:v,mergeExtraDefaults:S}=b,C=v==="never",w=v==="requiredOnly",A=v==="all"||!C&&!w,E=(g=b?.computeSkipPopulate)!==null&&g!==void 0?g:(()=>!1),D=o?.emptyObjectFields==="skipEmptyDefaults"?void 0:[];if(Array.isArray(f)&&(f=f.map((L,R)=>{const $=lE(y,gm.Fallback,R),j=Array.isArray(n)?n[R]:void 0;return Ld(e,$,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,parentDefaults:L,rawFormData:j,required:a,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u})})),Array.isArray(n)){const L=lE(y);if(C)f=n;else{const R=n.map((j,z)=>Ld(e,L,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:j,parentDefaults:We(f,[z]),required:a,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}));f=d2(f,R,(w&&a||A)&&S)}}if((hn(y)&&Sa in y&&o?.constAsDefaults!=="never")===!1){if(C)return f??D;if(w&&!a)return f||void 0}let I;const F=Array.isArray(f)?f.length:0;if(!y.minItems||aM(e,y,r,s)||E(e,y,r)||y.minItems<=F)I=f||!a&&!l?f:D;else{const L=f||[],R=lE(y,gm.Invert),$=R.default,j=Array.from({length:y.minItems-F},()=>Ld(e,R,{parentDefaults:$,rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,required:a,shouldMergeDefaultsIntoFormData:c}));I=L.concat(j)}return FQ(t,I)}function zz(e,t,n={},r){switch(il(t)){case"object":return GDe(e,t,n,r);case"array":return KDe(e,t,n,r)}}function BQ(e,t,n,r,i=!1,o,s,a){if(!hn(t))throw new Error("Invalid schema: "+t);const l=yo(e,t,r,n,s),c=Ld(e,l,{rootSchema:r,includeUndefinedValues:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:n,shouldMergeDefaultsIntoFormData:!0,initialDefaultsGenerated:a,requiredAsRoot:!0});if(l.type!=="object"&&hn(l.default))return{...c,...n};if(hn(n)||Array.isArray(n)){const{mergeDefaultsIntoFormData:u}=o||{};return d2(c,n,!0,u==="useDefaultIfFormDataUndefined",!0)}return c}function zQ(e={}){return"widget"in $t(e)&&$t(e).widget!=="hidden"}function HQ(e,t,n={},r,i){if(n[LT]==="files")return!0;if(t.items){const o=yo(e,t.items,r,void 0,i);return o.type==="string"&&o.format==="data-url"}return!1}function YDe(e,t,n={},r,i,o){const s=$t(n,i),{label:a=!0}=s;let l=!!a;if(l){const c=il(t),u=We(t,fu,!1);c==="array"&&(l=u||aM(e,t,r,o)||HQ(e,t,n,r,o)||zQ(n)),c==="object"&&(l=u),c==="boolean"&&n&&!n[LT]&&(l=!1),n&&n[j9e]&&(l=!1)}return l}function UQ(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=jw(e,s);n(a,s)&&KT(o,Gm(s,e),a)}return o}function XDe(e,t){return UQ(e,t,function(n,r){return iQ(e,r)})}var VQ=EQ(function(e,t){return e==null?{}:XDe(e,t)});function nh(e,t,n,r,i,o=[],s){if(mr in t||PT in t||wu in t||jT in t){const l=yo(e,t,r,i,s);if(o.findIndex(u=>_r(u,l))===-1)return nh(e,l,n,r,i,o.concat(l),s)}let a={[W5]:n.replace(/^\./,"")};if(nn in t||Pn in t){const l=nn in t?t.oneOf:t.anyOf,c=hc(t),u=u2(e,r,i,l,0,c,s),f=l[u];a={...a,...nh(e,f,n,r,i,o,s)}}if(n2 in t&&t[n2]!==!1&&cr(a,$T,!0),$h in t&&Array.isArray(i)){const{items:l,additionalItems:c}=t;Array.isArray(l)?i.forEach((u,f)=>{l[f]?a[f]=nh(e,l[f],`${n}.${f}`,r,u,o,s):c?a[f]=nh(e,c,`${n}.${f}`,r,u,o,s):console.warn(`Unable to generate path schema for "${n}.${f}". No schema defined for it`)}):i.forEach((u,f)=>{a[f]=nh(e,l,`${n}.${f}`,r,u,o,s)})}else if(Un in t)for(const l in t.properties){const c=We(t,[Un,l],{});a[l]=nh(e,c,`${n}.${l}`,r,We(i,[l]),o,s)}return a}function WQ(e,t,n="",r,i,o){return nh(e,t,n,r,i,void 0,o)}function qQ(e,t){if(t.length===0&&typeof e!="object")return e;const n=VQ(e,t);return Array.isArray(e)?Object.keys(n).map(r=>n[r]):n}function GQ(e,t){const n=(i,o)=>typeof i!="object"||yi(i)||o&&!yi(i),r=(i,o=[],s=[[]])=>{const a=Object.keys(i);return a.forEach(l=>{const c=i[l];if(typeof c=="object"){const u=s.map(f=>[...f,l]);c[$T]&&c[W5]!==""?o.push(c[W5]):r(c,o,u)}else l===W5&&c!==""&&s.forEach(u=>{const f=We(t,u),h=a.length===1;(n(f,h)||Array.isArray(f)&&f.every(g=>n(g,h)))&&o.push(u)})}),o};return r(e)}function ZDe(e,t,n={},r){const i=yo(e,t,n,r),o=WQ(e,i,"",n,r),a=GQ(o,r).map(l=>Array.isArray(l)?l.join("."):l);return qQ(r,a)}const Xp=Symbol("no Value");function u_(e,t,n,r,i={},o){let s;if(In(n,Un)){const a={};if(In(r,Un)){const u=We(r,Un,{});Object.keys(u).forEach(f=>{In(i,f)&&(a[f]=void 0)})}const l=Object.keys(We(n,Un,{})),c={};l.forEach(u=>{const f=We(i,u);let h=We(r,[Un,u],{}),g=We(n,[Un,u],{});In(h,mr)&&(h=yo(e,h,t,f,o)),In(g,mr)&&(g=yo(e,g,t,f,o));const y=We(h,"type"),b=We(g,"type");if(!y||y===b)if(In(a,u)&&delete a[u],b==="object"||b==="array"&&Array.isArray(f)){const v=u_(e,t,g,h,f,o);(v!==void 0||b==="array")&&(c[u]=v)}else{const v=We(g,"default",Xp),S=We(h,"default",Xp);v!==Xp&&v!==f&&(S===f?a[u]=v:We(g,"readOnly")===!0&&(a[u]=void 0));const C=We(g,"const",Xp),w=We(h,"const",Xp);C!==Xp&&C!==f&&(a[u]=w===f?C:void 0)}}),s={...typeof i=="string"||Array.isArray(i)?void 0:i,...a,...c}}else if(We(r,"type")==="array"&&We(n,"type")==="array"&&Array.isArray(i)){let a=We(r,"items"),l=We(n,"items");if(typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)){In(a,mr)&&(a=yo(e,a,t,i,o)),In(l,mr)&&(l=yo(e,l,t,i,o));const c=We(a,"type"),u=We(l,"type");if(!c||c===u){const f=We(n,"maxItems",-1);u==="object"?s=i.reduce((h,g)=>{const y=u_(e,t,l,a,g,o);return y!==void 0&&(f<0||h.length<f)&&h.push(y),h},[]):s=f>0&&i.length>f?i.slice(0,f):i}}else typeof a=="boolean"&&typeof l=="boolean"&&a===l&&(s=i)}return s}class JDe{constructor(t,n,r,i){n&&n[U1]===q5?this.rootSchema=l_(n,We(n,pr,"#")):this.rootSchema=n,this.validator=t,this.experimental_defaultFormStateBehavior=r,this.experimental_customMergeAllOf=i}getRootSchema(){return this.rootSchema}getValidator(){return this.validator}doesSchemaUtilsDiffer(t,n,r={},i){return!t||!n?!1:this.validator!==t||!_r(this.rootSchema,n)||!_r(this.experimental_defaultFormStateBehavior,r)||this.experimental_customMergeAllOf!==i}findFieldInSchema(t,n,r){return NDe(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}findSelectedOptionInXxxOf(t,n,r,i){return W1(this.validator,this.rootSchema,t,n,r,i,this.experimental_customMergeAllOf)}getDefaultFormState(t,n,r=!1,i){return BQ(this.validator,t,n,this.rootSchema,r,this.experimental_defaultFormStateBehavior,this.experimental_customMergeAllOf,i)}getDisplayLabel(t,n,r){return YDe(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}getClosestMatchingOption(t,n,r,i){return u2(this.validator,this.rootSchema,t,n,r,i,this.experimental_customMergeAllOf)}getFirstMatchingOption(t,n,r){return iM(this.validator,t,n,this.rootSchema,r)}getFromSchema(t,n,r){return Y5(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}isFilesArray(t,n){return HQ(this.validator,t,n,this.rootSchema,this.experimental_customMergeAllOf)}isMultiSelect(t){return aM(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}isSelect(t){return sM(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}omitExtraData(t,n){return ZDe(this.validator,t,this.rootSchema,n)}retrieveSchema(t,n,r){return yo(this.validator,t,this.rootSchema,n,this.experimental_customMergeAllOf,r)}sanitizeDataForNewSchema(t,n,r){return u_(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}toPathSchema(t,n,r){return WQ(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}}function QDe(e,t,n={},r){return new JDe(e,t,n,r)}function eOe(e){var t;if(e.indexOf("data:")===-1)throw new Error("File is invalid: URI must be a dataURI");const r=e.slice(5).split(";base64,");if(r.length!==2)throw new Error("File is invalid: dataURI must be base64");const[i,o]=r,[s,...a]=i.split(";"),l=s||"",c=decodeURI(((t=a.map(u=>u.split("=")).find(([u])=>u==="name"))===null||t===void 0?void 0:t[1])||"unknown");try{const u=atob(o),f=new Array(u.length);for(let g=0;g<u.length;g++)f[g]=u.charCodeAt(g);return{blob:new window.Blob([new Uint8Array(f)],{type:l}),name:c}}catch(u){throw new Error("File is invalid: "+u.message)}}function fd(e,t){let n=String(e);for(;n.length<t;)n="0"+n;return n}function KQ(e,t){if(e<=0&&t<=0)e=new Date().getFullYear()+e,t=new Date().getFullYear()+t;else if(e<0||t<0)throw new Error(`Both start (${e}) and stop (${t}) must both be <= 0 or > 0, got one of each`);if(e>t)return KQ(t,e).reverse();const n=[];for(let r=e;r<=t;r++)n.push({value:r,label:fd(r,2)});return n}function Hz(e,t){if(Object.is(e,t))return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const o=n[i];if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1}return!0}function tOe(e,t){let n=e;if(Array.isArray(t)){const r=n.split(/(%\d)/);t.forEach((i,o)=>{const s=r.findIndex(a=>a===`%${o+1}`);s>=0&&(r[s]=i)}),n=r.join("")}return n}function nOe(e,t){return tOe(e,t)}function no(e,t=[],n){if(Array.isArray(e))return e.map(o=>no(o,t)).filter(o=>o!==n);const r=e===""||e===null?-1:Number(e),i=t[r];return i?i.value:n}function YQ(e,t,n=[]){const r=no(e,n);return Array.isArray(t)?t.filter(i=>!_r(i,r)):_r(r,t)?void 0:t}function Fw(e,t){return Array.isArray(t)?t.some(n=>_r(n,e)):_r(t,e)}function lM(e,t=[],n=!1){const r=t.map((i,o)=>Fw(i.value,e)?String(o):void 0).filter(i=>typeof i<"u");return n?r:r[0]}function XQ(e,t,n=[]){const r=no(e,n);if(!a6(r)){const i=n.findIndex(a=>r===a.value),o=n.map(({value:a})=>a);return t.slice(0,i).concat(r,t.slice(i)).sort((a,l)=>+(o.indexOf(a)>o.indexOf(l)))}return t}var rOe=1,iOe=4;function cM(e){return hy(e,rOe|iOe)}function oOe(e,t,n,r){return r=typeof r=="function"?r:void 0,e==null?e:KT(e,t,n,r)}class ZQ{constructor(t){this.errorSchema={},this.resetAllErrors(t)}get ErrorSchema(){return this.errorSchema}getOrCreateErrorBlock(t){let r=Array.isArray(t)&&t.length>0||typeof t=="string"?We(this.errorSchema,t):this.errorSchema;return!r&&t&&(r={},oOe(this.errorSchema,t,r,Object)),r}resetAllErrors(t){return this.errorSchema=t?cM(t):{},this}addErrors(t,n){const r=this.getOrCreateErrorBlock(n);let i=We(r,po);return Array.isArray(i)||(i=[],r[po]=i),Array.isArray(t)?cr(r,po,[...new Set([...i,...t])]):cr(r,po,[...new Set([...i,t])]),this}setErrors(t,n){const r=this.getOrCreateErrorBlock(n),i=Array.isArray(t)?[...new Set([...t])]:[t];return cr(r,po,i),this}clearErrors(t){const n=this.getOrCreateErrorBlock(t);return cr(n,po,[]),this}}function sOe(e,t){if(e==null)return{};var n=qm(eM(e),function(r){return[r]});return t=XT(t),UQ(e,n,function(r,i){return t(r,i[0])})}var aOe=200;function lOe(e,t,n,r){var i=-1,o=QT,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;t.length>=aOe&&(o=o2,s=!1,t=new Nh(t));e:for(;++i<a;){var u=e[i],f=u;if(u=u!==0?u:0,s&&f===f){for(var h=c;h--;)if(t[h]===f)continue e;l.push(u)}else o(t,f,r)||l.push(u)}return l}var cOe=Lw(function(e,t){return a2(e)?lOe(e,Ob(t,1,a2,!0)):[]});function Uz(e,t){const n=Jd(e),r=Jd(t);if(e===t||!n&&!r)return[];if(n&&!r)return za(e);if(!n&&r)return za(t);{const i=za(sOe(e,(s,a)=>!_r(s,We(t,a)))),o=cOe(za(t),za(e));return[...i,...o]}}function uOe(e,t,n=[1900,new Date().getFullYear()+2],r="YMD"){const{day:i,month:o,year:s,hour:a,minute:l,second:c}=e,u={type:"day",range:[1,31],value:i},f={type:"month",range:[1,12],value:o},h={type:"year",range:n,value:s},g=[];switch(r){case"MDY":g.push(f,u,h);break;case"DMY":g.push(u,f,h);break;default:g.push(h,f,u)}return t&&g.push({type:"hour",range:[0,23],value:a},{type:"minute",range:[0,59],value:l},{type:"second",range:[0,59],value:c}),g}function JQ(e){const t={};return e.multipleOf&&(t.step=e.multipleOf),(e.minimum||e.minimum===0)&&(t.min=e.minimum),(e.maximum||e.maximum===0)&&(t.max=e.maximum),t}function QQ(e,t,n={},r=!0){const i={type:t||"text",...JQ(e)};return n.inputType?i.type=n.inputType:t||(e.type==="number"?(i.type="number",r&&i.step===void 0&&(i.step="any")):e.type==="integer"&&(i.type="number",i.step===void 0&&(i.step=1))),n.autocomplete&&(i.autoComplete=n.autocomplete),n.accept&&(i.accept=n.accept),i}const Vz={props:{disabled:!1},submitText:"Submit",norender:!1};function eee(e={}){const t=$t(e);if(t&&t[r6]){const n=t[r6];return{...Vz,...n}}return Vz}function Bt(e,t,n={}){const{templates:r}=t;if(e==="ButtonTemplates")return r[e];if(Object.hasOwn(n,e)&&typeof n[e]=="string"&&Object.hasOwn(r,n[e])){const i=n[e];return r[i]}return n[e]||r[e]}var dOe=0;function tee(e){var t=++dOe;return WT(e)+t}function uM(){if(typeof process>"u"||We(process,"env.NODE_ENV")!=="test")return{};const e=new Map;return new Proxy({},{get(t,n){return e.has(n)||e.set(n,tee("test-id-")),e.get(n)}})}var cE={exports:{}},rr={};var Wz;function fOe(){if(Wz)return rr;Wz=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function b(v){if(typeof v=="object"&&v!==null){var S=v.$$typeof;switch(S){case e:switch(v=v.type,v){case n:case i:case r:case c:case u:return v;default:switch(v=v&&v.$$typeof,v){case a:case s:case l:case h:case f:case o:return v;default:return S}}case t:return S}}}return rr.ContextConsumer=s,rr.ContextProvider=o,rr.Element=e,rr.ForwardRef=l,rr.Fragment=n,rr.Lazy=h,rr.Memo=f,rr.Portal=t,rr.Profiler=i,rr.StrictMode=r,rr.Suspense=c,rr.SuspenseList=u,rr.isAsyncMode=function(){return!1},rr.isConcurrentMode=function(){return!1},rr.isContextConsumer=function(v){return b(v)===s},rr.isContextProvider=function(v){return b(v)===o},rr.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},rr.isForwardRef=function(v){return b(v)===l},rr.isFragment=function(v){return b(v)===n},rr.isLazy=function(v){return b(v)===h},rr.isMemo=function(v){return b(v)===f},rr.isPortal=function(v){return b(v)===t},rr.isProfiler=function(v){return b(v)===i},rr.isStrictMode=function(v){return b(v)===r},rr.isSuspense=function(v){return b(v)===c},rr.isSuspenseList=function(v){return b(v)===u},rr.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===i||v===r||v===c||v===u||v===g||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===f||v.$$typeof===o||v.$$typeof===s||v.$$typeof===l||v.$$typeof===y||v.getModuleId!==void 0)},rr.typeOf=b,rr}var qz;function hOe(){return qz||(qz=1,cE.exports=fOe()),cE.exports}var pOe=hOe();const Gz=cs(pOe),uE={boolean:{checkbox:"CheckboxWidget",radio:"RadioWidget",select:"SelectWidget",hidden:"HiddenWidget"},string:{text:"TextWidget",password:"PasswordWidget",email:"EmailWidget",hostname:"TextWidget",ipv4:"TextWidget",ipv6:"TextWidget",uri:"URLWidget","data-url":"FileWidget",radio:"RadioWidget",select:"SelectWidget",textarea:"TextareaWidget",hidden:"HiddenWidget",date:"DateWidget",datetime:"DateTimeWidget","date-time":"DateTimeWidget","alt-date":"AltDateWidget","alt-datetime":"AltDateTimeWidget",time:"TimeWidget",color:"ColorWidget",file:"FileWidget"},number:{text:"TextWidget",select:"SelectWidget",updown:"UpDownWidget",range:"RangeWidget",radio:"RadioWidget",hidden:"HiddenWidget"},integer:{text:"TextWidget",select:"SelectWidget",updown:"UpDownWidget",range:"RangeWidget",radio:"RadioWidget",hidden:"HiddenWidget"},array:{select:"SelectWidget",checkboxes:"CheckboxesWidget",files:"FileWidget",hidden:"HiddenWidget"}};function mOe(e){let t=We(e,"MergedWidget");if(!t){const n=e.defaultProps&&e.defaultProps.options||{};t=({options:r,...i})=>m.jsx(e,{options:{...n,...r},...i}),cr(e,"MergedWidget",t)}return t}function pc(e,t,n={}){const r=il(e);if(typeof t=="function"||t&&Gz.isForwardRef(_.createElement(t))||Gz.isMemo(t))return mOe(t);if(typeof t!="string")throw new Error(`Unsupported widget definition: ${typeof t} in schema: ${JSON.stringify(e)}`);if(t in n){const i=n[t];return pc(e,i,n)}if(typeof r=="string"){if(!(r in uE))throw new Error(`No widget for type '${r}' in schema: ${JSON.stringify(e)}`);if(t in uE[r]){const i=n[uE[r][t]];return pc(e,i,n)}}throw new Error(`No widget '${t}' for type '${r}' in schema: ${JSON.stringify(e)}`)}function gOe(e){let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return t.toString(16)}function yOe(e){const t=new Set;return JSON.stringify(e,(n,r)=>(t.add(n),r)),JSON.stringify(e,Array.from(t).sort())}function Gl(e){return gOe(yOe(e))}function bOe(e){return Gl(e)}function vOe(e,t,n={}){try{return pc(e,t,n),!0}catch(r){const i=r;if(i.message&&(i.message.startsWith("No widget")||i.message.startsWith("Unsupported widget")))return!1;throw r}}function ip(e,t){return`${Qd(e)?e:e[pr]}__${t}`}function op(e){return ip(e,"description")}function dM(e){return ip(e,"error")}function Bw(e){return ip(e,"examples")}function fM(e){return ip(e,"help")}function zw(e){return ip(e,"title")}function Us(e,t=!1){const n=t?` ${Bw(e)}`:"";return`${dM(e)} ${op(e)} ${fM(e)}${n}`}function Hw(e,t){return`${e}-${t}`}function Kl(e,t){return ip(e,t)}function dE(e,t){return ip(e,`optional${t}`)}function Ym(e){return!a6(e)&&(!Bn(e)||Array.isArray(e)||!yi(e))}function xOe(e,t){const{rootSchema:n,schemaUtils:r}=e;if(s2(t,n))return!0;if(mr in n){const i=r.retrieveSchema(n);return s2(t,i)}return!1}function sp(e,t,n){return t?n:e}function SOe(e){return e?new Date(e).toJSON():void 0}function hM(e,t,n){const r=[P9e];return In(e,YB)&&r.unshift(YB),We(e,[...r,t],n)}function wOe(e,t){if(!Array.isArray(t))return e;const n=u=>u.reduce((f,h)=>(f[h]=!0,f),{}),r=u=>u.length>1?`properties '${u.join("', '")}'`:`property '${u[0]}'`,i=n(e),o=t.filter(u=>u==="*"||i[u]),s=n(o),a=e.filter(u=>!s[u]),l=o.indexOf("*");if(l===-1){if(a.length)throw new Error(`uiSchema order list does not contain ${r(a)}`);return o}if(l!==o.lastIndexOf("*"))throw new Error("uiSchema order list contains more than one wildcard item");const c=[...o];return c.splice(l,1,...a),c}function fE(e,t=!0){if(!e)return{year:-1,month:-1,day:-1,hour:t?-1:0,minute:t?-1:0,second:t?-1:0};const n=new Date(e);if(Number.isNaN(n.getTime()))throw new Error("Unable to parse date "+e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:t?n.getUTCHours():0,minute:t?n.getUTCMinutes():0,second:t?n.getUTCSeconds():0}}const COe=[$h,n2],EOe=[nn,Pn,wu];function X5(e,t,n,r=new Set){const{rootSchema:i,uiSchemaDefinitions:o}=n;let s={...t},a=e;const l=e[mr],c=l&&r.has(l);if(l){if(r.add(l),o&&l in o&&(s=Bh(o[l],s)),c)return s;try{a=rM(l,i)}catch{a=e}}const u=a[Un];if(u&&hn(u))for(const[f,h]of Object.entries(u)){const g=s[f]||{},y=X5(h,g,n,new Set(r));Object.keys(y).length>0&&(s[f]=y)}for(const f of COe){const h=a[f];if(h&&hn(h)&&!Array.isArray(h)){const g=s[f];if(typeof g!="function"){const b=X5(h,g||{},n,new Set(r));Object.keys(b).length>0&&(s[f]=b)}}}for(const f of EOe){const h=a[f];if(Array.isArray(h)&&h.length>0){const g=s[f],y=Array.isArray(g)?[...g]:[];let b=!1;for(let v=0;v<h.length;v++){const S=h[v],C=y[v]||{},w=X5(S,C,n,new Set(r));Object.keys(w).length>0&&(y[v]=w,b=!0)}b&&(s[f]=y)}}return s}function AOe(e,t,n){var r;const i=e[mr],o=i?(r=n.uiSchemaDefinitions)===null||r===void 0?void 0:r[i]:void 0;return o?!t||Object.keys(t).length===0?{...o}:Bh(o,t):t||{}}function py(e){if(e.const||e.enum&&e.enum.length===1&&e.enum[0]===!0)return!0;if(e.anyOf&&e.anyOf.length===1)return py(e.anyOf[0]);if(e.oneOf&&e.oneOf.length===1)return py(e.oneOf[0]);if(e.allOf){const t=n=>py(n);return e.allOf.some(t)}return!1}function nee(e,t,n,r="customDeep"){if(r==="always")return!0;if(r==="shallow"){const{props:s,state:a}=e;return!Hz(s,t)||!Hz(a,n)}const{props:i,state:o}=e;return!_r(i,t)||!_r(o,n)}function Kz(e){const t=pQ(e.map(n=>Bn(n)?il(n):void 0).flat().filter(n=>n!==void 0));return t.length===1?t[0]:t}function Tb(e,t,n,r){const{enableOptionalDataFieldForType:i=[]}=$t(r,e.globalUiOptions);let o;return Pn in t&&Array.isArray(t[Pn])?o=Kz(t[Pn]):nn in t&&Array.isArray(t[nn])?o=Kz(t[nn]):o=il(t),!xOe(e,t)&&!n&&!!o&&!Array.isArray(o)&&!!i.find(s=>s===o)}function Yz(e,t=!0){const{year:n,month:r,day:i,hour:o=0,minute:s=0,second:a=0}=e,l=Date.UTC(n,r-1,i,o,s,a),c=new Date(l).toJSON();return t?c:c.slice(0,10)}function pM(e,t=[]){if(!e)return[];let n=[];return po in e&&(n=n.concat(e[po].map(r=>{const i=`.${t.join(".")}`;return{property:i,message:r,stack:`${i} ${r}`}}))),Object.keys(e).reduce((r,i)=>{if(i!==po){const o=e[i];Jd(o)&&(r=r.concat(pM(o,[...t,i])))}return r},n)}function ree(e){return Fi(e)?qm(e,rp):_b(e)?[e]:JT(GJ(WT(e)))}function kOe(e){const t=new ZQ;return e.length&&e.forEach(n=>{const{property:r,message:i}=n,o=r==="."?[]:ree(r);o.length>0&&o[0]===""&&o.splice(0,1),i&&t.addErrors(i,o)}),t.ErrorSchema}function Ea(e,t,n,r){const i=Array.isArray(n)?n:n?.path,o=e===""?[]:[e],s=i?i.concat(...o):o,a=[t.idPrefix,...s].join(t.idSeparator);let l;return t.nameGenerator&&s.length>0&&(l=t.nameGenerator(s,t.idPrefix,r)),{path:s,[pr]:a,...l!==void 0&&{name:l}}}function iee(e){return Object.keys(e).reduce((t,n)=>{if(n==="addError")return t;{const r=e[n];return Jd(r)?{...t,[n]:iee(r)}:{...t,[n]:r}}},{})}function _Oe(e){return Object.values(e).every(t=>t!==-1)}function DOe(e){const{className:t="form-control",type:n,range:r,value:i,select:o,rootId:s,name:a,disabled:l,readonly:c,autofocus:u,registry:f,onBlur:h,onFocus:g}=e,y=`${s}_${n}`,{SelectWidget:b}=f.widgets,v=_.useCallback(S=>o(n,S),[o,n]);return m.jsx(b,{schema:{type:"integer"},id:y,name:a,className:t,options:{enumOptions:KQ(r[0],r[1])},placeholder:n,value:i,disabled:l,readonly:c,autofocus:u,onChange:v,onBlur:h,onFocus:g,registry:f,label:"","aria-describedby":Us(s)})}function OOe(e){const{time:t=!1,disabled:n=!1,readonly:r=!1,options:i,onChange:o,value:s}=e,[a,l]=_.useState(fE(s,t));_.useEffect(()=>{l(fE(s,t))},[t,s]);const c=_.useCallback((g,y)=>{const b={...a,[g]:typeof y>"u"?-1:y};_Oe(b)?o(Yz(b,t)):l(b)},[a,o,t]),u=_.useCallback(g=>{g.preventDefault(),!(n||r)&&o(void 0)},[n,r,o]),f=_.useCallback(g=>{if(g.preventDefault(),n||r)return;const y=fE(new Date().toJSON(),t);o(Yz(y,t))},[n,r,t,o]);return{elements:_.useMemo(()=>uOe(a,t,i.yearsRange,i.format),[a,t,i.yearsRange,i.format]),handleChange:c,handleClear:u,handleSetNow:f}}function ap(e){const t=_.useRef(e);return s2(e,t.current)||(t.current=e),t.current}function TOe(e,t){return e.replace(";base64",`;name=${encodeURIComponent(t)};base64`)}function MOe(e){const{name:t,size:n,type:r}=e;return new Promise((i,o)=>{const s=new window.FileReader;s.onerror=o,s.onload=a=>{var l;typeof((l=a.target)===null||l===void 0?void 0:l.result)=="string"?i({dataURL:TOe(a.target.result,t),name:t,size:n,type:r}):i({dataURL:null,name:t,size:n,type:r})},s.readAsDataURL(e)})}function ROe(e){return Promise.all(Array.from(e).map(MOe))}function Xz(e){return e.reduce((t,n)=>{if(!n)return t;try{const{blob:r,name:i}=eOe(n);return[...t,{dataURL:n,name:i,size:r.size,type:r.type}]}catch{return t}},[])}function IOe(e,t,n=!1){const r=_.useMemo(()=>n&&e?Array.isArray(e)?e:[e]:[],[e,n]),i=_.useMemo(()=>Array.isArray(e)?Xz(e):Xz([e||""]),[e]),o=_.useCallback(a=>{ROe(a).then(l=>{const c=l.map(u=>u.dataURL||null);t(n?r.concat(...c):c[0])})},[r,n,t]),s=_.useCallback(a=>{if(n){const l=r.filter((c,u)=>u!==a);t(l)}else t(void 0)},[r,n,t]);return{filesInfo:i,handleChange:o,handleRemove:s}}function POe(e){if(!e)return"";const t=new Date(e),n=fd(t.getFullYear(),4),r=fd(t.getMonth()+1,2),i=fd(t.getDate(),2),o=fd(t.getHours(),2),s=fd(t.getMinutes(),2),a=fd(t.getSeconds(),2),l=fd(t.getMilliseconds(),3);return`${n}-${r}-${i}T${o}:${s}:${a}.${l}`}function Z5(e,t,n=!1){if(!t)return e;const{errors:r,errorSchema:i}=e;let o=pM(t),s=t;return yi(i)||(s=Bh(i,t,n?"preventDuplicates":!0),o=[...r].concat(o)),{errorSchema:s,errors:o}}function jOe(e){for(const t in e){const n=e,r=n[t];t===mr&&typeof r=="string"&&r.startsWith("#")?n[t]=RJ+r:n[t]=mM(r)}return e}function $Oe(e){for(let t=0;t<e.length;t++)e[t]=mM(e[t]);return e}function mM(e){return Array.isArray(e)?$Oe([...e]):Bn(e)?jOe({...e}):e}var un;(function(e){e.ArrayItemTitle="Item",e.MissingItems="Missing items definition",e.EmptyArray="No items yet. Use the button below to add some.",e.YesLabel="Yes",e.NoLabel="No",e.CloseLabel="Close",e.ErrorsLabel="Errors",e.NewStringDefault="New Value",e.AddButton="Add",e.AddItemButton="Add Item",e.CopyButton="Copy",e.MoveDownButton="Move down",e.MoveUpButton="Move up",e.RemoveButton="Remove",e.NowLabel="Now",e.ClearLabel="Clear",e.AriaDateLabel="Select a date",e.PreviewLabel="Preview",e.DecrementAriaLabel="Decrease value by 1",e.IncrementAriaLabel="Increase value by 1",e.OptionalObjectAdd="Add data for optional field",e.OptionalObjectRemove="Remove data for optional field",e.OptionalObjectEmptyMsg="No data for optional field",e.Type="Type",e.Value="Value",e.ClearButton="clear input",e.UnknownFieldType="Unknown field type %1",e.OptionPrefix="Option %1",e.TitleOptionPrefix="%1 option %2",e.KeyLabel="%1 Key",e.InvalidObjectField='Invalid "%1" object field configuration: _%2_.',e.UnsupportedField="Unsupported field schema.",e.UnsupportedFieldWithId="Unsupported field schema for field `%1`.",e.UnsupportedFieldWithReason="Unsupported field schema: _%1_.",e.UnsupportedFieldWithIdAndReason="Unsupported field schema for field `%1`: _%2_.",e.FilesInfo="**%1** (%2, %3 bytes)"})(un||(un={}));function LOe(e,t){var n=Fi(e)?YT:$Q;return n(e,XJ(t))}function NOe(e,t){return e==null?!0:CQ(e,t)}function d_(){return tee("rjsf-array-item-")}function Zz(e){return Array.isArray(e)?e.map(t=>({key:d_(),item:t})):[]}function oee(e){return Array.isArray(e)?e.map(t=>t.item):[]}function FOe(e){return Array.isArray(e.type)?!e.type.includes("null"):e.type!=="null"}function see(e,t,n,r){let{addable:i}=$t(r,e.globalUiOptions);return i!==!1&&(t.maxItems!==void 0?i=n.length<t.maxItems:i=!0),i}function aee(e,t,n,r){if(typeof e.items=="function")try{return e.items(t,n,r)}catch(i){console.error(`Error executing dynamic uiSchema.items function for item at index ${n}:`,i);return}else return e.items}function BOe(e,t){const{schemaUtils:n,globalFormOptions:r}=e;let i=t.items;return r.useFallbackUiForUnsupportedType&&!i?i={}:oM(t)&&T9e(t)&&(i=t.additionalItems),n.getDefaultFormState(i)}function zOe(e){const{schema:t,fieldPathId:n,uiSchema:r,formData:i=[],disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,placeholder:c,onBlur:u,onFocus:f,registry:h,rawErrors:g,name:y,onSelectChange:b}=e,{widgets:v,schemaUtils:S,globalFormOptions:C,globalUiOptions:w}=h,A=S.retrieveSchema(t.items,i),E=mm(A,r),{widget:O="select",title:D,...T}=$t(r,w),I=pc(t,O,v),F=D??t.title??y,L=S.getDisplayLabel(t,r,w),R=ap(Ea("",C,n,!0));return m.jsx(I,{id:R[pr],name:y,multiple:!0,onChange:b,onBlur:u,onFocus:f,options:{...T,enumOptions:E},schema:t,uiSchema:r,registry:h,value:i,disabled:o,readonly:s,required:l,label:F,hideLabel:!L,placeholder:c,autofocus:a,rawErrors:g,htmlName:R.name})}function HOe(e){const{schema:t,fieldPathId:n,uiSchema:r,disabled:i=!1,readonly:o=!1,autofocus:s=!1,required:a=!1,hideError:l,placeholder:c,onBlur:u,onFocus:f,formData:h=[],registry:g,rawErrors:y,name:b,onSelectChange:v}=e,{widgets:S,schemaUtils:C,globalFormOptions:w,globalUiOptions:A}=g,{widget:E,title:O,...D}=$t(r,A),T=pc(t,E,S),I=O??t.title??b,F=C.getDisplayLabel(t,r,A),L=ap(Ea("",w,n,!0));return m.jsx(T,{id:L[pr],name:b,multiple:!0,onChange:v,onBlur:u,onFocus:f,options:D,schema:t,uiSchema:r,registry:g,value:h,disabled:i,readonly:o,hideError:l,required:a,label:I,hideLabel:!F,placeholder:c,autofocus:s,rawErrors:y,htmlName:L.name})}function UOe(e){const{schema:t,uiSchema:n,fieldPathId:r,name:i,disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,onBlur:c,onFocus:u,registry:f,formData:h=[],rawErrors:g,onSelectChange:y}=e,{widgets:b,schemaUtils:v,globalFormOptions:S,globalUiOptions:C}=f,{widget:w="files",title:A,...E}=$t(n,C),O=pc(t,w,b),D=A??t.title??i,T=v.getDisplayLabel(t,n,C),I=ap(Ea("",S,r,!0));return m.jsx(O,{options:E,id:I[pr],name:i,multiple:!0,onChange:y,onBlur:c,onFocus:u,schema:t,uiSchema:n,value:h,disabled:o,readonly:s,required:l,registry:f,autofocus:a,rawErrors:g,label:D,hideLabel:!T,htmlName:I.name})}function lee(e){const{itemKey:t,index:n,name:r,disabled:i,hideError:o,readonly:s,registry:a,uiOptions:l,parentUiSchema:c,canAdd:u,canRemove:f=!0,canMoveUp:h,canMoveDown:g,itemSchema:y,itemData:b,itemUiSchema:v,itemFieldPathId:S,itemErrorSchema:C,autofocus:w,onBlur:A,onFocus:E,onChange:O,rawErrors:D,totalItems:T,title:I,handleAddItem:F,handleCopyItem:L,handleRemoveItem:R,handleReorderItems:$}=e,{schemaUtils:j,fields:{ArraySchemaField:z,SchemaField:N},globalUiOptions:W}=a,H=ap(S),U=z||N,K=Bt("ArrayFieldItemTemplate",a,l),B=j.getDisplayLabel(y,v,W),{description:q}=$t(v),X=!!q||!!y.description,{orderable:V=!0,removable:Y=!0,copyable:J=!1}=l,ne={moveUp:V&&h,moveDown:V&&g,copy:J&&u,remove:Y&&f,toolbar:!1};ne.toolbar=Object.keys(ne).some(oe=>ne[oe]);const ee=_.useCallback(oe=>{F(oe,n+1)},[F,n]),se=_.useCallback(oe=>{L(oe,n)},[L,n]),ue=_.useCallback(oe=>{R(oe,n)},[R,n]),te=_.useCallback(oe=>{$(oe,n,n-1)},[$,n]),Z=_.useCallback(oe=>{$(oe,n,n+1)},[$,n]),re={children:m.jsx(U,{name:r,title:I,index:n,schema:y,uiSchema:v,formData:b,errorSchema:C,fieldPathId:H,required:FOe(y),onChange:O,onBlur:A,onFocus:E,registry:a,disabled:i,readonly:s,hideError:o,autofocus:w,rawErrors:D}),buttonsProps:{fieldPathId:H,disabled:i,readonly:s,canAdd:u,hasCopy:ne.copy,hasMoveUp:ne.moveUp,hasMoveDown:ne.moveDown,hasRemove:ne.remove,index:n,totalItems:T,onAddItem:ee,onCopyItem:se,onRemoveItem:ue,onMoveUpItem:te,onMoveDownItem:Z,registry:a,schema:y,uiSchema:v},itemKey:t,className:"rjsf-array-item",disabled:i,hasToolbar:ne.toolbar,index:n,totalItems:T,readonly:s,registry:a,schema:y,uiSchema:v,parentUiSchema:c,displayLabel:B,hasDescription:X};return m.jsx(K,{...re})}function VOe(e){const{schema:t,uiSchema:n={},errorSchema:r,fieldPathId:i,formData:o,name:s,title:a,disabled:l=!1,readonly:c=!1,autofocus:u=!1,required:f=!1,hideError:h=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,onChange:S,keyedFormData:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:O}=e,D=t.title||a||s,{schemaUtils:T,fields:I,formContext:F,globalFormOptions:L,globalUiOptions:R}=g,{OptionalDataControlsField:$}=I,j=$t(n,R),z=Bn(t.items)?t.items:{},N=T.retrieveSchema(z),W=oee(C),H=Tb(g,t,f,n),U=Ym(o),K=see(g,t,W,n)&&(!H||U),B=U?C:[],q=H?" rjsf-optional-array-field":"",X=e.childFieldPathId??i,V=H?m.jsx($,{...e,fieldPathId:X}):void 0,Y={canAdd:K,items:B.map((ne,ee)=>{const{key:se,item:ue}=ne,te=ue,Z=T.retrieveSchema(z,te),re=r?r[ee]:void 0,oe=Ea(ee,L,X),de=aee(n,ue,ee,F),be={itemKey:se,index:ee,name:s&&`${s}-${ee}`,registry:g,uiOptions:j,hideError:h,readonly:c,disabled:l,required:f,title:D?`${D}-${ee+1}`:void 0,canAdd:K,canMoveUp:ee>0,canMoveDown:ee<W.length-1,itemSchema:Z,itemFieldPathId:oe,itemErrorSchema:re,itemData:te,itemUiSchema:de,autofocus:u&&ee===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:C.length,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:O,onChange:S};return m.jsx(lee,{...be},se)}),className:`rjsf-field rjsf-field-array rjsf-field-array-of-${N.type}${q}`,disabled:l,fieldPathId:i,uiSchema:n,onAddClick:w,readonly:c,required:f,schema:t,title:D,formData:W,rawErrors:v,registry:g,optionalDataControl:V},J=Bt("ArrayFieldTemplate",g,j);return m.jsx(J,{...Y})}function WOe(e){const{schema:t,uiSchema:n={},formData:r,errorSchema:i,fieldPathId:o,name:s,title:a,disabled:l=!1,readonly:c=!1,autofocus:u=!1,required:f=!1,hideError:h=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,keyedFormData:S,onChange:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:O}=e;let{formData:D=[]}=e;const T=t.title||a||s,{schemaUtils:I,fields:F,formContext:L,globalFormOptions:R,globalUiOptions:$}=g,j=$t(n,$),{OptionalDataControlsField:z}=F,N=Tb(g,t,f,n),W=Ym(r),U=(Bn(t.items)?t.items:[]).map((ee,se)=>I.retrieveSchema(ee,D[se])),K=Bn(t.additionalItems)?I.retrieveSchema(t.additionalItems,r):null,B=e.childFieldPathId??o;D.length<U.length&&(D=D.concat(new Array(U.length-D.length)));const q=W?S:[],X=N?" rjsf-optional-array-field":"",V=N?m.jsx(z,{...e,fieldPathId:B}):void 0,Y=see(g,t,D,n)&&!!K&&(!N||W),J={canAdd:Y,className:`rjsf-field rjsf-field-array rjsf-field-array-fixed-items${X}`,disabled:l,fieldPathId:o,formData:r,items:q.map((ee,se)=>{const{key:ue,item:te}=ee,Z=te,re=se>=U.length,oe=(re&&Bn(t.additionalItems)?I.retrieveSchema(t.additionalItems,Z):U[se])||{},de=Ea(se,R,B);let be;re?be=n.additionalItems:Array.isArray(n.items)?be=n.items[se]:be=aee(n,te,se,L);const je=i?i[se]:void 0,De={index:se,itemKey:ue,name:s&&`${s}-${se}`,registry:g,uiOptions:j,hideError:h,readonly:c,disabled:l,required:f,title:T?`${T}-${se+1}`:void 0,canAdd:Y,canRemove:re,canMoveUp:se>=U.length+1,canMoveDown:re&&se<D.length-1,itemSchema:oe,itemData:Z,itemUiSchema:be,itemFieldPathId:de,itemErrorSchema:je,autofocus:u&&se===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:S.length,onChange:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:O};return m.jsx(lee,{...De},ue)}),onAddClick:w,readonly:c,required:f,registry:g,schema:t,uiSchema:n,title:T,errorSchema:i,rawErrors:v,optionalDataControl:V},ne=Bt("ArrayFieldTemplate",g,j);return m.jsx(ne,{...J})}function qOe(e=[]){const t=_.useMemo(()=>Gl(e),[e]),[n,r]=_.useState(()=>({formDataHash:t,keyedFormData:Zz(e)}));let{keyedFormData:i,formDataHash:o}=n;if(t!==o){const a=Array.isArray(e)?e:[],l=i||[];i=a.length===l.length?l.map((c,u)=>({key:c.key,item:a[u]})):Zz(a),o=t,r({formDataHash:o,keyedFormData:i})}const s=_.useCallback(a=>{const l=oee(a),c=Gl(l);return r({formDataHash:c,keyedFormData:a}),l},[]);return{keyedFormData:i,updateKeyedFormData:s}}function GOe(e){const{schema:t,uiSchema:n,errorSchema:r,fieldPathId:i,registry:o,formData:s,onChange:a}=e,{globalFormOptions:l,schemaUtils:c,translateString:u}=o,{keyedFormData:f,updateKeyedFormData:h}=qOe(s),g=e.childFieldPathId??i,y=_.useCallback((O,D)=>{O&&O.preventDefault();let T;if(r){T={};for(const L in r){const R=parseInt(L);D===void 0||R<D?cr(T,[R],r[L]):R>=D&&cr(T,[R+1],r[L])}}const I={key:d_(),item:BOe(o,t)},F=[...f];D!==void 0?F.splice(D,0,I):F.push(I),a(h(F),g.path,T)},[f,o,t,a,h,r,g]),b=_.useCallback((O,D)=>{O&&O.preventDefault();let T;if(r){T={};for(const L in r){const R=parseInt(L);R<=D?cr(T,[R],r[L]):R>D&&cr(T,[R+1],r[L])}}const I={key:d_(),item:cM(f[D].item)},F=[...f];D!==void 0?F.splice(D+1,0,I):F.push(I),a(h(F),g.path,T)},[f,a,h,r,g]),v=_.useCallback((O,D)=>{O&&O.preventDefault();let T;if(r){T={};for(const F in r){const L=parseInt(F);L<D?cr(T,[L],r[F]):L>D&&cr(T,[L-1],r[F])}}const I=f.filter((F,L)=>L!==D);a(h(I),g.path,T)},[f,a,h,r,g]),S=_.useCallback((O,D,T)=>{O&&(O.preventDefault(),O.currentTarget.blur());let I;if(r){I={};for(const R in r){const $=parseInt(R);$==D?cr(I,[T],r[D]):$==T?cr(I,[D],r[T]):cr(I,[R],r[$])}}function F(){const R=f.slice();return R.splice(D,1),R.splice(T,0,f[D]),R}const L=F();a(h(L),g.path,I)},[f,a,h,r,g]),C=_.useCallback((O,D,T,I)=>{a(O===void 0?null:O,D,T,I)},[a]),w=_.useCallback(O=>{a(O,g.path,void 0,g?.[pr])},[a,g]),A={...e,formData:s,fieldPathId:g,onSelectChange:w},E={...e,handleAddItem:y,handleCopyItem:b,handleRemoveItem:v,handleReorderItems:S,keyedFormData:f,onChange:C};if(!($h in t)){if(!l.useFallbackUiForUnsupportedType){const D=$t(n),T=Bt("UnsupportedFieldTemplate",o,D);return m.jsx(T,{schema:t,fieldPathId:i,reason:u(un.MissingItems),registry:o})}const O={...t,[$h]:{type:void 0}};A.schema=O,E.schema=O}return c.isMultiSelect(A.schema)?m.jsx(zOe,{...A}):zQ(n)?m.jsx(HOe,{...A}):oM(A.schema)?m.jsx(WOe,{...E}):c.isFilesArray(A.schema,n)?m.jsx(UOe,{...A}):m.jsx(VOe,{...E})}function KOe(e){const{schema:t,name:n,uiSchema:r,fieldPathId:i,formData:o,registry:s,required:a,disabled:l,readonly:c,hideError:u,autofocus:f,title:h,onChange:g,onFocus:y,onBlur:b,rawErrors:v}=e,{title:S}=t,{widgets:C,translateString:w,globalUiOptions:A}=s,{widget:E="checkbox",title:O,label:D=!0,enumNames:T,...I}=$t(r,A),F=pc(t,E,C),L=w(un.YesLabel),R=w(un.NoLabel);let $;const j=O??S??h??n;if(Array.isArray(t.oneOf))$=mm({oneOf:t.oneOf.map(N=>{if(Bn(N))return{...N,title:N.title||(N.const===!0?L:R)}}).filter(N=>N)},r);else{const N=t.enum??[!0,!1];!T&&N.length===2&&N.every(W=>typeof W=="boolean")?$=[{value:N[0],label:N[0]?L:R},{value:N[1],label:N[1]?L:R}]:$=mm({enum:N},r)}const z=_.useCallback((N,W,H)=>g(N,i.path,W,H),[g,i]);return m.jsx(F,{options:{...I,enumOptions:$},schema:t,uiSchema:r,id:i.$id,name:n,onChange:z,onFocus:y,onBlur:b,label:j,hideLabel:!D,value:o,required:a,disabled:l,readonly:c,hideError:u,registry:s,autofocus:f,rawErrors:v,htmlName:i.name})}function YOe(e){return{type:"string",enum:["string","number","boolean","object","array"],default:"string",title:e}}function XOe(e){const t=typeof e;return t==="string"||t==="number"||t==="boolean"?t:t==="object"?Array.isArray(e)?"array":"object":"string"}function ZOe(e,t){switch(t){case"string":return String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;default:return e}}function JOe(e){const{id:t,formData:n,displayLabel:r=!0,schema:i,name:o,uiSchema:s,required:a,disabled:l=!1,readonly:c=!1,onBlur:u,onFocus:f,registry:h,fieldPathId:g,onChange:y,errorSchema:b}=e,{translateString:v,fields:S,globalFormOptions:C}=h,[w,A]=_.useState(XOe(n)),E=$t(s),O=ap(Ea("__internal_type_selector",C,g)),D=v(un.Type),T=_.useMemo(()=>YOe(D),[D]),I=R=>{R!=null&&(A(R),y(ZOe(n,R),g.path,b,t))};if(!C.useFallbackUiForUnsupportedType){const{reason:R=v(un.UnknownFieldType,[String(i.type)])}=e,$=Bt("UnsupportedFieldTemplate",h,E);return m.jsx($,{schema:i,fieldPathId:g,reason:R,registry:h})}const F=Bt("FallbackFieldTemplate",h,E),{SchemaField:L}=S;return m.jsx(F,{schema:i,registry:h,typeSelector:m.jsx(L,{fieldPathId:O,name:`${o}__fallback_type`,schema:T,formData:w,onChange:I,onBlur:u,onFocus:f,registry:h,hideLabel:!r,disabled:l,readonly:c,required:a},n?Gl(n):"__empty__"),schemaField:m.jsx(L,{...e,schema:{type:w,title:v(un.Value),...w==="object"&&{additionalProperties:!0}}})})}function QOe(e,t){return qm(t,function(n){return e[n]})}function eTe(e){return e==null?[]:QOe(e,za(e))}var tTe=Math.max;function nTe(e,t,n,r){e=np(e)?e:eTe(e),n=n?ZJ(n):0;var i=e.length;return n<0&&(n=tTe(i+n,0)),Qd(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&fQ(e,t,n)>-1}var rTe=Math.min;function iTe(e,t,n){for(var r=QT,i=e[0].length,o=e.length,s=o,a=Array(o),l=1/0,c=[];s--;){var u=e[s];l=rTe(u.length,l),a[s]=i>=120&&u.length>=120?new Nh(s&&u):void 0}u=e[0];var f=-1,h=a[0];e:for(;++f<i&&c.length<l;){var g=u[f],y=g;if(g=g!==0?g:0,!(h?o2(h,y):r(c,y))){for(s=o;--s;){var b=a[s];if(!(b?o2(b,y):r(e[s],y)))continue e}h&&h.push(y),c.push(g)}}return c}function oTe(e){return a2(e)?e:[]}var Jz=Lw(function(e){var t=qm(e,oTe);return t.length&&t[0]===e[0]?iTe(t):[]});function cee(e){return e===void 0}var Yl;(function(e){e.ROW="ui:row",e.COLUMN="ui:col",e.COLUMNS="ui:columns",e.CONDITION="ui:condition"})(Yl||(Yl={}));var my;(function(e){e.ALL="all",e.SOME="some",e.NONE="none"})(my||(my={}));const sTe=/^\$lookup=(.+)/,hE="layoutGrid";function Qz(e,t){return e??t}function aTe(e){return/^\d+?$/.test(e)}const Nd=uM();function lTe(e,t,n,r,i){const o=We(n,[Qk],{}),s=We(n,e),a={...We(s,[$d],{}),...t,...o},l={...s};yi(a)||cr(l,[$d],a),yi(o)||cr(l,[Qk],o);let{readonly:c}=$t(l);return(i===!0||cee(c)&&r===!0)&&(c=!0,In(a,G7)?cr(l,[$d,G7],!0):cr(l,`ui:${G7}`,!0)),{fieldUiSchema:l,uiReadonly:c}}function cTe(e,t,n="$0m3tH1nG Un3xP3cT3d"){const r=a_([t]).sort(),i=a_([n]).sort();switch(e){case my.ALL:return s2(r,i);case my.SOME:return Jz(r,i).length>0;case my.NONE:return Jz(r,i).length===0;default:return!1}}function Uw(e,t,n){let r={},i=e[t];if(Jd(i)){const{children:o,className:s,...a}=i;if(i=o,s){const c=s.split(" ").map(u=>hM(n,u,u)).join(" ");r={...a,className:c}}else r=a}if(!Array.isArray(i))throw new TypeError(`Expected array for "${t}" in ${JSON.stringify(e)}`);return{children:i,gridProps:r}}function eH(e,t,n){let r;if(aTe(n)&&e&&e?.type==="array"&&In(e,$h)){const i=Number(n),o=e[$h];Array.isArray(o)?i>o.length?r=wQ(o):r=o[i]:r=o,t={[pr]:t[pr],path:[...t.path.slice(0,t.path.length-1),i]}}return{rawSchema:r,fieldPathId:t}}function uTe(e,t,n,r,i){const{schemaUtils:o,globalFormOptions:s}=e;let a=n,l=i;const c=t.split("."),u=c.pop();let f=o.retrieveSchema(a,r),h=r,g=f.readOnly;c.forEach(v=>{if(l=Ea(v,s,l),In(f,Un))a=We(f,[Un,v],{});else if(f&&(In(f,nn)||In(f,Pn))){const S=In(f,nn)?nn:Pn,C=o.findSelectedOptionInXxxOf(f,v,S,h);a=We(C,[Un,v],{})}else{const S=eH(f,l,v);a=S.rawSchema??{},l=S.fieldPathId}h=We(h,v,{}),f=o.retrieveSchema(a,h),g=Qz(f.readOnly,g)});let y,b=!1;if(yi(f)&&(f=void 0),f&&u){if(f&&(In(f,nn)||In(f,Pn))){const S=In(f,nn)?nn:Pn;f=o.findSelectedOptionInXxxOf(f,u,S,h)}l=Ea(u,s,l),b=f!==void 0&&Array.isArray(f.required)&&nTe(f.required,u);const v=eH(f,l,u);if(v.rawSchema?(f=v.rawSchema,l=v.fieldPathId):(f=We(f,[Un,u]),f=f&&o.retrieveSchema(f)),g=Qz(f?.readOnly,g),f&&(In(f,nn)||In(f,Pn))){const S=In(f,nn)?nn:Pn,C=hc(f);y={options:f[S],hasDiscriminator:!!C}}}return{schema:f,isRequired:b,isReadonly:g,optionsInfo:y,fieldPathId:l}}function dTe(e,t){let n=e;return Qd(n)&&(n=hM(t,n)),Eb(n)?n:null}function fTe(e,t){let n,r=null,i={},o;if(Qd(t)||cee(t))n=t??"";else{const{name:s="",render:a,...l}=t;n=s,i=l,yi(i)||LOe(i,(c,u)=>{if(Qd(c)){const f=sTe.exec(c);if(Array.isArray(f)&&f.length>1){const h=f[1];i[u]=hM(e,h,h)}}}),r=dTe(a,e),!s&&r&&(o=m.jsx(r,{...l,"data-testid":Nd.uiComponent}))}return{name:n,UIComponent:r,uiProps:i,rendered:o}}function Vw(e){const{childrenLayoutGridSchemaId:t,...n}=e,{registry:r,schema:i,formData:o}=n,{schemaUtils:s}=r,a=s.retrieveSchema(i,o);return t.map(l=>_.createElement(gM,{...n,key:`layoutGrid-${Gl(l)}`,schema:a,layoutGridSchema:l}))}function hTe(e){const{layoutGridSchema:t,...n}=e,{formData:r,registry:i}=n,{children:o,gridProps:s}=Uw(t,Yl.CONDITION,i),{operator:a,field:l="",value:c}=s,u=We(r,l,null);return cTe(a,u,c)?m.jsx(Vw,{...n,childrenLayoutGridSchemaId:o}):null}function pTe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=Uw(t,Yl.COLUMN,r),a=$t(i),l=Bt("GridTemplate",r,a);return m.jsx(l,{column:!0,"data-testid":Nd.col,...s,children:m.jsx(Vw,{...n,childrenLayoutGridSchemaId:o})})}function mTe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=Uw(t,Yl.COLUMNS,r),a=$t(i),l=Bt("GridTemplate",r,a);return o.map(c=>m.jsx(l,{column:!0,"data-testid":Nd.col,...s,children:m.jsx(Vw,{...n,childrenLayoutGridSchemaId:[c]})},`column-${Gl(c)}`))}function gTe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=Uw(t,Yl.ROW,r),a=$t(i),l=Bt("GridTemplate",r,a);return m.jsx(l,{...s,"data-testid":Nd.row,children:m.jsx(Vw,{...n,childrenLayoutGridSchemaId:o})})}function yTe(e){const{gridSchema:t,schema:n,uiSchema:r,errorSchema:i,fieldPathId:o,onBlur:s,onFocus:a,formData:l,readonly:c,registry:u,layoutGridSchema:f,...h}=e,{onChange:g}=h,{fields:y}=u,{SchemaField:b,LayoutMultiSchemaField:v}=y,S=fTe(u,t),{name:C,UIComponent:w,uiProps:A}=S,{schema:E,isRequired:O,isReadonly:D,optionsInfo:T,fieldPathId:I}=uTe(u,C,n,l,o),F=ap(I);if(S.rendered)return S.rendered;if(E){const L=T?.hasDiscriminator?v:b,{fieldUiSchema:R,uiReadonly:$}=lTe(C,A,r,D,c);return m.jsx(L,{"data-testid":T?.hasDiscriminator?Nd.layoutMultiSchemaField:Nd.field,...h,name:C,required:O,readonly:$,schema:E,uiSchema:R,errorSchema:We(i,C),fieldPathId:F,formData:We(l,C),onChange:g,onBlur:s,onFocus:a,options:T?.options,registry:u})}return w?m.jsx(w,{"data-testid":Nd.uiComponent,...h,name:C,required:O,formData:l,readOnly:!!D||c,errorSchema:i,uiSchema:r,schema:n,fieldPathId:o,onBlur:s,onFocus:a,registry:u,...A}):null}function gM(e){const{uiSchema:t}=e;let{layoutGridSchema:n}=e;const r=$t(t);if(!n&&hE in r&&Bn(r[hE])&&(n=r[hE]),Bn(n)){if(Yl.ROW in n)return m.jsx(gTe,{...e,layoutGridSchema:n});if(Yl.COLUMN in n)return m.jsx(pTe,{...e,layoutGridSchema:n});if(Yl.COLUMNS in n)return m.jsx(mTe,{...e,layoutGridSchema:n});if(Yl.CONDITION in n)return m.jsx(hTe,{...e,layoutGridSchema:n})}return m.jsx(yTe,{...e,gridSchema:n})}gM.TEST_IDS=Nd;function bTe(e){const{fieldPathId:t,title:n,schema:r,uiSchema:i,required:o,registry:s,name:a}=e,l=$t(i,s.globalUiOptions),{title:c}=l,{title:u}=r,f=c||n||u||a;if(!f)return null;const h=Bt("TitleFieldTemplate",s,l);return m.jsx(h,{id:zw(t),title:f,required:o,schema:r,uiSchema:i,registry:s})}function pE(e,t,n){const r="!@#!@$@#$!@$#";return e.map(({schema:o})=>o).find(o=>{const s=We(o,[Un,t]);return We(s,Ow,We(s,Sa,r))===n})}function tH(e,t,n,r,i){const o=t.map(l=>n.retrieveSchema(l,i));let s=e;In(e,nn)?s={...e,[nn]:o}:In(e,Pn)&&(s={...e,[Pn]:o});const a=mm(s,r);if(!a)throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(s)}`);return a}function vTe(e){const{name:t,baseType:n,disabled:r=!1,formData:i,fieldPathId:o,onBlur:s,onChange:a,options:l,onFocus:c,registry:u,uiSchema:f,schema:h,autofocus:g,readonly:y,required:b,errorSchema:v,hideError:S=!1}=e,{widgets:C,schemaUtils:w,globalUiOptions:A}=u,[E,O]=_.useState(tH(h,l,w,f,i)),D=We(o,pr),T=hc(h),I=Bt("FieldErrorTemplate",u,l),F=Bt("FieldTemplate",u,l),L=Gl(h),R=Gl(l),$=f?Gl(f):"",j=i?Gl(i):"";_.useEffect(()=>{O(tH(h,l,w,f,i))},[L,R,w,$,j]);const{widget:z=T?"radio":"select",title:N="",placeholder:W="",optionsSchemaSelector:H=T,hideError:U,...K}=$t(f);if(!H)throw new Error("No selector field provided for the LayoutMultiSchemaField");const B=We(i,H);let q=We(E[0]?.schema,[Un,H],{});const X=pE(E,H,B);q=q?.type?q:{...q,type:X?.type||n};const V=pc(q,z,C),Y=U===void 0?S:!!U,J=We(v,[po],[]),ne=l2(v,[po]),ee=w.getDisplayLabel(h,f,A),se=Z=>{const re=pE(E,H,Z),oe=pE(E,H,B);let de=w.sanitizeDataForNewSchema(re,oe,i);de&&re&&(de=w.getDefaultFormState(re,de,"excludeObjectChildren")),de&&cr(de,H,Z),a(de,o.path,void 0,D)},ue={enumOptions:E,...K},te=!Y&&J.length>0?m.jsx(I,{fieldPathId:o,schema:h,errors:J,registry:u}):void 0;return m.jsx(F,{fieldPathId:o,id:D,schema:h,label:(N||h.title)??"",disabled:r||Array.isArray(E)&&yi(E),uiSchema:f,required:b,readonly:!!y,registry:u,displayLabel:ee,errors:te,onChange:a,onKeyRename:G5,onKeyRenameBlur:G5,onRemoveProperty:G5,children:m.jsx(V,{id:D,name:t,schema:h,label:(N||h.title)??"",disabled:r||Array.isArray(E)&&yi(E),uiSchema:f,autofocus:g,readonly:y,required:b,registry:u,multiple:!1,rawErrors:J,hideError:Y,hideLabel:!ee,errorSchema:ne,placeholder:W,onChange:se,onBlur:s,onFocus:c,value:B,options:ue,htmlName:o.name})})}class nH extends _.Component{constructor(t){super(t);const{formData:n,options:r,registry:{schemaUtils:i}}=this.props,o=r.map(s=>i.retrieveSchema(s,n));this.state={retrievedOptions:o,selectedOption:this.getMatchingOption(0,n,o)}}componentDidUpdate(t,n){const{formData:r,options:i,fieldPathId:o}=this.props,{selectedOption:s}=this.state;let a=this.state;if(!_r(t.options,i)){const{registry:{schemaUtils:l}}=this.props,c=i.map(u=>l.retrieveSchema(u,r));a={selectedOption:s,retrievedOptions:c}}if(!_r(r,t.formData)&&o.$id===t.fieldPathId.$id){const{retrievedOptions:l}=a,c=this.getMatchingOption(s,r,l);n&&c!==s&&(a={selectedOption:c,retrievedOptions:l})}a!==this.state&&this.setState(a)}getMatchingOption(t,n,r){const{schema:i,registry:{schemaUtils:o}}=this.props,s=hc(i);return o.getClosestMatchingOption(n,r,t,s)}onOptionChange=t=>{const{selectedOption:n,retrievedOptions:r}=this.state,{formData:i,onChange:o,registry:s,fieldPathId:a}=this.props,{schemaUtils:l}=s,c=t!==void 0?parseInt(t,10):-1;if(c===n)return;const u=c>=0?r[c]:void 0,f=n>=0?r[n]:void 0;let h=l.sanitizeDataForNewSchema(u,f,i);u&&(h=l.getDefaultFormState(u,h,"excludeObjectChildren")),this.setState({selectedOption:c},()=>{o(h,a.path,void 0,this.getFieldId())})};getFieldId(){const{fieldPathId:t,schema:n}=this.props;return`${t.$id}${n.oneOf?"__oneof_select":"__anyof_select"}`}render(){const{name:t,disabled:n=!1,errorSchema:r={},formData:i,onBlur:o,onFocus:s,readonly:a,required:l=!1,registry:c,schema:u,uiSchema:f}=this.props,{widgets:h,fields:g,translateString:y,globalUiOptions:b,schemaUtils:v}=c,{SchemaField:S}=g,C=Bt("MultiSchemaFieldTemplate",c,b),w=Tb(c,u,l,f),A=Ym(i),{selectedOption:E,retrievedOptions:O}=this.state,{widget:D="select",placeholder:T,autofocus:I,autocomplete:F,title:L=u.title,...R}=$t(f,b),$=pc({type:"number"},D,h),j=We(r,po,[]),z=l2(r,[po]),N=v.getDisplayLabel(u,f,b),W=E>=0&&O[E]||null;let H;if(W){const{required:J}=u;H=J?Cu({required:J},W):W}let U=[];nn in u&&f&&nn in f?Array.isArray(f[nn])?U=f[nn]:console.warn(`uiSchema.oneOf is not an array for "${L||t}"`):Pn in u&&f&&Pn in f&&(Array.isArray(f[Pn])?U=f[Pn]:console.warn(`uiSchema.anyOf is not an array for "${L||t}"`));let K=f;E>=0&&U.length>E&&(K=U[E]);const B=L?un.TitleOptionPrefix:un.OptionPrefix,q=L?[L]:[],X=O.map((J,ne)=>{const{title:ee=J.title}=$t(U[ne]);return{label:ee||y(B,q.concat(String(ne+1))),value:ne}}),V=!w||A?m.jsx($,{id:this.getFieldId(),name:`${t}${u.oneOf?"__oneof_select":"__anyof_select"}`,schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:o,onFocus:s,disabled:n||yi(X),multiple:!1,rawErrors:j,errorSchema:z,value:E>=0?E:void 0,options:{enumOptions:X,...R},registry:c,placeholder:T,autocomplete:F,autofocus:I,label:L??t,hideLabel:!N,readonly:a}):void 0,Y=H&&H.type!=="null"&&m.jsx(S,{...this.props,schema:H,uiSchema:K})||null;return m.jsx(C,{schema:u,registry:c,uiSchema:f,selector:V,optionSchemaField:Y})}}const xTe=/\.([0-9]*0)*$/,STe=/[0.]0*$/;function wTe(e){const{registry:t,onChange:n,formData:r,value:i}=e,[o,s]=_.useState(i),{StringField:a}=t.fields;let l=r;const c=_.useCallback((u,f,h,g)=>{s(u),`${u}`.charAt(0)==="."&&(u=`0${u}`);const y=typeof u=="string"&&u.match(xTe)?KB(u.replace(STe,"")):KB(u);n(y,f,h,g)},[n]);if(typeof o=="string"&&typeof l=="number"){const u=new RegExp(`^(${String(l).replace(".","\\.")})?\\.?0*$`);o.match(u)&&(l=o)}return m.jsx(a,{...e,formData:l,onChange:c})}function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jl.apply(null,arguments)}const Nx=["strong","em","del","mark"],rH=[["**",Nx[0]],["__",Nx[0]],["~~",Nx[2]],["==",Nx[3]],["*","em"],["_","em"]];function CTe(e,t){for(var n=1,r=t+1;r<e.length&&n>0;)e[r]!=="\\"?(e[r]==="["&&n++,e[r]==="]"&&n--,r++):r+=2;if(n===0&&r<e.length&&(e[r]==="("||e[r]==="[")){var i=e[r]==="("?")":"]",o=1;for(r++;r<e.length&&o>0;)e[r]!=="\\"?(e[r]==="("&&i===")"&&o++,e[r]===i&&o--,r++):r+=2;if(o===0)return r}return-1}function ETe(e,t){if(!t||!t.inline&&!t.simple)return null;var n=e[0];if(n!=="*"&&n!=="_"&&n!=="~"&&n!=="=")return null;for(var r="",i=0,o="",s=0;s<6;s++){var a=rH[s][0];if(e.startsWith(a)&&e.length>=2*a.length){r=a,i=a.length,o=rH[s][1];break}}if(!r)return null;for(var l=i,c=!1,u=!1,f="",h=0,g="",y=!1,b="";l<e.length;){var v=e[l];if(y)g+=v,y=!1,b=v,l++;else if(v!=="\\")if(v!=="`"||h!==0){if(v==="["&&!c&&h===0){var S=CTe(e,l);if(S!==-1){g+=e.slice(l,S),l=S,b=e[S-1];continue}}if(u)g+=v,f?v===f&&(f=""):v==='"'||v==="'"?f=v:v===">"&&(u=!1),b=v,l++;else if(v!=="<"||c){if(v===`
|
|
225
225
|
`&&b===`
|
|
226
226
|
`&&!c&&h===0)return null;if(!c&&h===0){for(var C=0;l+C<e.length&&e[l+C]===r[0];)C++;if(C>=i&&(i!==1||r!=="*"&&r!=="_"||e[l-1]!==r&&e[l+1]!==r)){var w=[e.slice(0,l+C),o,g+e.slice(l+i,l+C)];return w.index=0,w.input=e,w}}g+=v,b=v,l++}else{var A=e[l+1],E=e.indexOf(">",l);if(E!==-1){var O=e.slice(l,E+1).endsWith("/>");A==="/"?h=Math.max(0,h-1):O||h++}u=!0,g+=v,b=v,l++}}else c=!c,g+=v,b=v,l++;else g+=v,y=!0,b=v,l++}return null}const ATe=["children","options"],iH=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),oH={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},kTe=["style","script","pre"],_Te=["src","href","data","formAction","srcDoc","action"],DTe=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,OTe=/\n{2,}$/,sH=/^(\s*>[\s\S]*?)(?=\n\n|$)/,TTe=/^ *> ?/gm,MTe=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,RTe=/^ {2,}\n/,ITe=/^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/,aH=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,lH=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,PTe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,jTe=/^(?:\n *)*\n/,$Te=/\r\n?/g,LTe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,NTe=/^\[\^([^\]]+)]/,FTe=/\f/g,BTe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,zTe=/^\[(x|\s)\]/,cH=/^(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,uH=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,dH=/^([^\n]+)\n *(=|-)\2{2,} *\n/,yM=/^<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>/i;function HTe(e){const t=yM.exec(e);if(!t)return null;const n=t[1],r=n.toLowerCase(),i=r.length+1;let o=t[0].length;e[o]===`
|
|
@@ -496,4 +496,4 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
496
496
|
To pick up a draggable item, press the space bar.
|
|
497
497
|
While dragging, use the arrow keys to move the item.
|
|
498
498
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
499
|
-
`},Kat={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yat(e){let{announcements:t=Kat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Gat}=e;const{announce:o,announcement:s}=Vat(),a=av("DndLiveRegion"),[l,c]=_.useState(!1);if(_.useEffect(()=>{c(!0)},[]),Wat(_.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=qt.createElement(qt.Fragment,null,qt.createElement(Hat,{id:r,value:i.draggable}),qt.createElement(Uat,{id:a,announcement:s}));return n?Dd.createPortal(u,n):u}var Li;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Li||(Li={}));function CS(){}function _K(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function Ele(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ale(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Zat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function DK(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function kle(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function OK(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Jat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=OK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=Ele(OK(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Ale)},Qat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=DK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=DK(l),u=i.reduce((h,g,y)=>h+Ele(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Ale)};function elt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const tlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=elt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Zat)};function nlt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _le(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function rlt(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const ilt=rlt(1);function olt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function slt(e,t,n){const r=olt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const alt={ignoreTransform:!1};function pg(e,t){t===void 0&&(t=alt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=ds(e).getComputedStyle(e);c&&(n=slt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function TK(e){return pg(e,{ignoreTransform:!0})}function llt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function clt(e,t){return t===void 0&&(t=ds(e).getComputedStyle(e)),t.position==="fixed"}function ult(e,t){t===void 0&&(t=ds(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function qC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(SI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ov(i)||Sle(i)||n.includes(i))return n;const o=ds(e).getComputedStyle(i);return i!==e&&ult(i,o)&&n.push(i),clt(i,o)?n:r(i.parentNode)}return e?r(e):n}function Dle(e){const[t]=qC(e,1);return t??null}function XA(e){return!WC||!e?null:fg(e)?e:xI(e)?SI(e)||e===hg(e).scrollingElement?window:ov(e)?e:null:null}function Ole(e){return fg(e)?e.scrollX:e.scrollLeft}function Tle(e){return fg(e)?e.scrollY:e.scrollTop}function ZD(e){return{x:Ole(e),y:Tle(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function Mle(e){return!WC||!e?!1:e===document.scrollingElement}function Rle(e){const t={x:0,y:0},n=Mle(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const dlt={x:.2,y:.2};function flt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=dlt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Rle(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function hlt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ile(e){return e.reduce((t,n)=>nm(t,ZD(n)),sl)}function plt(e){return e.reduce((t,n)=>t+Ole(n),0)}function mlt(e){return e.reduce((t,n)=>t+Tle(n),0)}function glt(e,t){if(t===void 0&&(t=pg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Dle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ylt=[["x",["left","right"],plt],["y",["top","bottom"],mlt]];class EI{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=qC(n),i=Ile(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of ylt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Iy{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function blt(e){const{EventTarget:t}=ds(e);return e instanceof t?e:hg(e)}function ZA(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var na;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(na||(na={}));function MK(e){e.preventDefault()}function vlt(e){e.stopPropagation()}var Ln;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ln||(Ln={}));const Ple={start:[Ln.Space,Ln.Enter],cancel:[Ln.Esc],end:[Ln.Space,Ln.Enter,Ln.Tab]},xlt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ln.Right:return{...n,x:n.x+25};case Ln.Left:return{...n,x:n.x-25};case Ln.Down:return{...n,y:n.y+25};case Ln.Up:return{...n,y:n.y-25}}};class AI{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Iy(hg(n)),this.windowListeners=new Iy(ds(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(na.Resize,this.handleCancel),this.windowListeners.add(na.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(na.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&glt(r),n(sl)}handleKeyDown(t){if(CI(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ple,coordinateGetter:s=xlt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=nb(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=Rle(b),D=hlt(b),T={x:Math.min(v===Ln.Right?D.right-D.width/2:D.right,Math.max(v===Ln.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===Ln.Down?D.bottom-D.height/2:D.bottom,Math.max(v===Ln.Down?D.top:D.top+D.height/2,f.y))},I=v===Ln.Right&&!C||v===Ln.Left&&!w,F=v===Ln.Down&&!A||v===Ln.Up&&!S;if(I&&T.x!==f.x){const L=b.scrollLeft+h.x,R=v===Ln.Right&&L<=E.x||v===Ln.Left&&L>=O.x;if(R&&!h.y){b.scrollTo({left:L,behavior:a});return}R?g.x=b.scrollLeft-L:g.x=v===Ln.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(F&&T.y!==f.y){const L=b.scrollTop+h.y,R=v===Ln.Down&&L<=E.y||v===Ln.Up&&L>=O.y;if(R&&!h.x){b.scrollTo({top:L,behavior:a});return}R?g.y=b.scrollTop-L:g.y=v===Ln.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,nm(nb(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}AI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ple,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function RK(e){return!!(e&&"distance"in e)}function IK(e){return!!(e&&"delay"in e)}class kI{constructor(t,n,r){var i;r===void 0&&(r=blt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=hg(s),this.documentListeners=new Iy(this.document),this.listeners=new Iy(r),this.windowListeners=new Iy(ds(s)),this.initialCoordinates=(i=XD(o))!=null?i:sl,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(na.Resize,this.handleCancel),this.windowListeners.add(na.DragStart,MK),this.windowListeners.add(na.VisibilityChange,this.handleCancel),this.windowListeners.add(na.ContextMenu,MK),this.documentListeners.add(na.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(IK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(RK(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(na.Click,vlt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(na.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=XD(t))!=null?n:sl,c=nb(i,l);if(!r&&a){if(RK(a)){if(a.tolerance!=null&&ZA(c,a.tolerance))return this.handleCancel();if(ZA(c,a.distance))return this.handleStart()}if(IK(a)&&ZA(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ln.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Slt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class _I extends kI{constructor(t){const{event:n}=t,r=hg(n.target);super(t,Slt,r)}}_I.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const wlt={move:{name:"mousemove"},end:{name:"mouseup"}};var JD;(function(e){e[e.RightClick=2]="RightClick"})(JD||(JD={}));class Clt extends kI{constructor(t){super(t,wlt,hg(t.event.target))}}Clt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===JD.RightClick?!1:(r?.({event:n}),!0)}}];const JA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Elt extends kI{constructor(t){super(t,JA)}static setup(){return window.addEventListener(JA.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(JA.move.name,t)};function t(){}}}Elt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Py;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Py||(Py={}));var ES;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ES||(ES={}));function Alt(e){let{acceleration:t,activator:n=Py.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=ES.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=_lt({delta:f,disabled:!o}),[y,b]=Lat(),v=_.useRef({x:0,y:0}),S=_.useRef({x:0,y:0}),C=_.useMemo(()=>{switch(n){case Py.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Py.DraggableRect:return i}},[n,i,l]),w=_.useRef(null),A=_.useCallback(()=>{const O=w.current;if(!O)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(D,T)},[]),E=_.useMemo(()=>a===ES.TreeOrder?[...c].reverse():c,[a,c]);_.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const D=c.indexOf(O),T=u[D];if(!T)continue;const{direction:I,speed:F}=flt(O,T,C,t,h);for(const L of["x","y"])g[L][I[L]]||(F[L]=0,I[L]=0);if(F.x>0||F.y>0){b(),w.current=O,y(A,s),v.current=F,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(h)])}const klt={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function _lt(e){let{delta:t,disabled:n}=e;const r=YD(t);return sv(i=>{if(n||!r||!i)return klt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Dlt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return sv(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Olt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var ib;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ib||(ib={}));var QD;(function(e){e.Optimized="optimized"})(QD||(QD={}));const PK=new Map;function Tlt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=_.useState(null),{frequency:a,measure:l,strategy:c}=i,u=_.useRef(e),f=v(),h=tb(f),g=_.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=_.useRef(null),b=sv(S=>{if(f&&!n)return PK;if(!S||S===PK||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new EI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return _.useEffect(()=>{u.current=e},[e]),_.useEffect(()=>{f||g()},[n,f]),_.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),_.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ib.Always:return!1;case ib.BeforeDragging:return n;default:return!n}}}function jle(e,t){return sv(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Mlt(e,t){return jle(e,t)}function Rlt(e){let{callback:t,disabled:n}=e;const r=wI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function GC(e){let{callback:t,disabled:n}=e;const r=wI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function Ilt(e){return new EI(pg(e),e)}function jK(e,t,n){t===void 0&&(t=Ilt);const[r,i]=_.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Rlt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=GC({callback:o});return yc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Plt(e){const t=jle(e);return _le(e,t)}const $K=[];function jlt(e){const t=_.useRef(e),n=sv(r=>e?r&&r!==$K&&e&&t.current&&e.parentNode===t.current.parentNode?r:qC(e):$K,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function $lt(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(o=>{const s=XA(o.target);s&&n(a=>a?(a.set(s,ZD(s)),new Map(a)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=XA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,ZD(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=XA(l);c?.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>nm(o,s),sl):Ile(e):sl,[e,t])}function LK(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?nb(e,n.current):sl}function Llt(e){_.useEffect(()=>{if(!WC)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Nlt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function $le(e){return _.useMemo(()=>e?llt(e):null,[e])}const NK=[];function Flt(e,t){t===void 0&&(t=pg);const[n]=e,r=$le(n?ds(n):null),[i,o]=_.useState(NK);function s(){o(()=>e.length?e.map(l=>Mle(l)?r:new EI(t(l),l)):NK)}const a=GC({callback:s});return yc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Blt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ov(t)?t:e}function zlt(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(c=>{for(const{target:u}of c)if(ov(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=GC({callback:i}),s=_.useCallback(c=>{const u=Blt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=wS(s);return _.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Hlt=[{sensor:_I,options:{}},{sensor:AI,options:{}}],Ult={current:{}},k4={draggable:{measure:TK},droppable:{measure:TK,strategy:ib.WhileDragging,frequency:QD.Optimized},dragOverlay:{measure:pg}};class jy extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Vlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:CS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:k4,measureDroppableContainers:CS,windowRect:null,measuringScheduled:!1},Wlt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:CS,draggableNodes:new Map,over:null,measureDroppableContainers:CS},KC=_.createContext(Wlt),Lle=_.createContext(Vlt);function qlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jy}}}function Glt(e,t){switch(t.type){case Li.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Li.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Li.DragEnd:case Li.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Li.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new jy(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Li.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new jy(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Li.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new jy(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Klt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(KC),o=YD(r),s=YD(n?.id);return _.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!CI(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Bat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Ylt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Xlt(e){return _.useMemo(()=>({draggable:{...k4.draggable,...e?.draggable},droppable:{...k4.droppable,...e?.droppable},dragOverlay:{...k4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Zlt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=_.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;yc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=_le(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Dle(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const Nle=_.createContext({...sl,scaleX:1,scaleY:1});var xd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xd||(xd={}));const Jlt=_.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Hlt,collisionDetection:f=tlt,measuring:h,modifiers:g,...y}=t;const b=_.useReducer(Glt,void 0,qlt),[v,S]=b,[C,w]=qat(),[A,E]=_.useState(xd.Uninitialized),O=A===xd.Initialized,{draggable:{active:D,nodes:T,translate:I},droppable:{containers:F}}=v,L=D!=null?T.get(D):null,R=_.useRef({initial:null,translated:null}),$=_.useMemo(()=>{var Dt;return D!=null?{id:D,data:(Dt=L?.data)!=null?Dt:Ult,rect:R}:null},[D,L]),j=_.useRef(null),[z,N]=_.useState(null),[W,H]=_.useState(null),U=tb(y,Object.values(y)),K=av("DndDescribedBy",s),B=_.useMemo(()=>F.getEnabled(),[F]),q=Xlt(h),{droppableRects:X,measureDroppableContainers:V,measuringScheduled:Y}=Tlt(B,{dragging:O,dependencies:[I.x,I.y],config:q.droppable}),J=Dlt(T,D),ne=_.useMemo(()=>W?XD(W):null,[W]),ee=yr(),se=Mlt(J,q.draggable.measure);Zlt({activeNode:D!=null?T.get(D):null,config:ee.layoutShiftCompensation,initialRect:se,measure:q.draggable.measure});const ue=jK(J,q.draggable.measure,se),te=jK(J?J.parentElement:null),Z=_.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=F.getNodeFor((n=Z.current.over)==null?void 0:n.id),oe=zlt({measure:q.dragOverlay.measure}),de=(r=oe.nodeRef.current)!=null?r:J,be=O?(i=oe.rect)!=null?i:ue:null,je=!!(oe.nodeRef.current&&oe.rect),De=Plt(je?null:ue),Ke=$le(de?ds(de):null),xe=jlt(O?re??J:null),Le=Flt(xe),Te=Ylt(g,{transform:{x:I.x-De.x,y:I.y-De.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:oe.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),ht=ne?nm(ne,I):null,mt=$lt(xe),ze=LK(mt),Ie=LK(mt,[ue]),He=nm(Te,ze),Je=be?ilt(be,Te):null,nt=$&&Je?f({active:$,collisionRect:Je,droppableRects:X,droppableContainers:B,pointerCoordinates:ht}):null,ot=kle(nt,"id"),[Xe,Lt]=_.useState(null),Nt=je?Te:nm(Te,Ie),Ot=nlt(Nt,(o=Xe?.rect)!=null?o:null,ue),Xn=_.useRef(null),rn=_.useCallback((Dt,jt)=>{let{sensor:Jt,options:jn}=jt;if(j.current==null)return;const on=T.get(j.current);if(!on)return;const St=Dt.nativeEvent,mn=new Jt({active:j.current,activeNode:on,event:St,options:jn,context:Z,onAbort(br){if(!T.get(br))return;const{onDragAbort:le}=U.current,pe={id:br};le?.(pe),C({type:"onDragAbort",event:pe})},onPending(br,ei,le,pe){if(!T.get(br))return;const{onDragPending:Fe}=U.current,Ue={id:br,constraint:ei,initialCoordinates:le,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=j.current;if(ei==null)return;const le=T.get(ei);if(!le)return;const{onDragStart:pe}=U.current,Se={activatorEvent:St,active:{id:ei,data:le.data,rect:R}};Dd.unstable_batchedUpdates(()=>{pe?.(Se),E(xd.Initializing),S({type:Li.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:Se}),N(Xn.current),H(St)})},onMove(br){S({type:Li.DragMove,coordinates:br})},onEnd:Qr(Li.DragEnd),onCancel:Qr(Li.DragCancel)});Xn.current=mn;function Qr(br){return async function(){const{active:le,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(le&&Fe){const{cancelDrop:yt}=U.current;Ue={activatorEvent:St,active:le,collisions:pe,delta:Fe,over:Se},br===Li.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(Ue))&&(br=Li.DragCancel)}j.current=null,Dd.unstable_batchedUpdates(()=>{S({type:br}),E(xd.Uninitialized),Lt(null),N(null),H(null),Xn.current=null;const yt=br===Li.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const rt=U.current[yt];rt?.(Ue),C({type:yt,event:Ue})}})}}},[T]),at=_.useCallback((Dt,jt)=>(Jt,jn)=>{const on=Jt.nativeEvent,St=T.get(jn);if(j.current!==null||!St||on.dndKit||on.defaultPrevented)return;const mn={active:St};Dt(Jt,jt.options,mn)===!0&&(on.dndKit={capturedBy:jt.sensor},j.current=jn,rn(Jt,jt))},[T,rn]),Ht=Olt(u,at);Llt(u),yc(()=>{ue&&A===xd.Initializing&&E(xd.Initialized)},[ue,A]),_.useEffect(()=>{const{onDragMove:Dt}=U.current,{active:jt,activatorEvent:Jt,collisions:jn,over:on}=Z.current;if(!jt||!Jt)return;const St={active:jt,activatorEvent:Jt,collisions:jn,delta:{x:He.x,y:He.y},over:on};Dd.unstable_batchedUpdates(()=>{Dt?.(St),C({type:"onDragMove",event:St})})},[He.x,He.y]),_.useEffect(()=>{const{active:Dt,activatorEvent:jt,collisions:Jt,droppableContainers:jn,scrollAdjustedTranslate:on}=Z.current;if(!Dt||j.current==null||!jt||!on)return;const{onDragOver:St}=U.current,mn=jn.get(ot),Qr=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,br={active:Dt,activatorEvent:jt,collisions:Jt,delta:{x:on.x,y:on.y},over:Qr};Dd.unstable_batchedUpdates(()=>{Lt(Qr),St?.(br),C({type:"onDragOver",event:br})})},[ot]),yc(()=>{Z.current={activatorEvent:W,active:$,activeNode:J,collisionRect:Je,collisions:nt,droppableRects:X,draggableNodes:T,draggingNode:de,draggingNodeRect:be,droppableContainers:F,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[$,J,nt,Je,T,de,be,X,F,Xe,xe,He]),Alt({...ee,delta:I,draggingRect:Je,pointerCoordinates:ht,scrollableAncestors:xe,scrollableAncestorRects:Le});const Dn=_.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ue,activatorEvent:W,collisions:nt,containerNodeRect:te,dragOverlay:oe,draggableNodes:T,droppableContainers:F,droppableRects:X,over:Xe,measureDroppableContainers:V,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:q,measuringScheduled:Y,windowRect:Ke}),[$,J,ue,W,nt,te,oe,T,F,X,Xe,V,xe,Le,q,Y,Ke]),Gn=_.useMemo(()=>({activatorEvent:W,activators:Ht,active:$,activeNodeRect:ue,ariaDescribedById:{draggable:K},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:V}),[W,Ht,$,ue,S,K,T,Xe,V]);return qt.createElement(Cle.Provider,{value:w},qt.createElement(KC.Provider,{value:Gn},qt.createElement(Lle.Provider,{value:Dn},qt.createElement(Nle.Provider,{value:Ot},c)),qt.createElement(Klt,{disabled:a?.restoreFocus===!1})),qt.createElement(Yat,{...a,hiddenTextDescribedById:K}));function yr(){const Dt=z?.autoScrollEnabled===!1,jt=typeof l=="object"?l.enabled===!1:l===!1,Jt=O&&!Dt&&!jt;return typeof l=="object"?{...l,enabled:Jt}:{enabled:Jt}}}),Qlt=_.createContext(null),FK="button",ect="Draggable";function tct(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=av(ect),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=_.useContext(KC),{role:g=FK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=_.useContext(v?Nle:Qlt),[C,w]=wS(),[A,E]=wS(),O=Nlt(s,t),D=tb(n);yc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=_.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===FK?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function nct(){return _.useContext(Lle)}const rct="Droppable",ict={timeout:25};function oct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=av(rct),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=_.useContext(KC),u=_.useRef({disabled:n}),f=_.useRef(!1),h=_.useRef(null),g=_.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...ict,...i},S=tb(b??r),C=_.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=GC({callback:C,disabled:y||!s}),A=_.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,O]=wS(A),D=tb(t);return _.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),_.useEffect(()=>(a({type:Li.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Li.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==u.current.disabled&&(a({type:Li.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function DI(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function sct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function A5(e){return e!==null&&e>=0}function act(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function lct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Fle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=DI(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},k5={scaleX:1,scaleY:1},cct=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...k5}:null}const l=uct(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...k5}:i<n&&i>=s?{x:0,y:a.height+l,...k5}:{x:0,y:0,...k5}};function uct(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Ble="Sortable",zle=qt.createContext({activeIndex:-1,containerId:Ble,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fle,disabled:{draggable:!1,droppable:!1}});function dct(e){let{children:t,id:n,items:r,strategy:i=Fle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=nct(),f=av(Ble,n),h=a.rect!==null,g=_.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=_.useRef(g),C=!act(g,S.current),w=v!==-1&&b===-1||C,A=lct(o);yc(()=>{C&&y&&u(g)},[C,g,y,u]),_.useEffect(()=>{S.current=g},[g]);const E=_.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:sct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(zle.Provider,{value:E},t)}const fct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return DI(n,r,i).indexOf(t)},hct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},pct={duration:200,easing:"ease"},Hle="transform",mct=rb.Transition.toString({property:Hle,duration:0,easing:"linear"}),gct={roleDescription:"sortable"};function yct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=_.useState(null),a=_.useRef(n);return yc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=pg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),_.useEffect(()=>{o&&s(null)},[o]),o}function bct(e){let{animateLayoutChanges:t=hct,attributes:n,disabled:r,data:i,getNewIndex:o=fct,id:s,strategy:a,resizeObserverConfig:l,transition:c=pct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=_.useContext(zle),w=vct(r,g),A=u.indexOf(s),E=_.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),O=_.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:D,node:T,isOver:I,setNodeRef:F}=oct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:R,activeNodeRect:$,attributes:j,setNodeRef:z,listeners:N,isDragging:W,over:H,setActivatorNodeRef:U,transform:K}=tct({id:s,data:E,attributes:{...gct,...n},disabled:w.draggable}),B=$at(F,z),q=!!L,X=q&&!y&&A5(h)&&A5(v),V=!S&&W,Y=V&&X?K:null,ne=X?Y??(a??C)({rects:b,activeNodeRect:$,activeIndex:h,overIndex:v,index:A}):null,ee=A5(h)&&A5(v)?o({id:s,items:u,activeIndex:h,overIndex:v}):A,se=L?.id,ue=_.useRef({activeId:se,items:u,newIndex:ee,containerId:f}),te=u!==ue.current.items,Z=t({active:L,containerId:f,isDragging:W,isSorting:q,id:s,index:A,items:u,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:c,wasDragging:ue.current.activeId!=null}),re=yct({disabled:!Z,index:A,node:T,rect:D});return _.useEffect(()=>{q&&ue.current.newIndex!==ee&&(ue.current.newIndex=ee),f!==ue.current.containerId&&(ue.current.containerId=f),u!==ue.current.items&&(ue.current.items=u)},[q,ee,f,u]),_.useEffect(()=>{if(se===ue.current.activeId)return;if(se!=null&&ue.current.activeId==null){ue.current.activeId=se;return}const de=setTimeout(()=>{ue.current.activeId=se},50);return()=>clearTimeout(de)},[se]),{active:L,activeIndex:h,attributes:j,data:E,rect:D,index:A,newIndex:ee,items:u,isOver:I,isSorting:q,isDragging:W,listeners:N,node:T,overIndex:v,over:H,setNodeRef:B,setActivatorNodeRef:U,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:re??ne,transition:oe()};function oe(){if(re||te&&ue.current.newIndex===A)return mct;if(!(V&&!CI(R)||!c)&&(q||Z))return rb.Transition.toString({...c,property:Hle})}}function vct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function AS(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const xct=[Ln.Down,Ln.Right,Ln.Up,Ln.Left],Sct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(xct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case Ln.Down:r.top<h.top&&l.push(f);break;case Ln.Up:r.top>h.top&&l.push(f);break;case Ln.Left:r.left>h.left&&l.push(f);break;case Ln.Right:r.left<h.left&&l.push(f);break}});const c=Qat({collisionRect:r,droppableRects:i,droppableContainers:l});let u=kle(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),h=o.get(u),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=qC(y).some((O,D)=>a[D]!==O),S=Ule(f,h),C=wct(f,h),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:nb(A,w)}}}};function Ule(e,t){return!AS(e)||!AS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wct(e,t){return!AS(e)||!AS(t)||!Ule(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Cct=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=bct({id:e.id}),[l,c]=_.useState(!1);_.useEffect(()=>{_w(e.id).then(c)},[e.id]);const u={transform:rb.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(tr,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(ce,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(e8e,{})}),m.jsx(Et,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:RT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=MT(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(ce,{sx:{flex:1},children:[m.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Ect=()=>{const e=Tu(),{content:t,isLoading:n}=Vm(),r=wCe(),[i,o]=_.useState([]),[s,a]=_.useState(!1);_.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=Xat(_K(_I),_K(AI,{coordinateGetter:Sct})),c=_.useCallback(h=>{const{active:g,over:y}=h;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return DI(b,v,S)}),a(!0))},[]),u=_.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=_.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(ie,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(lw,{items:[{name:"Bridges",to:Pt.bridges},{name:"Startup Order",to:Pt.startup}]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(yb,{color:"primary",fontSize:"large"}),m.jsxs(ce,{children:[m.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(kt,{color:"inherit",size:"small",startIcon:m.jsx(n6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Jlt,{sensors:l,collisionDetection:Jat,onDragEnd:c,children:m.jsx(dct,{items:f,strategy:cct,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(Cct,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(ce,{display:"flex",justifyContent:"flex-end",children:m.jsx(kt,{variant:"contained",startIcon:m.jsx(n6,{}),onClick:u,children:"Save Startup Order"})})]})},QA="https://riddix.github.io/home-assistant-matter-hub",Pt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:QA,faq:{multiFabric:`${QA}/connect-multiple-fabrics`,bridgeConfig:`${QA}/bridge-configuration`}},Act=[{path:"",element:m.jsx(D2e,{}),children:[{path:"",element:m.jsx(d9e,{})},{path:Pt.bridges,element:m.jsx(l9e,{})},{path:Pt.createBridge,element:m.jsx(QQe,{})},{path:Pt.bridge(":bridgeId"),element:m.jsx(PCe,{})},{path:Pt.editBridge(":bridgeId"),element:m.jsx(eet,{})},{path:Pt.devices,element:m.jsx(O9e,{})},{path:Pt.networkMap,element:m.jsx(Mat,{})},{path:Pt.health,element:m.jsx(cet,{})},{path:Pt.labels,element:m.jsx(het,{})},{path:Pt.lockCredentials,element:m.jsx(vet,{})},{path:Pt.settings,element:m.jsx(jat,{})},{path:Pt.startup,element:m.jsx(Ect,{})},{path:"*",element:m.jsx(xet,{})}]}],kct={items:{isInitialized:!1,isLoading:!1}},_ct=BO(kct,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(HX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(VX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(WX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(UX.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(qX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(GX,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Dct={byBridge:{}},Oct=BO(Dct,e=>{e.addCase(du.pending,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)}).addCase(du.rejected,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)}).addCase(du.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)})}),Tct={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},ek=BO(Tct,e=>{e.addCase(du.pending,t=>{t.isLoading=!0}).addCase(du.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(du.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Mct=c2e({reducer:{bridges:_ct,devices:Oct}}),OI=qme({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>it({props:e,name:"MuiContainer"})});function Rct(e){return Qe("MuiToolbar",e)}tt("MuiToolbar",["root","gutters","regular","dense"]);const Ict=e=>{const{classes:t,disableGutters:n,variant:r}=e;return et({root:["root",!n&&"gutters",r]},Rct,t)},Pct=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),Vle=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=Ict(c);return m.jsx(Pct,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class jct extends _.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?m.jsxs(ce,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[m.jsx(YO,{color:"error",sx:{fontSize:64}}),m.jsx(ie,{variant:"h5",fontWeight:600,children:"Something went wrong"}),m.jsx(ie,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??"An unexpected error occurred."}),m.jsx(kt,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:"Reload Page"})]}):this.props.children}}const $ct=[{name:"GitHub",url:Pt.githubRepository},{name:"Documentation",url:Pt.documentation}],Lct=()=>m.jsxs(OI,{sx:{mt:16,mb:4},children:[m.jsx(gi,{sx:{mt:4,mb:4}}),m.jsx(dt,{container:!0,spacing:2,justifyContent:"center",children:$ct.map((e,t)=>m.jsx(dt,{size:{xs:12,sm:"auto"},children:m.jsx(kt,{fullWidth:!0,size:"small",variant:"outlined",component:aw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function Nct(e){return Qe("MuiAppBar",e)}tt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const Fct=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return et(i,Nct,r)},BK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,Bct=me(Ur,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Fn(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?BK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?BK(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}))),zct=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=Fct(c);return m.jsx(Bct,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Hct(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function Uct(e){return typeof e=="function"?e():e}function _5(e,t,n){const r=Uct(n),i=Hct(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Vct=_.forwardRef(function(t,n){const r=zs(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ta,...O}=t,D=_.useRef(null),T=Tr(gf(l),D,n),I=H=>U=>{H&&(U===void 0?H(D.current):H(D.current,U))},F=I((H,U)=>{_5(u,H,c),PO(H),g&&g(H,U)}),L=I((H,U)=>{const K=Kd({timeout:A,style:w,easing:f},{mode:"enter"});H.style.webkitTransition=r.transitions.create("-webkit-transform",{...K}),H.style.transition=r.transitions.create("transform",{...K}),H.style.webkitTransform="none",H.style.transform="none",b&&b(H,U)}),R=I(y),$=I(C),j=I(H=>{const U=Kd({timeout:A,style:w,easing:f},{mode:"exit"});H.style.webkitTransition=r.transitions.create("-webkit-transform",U),H.style.transition=r.transitions.create("transform",U),_5(u,H,c),v&&v(H)}),z=I(H=>{H.style.webkitTransition="",H.style.transition="",S&&S(H)}),N=H=>{s&&s(D.current,H)},W=_.useCallback(()=>{D.current&&_5(u,D.current,c)},[u,c]);return _.useEffect(()=>{if(h||u==="down"||u==="right")return;const H=TO(()=>{D.current&&_5(u,D.current,c)}),U=tl(D.current);return U.addEventListener("resize",H),()=>{H.clear(),U.removeEventListener("resize",H)}},[u,h,c]),_.useEffect(()=>{h||W()},[h,W]),m.jsx(E,{nodeRef:D,onEnter:F,onEntered:R,onEntering:L,onExit:j,onExited:z,onExiting:$,addEndListener:N,appear:a,in:h,timeout:A,...O,children:(H,{ownerState:U,...K})=>_.cloneElement(l,{ref:T,style:{visibility:H==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...K})})});function Wct(e){return Qe("MuiDrawer",e)}tt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Wle=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},qct=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return et(i,Wct,t)},Gct=me(JO,{name:"MuiDrawer",slot:"Root",overridesResolver:Wle})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Kct=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Wle})({flex:"0 0 auto"}),Yct=me(Ur,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),qle={left:"right",right:"left",top:"down",bottom:"up"};function Xct(e){return["left","right"].includes(e)}function Zct({direction:e},t){return e==="rtl"&&Xct(t)?qle[t]:t}const Jct=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiDrawer"}),i=zs(),o=mf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:D={},...T}=r,I=_.useRef(!1);_.useEffect(()=>{I.current=!0},[]);const F=Zct({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},$=qct(R),j={slots:{transition:w,...O},slotProps:{paper:S,transition:C,...D,backdrop:MO(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=lt("root",{ref:n,elementType:Gct,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...j,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:j.slots.backdrop},slotProps:{backdrop:j.slotProps.backdrop}}}),[W,H]=lt("paper",{elementType:Yct,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:j,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[U,K]=lt("docked",{elementType:Kct,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:j,additionalProps:T}),[B,q]=lt("transition",{elementType:Vct,ownerState:R,externalForwardedProps:j,additionalProps:{in:v,direction:qle[F],timeout:A,appear:I.current}}),X=m.jsx(W,{...H,children:c});if(E==="permanent")return m.jsx(U,{...K,children:X});const V=m.jsx(B,{...q,children:X});return E==="persistent"?m.jsx(U,{...K,children:V}):m.jsx(z,{...N,children:V})}),Qct=ZY({themeId:da}),tk={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},eut={error:vf,warn:iw,info:XO,debug:Aw},tut=({open:e,onClose:t})=>{const[n,r]=_.useState([]),[i,o]=_.useState(!0),[s,a]=_.useState("error,warn,info".split(",")),[l,c]=_.useState(""),[u,f]=_.useState(!0),h=_.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);_.useEffect(()=>{e&&h()},[e,h]),_.useEffect(()=>{if(!u||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[u,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{c(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=eut[S]||XO;return m.jsx(C,{sx:{fontSize:16,color:tk[S]}})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Su,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Aw,{}),"System Logs",m.jsx(ce,{sx:{flexGrow:1}}),m.jsx(cn,{title:"Auto Refresh",children:m.jsx(Et,{label:u?"Auto":"Manual",color:u?"success":"default",size:"small",onClick:()=>f(!u),sx:{cursor:"pointer"}})}),m.jsx(_n,{onClick:t,children:m.jsx(GCe,{})})]}),m.jsxs(xu,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(pa,{size:"small",sx:{minWidth:200},children:[m.jsx(sc,{children:"Log Level"}),m.jsxs(sa,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(ce,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Et,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:tk[C],color:"white"}},C))}),children:[m.jsx(er,{value:"error",children:"Error"}),m.jsx(er,{value:"warn",children:"Warning"}),m.jsx(er,{value:"info",children:"Info"}),m.jsx(er,{value:"debug",children:"Debug"})]})]}),m.jsx(Lr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(kt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(kt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(ce,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{children:"Loading logs..."})}):n.length===0?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(ce,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Et,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:tk[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(ie,{sx:{ml:3},children:S.message}),S.context&&m.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Xd,{children:m.jsx(kt,{onClick:t,children:"Close"})})]})};function zK(){const{isConnected:e}=k2e(),[t,n]=_.useState(null),[r,i]=_.useState(!1);_.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?m.jsxs(ce,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(vf,{fontSize:"small"}):l?m.jsx(Mu,{fontSize:"small"}):m.jsx(dw,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(cn,{title:u,arrow:!0,children:m.jsx(Et,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const nut=e=>_.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},_.createElement("g",{style:{display:"inline"}},_.createElement("path",{style:{fill:"#18bcf2",fillOpacity:1,strokeWidth:.266194},d:"m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z"}),_.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,strokeWidth:.175841},d:"m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z"}))),rut="home-assistant-matter-hub",iut={name:rut};function out(){const[e,t]=_.useState("2.1.0-alpha.425");return _.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),_.useMemo(()=>({name:iut.name,version:e}),[e])}const sut=e=>{const t=out();return m.jsxs(ce,{component:Du,to:Pt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(nut,{style:{height:"40px"}}),m.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},aut=()=>{const e=Qct("(min-width:600px)"),{mode:t,setMode:n}=KS(),[r,i]=_.useState(!1),[o,s]=_.useState(!1),a=hf(),l=()=>{n(t==="dark"?"light":"dark")},c=[{label:"Dashboard",icon:m.jsx(ET,{}),to:Pt.dashboard},{label:"Bridges",icon:m.jsx(t6,{}),to:Pt.bridges},{label:"All Devices",icon:m.jsx(Ns,{}),to:Pt.devices},{label:"Network Map",icon:m.jsx(vT,{}),to:Pt.networkMap},{label:"Startup Order",icon:m.jsx(yb,{}),to:Pt.startup},{label:"Lock Credentials",icon:m.jsx(uu,{}),to:Pt.lockCredentials},{label:"Filter Reference",icon:m.jsx(AT,{}),to:Pt.labels},{label:"Settings",icon:m.jsx(wb,{}),to:Pt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(l8e,{}):m.jsx(XCe,{}),onClick:l},{label:"System Logs",icon:m.jsx(Aw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(eT,{}),to:Pt.health}],u=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(ce,{children:[m.jsx(zct,{sx:{height:"72px"},children:m.jsx(Vle,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(OI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(sut,{large:e}),e?m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.map(f=>f.to?m.jsx(cn,{title:f.label,children:m.jsx(_n,{component:Du,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(cn,{title:f.label,children:m.jsx(_n,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(zK,{})]}):m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(zK,{}),m.jsx(_n,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(c8e,{})})]})]})})}),m.jsx(Jct,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(bc,{sx:{width:250},children:c.map(f=>m.jsxs(sbe,{onClick:()=>u(f),children:[m.jsx(Ul,{children:f.icon}),m.jsx(Va,{primary:f.label})]},f.label))})}),m.jsx(tut,{open:r,onClose:()=>i(!1)})]})},lut=()=>m.jsxs(ce,{children:[m.jsx(aut,{}),m.jsx(Vle,{}),m.jsx(OI,{sx:{p:2},children:m.jsx(jct,{children:m.jsx(bY,{})})}),m.jsx(Lct,{})]}),cut=WS({colorSchemes:{light:{palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2"},background:{default:"#f5f5f5",paper:"#ffffff"}}},dark:{palette:{primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},background:{default:"#121212",paper:"#1e1e1e"}}}},typography:{fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-2px)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)"}}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:"none"}}}}});let _4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");_4?.startsWith("http")&&(_4=new URL(_4).pathname);const uut=Uhe([{path:"/",element:m.jsx(lut,{}),children:Act}],{basename:_4});ade.createRoot(document.getElementById("root")).render(m.jsx(_.StrictMode,{children:m.jsx(Ede,{store:Mct,children:m.jsxs(r1e,{theme:cut,children:[m.jsx(Jge,{}),m.jsx(fX,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),m.jsx(_2e,{children:m.jsx(bye,{children:m.jsx(tpe,{router:uut})})})]})})}));
|
|
499
|
+
`},Kat={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yat(e){let{announcements:t=Kat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Gat}=e;const{announce:o,announcement:s}=Vat(),a=av("DndLiveRegion"),[l,c]=_.useState(!1);if(_.useEffect(()=>{c(!0)},[]),Wat(_.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=qt.createElement(qt.Fragment,null,qt.createElement(Hat,{id:r,value:i.draggable}),qt.createElement(Uat,{id:a,announcement:s}));return n?Dd.createPortal(u,n):u}var Li;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Li||(Li={}));function CS(){}function _K(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function Ele(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ale(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Zat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function DK(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function kle(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function OK(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Jat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=OK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=Ele(OK(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Ale)},Qat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=DK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=DK(l),u=i.reduce((h,g,y)=>h+Ele(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Ale)};function elt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const tlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=elt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Zat)};function nlt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _le(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function rlt(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const ilt=rlt(1);function olt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function slt(e,t,n){const r=olt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const alt={ignoreTransform:!1};function pg(e,t){t===void 0&&(t=alt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=ds(e).getComputedStyle(e);c&&(n=slt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function TK(e){return pg(e,{ignoreTransform:!0})}function llt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function clt(e,t){return t===void 0&&(t=ds(e).getComputedStyle(e)),t.position==="fixed"}function ult(e,t){t===void 0&&(t=ds(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function qC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(SI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ov(i)||Sle(i)||n.includes(i))return n;const o=ds(e).getComputedStyle(i);return i!==e&&ult(i,o)&&n.push(i),clt(i,o)?n:r(i.parentNode)}return e?r(e):n}function Dle(e){const[t]=qC(e,1);return t??null}function XA(e){return!WC||!e?null:fg(e)?e:xI(e)?SI(e)||e===hg(e).scrollingElement?window:ov(e)?e:null:null}function Ole(e){return fg(e)?e.scrollX:e.scrollLeft}function Tle(e){return fg(e)?e.scrollY:e.scrollTop}function ZD(e){return{x:Ole(e),y:Tle(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function Mle(e){return!WC||!e?!1:e===document.scrollingElement}function Rle(e){const t={x:0,y:0},n=Mle(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const dlt={x:.2,y:.2};function flt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=dlt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Rle(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function hlt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ile(e){return e.reduce((t,n)=>nm(t,ZD(n)),sl)}function plt(e){return e.reduce((t,n)=>t+Ole(n),0)}function mlt(e){return e.reduce((t,n)=>t+Tle(n),0)}function glt(e,t){if(t===void 0&&(t=pg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Dle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ylt=[["x",["left","right"],plt],["y",["top","bottom"],mlt]];class EI{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=qC(n),i=Ile(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of ylt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Iy{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function blt(e){const{EventTarget:t}=ds(e);return e instanceof t?e:hg(e)}function ZA(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var na;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(na||(na={}));function MK(e){e.preventDefault()}function vlt(e){e.stopPropagation()}var Ln;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ln||(Ln={}));const Ple={start:[Ln.Space,Ln.Enter],cancel:[Ln.Esc],end:[Ln.Space,Ln.Enter,Ln.Tab]},xlt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ln.Right:return{...n,x:n.x+25};case Ln.Left:return{...n,x:n.x-25};case Ln.Down:return{...n,y:n.y+25};case Ln.Up:return{...n,y:n.y-25}}};class AI{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Iy(hg(n)),this.windowListeners=new Iy(ds(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(na.Resize,this.handleCancel),this.windowListeners.add(na.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(na.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&glt(r),n(sl)}handleKeyDown(t){if(CI(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ple,coordinateGetter:s=xlt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=nb(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=Rle(b),D=hlt(b),T={x:Math.min(v===Ln.Right?D.right-D.width/2:D.right,Math.max(v===Ln.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===Ln.Down?D.bottom-D.height/2:D.bottom,Math.max(v===Ln.Down?D.top:D.top+D.height/2,f.y))},I=v===Ln.Right&&!C||v===Ln.Left&&!w,F=v===Ln.Down&&!A||v===Ln.Up&&!S;if(I&&T.x!==f.x){const L=b.scrollLeft+h.x,R=v===Ln.Right&&L<=E.x||v===Ln.Left&&L>=O.x;if(R&&!h.y){b.scrollTo({left:L,behavior:a});return}R?g.x=b.scrollLeft-L:g.x=v===Ln.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(F&&T.y!==f.y){const L=b.scrollTop+h.y,R=v===Ln.Down&&L<=E.y||v===Ln.Up&&L>=O.y;if(R&&!h.x){b.scrollTo({top:L,behavior:a});return}R?g.y=b.scrollTop-L:g.y=v===Ln.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,nm(nb(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}AI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ple,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function RK(e){return!!(e&&"distance"in e)}function IK(e){return!!(e&&"delay"in e)}class kI{constructor(t,n,r){var i;r===void 0&&(r=blt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=hg(s),this.documentListeners=new Iy(this.document),this.listeners=new Iy(r),this.windowListeners=new Iy(ds(s)),this.initialCoordinates=(i=XD(o))!=null?i:sl,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(na.Resize,this.handleCancel),this.windowListeners.add(na.DragStart,MK),this.windowListeners.add(na.VisibilityChange,this.handleCancel),this.windowListeners.add(na.ContextMenu,MK),this.documentListeners.add(na.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(IK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(RK(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(na.Click,vlt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(na.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=XD(t))!=null?n:sl,c=nb(i,l);if(!r&&a){if(RK(a)){if(a.tolerance!=null&&ZA(c,a.tolerance))return this.handleCancel();if(ZA(c,a.distance))return this.handleStart()}if(IK(a)&&ZA(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ln.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Slt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class _I extends kI{constructor(t){const{event:n}=t,r=hg(n.target);super(t,Slt,r)}}_I.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const wlt={move:{name:"mousemove"},end:{name:"mouseup"}};var JD;(function(e){e[e.RightClick=2]="RightClick"})(JD||(JD={}));class Clt extends kI{constructor(t){super(t,wlt,hg(t.event.target))}}Clt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===JD.RightClick?!1:(r?.({event:n}),!0)}}];const JA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Elt extends kI{constructor(t){super(t,JA)}static setup(){return window.addEventListener(JA.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(JA.move.name,t)};function t(){}}}Elt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Py;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Py||(Py={}));var ES;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ES||(ES={}));function Alt(e){let{acceleration:t,activator:n=Py.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=ES.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=_lt({delta:f,disabled:!o}),[y,b]=Lat(),v=_.useRef({x:0,y:0}),S=_.useRef({x:0,y:0}),C=_.useMemo(()=>{switch(n){case Py.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Py.DraggableRect:return i}},[n,i,l]),w=_.useRef(null),A=_.useCallback(()=>{const O=w.current;if(!O)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(D,T)},[]),E=_.useMemo(()=>a===ES.TreeOrder?[...c].reverse():c,[a,c]);_.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const D=c.indexOf(O),T=u[D];if(!T)continue;const{direction:I,speed:F}=flt(O,T,C,t,h);for(const L of["x","y"])g[L][I[L]]||(F[L]=0,I[L]=0);if(F.x>0||F.y>0){b(),w.current=O,y(A,s),v.current=F,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(h)])}const klt={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function _lt(e){let{delta:t,disabled:n}=e;const r=YD(t);return sv(i=>{if(n||!r||!i)return klt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Dlt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return sv(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Olt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var ib;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ib||(ib={}));var QD;(function(e){e.Optimized="optimized"})(QD||(QD={}));const PK=new Map;function Tlt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=_.useState(null),{frequency:a,measure:l,strategy:c}=i,u=_.useRef(e),f=v(),h=tb(f),g=_.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=_.useRef(null),b=sv(S=>{if(f&&!n)return PK;if(!S||S===PK||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new EI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return _.useEffect(()=>{u.current=e},[e]),_.useEffect(()=>{f||g()},[n,f]),_.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),_.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ib.Always:return!1;case ib.BeforeDragging:return n;default:return!n}}}function jle(e,t){return sv(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Mlt(e,t){return jle(e,t)}function Rlt(e){let{callback:t,disabled:n}=e;const r=wI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function GC(e){let{callback:t,disabled:n}=e;const r=wI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function Ilt(e){return new EI(pg(e),e)}function jK(e,t,n){t===void 0&&(t=Ilt);const[r,i]=_.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Rlt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=GC({callback:o});return yc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Plt(e){const t=jle(e);return _le(e,t)}const $K=[];function jlt(e){const t=_.useRef(e),n=sv(r=>e?r&&r!==$K&&e&&t.current&&e.parentNode===t.current.parentNode?r:qC(e):$K,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function $lt(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(o=>{const s=XA(o.target);s&&n(a=>a?(a.set(s,ZD(s)),new Map(a)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=XA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,ZD(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=XA(l);c?.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>nm(o,s),sl):Ile(e):sl,[e,t])}function LK(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?nb(e,n.current):sl}function Llt(e){_.useEffect(()=>{if(!WC)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Nlt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function $le(e){return _.useMemo(()=>e?llt(e):null,[e])}const NK=[];function Flt(e,t){t===void 0&&(t=pg);const[n]=e,r=$le(n?ds(n):null),[i,o]=_.useState(NK);function s(){o(()=>e.length?e.map(l=>Mle(l)?r:new EI(t(l),l)):NK)}const a=GC({callback:s});return yc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Blt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ov(t)?t:e}function zlt(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(c=>{for(const{target:u}of c)if(ov(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=GC({callback:i}),s=_.useCallback(c=>{const u=Blt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=wS(s);return _.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Hlt=[{sensor:_I,options:{}},{sensor:AI,options:{}}],Ult={current:{}},k4={draggable:{measure:TK},droppable:{measure:TK,strategy:ib.WhileDragging,frequency:QD.Optimized},dragOverlay:{measure:pg}};class jy extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Vlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:CS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:k4,measureDroppableContainers:CS,windowRect:null,measuringScheduled:!1},Wlt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:CS,draggableNodes:new Map,over:null,measureDroppableContainers:CS},KC=_.createContext(Wlt),Lle=_.createContext(Vlt);function qlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jy}}}function Glt(e,t){switch(t.type){case Li.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Li.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Li.DragEnd:case Li.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Li.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new jy(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Li.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new jy(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Li.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new jy(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Klt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(KC),o=YD(r),s=YD(n?.id);return _.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!CI(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Bat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Ylt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Xlt(e){return _.useMemo(()=>({draggable:{...k4.draggable,...e?.draggable},droppable:{...k4.droppable,...e?.droppable},dragOverlay:{...k4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Zlt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=_.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;yc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=_le(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Dle(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const Nle=_.createContext({...sl,scaleX:1,scaleY:1});var xd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xd||(xd={}));const Jlt=_.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Hlt,collisionDetection:f=tlt,measuring:h,modifiers:g,...y}=t;const b=_.useReducer(Glt,void 0,qlt),[v,S]=b,[C,w]=qat(),[A,E]=_.useState(xd.Uninitialized),O=A===xd.Initialized,{draggable:{active:D,nodes:T,translate:I},droppable:{containers:F}}=v,L=D!=null?T.get(D):null,R=_.useRef({initial:null,translated:null}),$=_.useMemo(()=>{var Dt;return D!=null?{id:D,data:(Dt=L?.data)!=null?Dt:Ult,rect:R}:null},[D,L]),j=_.useRef(null),[z,N]=_.useState(null),[W,H]=_.useState(null),U=tb(y,Object.values(y)),K=av("DndDescribedBy",s),B=_.useMemo(()=>F.getEnabled(),[F]),q=Xlt(h),{droppableRects:X,measureDroppableContainers:V,measuringScheduled:Y}=Tlt(B,{dragging:O,dependencies:[I.x,I.y],config:q.droppable}),J=Dlt(T,D),ne=_.useMemo(()=>W?XD(W):null,[W]),ee=yr(),se=Mlt(J,q.draggable.measure);Zlt({activeNode:D!=null?T.get(D):null,config:ee.layoutShiftCompensation,initialRect:se,measure:q.draggable.measure});const ue=jK(J,q.draggable.measure,se),te=jK(J?J.parentElement:null),Z=_.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=F.getNodeFor((n=Z.current.over)==null?void 0:n.id),oe=zlt({measure:q.dragOverlay.measure}),de=(r=oe.nodeRef.current)!=null?r:J,be=O?(i=oe.rect)!=null?i:ue:null,je=!!(oe.nodeRef.current&&oe.rect),De=Plt(je?null:ue),Ke=$le(de?ds(de):null),xe=jlt(O?re??J:null),Le=Flt(xe),Te=Ylt(g,{transform:{x:I.x-De.x,y:I.y-De.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:oe.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),ht=ne?nm(ne,I):null,mt=$lt(xe),ze=LK(mt),Ie=LK(mt,[ue]),He=nm(Te,ze),Je=be?ilt(be,Te):null,nt=$&&Je?f({active:$,collisionRect:Je,droppableRects:X,droppableContainers:B,pointerCoordinates:ht}):null,ot=kle(nt,"id"),[Xe,Lt]=_.useState(null),Nt=je?Te:nm(Te,Ie),Ot=nlt(Nt,(o=Xe?.rect)!=null?o:null,ue),Xn=_.useRef(null),rn=_.useCallback((Dt,jt)=>{let{sensor:Jt,options:jn}=jt;if(j.current==null)return;const on=T.get(j.current);if(!on)return;const St=Dt.nativeEvent,mn=new Jt({active:j.current,activeNode:on,event:St,options:jn,context:Z,onAbort(br){if(!T.get(br))return;const{onDragAbort:le}=U.current,pe={id:br};le?.(pe),C({type:"onDragAbort",event:pe})},onPending(br,ei,le,pe){if(!T.get(br))return;const{onDragPending:Fe}=U.current,Ue={id:br,constraint:ei,initialCoordinates:le,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=j.current;if(ei==null)return;const le=T.get(ei);if(!le)return;const{onDragStart:pe}=U.current,Se={activatorEvent:St,active:{id:ei,data:le.data,rect:R}};Dd.unstable_batchedUpdates(()=>{pe?.(Se),E(xd.Initializing),S({type:Li.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:Se}),N(Xn.current),H(St)})},onMove(br){S({type:Li.DragMove,coordinates:br})},onEnd:Qr(Li.DragEnd),onCancel:Qr(Li.DragCancel)});Xn.current=mn;function Qr(br){return async function(){const{active:le,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(le&&Fe){const{cancelDrop:yt}=U.current;Ue={activatorEvent:St,active:le,collisions:pe,delta:Fe,over:Se},br===Li.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(Ue))&&(br=Li.DragCancel)}j.current=null,Dd.unstable_batchedUpdates(()=>{S({type:br}),E(xd.Uninitialized),Lt(null),N(null),H(null),Xn.current=null;const yt=br===Li.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const rt=U.current[yt];rt?.(Ue),C({type:yt,event:Ue})}})}}},[T]),at=_.useCallback((Dt,jt)=>(Jt,jn)=>{const on=Jt.nativeEvent,St=T.get(jn);if(j.current!==null||!St||on.dndKit||on.defaultPrevented)return;const mn={active:St};Dt(Jt,jt.options,mn)===!0&&(on.dndKit={capturedBy:jt.sensor},j.current=jn,rn(Jt,jt))},[T,rn]),Ht=Olt(u,at);Llt(u),yc(()=>{ue&&A===xd.Initializing&&E(xd.Initialized)},[ue,A]),_.useEffect(()=>{const{onDragMove:Dt}=U.current,{active:jt,activatorEvent:Jt,collisions:jn,over:on}=Z.current;if(!jt||!Jt)return;const St={active:jt,activatorEvent:Jt,collisions:jn,delta:{x:He.x,y:He.y},over:on};Dd.unstable_batchedUpdates(()=>{Dt?.(St),C({type:"onDragMove",event:St})})},[He.x,He.y]),_.useEffect(()=>{const{active:Dt,activatorEvent:jt,collisions:Jt,droppableContainers:jn,scrollAdjustedTranslate:on}=Z.current;if(!Dt||j.current==null||!jt||!on)return;const{onDragOver:St}=U.current,mn=jn.get(ot),Qr=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,br={active:Dt,activatorEvent:jt,collisions:Jt,delta:{x:on.x,y:on.y},over:Qr};Dd.unstable_batchedUpdates(()=>{Lt(Qr),St?.(br),C({type:"onDragOver",event:br})})},[ot]),yc(()=>{Z.current={activatorEvent:W,active:$,activeNode:J,collisionRect:Je,collisions:nt,droppableRects:X,draggableNodes:T,draggingNode:de,draggingNodeRect:be,droppableContainers:F,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[$,J,nt,Je,T,de,be,X,F,Xe,xe,He]),Alt({...ee,delta:I,draggingRect:Je,pointerCoordinates:ht,scrollableAncestors:xe,scrollableAncestorRects:Le});const Dn=_.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ue,activatorEvent:W,collisions:nt,containerNodeRect:te,dragOverlay:oe,draggableNodes:T,droppableContainers:F,droppableRects:X,over:Xe,measureDroppableContainers:V,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:q,measuringScheduled:Y,windowRect:Ke}),[$,J,ue,W,nt,te,oe,T,F,X,Xe,V,xe,Le,q,Y,Ke]),Gn=_.useMemo(()=>({activatorEvent:W,activators:Ht,active:$,activeNodeRect:ue,ariaDescribedById:{draggable:K},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:V}),[W,Ht,$,ue,S,K,T,Xe,V]);return qt.createElement(Cle.Provider,{value:w},qt.createElement(KC.Provider,{value:Gn},qt.createElement(Lle.Provider,{value:Dn},qt.createElement(Nle.Provider,{value:Ot},c)),qt.createElement(Klt,{disabled:a?.restoreFocus===!1})),qt.createElement(Yat,{...a,hiddenTextDescribedById:K}));function yr(){const Dt=z?.autoScrollEnabled===!1,jt=typeof l=="object"?l.enabled===!1:l===!1,Jt=O&&!Dt&&!jt;return typeof l=="object"?{...l,enabled:Jt}:{enabled:Jt}}}),Qlt=_.createContext(null),FK="button",ect="Draggable";function tct(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=av(ect),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=_.useContext(KC),{role:g=FK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=_.useContext(v?Nle:Qlt),[C,w]=wS(),[A,E]=wS(),O=Nlt(s,t),D=tb(n);yc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=_.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===FK?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function nct(){return _.useContext(Lle)}const rct="Droppable",ict={timeout:25};function oct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=av(rct),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=_.useContext(KC),u=_.useRef({disabled:n}),f=_.useRef(!1),h=_.useRef(null),g=_.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...ict,...i},S=tb(b??r),C=_.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=GC({callback:C,disabled:y||!s}),A=_.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,O]=wS(A),D=tb(t);return _.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),_.useEffect(()=>(a({type:Li.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Li.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==u.current.disabled&&(a({type:Li.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function DI(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function sct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function A5(e){return e!==null&&e>=0}function act(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function lct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Fle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=DI(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},k5={scaleX:1,scaleY:1},cct=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...k5}:null}const l=uct(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...k5}:i<n&&i>=s?{x:0,y:a.height+l,...k5}:{x:0,y:0,...k5}};function uct(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Ble="Sortable",zle=qt.createContext({activeIndex:-1,containerId:Ble,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fle,disabled:{draggable:!1,droppable:!1}});function dct(e){let{children:t,id:n,items:r,strategy:i=Fle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=nct(),f=av(Ble,n),h=a.rect!==null,g=_.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=_.useRef(g),C=!act(g,S.current),w=v!==-1&&b===-1||C,A=lct(o);yc(()=>{C&&y&&u(g)},[C,g,y,u]),_.useEffect(()=>{S.current=g},[g]);const E=_.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:sct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(zle.Provider,{value:E},t)}const fct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return DI(n,r,i).indexOf(t)},hct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},pct={duration:200,easing:"ease"},Hle="transform",mct=rb.Transition.toString({property:Hle,duration:0,easing:"linear"}),gct={roleDescription:"sortable"};function yct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=_.useState(null),a=_.useRef(n);return yc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=pg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),_.useEffect(()=>{o&&s(null)},[o]),o}function bct(e){let{animateLayoutChanges:t=hct,attributes:n,disabled:r,data:i,getNewIndex:o=fct,id:s,strategy:a,resizeObserverConfig:l,transition:c=pct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=_.useContext(zle),w=vct(r,g),A=u.indexOf(s),E=_.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),O=_.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:D,node:T,isOver:I,setNodeRef:F}=oct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:R,activeNodeRect:$,attributes:j,setNodeRef:z,listeners:N,isDragging:W,over:H,setActivatorNodeRef:U,transform:K}=tct({id:s,data:E,attributes:{...gct,...n},disabled:w.draggable}),B=$at(F,z),q=!!L,X=q&&!y&&A5(h)&&A5(v),V=!S&&W,Y=V&&X?K:null,ne=X?Y??(a??C)({rects:b,activeNodeRect:$,activeIndex:h,overIndex:v,index:A}):null,ee=A5(h)&&A5(v)?o({id:s,items:u,activeIndex:h,overIndex:v}):A,se=L?.id,ue=_.useRef({activeId:se,items:u,newIndex:ee,containerId:f}),te=u!==ue.current.items,Z=t({active:L,containerId:f,isDragging:W,isSorting:q,id:s,index:A,items:u,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:c,wasDragging:ue.current.activeId!=null}),re=yct({disabled:!Z,index:A,node:T,rect:D});return _.useEffect(()=>{q&&ue.current.newIndex!==ee&&(ue.current.newIndex=ee),f!==ue.current.containerId&&(ue.current.containerId=f),u!==ue.current.items&&(ue.current.items=u)},[q,ee,f,u]),_.useEffect(()=>{if(se===ue.current.activeId)return;if(se!=null&&ue.current.activeId==null){ue.current.activeId=se;return}const de=setTimeout(()=>{ue.current.activeId=se},50);return()=>clearTimeout(de)},[se]),{active:L,activeIndex:h,attributes:j,data:E,rect:D,index:A,newIndex:ee,items:u,isOver:I,isSorting:q,isDragging:W,listeners:N,node:T,overIndex:v,over:H,setNodeRef:B,setActivatorNodeRef:U,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:re??ne,transition:oe()};function oe(){if(re||te&&ue.current.newIndex===A)return mct;if(!(V&&!CI(R)||!c)&&(q||Z))return rb.Transition.toString({...c,property:Hle})}}function vct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function AS(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const xct=[Ln.Down,Ln.Right,Ln.Up,Ln.Left],Sct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(xct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case Ln.Down:r.top<h.top&&l.push(f);break;case Ln.Up:r.top>h.top&&l.push(f);break;case Ln.Left:r.left>h.left&&l.push(f);break;case Ln.Right:r.left<h.left&&l.push(f);break}});const c=Qat({collisionRect:r,droppableRects:i,droppableContainers:l});let u=kle(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),h=o.get(u),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=qC(y).some((O,D)=>a[D]!==O),S=Ule(f,h),C=wct(f,h),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:nb(A,w)}}}};function Ule(e,t){return!AS(e)||!AS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wct(e,t){return!AS(e)||!AS(t)||!Ule(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Cct=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=bct({id:e.id}),[l,c]=_.useState(!1);_.useEffect(()=>{_w(e.id).then(c)},[e.id]);const u={transform:rb.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(tr,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(ce,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(e8e,{})}),m.jsx(Et,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(ce,{component:"img",src:t2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:RT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=MT(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(ce,{sx:{flex:1},children:[m.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Ect=()=>{const e=Tu(),{content:t,isLoading:n}=Vm(),r=wCe(),[i,o]=_.useState([]),[s,a]=_.useState(!1);_.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=Xat(_K(_I),_K(AI,{coordinateGetter:Sct})),c=_.useCallback(h=>{const{active:g,over:y}=h;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return DI(b,v,S)}),a(!0))},[]),u=_.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=_.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(ie,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(lw,{items:[{name:"Bridges",to:Pt.bridges},{name:"Startup Order",to:Pt.startup}]}),m.jsxs(ce,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(yb,{color:"primary",fontSize:"large"}),m.jsxs(ce,{children:[m.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(kt,{color:"inherit",size:"small",startIcon:m.jsx(n6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Jlt,{sensors:l,collisionDetection:Jat,onDragEnd:c,children:m.jsx(dct,{items:f,strategy:cct,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(Cct,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(ce,{display:"flex",justifyContent:"flex-end",children:m.jsx(kt,{variant:"contained",startIcon:m.jsx(n6,{}),onClick:u,children:"Save Startup Order"})})]})},QA="https://riddix.github.io/home-assistant-matter-hub",Pt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:QA,faq:{multiFabric:`${QA}/connect-multiple-fabrics`,bridgeConfig:`${QA}/bridge-configuration`}},Act=[{path:"",element:m.jsx(D2e,{}),children:[{path:"",element:m.jsx(d9e,{})},{path:Pt.bridges,element:m.jsx(l9e,{})},{path:Pt.createBridge,element:m.jsx(QQe,{})},{path:Pt.bridge(":bridgeId"),element:m.jsx(PCe,{})},{path:Pt.editBridge(":bridgeId"),element:m.jsx(eet,{})},{path:Pt.devices,element:m.jsx(O9e,{})},{path:Pt.networkMap,element:m.jsx(Mat,{})},{path:Pt.health,element:m.jsx(cet,{})},{path:Pt.labels,element:m.jsx(het,{})},{path:Pt.lockCredentials,element:m.jsx(vet,{})},{path:Pt.settings,element:m.jsx(jat,{})},{path:Pt.startup,element:m.jsx(Ect,{})},{path:"*",element:m.jsx(xet,{})}]}],kct={items:{isInitialized:!1,isLoading:!1}},_ct=BO(kct,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(HX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(VX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(WX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(UX.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(qX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(GX,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Dct={byBridge:{}},Oct=BO(Dct,e=>{e.addCase(du.pending,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)}).addCase(du.rejected,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)}).addCase(du.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=ek(t.byBridge[n.meta.arg],n)})}),Tct={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},ek=BO(Tct,e=>{e.addCase(du.pending,t=>{t.isLoading=!0}).addCase(du.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(du.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Mct=c2e({reducer:{bridges:_ct,devices:Oct}}),OI=qme({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>it({props:e,name:"MuiContainer"})});function Rct(e){return Qe("MuiToolbar",e)}tt("MuiToolbar",["root","gutters","regular","dense"]);const Ict=e=>{const{classes:t,disableGutters:n,variant:r}=e;return et({root:["root",!n&&"gutters",r]},Rct,t)},Pct=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),Vle=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=Ict(c);return m.jsx(Pct,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class jct extends _.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?m.jsxs(ce,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[m.jsx(YO,{color:"error",sx:{fontSize:64}}),m.jsx(ie,{variant:"h5",fontWeight:600,children:"Something went wrong"}),m.jsx(ie,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??"An unexpected error occurred."}),m.jsx(kt,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:"Reload Page"})]}):this.props.children}}const $ct=[{name:"GitHub",url:Pt.githubRepository},{name:"Documentation",url:Pt.documentation}],Lct=()=>m.jsxs(OI,{sx:{mt:16,mb:4},children:[m.jsx(gi,{sx:{mt:4,mb:4}}),m.jsx(dt,{container:!0,spacing:2,justifyContent:"center",children:$ct.map((e,t)=>m.jsx(dt,{size:{xs:12,sm:"auto"},children:m.jsx(kt,{fullWidth:!0,size:"small",variant:"outlined",component:aw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function Nct(e){return Qe("MuiAppBar",e)}tt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const Fct=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return et(i,Nct,r)},BK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,Bct=me(Ur,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Fn(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?BK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?BK(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}))),zct=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=Fct(c);return m.jsx(Bct,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Hct(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function Uct(e){return typeof e=="function"?e():e}function _5(e,t,n){const r=Uct(n),i=Hct(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Vct=_.forwardRef(function(t,n){const r=zs(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ta,...O}=t,D=_.useRef(null),T=Tr(gf(l),D,n),I=H=>U=>{H&&(U===void 0?H(D.current):H(D.current,U))},F=I((H,U)=>{_5(u,H,c),PO(H),g&&g(H,U)}),L=I((H,U)=>{const K=Kd({timeout:A,style:w,easing:f},{mode:"enter"});H.style.webkitTransition=r.transitions.create("-webkit-transform",{...K}),H.style.transition=r.transitions.create("transform",{...K}),H.style.webkitTransform="none",H.style.transform="none",b&&b(H,U)}),R=I(y),$=I(C),j=I(H=>{const U=Kd({timeout:A,style:w,easing:f},{mode:"exit"});H.style.webkitTransition=r.transitions.create("-webkit-transform",U),H.style.transition=r.transitions.create("transform",U),_5(u,H,c),v&&v(H)}),z=I(H=>{H.style.webkitTransition="",H.style.transition="",S&&S(H)}),N=H=>{s&&s(D.current,H)},W=_.useCallback(()=>{D.current&&_5(u,D.current,c)},[u,c]);return _.useEffect(()=>{if(h||u==="down"||u==="right")return;const H=TO(()=>{D.current&&_5(u,D.current,c)}),U=tl(D.current);return U.addEventListener("resize",H),()=>{H.clear(),U.removeEventListener("resize",H)}},[u,h,c]),_.useEffect(()=>{h||W()},[h,W]),m.jsx(E,{nodeRef:D,onEnter:F,onEntered:R,onEntering:L,onExit:j,onExited:z,onExiting:$,addEndListener:N,appear:a,in:h,timeout:A,...O,children:(H,{ownerState:U,...K})=>_.cloneElement(l,{ref:T,style:{visibility:H==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...K})})});function Wct(e){return Qe("MuiDrawer",e)}tt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Wle=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},qct=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return et(i,Wct,t)},Gct=me(JO,{name:"MuiDrawer",slot:"Root",overridesResolver:Wle})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Kct=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Wle})({flex:"0 0 auto"}),Yct=me(Ur,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),qle={left:"right",right:"left",top:"down",bottom:"up"};function Xct(e){return["left","right"].includes(e)}function Zct({direction:e},t){return e==="rtl"&&Xct(t)?qle[t]:t}const Jct=_.forwardRef(function(t,n){const r=it({props:t,name:"MuiDrawer"}),i=zs(),o=mf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:D={},...T}=r,I=_.useRef(!1);_.useEffect(()=>{I.current=!0},[]);const F=Zct({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},$=qct(R),j={slots:{transition:w,...O},slotProps:{paper:S,transition:C,...D,backdrop:MO(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=lt("root",{ref:n,elementType:Gct,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...j,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:j.slots.backdrop},slotProps:{backdrop:j.slotProps.backdrop}}}),[W,H]=lt("paper",{elementType:Yct,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:j,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[U,K]=lt("docked",{elementType:Kct,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:j,additionalProps:T}),[B,q]=lt("transition",{elementType:Vct,ownerState:R,externalForwardedProps:j,additionalProps:{in:v,direction:qle[F],timeout:A,appear:I.current}}),X=m.jsx(W,{...H,children:c});if(E==="permanent")return m.jsx(U,{...K,children:X});const V=m.jsx(B,{...q,children:X});return E==="persistent"?m.jsx(U,{...K,children:V}):m.jsx(z,{...N,children:V})}),Qct=ZY({themeId:da}),tk={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},eut={error:vf,warn:iw,info:XO,debug:Aw},tut=({open:e,onClose:t})=>{const[n,r]=_.useState([]),[i,o]=_.useState(!0),[s,a]=_.useState("error,warn,info".split(",")),[l,c]=_.useState(""),[u,f]=_.useState(!0),h=_.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);_.useEffect(()=>{e&&h()},[e,h]),_.useEffect(()=>{if(!u||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[u,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{c(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=eut[S]||XO;return m.jsx(C,{sx:{fontSize:16,color:tk[S]}})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Su,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Aw,{}),"System Logs",m.jsx(ce,{sx:{flexGrow:1}}),m.jsx(cn,{title:"Auto Refresh",children:m.jsx(Et,{label:u?"Auto":"Manual",color:u?"success":"default",size:"small",onClick:()=>f(!u),sx:{cursor:"pointer"}})}),m.jsx(_n,{onClick:t,children:m.jsx(GCe,{})})]}),m.jsxs(xu,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(pa,{size:"small",sx:{minWidth:200},children:[m.jsx(sc,{children:"Log Level"}),m.jsxs(sa,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(ce,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Et,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:tk[C],color:"white"}},C))}),children:[m.jsx(er,{value:"error",children:"Error"}),m.jsx(er,{value:"warn",children:"Warning"}),m.jsx(er,{value:"info",children:"Info"}),m.jsx(er,{value:"debug",children:"Debug"})]})]}),m.jsx(Lr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(kt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(kt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(ce,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{children:"Loading logs..."})}):n.length===0?m.jsx(ce,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(ce,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Et,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:tk[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(ie,{sx:{ml:3},children:S.message}),S.context&&m.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Xd,{children:m.jsx(kt,{onClick:t,children:"Close"})})]})};function zK(){const{isConnected:e}=k2e(),[t,n]=_.useState(null),[r,i]=_.useState(!1);_.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?m.jsxs(ce,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(vf,{fontSize:"small"}):l?m.jsx(Mu,{fontSize:"small"}):m.jsx(dw,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(cn,{title:u,arrow:!0,children:m.jsx(Et,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const nut=e=>_.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},_.createElement("g",{style:{display:"inline"}},_.createElement("path",{style:{fill:"#18bcf2",fillOpacity:1,strokeWidth:.266194},d:"m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z"}),_.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,strokeWidth:.175841},d:"m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z"}))),rut="home-assistant-matter-hub",iut={name:rut};function out(){const[e,t]=_.useState("2.1.0-alpha.426");return _.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),_.useMemo(()=>({name:iut.name,version:e}),[e])}const sut=e=>{const t=out();return m.jsxs(ce,{component:Du,to:Pt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(nut,{style:{height:"40px"}}),m.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},aut=()=>{const e=Qct("(min-width:600px)"),{mode:t,setMode:n}=KS(),[r,i]=_.useState(!1),[o,s]=_.useState(!1),a=hf(),l=()=>{n(t==="dark"?"light":"dark")},c=[{label:"Dashboard",icon:m.jsx(ET,{}),to:Pt.dashboard},{label:"Bridges",icon:m.jsx(t6,{}),to:Pt.bridges},{label:"All Devices",icon:m.jsx(Ns,{}),to:Pt.devices},{label:"Network Map",icon:m.jsx(vT,{}),to:Pt.networkMap},{label:"Startup Order",icon:m.jsx(yb,{}),to:Pt.startup},{label:"Lock Credentials",icon:m.jsx(uu,{}),to:Pt.lockCredentials},{label:"Filter Reference",icon:m.jsx(AT,{}),to:Pt.labels},{label:"Settings",icon:m.jsx(wb,{}),to:Pt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(l8e,{}):m.jsx(XCe,{}),onClick:l},{label:"System Logs",icon:m.jsx(Aw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(eT,{}),to:Pt.health}],u=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(ce,{children:[m.jsx(zct,{sx:{height:"72px"},children:m.jsx(Vle,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(OI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(sut,{large:e}),e?m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.map(f=>f.to?m.jsx(cn,{title:f.label,children:m.jsx(_n,{component:Du,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(cn,{title:f.label,children:m.jsx(_n,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(zK,{})]}):m.jsxs(ce,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(zK,{}),m.jsx(_n,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(c8e,{})})]})]})})}),m.jsx(Jct,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(bc,{sx:{width:250},children:c.map(f=>m.jsxs(sbe,{onClick:()=>u(f),children:[m.jsx(Ul,{children:f.icon}),m.jsx(Va,{primary:f.label})]},f.label))})}),m.jsx(tut,{open:r,onClose:()=>i(!1)})]})},lut=()=>m.jsxs(ce,{children:[m.jsx(aut,{}),m.jsx(Vle,{}),m.jsx(OI,{sx:{p:2},children:m.jsx(jct,{children:m.jsx(bY,{})})}),m.jsx(Lct,{})]}),cut=WS({colorSchemes:{light:{palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2"},background:{default:"#f5f5f5",paper:"#ffffff"}}},dark:{palette:{primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},background:{default:"#121212",paper:"#1e1e1e"}}}},typography:{fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-2px)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)"}}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:"none"}}}}});let _4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");_4?.startsWith("http")&&(_4=new URL(_4).pathname);const uut=Uhe([{path:"/",element:m.jsx(lut,{}),children:Act}],{basename:_4});ade.createRoot(document.getElementById("root")).render(m.jsx(_.StrictMode,{children:m.jsx(Ede,{store:Mct,children:m.jsxs(r1e,{theme:cut,children:[m.jsx(Jge,{}),m.jsx(fX,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),m.jsx(_2e,{children:m.jsx(bye,{children:m.jsx(tpe,{router:uut})})})]})})}));
|