@tap-payments/os-micro-frontend-shared 0.3.274 → 0.3.276

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.
@@ -0,0 +1 @@
1
+ import {h,b as b$1,f as f$1}from'./chunk-37SWWF3G.js';import {b,h as h$1,c,e,d,j as j$1,i}from'./chunk-7L6NBFKR.js';import {g as g$1,f,h as h$2}from'./chunk-ISC5KT5E.js';import {H as H$1,j}from'./chunk-CAVYK7HF.js';import {a}from'./chunk-HZCNE5Q2.js';import {g,mc,nc}from'./chunk-Z2DUFVI5.js';import {Vd,ta,dl,el,wi,Ik,A,xe as xe$1,we,sa,qa,ra}from'./chunk-3M2GZVQW.js';import {forwardRef,memo,createContext,useState,useRef,useMemo,useContext,useEffect,useCallback,useId}from'react';import ie from'@mui/material/Box';import it from'@mui/material/Typography';import P from'@uiw/react-json-view';import {motion,AnimatePresence}from'framer-motion';import {styled}from'@mui/material/styles';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useTranslation}from'react-i18next';var O="os-shared-JSONViewWindow",m={root:`${O}-root`,body:`${O}-body`,requestPane:`${O}-requestPane`,responsePane:`${O}-responsePane`,section:`${O}-section`,title:`${O}-title`,actions:`${O}-actions`,scroll:`${O}-scroll`,footer:`${O}-footer`,count:`${O}-count`},N=400,B=545,Z=.5,co=20,mo=30,Ne="Items",We="JSON Response",be="JSON Request & Response",fo="rgb(231, 231, 231)";var uo=styled("span")({display:"inline-flex",alignItems:"center",gap:"6px"}),xo=styled("span")({margin:"0px",fontStyle:"normal",fontStretch:"normal",color:"rgb(32, 35, 43)",letterSpacing:"0px",fontSize:"9px",fontWeight:400,lineHeight:"10.8px"}),go=styled("span")({margin:"0px",fontStyle:"normal",fontStretch:"normal",color:"rgb(32, 35, 43)",letterSpacing:"0px",fontSize:"10.5px",fontWeight:700,lineHeight:"12.6px",textAlign:"right"});var ho=forwardRef(function({totalCount:o,id:n,className:t,sx:r},i){return jsx(h,{ref:i,id:n,"data-testid":n??"Footer",className:nc(g$1,m.footer,t),sx:mc({justifyContent:"flex-start",cursor:"move"},r),children:o!=null?jsx(H$1,{variant:"text",className:m.count,sx:{cursor:"text",borderWidth:.75},children:jsxs(uo,{children:[jsx(xo,{children:Ne}),jsx(go,{children:g(o??0)})]})}):null})});ho.displayName="Footer";var H=memo(ho);var yo=styled("button")(({theme:e})=>({outline:"none",cursor:"pointer",border:"1px solid transparent","&:hover":{boxShadow:e.shadows[8]},borderRadius:"0.25rem",position:"relative",backgroundColor:e.palette.background.transparent,display:"inline-flex",alignItems:"center",justifyContent:"center"})),Ie=styled(motion.img)({height:"14px",width:"14px"});function oe({"data-copied":e,style:o,onClick:n},{keyName:t}){return t?jsxs(yo,{style:o,onClick:r=>{n?.(r);},children:[jsx(AnimatePresence,{children:e&&jsx(Ie,{initial:{opacity:0},animate:{opacity:1,position:"absolute"},exit:{opacity:0},transition:{duration:.4},src:ta,alt:"icon"},"copied-icon")}),jsx(AnimatePresence,{children:!e&&jsx(Ie,{initial:{opacity:0},animate:{opacity:1,position:"absolute"},exit:{opacity:0},transition:{duration:.4},src:ra,alt:"icon"},"copy-icon")})]}):jsx("span",{})}var No=styled("button")(({theme:e})=>({padding:"0rem",borderRadius:"0.25rem",backgroundColor:e.palette.background.paper,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.25rem",color:e.palette.text.primary,fontSize:"0.625rem",fontWeight:e.typography.fontWeightBold,outline:"none",cursor:"pointer",border:`1px solid ${e.palette.grey[100]}`,"&:hover":{boxShadow:"0px 0px 8px 0px rgba(31, 136, 208, 0.30)",border:`1px solid ${e.palette.info.dark};`},position:"relative",overflow:"hidden",transition:"all 0.2s ease-in-out",width:"24px",height:"24px",flexShrink:0}));function Wo({onClick:e,icon:o,label:n,disableAnimation:t,...r}){let[i,s]=useState(false),{t:c}=useTranslation();return jsxs(No,{...r,onClick:p=>{e?.(p),!t&&(s(true),setTimeout(()=>{s(false);},2e3));},children:[jsxs(ie,{sx:{width:"16px",display:"flex",overflow:"hidden",justifyContent:"center",alignItems:"center"},children:[jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.img,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.4}},exit:{opacity:0,transition:{duration:.1}},transition:{duration:.4},src:ta,alt:"icon"},"id-icon")}),jsx(AnimatePresence,{mode:"wait",children:!i&&jsx(motion.img,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.4}},exit:{opacity:0,transition:{duration:.1}},transition:{duration:.4},src:o,alt:"icon"},"id-icon")})]}),n&&jsxs(Fragment,{children:[jsx(AnimatePresence,{children:i&&jsx(motion.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{duration:.4},children:c("copied")})}),jsx(AnimatePresence,{children:!i&&jsx(motion.span,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.4}},exit:{opacity:0,position:"absolute",width:"53px"},transition:{duration:.4},children:n})})]})]})}Wo.displayName="IconButton";var T=memo(Wo);var bo=styled("div")(()=>({display:"flex",alignItems:"center",position:"relative",flexShrink:0,width:"24px",height:"24px"})),Co=styled("button")(({theme:e,isActive:o})=>({width:"24px",height:"24px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",border:`1px solid ${o?e.palette.info.dark:e.palette.grey[100]}`,backgroundColor:e.palette.background.paper,cursor:"pointer",outline:"none",padding:0,position:"relative",zIndex:11,transition:"all 0.2s ease-in-out","&:hover":{boxShadow:"0px 0px 8px 0px rgba(31, 136, 208, 0.30)",border:`1px solid ${e.palette.info.dark}`}})),Io=styled(motion.div)(()=>({position:"absolute",right:0,top:0,height:"24px",display:"flex",alignItems:"center",zIndex:20,background:"transparent"})),Oo=styled(motion.input)(({theme:e})=>({width:"177px",height:"24px",borderRadius:"4px",color:e.palette.text.primary,fontSize:"10px",outline:0,background:e.palette.background.paper,boxShadow:"0px 0px 8px 0px rgba(31, 136, 208, 0.30)",border:`1px solid ${e.palette.info.dark}`,paddingLeft:"8px",boxSizing:"border-box","::placeholder":{color:"#D5D5D5"}})),Te={position:"absolute",top:"50%",transform:"translateY(-50%)",zIndex:2,userSelect:"none"},To={...Te,background:"none",border:"none",padding:0,margin:0,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:"none","&:disabled":{opacity:.3,cursor:"default"}},Po=styled("button")(()=>({...To,right:53})),_o=styled("button")(()=>({...To,right:39})),vo=styled(motion.img)(()=>({...Te,right:24,width:10,height:10,cursor:"pointer"})),Jo=styled(motion.img)(()=>({...Te,right:8,width:11,height:11,cursor:"default"})),Pe=styled("img")(()=>({width:10,height:10})),Eo=styled("img")(()=>({width:12,height:12})),Vo=styled("span")(({theme:e})=>({position:"absolute",right:67,top:"50%",transform:"translateY(-50%)",fontSize:"9px",lineHeight:1,color:e.palette.text.secondary,whiteSpace:"nowrap",userSelect:"none",zIndex:2,pointerEvents:"none"}));function Ht({value:e,onChange:o,currentIndex:n,totalCount:t,onPrev:r,onNext:i,onOpen:s,placeholder:c="Search..."}){let[a,p]=useState(false),u=useRef(null),f=e.trim().length>0,y=t>0,S=f,b=()=>{s?.(),p(true),requestAnimationFrame(()=>u.current?.focus());},C=()=>{o(""),p(false);};return jsxs(bo,{children:[jsx(AnimatePresence,{children:a&&jsxs(Io,{initial:{clipPath:"inset(0 0 0 100%)",opacity:0},animate:{clipPath:"inset(0 0 0 0%)",opacity:1},exit:{clipPath:"inset(0 0 0 100%)",opacity:0},transition:{duration:.22,ease:[.4,0,.2,1]},children:[jsx(Oo,{ref:u,initial:false,animate:{paddingRight:S?"98px":"24px"},transition:{duration:.15},placeholder:c,value:e,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.shiftKey?r():i()),I.key==="Escape"&&C();},onBlur:()=>{f||p(false);}}),S&&jsx(Po,{onClick:r,disabled:!y,title:"Previous match (Shift+Enter)",children:jsx(Pe,{src:dl,alt:"prev"})}),S&&jsx(_o,{onClick:i,disabled:!y,title:"Next match (Enter)",children:jsx(Pe,{src:el,alt:"next"})}),S&&jsx(vo,{src:wi,alt:"clear",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:C}),jsx(Jo,{src:Ik,alt:"search",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),S&&jsx(Vo,{children:y?`${n+1}/${t}`:"0/0"})]},"input-area")}),jsx(AnimatePresence,{children:!a&&jsx(motion.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.15},children:jsx(Co,{isActive:false,onClick:b,title:"Search",children:jsx(Eo,{src:A,alt:"search"})})})})]})}var M=memo(Ht);function Do(e,o){let n=[],t=o.length,r=0,i=e.indexOf(o,r);for(;i!==-1;){let s=i+t;n.push([i,s]),r=s,i=e.indexOf(o,r);}return n}var Mt={padding:0,outline:"none"};function Ao({text:e,queryLength:o,ranges:n,idPrefix:t}){let r=[],i=0;return n.forEach(([s,c],a)=>{s>i&&r.push(e.slice(i,s)),r.push(jsx("mark",{style:Mt,children:e.slice(s,s+o)},`${t}-${a}`)),i=c;}),i<e.length&&r.push(e.slice(i)),jsx(Fragment,{children:r})}function R({text:e,query:o}){let n=useId(),t=useMemo(()=>o.trim().toLowerCase(),[o]),r=useMemo(()=>{if(!t)return e;let i=e.toLowerCase(),s=Do(i,t);return s.length===0?e:jsx(Ao,{text:e,queryLength:o.length,ranges:s,idPrefix:n})},[e,o.length,t,n]);return jsx(Fragment,{children:r})}var Lo={overflow:"visible",boxShadow:"none",filter:"drop-shadow(0 0 20px rgba(0, 0, 0, 0.15))"},_e={"--w-rjv-color":"#9cdcfe","--w-rjv-key-string":"#357fb9","--w-rjv-background-color":"#ffffff","--w-rjv-line-color":"#ffffff","--w-rjv-arrow-color":"#116e6bed","--w-rjv-edit-color":"#9cdcfe","--w-rjv-info-color":"#9c9c9c7a","--w-rjv-update-color":"#FFE20B","--w-rjv-copied-color":"#9cdcfe","--w-rjv-copied-success-color":"#28a745","--w-rjv-curlybraces-color":"#000000","--w-rjv-colon-color":"#000000","--w-rjv-brackets-color":"#000000","--w-rjv-quotes-color":"#9cdcfe","--w-rjv-quotes-string-color":"#c27c46","--w-rjv-type-string-color":"#c27c46","--w-rjv-type-int-color":"#956ea5","--w-rjv-type-float-color":"#956ea5","--w-rjv-type-bigint-color":"#956ea5","--w-rjv-type-boolean-color":"#357fb9","--w-rjv-type-date-color":"#956ea5","--w-rjv-type-url-color":"#3b89cf","--w-rjv-type-null-color":"#956ea5","--w-rjv-type-nan-color":"#956ea5","--w-rjv-type-undefined-color":"#956ea5",padding:"1rem",height:"100%",overflow:"auto"},zo={..._e,background:"transparent","--w-rjv-line-color":"transparent"},ve=styled(j)(()=>({border:"1px solid rgba(242, 242, 242, 0.70);",display:"inline-flex",height:"24px",minWidth:"73px",padding:"0px 8px",justifyContent:"center",alignItems:"center",gap:"6px",borderRadius:"37.5px",backgroundColor:"#fff",fontSize:"9px",lineHeight:"15px",fontWeight:400})),Je=styled(ie)(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"4px",paddingBlock:"8px",paddingInlineStart:"12px",paddingInlineEnd:"12px",position:"sticky",left:0,right:0,top:0,background:"#fff",zIndex:5,flexShrink:0,minHeight:44})),Ee=styled(ie)(()=>({display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"4px",flexShrink:0,marginLeft:"auto"})),Fo=styled(ie)(()=>({display:"flex",flexDirection:"row",flex:1,minHeight:0,height:"100%",width:"100%",background:"transparent",position:"relative",overflow:"visible"})),Ve=styled(ie)(()=>({display:"flex",flexDirection:"column",flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"})),qo=styled(motion.div,{shouldForwardProp:e=>!["isRequestShown","isMaximized"].includes(e)})(({isRequestShown:e,isMaximized:o})=>({width:"100%",height:"100%",minHeight:0,overflow:"hidden",background:"#fff",zIndex:20,position:"relative",left:0,display:"flex",flexDirection:"column",flex:1,minWidth:0,borderBottomRightRadius:"12px",borderBottomLeftRadius:e?0:"12px",...o&&{borderBottomLeftRadius:0,borderBottomRightRadius:0}})),$o=styled(motion.div,{shouldForwardProp:e=>!["isMaximized","currentRequestWidth"].includes(e)})(({isMaximized:e,currentRequestWidth:o})=>({backgroundColor:fo,backdropFilter:"blur(24px)",height:"100%",overflowY:"auto",overflowX:"hidden",position:"absolute",width:e?"100%":o,zIndex:19,display:"flex",flexDirection:"column",borderBottomLeftRadius:"12px",top:0,bottom:0})),Ko=styled("span")(()=>({color:"#032F62"})),Uo=styled("span")(()=>({color:"#357fb9"}));function se(e,o){return e.toLowerCase().includes(o)}function ae(e){return e.trim().toLowerCase()}function le(e){let o=ae(e);return (n,{keyName:t})=>{if(!o||!t)return;let r=String(t);if(se(r,o))return jsx(Uo,{children:jsx(R,{text:String(t),query:e})})}}function pe(e){let o=ae(e);return (n,{value:t})=>{if(!o)return;let r=String(t??"");if(se(r,o))return jsxs(Ko,{children:['"',jsx(R,{text:String(t??""),query:e}),'"']})}}function Qo(e,o){return e==null?String(e).includes(o):typeof e=="string"?e.toLowerCase().includes(o):typeof e=="number"||typeof e=="boolean"?String(e).includes(o):false}function Yo(e,o){if(Array.isArray(e)){let n=e.map(t=>Yo(t,o)).filter(t=>t!=null);return n.length>0?n:null}return typeof e=="object"&&e!==null?Xo(e,o):Qo(e,o)?e:null}function Xo(e,o){let n={};for(let[t,r]of Object.entries(e))if(t.toLowerCase().includes(o))n[t]=r;else if(typeof r=="object"&&r!==null){let i=Yo(r,o);i!==null&&(n[t]=i);}else Qo(r,o)&&(n[t]=r);return Object.keys(n).length>0?n:null}function Re(e,o){return o.trim()?Xo(e,o.toLowerCase()):e}function Zo(e,o,n){return {x:e/2-N/4+n*co,y:o/2-B/2+n*mo}}var nt="#FFE20B";function z(e,o){let[n,t]=useState(0),[r,i]=useState(0);useEffect(()=>{if(!o.trim()){i(0),t(0);return}let a=setTimeout(()=>{let p=e.current?.querySelectorAll("mark")??[];i(p.length),t(0);},50);return ()=>clearTimeout(a)},[o,e]),useEffect(()=>{if(!e.current||!o.trim())return;let a=Array.from(e.current.querySelectorAll("mark"));a.forEach((p,u)=>{let f=u===n;p.style.backgroundColor=f?nt:"transparent",p.style.outline=f?`1px solid ${nt}`:"none",p.style.borderRadius="2px";}),a[n]?.scrollIntoView({behavior:"smooth",block:"nearest"});},[n,r,o,e]);let s=useCallback(()=>{r!==0&&t(a=>(a+1)%r);},[r]),c=useCallback(()=>{r!==0&&t(a=>(a-1+r)%r);},[r]);return {currentIndex:n,totalCount:r,goNext:s,goPrev:c}}function st({json:e,requestJson:o={},onJsonSearch:n,onJsonCopy:t,onJsonIdCopy:r,onJsonNodesMinimize:i,onJsonNodesMaximize:s,isRequestShown:c,isToolbarAnimationDisabled:a}){let{isMaximized:p,size:u,isResizing:f}=b$1(),[y,S]=useState(false),[b,C]=useState(true),[x,g]=useState(""),[h,I]=useState(""),D=useRef(null),A=useRef(null),U=z(D,x),G=z(A,h),Wt=useMemo(()=>Object.keys(e??{})?.length??0,[e]),Ae=u.width||N,He=_=>{setTimeout(()=>{navigator.clipboard.writeText(_||"").then(()=>{});},10);},bt=useMemo(()=>Object.keys(o??{})?.length??0,[o]),Me=useMemo(()=>Re(e,x),[e,x]),je=useMemo(()=>Re(o,h),[o,h]);return jsxs(Fo,{"data-testid":"Pane",className:nc(m.root,m.body),children:[jsx(AnimatePresence,{children:c&&jsx($o,{className:nc(m.requestPane),initial:{left:0},animate:{left:p?0:-Ae},exit:{left:0},transition:{duration:Z,...a&&{duration:0},...f&&{duration:0}},isMaximized:p,currentRequestWidth:Ae,children:jsxs(ie,{ref:A,sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[jsxs(Je,{className:nc(m.section),sx:{background:"transparent"},children:[jsx(ve,{variant:"subtitle1",className:nc(m.title),children:"API Request"}),jsxs(Ee,{className:nc(m.actions),children:[jsx(M,{value:h,onChange:I,onOpen:()=>n?.(),currentIndex:G.currentIndex,totalCount:G.totalCount,onPrev:G.goPrev,onNext:G.goNext}),jsx(T,{disableAnimation:true,onClick:()=>{b?s?.():i?.(),C(_=>!_);},icon:b?xe$1:we}),jsx(T,{onClick:()=>{t?.(),navigator.clipboard.writeText(JSON.stringify(o,null,2)).then(()=>{});},icon:sa}),jsx(T,{onClick:()=>{r?.(),navigator.clipboard.writeText(e?.id||"").then(()=>{});},icon:qa})]})]}),h.trim()&&je===null?jsx(ie,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,height:"100%"},children:jsx(it,{variant:"body2",sx:{fontSize:"0.75rem",color:"text.secondary"},children:"No Data Found"})}):jsx(Ve,{className:nc(m.scroll),children:jsxs(P,{value:je??o,style:zo,displayDataTypes:false,collapsed:h.trim()?void 0:b?1:void 0,onCopied:(_,v)=>{typeof v=="string"&&He(v);},enableClipboard:false,children:[jsx(P.String,{render:pe(h)}),jsx(P.KeyName,{render:le(h)}),jsx(P.CountInfo,{render:(_,{keyName:v})=>{if(!v)return jsx("span",{})}}),jsx(P.Copied,{render:oe})]})}),jsx(H,{totalCount:bt,sx:{borderBottomRightRadius:0,background:"#f8f9fb"}})]})},"request-pane")}),jsxs(qo,{ref:D,className:nc(m.responsePane),isMaximized:p,isRequestShown:c,initial:{...p&&{width:"100vw",left:0}},animate:{...p&&{position:"absolute",left:c?"50vw":"0"}},transition:{duration:Z,...a&&{duration:0},...f&&{duration:0}},children:[jsxs(Je,{className:nc(m.section),children:[jsx(ve,{variant:"subtitle1",className:nc(m.title),children:"API Response"}),jsxs(Ee,{className:nc(m.actions),children:[jsx(M,{value:x,onChange:g,onOpen:()=>n?.(),currentIndex:U.currentIndex,totalCount:U.totalCount,onPrev:U.goPrev,onNext:U.goNext}),jsx(T,{disableAnimation:true,onClick:()=>{y?s?.():i?.(),S(_=>!_);},icon:y?xe$1:we}),jsx(T,{onClick:()=>{t?.(),navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{});},icon:sa}),jsx(T,{onClick:()=>{r?.(),navigator.clipboard.writeText(e?.id||"").then(()=>{});},icon:qa})]})]}),x.trim()&&Me===null?jsx(ie,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,height:"100%"},children:jsx(it,{variant:"body2",sx:{fontSize:"0.75rem",color:"text.secondary"},children:"No Data Found"})}):jsx(Ve,{className:nc(m.scroll),children:jsxs(P,{value:Me??e,style:_e,displayDataTypes:false,collapsed:x.trim()?void 0:y?1:void 0,onCopied:(_,v)=>{typeof v=="string"&&He(v);},children:[jsx(P.String,{render:pe(x)}),jsx(P.KeyName,{render:le(x)}),jsx(P.CountInfo,{render:(_,{keyName:v})=>{if(!v)return jsx("span",{})}}),jsx(P.Copied,{render:oe})]})}),jsx(H,{totalCount:Wt,sx:{borderBottomLeftRadius:c?0:"12px",background:"#f8f9fb"}})]})]})}st.displayName="Pane";var me=memo(st);var Ut="os-shared-JSONViewWindowToolbar",F={root:`${Ut}-root`};var lt=forwardRef(function({title:o,onClose:n,onMaximize:t,maximized:r=false,onRequestClick:i$1,requestDirection:s="left",showRequestIcon:c$1=false,id:a,className:p,sx:u},f$1){return jsxs(b,{ref:f$1,id:a??f,"data-testid":a??"Toolbar",sx:mc({backgroundColor:"#f9f9f9",backdropFilter:"none"},u),className:nc(F.root,p),children:[jsxs(h$1,{children:[jsx(c,{onClick:n}),jsx(e,{isMaximized:r,onClick:t}),c$1&&jsx(d,{onClick:i$1,direction:s,children:"Request"})]}),jsx(j$1,{title:o,icon:Vd}),jsx(i,{})]})});lt.displayName="Toolbar";var $=memo(lt);var Yt="os-shared-JSONViewWindowContent",pt={root:`${Yt}-root`};var dt=styled(motion.div)({flexShrink:0}),mt=styled("div")({display:"contents"});function en({requestJson:e={},onClose:o,onJsonRequestOpen:n,isRequestShown:t,setIsRequestShown:r,isToolbarAnimationDisabled:i,setIsToolbarAnimationDisabled:s,className:c,...a}){let{isMaximized:p,setIsMaximized:u,setSize:f,size:y,isResizing:S}=b$1(),b=Object.keys(e??{})?.length,C=y.width||N;return jsxs(Fragment,{children:[jsx(dt,{animate:{width:p?"100%":t?C*2:C,x:!p&&t?-C:0},transition:{duration:S||i?0:h$2},children:jsx($,{title:t?be:We,onClose:()=>o(),onMaximize:()=>{u(x=>!x),s(true),setTimeout(()=>{s(false);},h$2*1e3);},maximized:p,onRequestClick:()=>{r(x=>!x),s(false),t||(n?.(),f({width:N,height:B}));},requestDirection:t?"right":"left",showRequestIcon:!!b})}),jsx(mt,{className:nc(pt.root,c),children:jsx(me,{...a,requestJson:e,onClose:o,onJsonRequestOpen:n,isRequestShown:t,isToolbarAnimationDisabled:i})})]})}var K=memo(en);var k=createContext({windows:[],open:()=>{},close:()=>{},closeAll:()=>{},handleWindowMinimize:()=>{},handleWindowOrder:()=>{},registerJSONViewWindowEvents:()=>{},containerRef:{current:null}});function ut({list:e,events:o,onClose:n,isWindowMinimized:t,windowOrder:r}){return e?.length?jsx(Fragment,{children:e.map((i,s)=>jsx(xe,{index:s,...o,...i,onClose:()=>{n(s);},isWindowMinimized:t,windowOrder:r},i.json.id))}):null}ut.displayName="List";var ue=memo(ut);var gt=({children:e,containerRef:o})=>{let[n,t]=useState([]),[r,i]=useState(false),[s,c]=useState(1),a=useRef({}),p=useCallback(g=>{if(n.length===7){alert("Maximum allowed active JSON View Window is 7 per table.");return}if(n.some(A=>A.json.id===g.json.id))return;let h=structuredClone(g.json),I=h.request_body,D={...g,json:h,requestJson:g.requestJson||I||void 0};delete D.json.request_body,t(A=>[...A,D]);},[n]),u=useCallback(g=>{t(h=>h.filter((I,D)=>g!==D));},[]),f=useCallback(()=>{t([]);},[]),y=useCallback(g=>{i(g);},[]),S=useCallback(g=>{c(g);},[]),b=useCallback(g=>{a.current=g;},[]),C=useMemo(()=>({onJsonRequestOpen:()=>a.current.onJsonRequestOpen?.(),onJsonSearch:()=>a.current.onJsonSearch?.(),onJsonCopy:()=>a.current.onJsonCopy?.(),onJsonIdCopy:()=>a.current.onJsonIdCopy?.(),onJsonNodesMinimize:()=>a.current.onJsonNodesMinimize?.(),onJsonNodesMaximize:()=>a.current.onJsonNodesMaximize?.()}),[]),x=useMemo(()=>({windows:n,open:p,close:u,closeAll:f,handleWindowMinimize:y,handleWindowOrder:S,registerJSONViewWindowEvents:b,containerRef:o}),[n,p,u,f,y,S,b,o]);return jsxs(k.Provider,{value:x,children:[e,jsx(ue,{list:n,events:C,onClose:u,isWindowMinimized:r,windowOrder:s})]})};function yt(e){let{containerRef:o}=useContext(k),{height:n,width:t}=a(),[r,i]=useState(false),[s,c]=useState(false);return jsx(f$1,{isOpen:true,onClose:e.onClose,containerRef:o,defaultSize:{width:N,height:B},minSize:{width:N,height:300},defaultPosition:Zo(t,n,e.index),order:e.windowOrder,isMinimized:e.isWindowMinimized,id:"json-view-window",className:nc(m.root,e.className),sx:Lo,children:jsx(K,{...e,isRequestShown:r,setIsRequestShown:i,isToolbarAnimationDisabled:s,setIsToolbarAnimationDisabled:c})})}yt.displayName="JSONViewWindow";var xe=memo(yt);var Nt=({isWindowMinimized:e,windowOrder:o,...n}={})=>{let{windows:t,open:r,close:i,closeAll:s,handleWindowMinimize:c,handleWindowOrder:a,registerJSONViewWindowEvents:p}=useContext(k),u=useCallback(()=>{c(e??false);},[c,e]),f=useCallback(()=>{a(o??1);},[a,o]);return useEffect(()=>{f();},[f]),useEffect(()=>{u();},[u]),useEffect(()=>{p(n);},[p,n]),{open:r,close:i,closeAll:s,windows:t,count:t.length}};var Ts=xe;export{m as a,N as b,B as c,Z as d,Ne as e,We as f,be as g,H as h,T as i,M as j,R as k,z as l,me as m,F as n,$ as o,K as p,k as q,ue as r,gt as s,Nt as t,Ts as u};
@@ -0,0 +1 @@
1
+ import {n,j,k,l,h,f,b,g,i,m as m$1,c,e,d}from'./chunk-52PPSCXG.js';import {X,V,W,Y,k as k$1,a,O,Q,b as b$1,_,P,R,S,T,U,F,m,$,I,G,H,Z,L,M,ba as ba$1,aa,c as c$1,J,K,N}from'./chunk-ZO7IPGTD.js';import {ba}from'./chunk-CAVYK7HF.js';import {Dc,nc,mc}from'./chunk-Z2DUFVI5.js';import {forwardRef,useState,useCallback,useMemo,memo}from'react';import pe from'@mui/material/Box';import At from'@mui/material/InputLabel';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function Nt({endAdornmentProp:h,isLoading:o,showClear:S,showMenuArrow:i,menuOpen:b,ClearIconComponent:c=$,ChevronIconComponent:u=aa,onClear:p,onClearDefault:R}){if(!h&&!S&&!o&&!i)return null;let m=C=>{C.preventDefault(),C.stopPropagation(),p?p():R();};return jsxs(pe,{className:nc("Select-endAdornmentRoot",o&&"Select-endAdornmentRoot--loading"),component:"span",children:[h,o?jsx(pe,{component:"span",className:"Select-menuTriggerIcon Select-menuTriggerIcon--loading","aria-hidden":true,children:jsx(ba$1,{})}):null,!o&&S?jsx(pe,{component:"button",className:"Select-clearIconButton","data-select-clear":"",type:"button",tabIndex:0,"aria-label":"Clear selection",onMouseDown:m,onClick:m,children:jsx(c,{})}):null,!o&&i?jsx(pe,{component:"span",className:`Select-menuTriggerIcon${b?" Select-menuTriggerIcon-open":""}`,"aria-hidden":true,children:jsx(u,{})}):null]})}var Et=forwardRef(function({isMultiple:o=false,options:S,value:i,onChange:b,label:c="",disabled:u,required:p,hasError:R=false,helperText:m,feedback:C,showClearIcon:K=false,ClearIconComponent:me,ChevronIconComponent:q,onClear:Q,isLoading:F,MenuProps:j$1,children:ye,id:z="Select",className:J,open:w,onOpen:X$1,onClose:k$1,name:Y$1,inputProps:P,endAdornment:Z,renderValue:D,valueAlignment:_},g){let[fe,ee]=useState(false),I=w??fe,x=!!(u||F),{isProvided:te,isVisible:T,type:le}=Dc(C),L=`${z}-label`,B=Array.isArray(i)?i:i!=null?[i]:[],V$1=useCallback((t,$)=>{$?X$1?.(t):k$1?.(t),w===void 0&&ee($);},[X$1,k$1,w]),ne=t=>{t.button===0&&(m$1(t)||t.target.closest('.MuiSelect-select[role="combobox"]')||x||(t.preventDefault(),t.stopPropagation(),V$1(t,!I)));},oe=t=>{m$1(t)||t.target.closest('.MuiSelect-select[role="combobox"]')||(t.preventDefault(),t.stopPropagation());},ae=t=>{let ce=t.target.value.map(A=>S.find(W=>j(W)===A||String(W.value)===String(A))).filter(A=>A!=null);b?.(ce);},re=jsx(Nt,{endAdornmentProp:Z,isLoading:!!F,showClear:K&&n(i)&&!x,showMenuArrow:!F,menuOpen:I,ClearIconComponent:me,ChevronIconComponent:q,onClear:Q,onClearDefault:()=>b?.(o?[]:null)}),H=o?B.map(j):j(B[0]??null);return jsxs(X,{$hasFeedback:T,onMouseDown:ne,onClick:oe,children:[jsxs(V,{variant:"filled",required:p,className:J,children:[jsx(At,{id:L,children:c}),jsx(W,{multiple:o,ref:g,value:H,error:R&&!T,feedbackType:le,hasFeedback:T,valueAlignment:_,disableUnderline:true,required:p,hasLabel:!!c.trim(),labelId:L,id:z,name:Y$1,open:I,onOpen:t=>V$1(t,true),onClose:t=>{k(t)||o&&l(t)||V$1(t,false);},onChange:o?ae:void 0,renderValue:D,inputProps:P,disabled:x,IconComponent:()=>null,autoWidth:false,endAdornment:re,MenuProps:j$1,children:ye})]}),te?jsx(ba,{...C}):m!=null&&m!==""?jsx(Y,{children:m}):null]})}),Pe=Et;function Rt({options:h,maxVisibleValues:o,valueAlignment:S=m}){let b$1=typeof o=="number"&&Number.isFinite(o)?Math.max(0,Math.floor(o)):h.length,c=h.slice(0,b$1),u=h.length-c.length,p=c.map(b).join(", ");return jsxs(L,{className:a.values,$valueAlignment:S,children:[jsx(M,{className:a.value,children:p}),u>0?jsxs(N,{className:a.valueOverflow,children:["+",u," more"]}):null]})}var Ct=Rt;var vt=forwardRef(function({options:o,isMultiple:S$1=false,hasCheckbox:i$1,maxVisibleValues:b$2,value:c$2,onChange:u,label:p,placeholder:R$1,disabled:m$1,required:C,error:K$1=false,helperText:me,feedback:q,hasClearIcon:Q$1=false,ClearIconComponent:F$1,ChevronIconComponent:j,SearchIconComponent:ye,onClear:z,isLoading:J$1,isSearchable:w=false,searchPlaceholder:X,hasSelectionSummary:k=false,hasSelectedCheckmark:Y=false,valueAlignment:P$1=m,menuDirection:Z$1=k$1,MenuProps:D,children:_$1,id:g$1="Select",className:fe,sx:ee,selectClassNames:I$1,inputRef:x,open:te,onOpen:T$1,onClose:le,name:L$1,inputProps:B,endAdornment:V,renderValue:ne,renderOption:oe},ae){let[re,H$1]=useState(""),[t,$$1]=useState(Z$1),[ce,A]=useState(void 0),W=p??"",Ae=R$1??"",Ne=me??void 0,Ee=X??b$1,Mt=ye??_,Re=i$1??S$1,y=useMemo(()=>h(o),[o]),ke=nc(a.root,I$1?.root,fe),De=useMemo(()=>f(D,t,ce),[D,t,ce]),Te=e$1=>{let s=c(e$1);s?.width&&A(s.width),$$1(e({preferred:Z$1,anchorRect:s,menuMaxHeight:d(D,w,k),gapPx:c$1})),T$1?.(e$1);},N=w?re.toLowerCase().trim():"",Le=e=>!N||b(e).toLowerCase().includes(N),Be=e=>oe?jsx(J,{className:a.option,$customLayout:true,children:oe(e)}):jsx(J,{className:a.option,children:jsx(K,{title:b(e),children:b(e)})}),wt=useMemo(()=>N?y.filter(e=>b(e).toLowerCase().includes(N)):y,[y,N]),It=!!N&&wt.length===0,se=()=>{u?.(S$1?[]:null),z?.();},He=w?jsx(O,{className:a.search,disableGutters:true,"data-select-menu-search":"",onMouseDown:g,onClick:g,onKeyDown:g,children:jsx(Q,{placeholder:Ee,value:re,onChange:e=>H$1(e.target.value),onMouseDown:g,onClick:g,onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),disableUnderline:true,fullWidth:true,inputProps:{"aria-label":Ee,onMouseDown:g,onClick:g},endAdornment:jsx(Mt,{})})}):null,$e=It?jsx(P,{disableGutters:true,onMouseDown:g,onClick:g,children:"No results found"}):null;if(S$1){let e=Array.isArray(c$2)?c$2:[],s=y.filter(l=>e.some(f=>f===l.value||String(f)===String(l.value))),U$1=s.length,Ft=k&&U$1>0?jsx(R,{className:a.summary,disableGutters:true,disableSticky:true,"data-select-menu-keep-open":"",onMouseDown:g,onClick:g,onKeyDown:g,children:jsxs(S,{children:[jsxs(T,{children:[U$1," selected"]}),jsx(U,{type:"button",variant:"text",disableRipple:true,"aria-label":"Clear all selected options",onMouseDown:l=>{l.preventDefault(),l.stopPropagation(),se();},onClick:l=>{l.preventDefault(),l.stopPropagation(),se();},children:"Clear"})]})}):null;return jsx(F,{id:g$1,"data-testid":g$1??"Select",className:ke,sx:mc(ee??{}),children:jsxs(Pe,{ref:x??ae,isMultiple:true,id:g$1,className:nc(a.field,I$1?.field),options:y,value:s,onChange:l=>{u?.(Array.isArray(l)?l.map(f=>f.value):[]);},label:W,disabled:m$1,required:C,hasError:K$1,helperText:Ne,feedback:q,showClearIcon:Q$1,ClearIconComponent:F$1??$,ChevronIconComponent:j,onClear:se,isLoading:J$1,MenuProps:De,open:te,onOpen:Te,onClose:l=>{H$1(""),le?.(l);},name:L$1,inputProps:B,endAdornment:V,valueAlignment:P$1,renderValue:()=>s.length>0?jsx(Ct,{options:s,maxVisibleValues:b$2,valueAlignment:P$1}):Ae,children:[_$1,He,Ft,$e,y.map(l=>{let f=e.some(Ue=>Ue===l.value||String(Ue)===String(l.value)),We=Be(l);return jsx(I,{value:String(l.value),disabled:l.disabled,$selected:f,$hidden:!Le(l),className:a.option,onMouseDown:g,onClick:g,children:Re?jsxs(G,{children:[jsx(H,{checked:f,$mutedRect:f&&l.disabled,tabIndex:-1,disableRipple:true}),We]}):jsxs(Fragment,{children:[We,Y&&f?jsx(Z,{}):null]})},l.id)})]})})}let Ot=Array.isArray(c$2)?c$2[0]??null:c$2??null,O$1=i(y,Ot);return jsx(F,{id:g$1,"data-testid":g$1??"Select",className:ke,sx:mc(ee??{}),children:jsxs(Pe,{ref:x??ae,id:g$1,className:nc(a.field,I$1?.field),options:y,value:O$1,onChange:e=>{u?.(e==null||Array.isArray(e)?null:e.value);},label:W,disabled:m$1,required:C,hasError:K$1,helperText:Ne,feedback:q,showClearIcon:Q$1,ClearIconComponent:F$1??$,ChevronIconComponent:j,onClear:se,isLoading:J$1,MenuProps:De,open:te,onOpen:Te,onClose:e=>{H$1(""),le?.(e);},name:L$1,inputProps:B,endAdornment:V,valueAlignment:P$1,renderValue:()=>{if(!O$1)return Ae;if(ne)return ne(O$1);let e=b(O$1);return jsx(L,{className:a.values,$valueAlignment:P$1,children:jsx(M,{className:a.value,title:e,children:e})})},children:[_$1,He,$e,y.map(e=>{let s=O$1!=null&&(O$1.value===e.value||String(O$1.value)===String(e.value)),U=Be(e);return jsx(I,{value:String(e.value),disabled:e.disabled,$selected:s,$hidden:!Le(e),onMouseDown:g,onClick:()=>u?.(e.value),className:a.option,children:Re?jsxs(G,{children:[jsx(H,{checked:s,tabIndex:-1,disableRipple:true}),U]}):jsxs(Fragment,{children:[U,Y&&s?jsx(Z,{}):null]})},e.id)})]})})});vt.displayName="Select";var Lt=memo(vt);export{Lt as a};