@uniformdev/mesh-sdk-react 17.5.1-alpha.7 → 17.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ga=Object.create;var rt=Object.defineProperty;var Oa=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var $a=Object.getPrototypeOf,Fa=Object.prototype.hasOwnProperty;var Co=(e,t)=>{for(var a in t)rt(e,a,{get:t[a],enumerable:!0})},tt=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qa(t))!Fa.call(e,r)&&r!==a&&rt(e,r,{get:()=>t[r],enumerable:!(o=Oa(t,r))||o.enumerable});return e},X=(e,t,a)=>(tt(e,t,"default"),a&&tt(a,t,"default")),se=(e,t,a)=>(a=e!=null?Ga($a(e)):{},tt(t||!e||!e.__esModule?rt(a,"default",{value:e,enumerable:!0}):a,e)),Na=e=>tt(rt({},"__esModule",{value:!0}),e);var Y={};Co(Y,{AddListButton:()=>h.AddListButton,Button:()=>h.Button,Callout:()=>h.Callout,DamSelectedItem:()=>mn,DefaultSearchRow:()=>wr,DefaultSelectedItem:()=>mr,EntrySearch:()=>Dr,Heading:()=>h.Heading,Icons:()=>ut,Input:()=>h.Input,InputComboBox:()=>h.InputComboBox,InputSelect:()=>h.InputSelect,InputToggle:()=>h.InputToggle,InputVariables:()=>po,KeywordSearchInput:()=>h.InputKeywordSearch,Label:()=>h.Label,LoadingIndicator:()=>h.LoadingIndicator,LoadingOverlay:()=>h.LoadingOverlay,Menu:()=>h.Menu,MenuItem:()=>h.MenuItem,MeshApp:()=>vn,ProductPreviewList:()=>Kt,ProductQuery:()=>Xa,ProductQueryContext:()=>Nt,ProductSearch:()=>gn,ProductSearchContext:()=>Zr,ProductSearchRow:()=>qr,ProductSelectedItem:()=>Yr,RequestBody:()=>wn,RequestHeaders:()=>Sn,RequestMethodSelect:()=>Cn,RequestParameters:()=>Rn,RequestProvider:()=>bn,RequestTypeContainer:()=>mo,RequestUrlInput:()=>Pn,ResolvableLoadingValue:()=>Ot,ScrollableList:()=>h.ScrollableList,ScrollableListItem:()=>h.ScrollableListItem,SelectionField:()=>qt,Switch:()=>h.Switch,Textarea:()=>h.Textarea,Theme:()=>h.Theme,UniformMeshLocationContext:()=>Ht,UniformMeshLocationContextProvider:()=>Qe,UniformMeshSdkContext:()=>Ke,UniformMeshSdkContextProvider:()=>Wa,VariableEditor:()=>co,VariablesList:()=>yn,VariablesProvider:()=>hn,badgeIcon:()=>bt,damSelectItemImage:()=>kt,damSelectedItemContainer:()=>Xr,damSelectedItemCopy:()=>eo,damSelectedItemDetails:()=>jr,damSelectedItemIcon:()=>ro,damSelectedItemInfoBtn:()=>io,damSelectedItemInner:()=>Jr,damSelectedItemLinkBtn:()=>Pt,damSelectedItemLinkContainer:()=>ao,damSelectedItemMediaContainer:()=>no,damSelectedItemPopover:()=>oo,damSelectedItemPopoverLabel:()=>je,damSelectedItemSmallText:()=>_e,damSelectedItemTitle:()=>to,decomposeRelativeUrl:()=>xn,draggableContainer:()=>Ir,draggableIcon:()=>yt,draggableIconOffset:()=>Er,draggableIconWrapper:()=>Vr,entrySearchBtn:()=>Cr,entrySearchConfig:()=>Pr,entrySearchConfigHidden:()=>kr,entrySearchLoadMoreBtn:()=>Rr,entrySearchResultList:()=>Tr,entrySearchSelectIcon:()=>Lr,entrySearchSelectImg:()=>_r,entrySearchSelectInput:()=>cn,entrySearchSelectOption:()=>pn,entrySearchWrapper:()=>Sr,productSearchRowActiveIcon:()=>Gr,productSearchRowCategory:()=>Ar,productSearchRowContainer:()=>Mr,productSearchRowContent:()=>Ur,productSearchRowContentActive:()=>Br,productSearchRowDetails:()=>Hr,productSearchRowTitle:()=>zr,productSelectedItemContainer:()=>Fr,productSelectedItemContent:()=>Wr,productSelectedItemDetails:()=>Nr,productSelectedItemIcon:()=>Kr,productSelectedItemImage:()=>xt,productSelectedItemLinkContainer:()=>Qr,productedSelectedItemLinkBtn:()=>wt,productedSelectedItemSmallText:()=>St,searchRowBtn:()=>br,searchRowContainer:()=>fr,searchRowContainerActive:()=>hr,searchRowContainerWithPopover:()=>vr,searchRowPopover:()=>yr,searchRowText:()=>ht,searchRowTextSmall:()=>vt,selectItemLinkBtn:()=>mt,selectItemLinkContainer:()=>ur,selectItemPopover:()=>pr,selectItemPopoverLabel:()=>Ae,selectItemSmallText:()=>he,selectedItemContainer:()=>nr,selectedItemCopy:()=>lr,selectedItemDetails:()=>sr,selectedItemIcon:()=>cr,selectedItemInner:()=>ir,selectedItemTitle:()=>dr,useInitializeUniformMeshSdk:()=>Gt,useMeshLocation:()=>Qa,useProductQueryContext:()=>Wt,useProductSearchContext:()=>Je,useRequest:()=>te,useUniformMeshLocation:()=>Ka,useUniformMeshLocationContext:()=>Ye,useUniformMeshSdk:()=>At,useUniformMeshSdkContext:()=>zt,useVariables:()=>De,variablesToList:()=>lo});module.exports=Na(Y);var l=require("@emotion/react"),w=se(require("react"));var ve=require("react");var ot=require("react");var Ro=require("@uniformdev/design-system"),We=require("@emotion/react/jsx-runtime"),Ke=(0,ot.createContext)(void 0),Wa=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),(0,We.jsxs)(Ke.Provider,{value:t,children:[(0,We.jsx)(Ro.Theme,{}),(0,We.jsx)(Qe,{children:e})]})},zt=()=>{let e=(0,ot.useContext)(Ke);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function At(){let{sdk:e}=zt();return e}var Po=require("@emotion/react/jsx-runtime"),Ht=(0,ve.createContext)(void 0),Qe=({children:e})=>{let t=At(),[a,o]=(0,ve.useState)(t.getCurrentLocation()),r=n=>{o(i=>({...i,value:n.newValue}))};return(0,ve.useEffect)(()=>(t.events.on("onValueChanged",r),()=>{t.events.off("onValueChanged",r)}),[t]),(0,Po.jsx)(Ht.Provider,{value:{location:a},children:e})},Ye=()=>{let e=(0,ve.useContext)(Ht);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function Ka(){let{location:e}=Ye();return e}var ko=require("@uniformdev/mesh-sdk"),Re=require("react"),Gt=({autoResizingDisabled:e}={})=>{let[t,a]=(0,Re.useState)(),[o,r]=(0,Re.useState)(),n=(0,Re.useRef)(!1);return(0,Re.useEffect)(()=>{typeof window=="undefined"||o||(typeof window.UniformMeshSDK=="undefined"&&!n.current?(n.current=!0,(0,ko.initializeUniformMeshSDK)({autoResizingDisabled:e}).then(i=>{r(i)}).catch(i=>{a(i)}).finally(()=>{n.current=!1})):r(window.UniformMeshSDK))},[e]),{initializing:!o&&!t,error:t,sdk:o}};function Qa(e){let{location:t}=Ye();if(e&&t.type!==e)throw new Error(`Expected location type ${e} but got ${t.type}`);return t}var de=se(require("react"));var Io=require("@emotion/react"),nt=require("@uniformdev/design-system"),Vo=require("react-icons/cg");var Be=require("@emotion/react/jsx-runtime"),Ot=({value:e,text:t,loading:a})=>(0,Be.jsxs)(Be.Fragment,{children:[!!t&&t,!t&&(0,Be.jsxs)(Be.Fragment,{children:[a&&`${e} (Loading...)`,!a&&`${e} (Unresolvable)`]})]});var at=require("@emotion/react"),To=at.css`
1
+ "use strict";var Wo=Object.create;var at=Object.defineProperty;var Ko=Object.getOwnPropertyDescriptor;var Qo=Object.getOwnPropertyNames;var Yo=Object.getPrototypeOf,Zo=Object.prototype.hasOwnProperty;var Ra=(e,t)=>{for(var o in t)at(e,o,{get:t[o],enumerable:!0})},rt=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qo(t))!Zo.call(e,r)&&r!==o&&at(e,r,{get:()=>t[r],enumerable:!(a=Ko(t,r))||a.enumerable});return e},X=(e,t,o)=>(rt(e,t,"default"),o&&rt(o,t,"default")),se=(e,t,o)=>(o=e!=null?Wo(Yo(e)):{},rt(t||!e||!e.__esModule?at(o,"default",{value:e,enumerable:!0}):o,e)),Xo=e=>rt(at({},"__esModule",{value:!0}),e);var Y={};Ra(Y,{AddListButton:()=>h.AddListButton,Button:()=>h.Button,Callout:()=>h.Callout,DamSelectedItem:()=>hn,DefaultSearchRow:()=>sr,DefaultSelectedItem:()=>hr,EntrySearch:()=>_r,Heading:()=>h.Heading,Icons:()=>dt,Input:()=>h.Input,InputComboBox:()=>h.InputComboBox,InputSelect:()=>h.InputSelect,InputToggle:()=>h.InputToggle,InputVariables:()=>ma,KeywordSearchInput:()=>h.InputKeywordSearch,Label:()=>h.Label,LoadingIndicator:()=>h.LoadingIndicator,LoadingOverlay:()=>h.LoadingOverlay,Menu:()=>h.Menu,MenuItem:()=>h.MenuItem,MeshApp:()=>xn,ProductPreviewList:()=>Jt,ProductQuery:()=>un,ProductQueryContext:()=>Zt,ProductSearch:()=>vn,ProductSearchContext:()=>Wr,ProductSearchRow:()=>Ar,ProductSelectedItem:()=>Fr,RequestBody:()=>Cn,RequestHeaders:()=>Rn,RequestMethodSelect:()=>Pn,RequestParameters:()=>Tn,RequestProvider:()=>wn,RequestTypeContainer:()=>ca,RequestUrlInput:()=>In,ResolvableLoadingValue:()=>Qt,ScrollableList:()=>h.ScrollableList,ScrollableListItem:()=>h.ScrollableListItem,SelectionField:()=>Yt,Switch:()=>h.Switch,Textarea:()=>h.Textarea,Theme:()=>h.Theme,UniformMeshLocationContext:()=>sa,UniformMeshLocationContextProvider:()=>Je,UniformMeshSdkContext:()=>Xe,UniformMeshSdkContextProvider:()=>yn,VariableEditor:()=>ua,VariablesList:()=>_n,VariablesProvider:()=>kn,badgeIcon:()=>yt,damSelectItemImage:()=>Tt,damSelectedItemContainer:()=>Kr,damSelectedItemCopy:()=>Zr,damSelectedItemDetails:()=>Yr,damSelectedItemIcon:()=>Jr,damSelectedItemInfoBtn:()=>ra,damSelectedItemInner:()=>Qr,damSelectedItemLinkBtn:()=>Pt,damSelectedItemLinkContainer:()=>ea,damSelectedItemMediaContainer:()=>ta,damSelectedItemPopover:()=>jr,damSelectedItemPopoverLabel:()=>Ye,damSelectedItemSmallText:()=>ke,damSelectedItemTitle:()=>Xr,draggableContainer:()=>Tr,draggableIcon:()=>bt,draggableIconOffset:()=>Lr,draggableIconWrapper:()=>kr,entrySearchBtn:()=>yr,entrySearchConfig:()=>wr,entrySearchConfigHidden:()=>Sr,entrySearchLoadMoreBtn:()=>xr,entrySearchResultList:()=>Cr,entrySearchSelectIcon:()=>Rr,entrySearchSelectImg:()=>Pr,entrySearchSelectInput:()=>gn,entrySearchSelectOption:()=>mn,entrySearchWrapper:()=>br,productSearchRowActiveIcon:()=>Br,productSearchRowCategory:()=>Mr,productSearchRowContainer:()=>Ir,productSearchRowContent:()=>Dr,productSearchRowContentActive:()=>Vr,productSearchRowDetails:()=>Ur,productSearchRowTitle:()=>Er,productSelectedItemContainer:()=>Gr,productSelectedItemContent:()=>qr,productSelectedItemDetails:()=>Or,productSelectedItemIcon:()=>Nr,productSelectedItemImage:()=>xt,productSelectedItemLinkContainer:()=>$r,productedSelectedItemLinkBtn:()=>wt,productedSelectedItemSmallText:()=>St,searchRowBtn:()=>nr,searchRowContainer:()=>tr,searchRowContainerActive:()=>ar,searchRowContainerWithPopover:()=>rr,searchRowPopover:()=>or,searchRowText:()=>mt,searchRowTextSmall:()=>gt,selectItemLinkBtn:()=>vt,selectItemLinkContainer:()=>fr,selectItemPopover:()=>mr,selectItemPopoverLabel:()=>ze,selectItemSmallText:()=>ve,selectedItemContainer:()=>lr,selectedItemCopy:()=>pr,selectedItemDetails:()=>cr,selectedItemIcon:()=>gr,selectedItemInner:()=>dr,selectedItemTitle:()=>ur,urlEncodeRequestParameter:()=>Vn,urlEncodeRequestUrl:()=>Dn,useInitializeUniformMeshSdk:()=>oa,useMeshLocation:()=>En,useProductQueryContext:()=>Xt,useProductSearchContext:()=>Qe,useRequest:()=>te,useUniformMeshLocation:()=>Mn,useUniformMeshLocationContext:()=>je,useUniformMeshSdk:()=>ia,useUniformMeshSdkContext:()=>na,useVariables:()=>Ve,variablesToList:()=>fa});module.exports=Xo(Y);var l=require("@emotion/react"),S=se(require("react"));var dt={};Ra(dt,{Caution:()=>Pa,Checkmark:()=>ot,ChevronDown:()=>nt,Close:()=>Ta,Danger:()=>ka,ExclamationPoint:()=>La,Info:()=>it,Lightbulb:()=>_a,MagnifyingGlass:()=>Ia,MaximizeAlt:()=>Da,Minus:()=>st,MoreVerticalAlt:()=>Ke,Plus:()=>lt});var zt=require("@emotion/react/jsx-runtime"),Jo=e=>(0,zt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:(0,zt.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})}),Pa=Jo;var At=require("@emotion/react/jsx-runtime"),jo=e=>(0,At.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,At.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})}),ot=jo;var Ht=require("@emotion/react/jsx-runtime"),en=e=>(0,Ht.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:(0,Ht.jsx)("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})}),nt=en;var Ue=require("@emotion/react/jsx-runtime"),tn=e=>(0,Ue.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:(0,Ue.jsxs)("g",{fillRule:"evenodd",children:[(0,Ue.jsx)("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),(0,Ue.jsx)("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"})]})}),Ta=tn;var Gt=require("@emotion/react/jsx-runtime"),rn=e=>(0,Gt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,Gt.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})}),ka=rn;var Ot=require("@emotion/react/jsx-runtime"),an=e=>(0,Ot.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:(0,Ot.jsx)("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})}),La=an;var We=require("@emotion/react/jsx-runtime"),on=e=>(0,We.jsxs)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[(0,We.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),(0,We.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})]}),it=on;var qt=require("@emotion/react/jsx-runtime"),nn=e=>(0,qt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,qt.jsx)("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})}),_a=nn;var le=require("@emotion/react/jsx-runtime"),sn=e=>(0,le.jsxs)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,le.jsxs)("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[(0,le.jsx)("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),(0,le.jsx)("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})]}),(0,le.jsx)("defs",{children:(0,le.jsx)("clipPath",{id:"magnifying-glass_svg__a",children:(0,le.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Ia=sn;var Nt=require("@emotion/react/jsx-runtime"),ln=e=>(0,Nt.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,Nt.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})}),Da=ln;var $t=require("@emotion/react/jsx-runtime"),dn=e=>(0,$t.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,$t.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),st=dn;var Ft=require("@emotion/react/jsx-runtime"),cn=e=>(0,Ft.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,Ft.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Ke=cn;var Wt=require("@emotion/react/jsx-runtime"),pn=e=>(0,Wt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Wt.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})}),lt=pn;var er=require("@emotion/react"),Ya=require("@uniformdev/design-system");var Kt=require("@emotion/react/jsx-runtime");function ae({src:e,alt:t,className:o}){let a=e&&typeof e!="string"?e:null;return a?(0,Kt.jsx)(a,{className:o}):(0,Kt.jsx)("img",{src:e,alt:t,className:o})}var z=require("@emotion/react"),F=require("@uniformdev/design-system"),ce=se(require("react")),ut=require("react-use");var Ua=require("@emotion/react"),pt=require("@uniformdev/design-system"),Ba=require("react-icons/cg");var Be=require("@emotion/react/jsx-runtime"),Qt=({value:e,text:t,loading:o})=>(0,Be.jsxs)(Be.Fragment,{children:[!!t&&t,!t&&(0,Be.jsxs)(Be.Fragment,{children:[o&&`${e} (Loading...)`,!o&&`${e} (Unresolvable)`]})]});var ct=require("@emotion/react"),Va=ct.css`
2
2
  align-items: center;
3
3
  background: var(--gray-100);
4
4
  border: 1px solid var(--gray-300);
@@ -7,21 +7,21 @@
7
7
  justify-content: space-between;
8
8
  margin-bottom: var(--spacing-sm);
9
9
  margin-right: var(--spacing-sm);
10
- `,Lo=at.css`
10
+ `,Ea=ct.css`
11
11
  color: var(--gray-800);
12
12
  padding: var(--spacing-3);
13
- `,_o=at.css`
13
+ `,Ma=ct.css`
14
14
  border: none;
15
15
  border-left: 1px solid var(--gray-300);
16
16
  background: var(--gray-100);
17
17
  padding: var(--spacing-3);
18
- `;var le=require("@emotion/react/jsx-runtime"),qt=({id:e,label:t,loading:a,selectedValues:o,values:r,onAdd:n,onRemove:i})=>{var v;let m=(v=r==null?void 0:r.filter(s=>!(o!=null&&o.includes(s.id.toString()))))!=null?v:[],d=(s,f)=>{s.preventDefault(),i(f)};return(0,le.jsxs)("div",{children:[(0,le.jsx)(nt.InputSelect,{id:e,name:e,label:t,onChange:s=>n(s.target.value),disabled:a,options:[{value:"",label:"Add..."},...m.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(o)&&o.length>0?Io.css`
18
+ `;var de=require("@emotion/react/jsx-runtime"),Yt=({id:e,label:t,loading:o,selectedValues:a,values:r,onAdd:n,onRemove:i})=>{var m;let c=(m=r==null?void 0:r.filter(s=>!(a!=null&&a.includes(s.id.toString()))))!=null?m:[],d=(s,p)=>{s.preventDefault(),i(p)};return(0,de.jsxs)("div",{children:[(0,de.jsx)(pt.InputSelect,{id:e,name:e,label:t,onChange:s=>n(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...c.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(a)&&a.length>0?Ua.css`
19
19
  margin-bottom: var(--spacing-base);
20
- `:""}),o==null?void 0:o.map(s=>{var f;return(0,le.jsxs)("div",{css:To,children:[(0,le.jsx)("span",{css:Lo,children:(0,le.jsx)(Ot,{value:s,loading:a,text:(f=r.find(c=>c.id===s))==null?void 0:f.name})}),(0,le.jsx)("button",{css:_o,title:"remove",onClick:c=>d(c,s),children:(0,le.jsx)(nt.Icon,{icon:Vo.CgClose,iconColor:"currentColor",size:20})})]},s)})]})};var $t=require("@emotion/react/jsx-runtime"),Ya=e=>(0,$t.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,$t.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})}),it=Ya;var Ft=require("@emotion/react/jsx-runtime"),Za=e=>(0,Ft.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Ft.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),st=Za;var lt=require("react-use"),F=require("@uniformdev/design-system"),z=require("@emotion/react"),S=require("@emotion/react/jsx-runtime"),Eo={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Xa=({value:e,setValue:t,brands:a,categories:o,loading:r,categoriesLoading:n,brandsLoading:i,logoIcon:m,onGetProducts:d,sortOptions:v,sortOrderOptions:s,categoryLabel:f="Product Category",brandLabel:c="Brand",disableBrands:x,restrictToSingleCategory:U=!1})=>{var q,y,K;let P=async p=>{t({...Eo,...e||{},...p})},L=(0,de.useMemo)(()=>({...Eo,...e||{}}),[e]),[Ue,Fe]=(0,lt.useAsyncFn)(async p=>await d(p),[d]);(0,lt.useDebounce)(async()=>{await Fe({brand:L.brand,categories:L.categories,keyword:L.keyword,sort:L.sort,sortOrder:L.sortOrder,count:L.count})},250,[L]);let re=(0,de.useMemo)(()=>{let p=[];return o==null||o.forEach(Z=>{let E=Mo(Z,void 0);p.push(...E)}),p},[o]),me=(0,de.useMemo)(()=>[{value:"",label:"All categories"},...re.map(p=>({label:p.name,value:p.id}))],[re]),ie=(0,de.useMemo)(()=>(a==null?void 0:a.map(p=>({id:p.id.toString(),name:p.name})))||[],[a]),Ne=p=>{if(!p)return;let Z=(e==null?void 0:e.categories)||[];P({categories:[...Z,p]})},et=p=>{var Z;P({categories:(Z=e==null?void 0:e.categories)==null?void 0:Z.filter(E=>E!==p)})},Se=p=>{P({brand:p.target.value})},O=p=>{P({count:p||1})};return r?(0,S.jsx)("div",{children:"Loading..."}):(0,S.jsx)(Nt.Provider,{value:{categories:o,logoIcon:m},children:(0,S.jsxs)("div",{css:z.css`
20
+ `:""}),a==null?void 0:a.map(s=>{var p;return(0,de.jsxs)("div",{css:Va,children:[(0,de.jsx)("span",{css:Ea,children:(0,de.jsx)(Qt,{value:s,loading:o,text:(p=r.find(y=>y.id===s))==null?void 0:p.name})}),(0,de.jsx)("button",{css:Ma,title:"remove",onClick:y=>d(y,s),children:(0,de.jsx)(pt.Icon,{icon:Ba.CgClose,iconColor:"currentColor",size:20})})]},s)})]})};var C=require("@emotion/react/jsx-runtime"),za={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},un=({value:e,setValue:t,brands:o,categories:a,loading:r,categoriesLoading:n,brandsLoading:i,logoIcon:c,onGetProducts:d,sortOptions:m,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:y="Brand",disableBrands:v,restrictToSingleCategory:I=!1})=>{var N,b,K;let x=async u=>{t({...za,...e||{},...u})},P=(0,ce.useMemo)(()=>({...za,...e||{}}),[e]),[Me,$e]=(0,ut.useAsyncFn)(async u=>await d(u),[d]);(0,ut.useDebounce)(async()=>{await $e({brand:P.brand,categories:P.categories,keyword:P.keyword,sort:P.sort,sortOrder:P.sortOrder,count:P.count})},250,[P]);let re=(0,ce.useMemo)(()=>{let u=[];return a==null||a.forEach(Z=>{let E=Ha(Z,void 0);u.push(...E)}),u},[a]),ge=(0,ce.useMemo)(()=>[{value:"",label:"All categories"},...re.map(u=>({label:u.name,value:u.id}))],[re]),ie=(0,ce.useMemo)(()=>(o==null?void 0:o.map(u=>({id:u.id.toString(),name:u.name})))||[],[o]),Fe=u=>{if(!u)return;let Z=(e==null?void 0:e.categories)||[];x({categories:[...Z,u]})},tt=u=>{var Z;x({categories:(Z=e==null?void 0:e.categories)==null?void 0:Z.filter(E=>E!==u)})},we=u=>{x({brand:u.target.value})},q=u=>{x({count:u||1})};return r?(0,C.jsx)("div",{children:"Loading..."}):(0,C.jsx)(Zt.Provider,{value:{categories:a,logoIcon:c},children:(0,C.jsxs)("div",{css:z.css`
21
21
  > :not(:last-child) {
22
22
  margin-bottom: var(--spacing-md);
23
23
  }
24
- `,children:[U?(0,S.jsx)(F.InputSelect,{id:"selection-field-product-category",label:f,disabled:r,value:(y=(q=L.categories)==null?void 0:q[0])!=null?y:"",options:me,onChange:p=>{P({categories:p.target.value===""?[]:[p.target.value]})}}):(0,S.jsx)(qt,{loading:n||!1,id:"selection-field-product-category",label:f,onAdd:Ne,onRemove:et,selectedValues:L.categories,values:re}),(0,S.jsxs)("div",{css:z.css`
24
+ `,children:[I?(0,C.jsx)(F.InputSelect,{id:"selection-field-product-category",label:p,disabled:r,value:(b=(N=P.categories)==null?void 0:N[0])!=null?b:"",options:ge,onChange:u=>{x({categories:u.target.value===""?[]:[u.target.value]})}}):(0,C.jsx)(Yt,{loading:n||!1,id:"selection-field-product-category",label:p,onAdd:Fe,onRemove:tt,selectedValues:P.categories,values:re}),(0,C.jsxs)("div",{css:z.css`
25
25
  display: flex;
26
26
  flex-wrap: wrap;
27
27
  column-gap: var(--spacing-lg);
@@ -29,12 +29,12 @@
29
29
  ${(0,F.mq)("md")} {
30
30
  flex-wrap: nowrap;
31
31
  }
32
- `,children:[x?null:(0,S.jsx)("div",{css:z.css`
32
+ `,children:[v?null:(0,C.jsx)("div",{css:z.css`
33
33
  width: 50%;
34
- `,children:(0,S.jsx)(F.InputSelect,{id:"brand",name:"brand",label:c,disabled:i,value:L.brand,onChange:Se,options:[{value:"",label:"Choose..."},...ie.map(p=>({value:p.id,label:p.name}))]})}),(0,S.jsx)("div",{css:z.css`
34
+ `,children:(0,C.jsx)(F.InputSelect,{id:"brand",name:"brand",label:y,disabled:i,value:P.brand,onChange:we,options:[{value:"",label:"Choose..."},...ie.map(u=>({value:u.id,label:u.name}))]})}),(0,C.jsx)("div",{css:z.css`
35
35
  flex-grow: 1;
36
36
  position: relative;
37
- `,children:(0,S.jsx)(F.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:L.keyword,placeholder:"Enter keyword",onChange:p=>P({keyword:p.target.value})})})]}),(0,S.jsxs)("div",{css:z.css`
37
+ `,children:(0,C.jsx)(F.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:P.keyword,placeholder:"Enter keyword",onChange:u=>x({keyword:u.target.value})})})]}),(0,C.jsxs)("div",{css:z.css`
38
38
  display: flex;
39
39
  flex-wrap: wrap;
40
40
  column-gap: var(--spacing-lg);
@@ -42,31 +42,31 @@
42
42
  ${(0,F.mq)("md")} {
43
43
  flex-wrap: nowrap;
44
44
  }
45
- `,children:[(0,S.jsxs)("div",{css:z.css`
45
+ `,children:[(0,C.jsxs)("div",{css:z.css`
46
46
  width: 100%;
47
47
  ${(0,F.mq)("md")} {
48
48
  width: 33.333333%;
49
49
  }
50
50
  position: relative;
51
- `,children:[(0,S.jsx)(F.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:L.count,onChange:p=>O(p.target.valueAsNumber),label:"Count"}),(0,S.jsxs)("div",{css:z.css`
51
+ `,children:[(0,C.jsx)(F.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:P.count,onChange:u=>q(u.target.valueAsNumber),label:"Count"}),(0,C.jsxs)("div",{css:z.css`
52
52
  position: absolute;
53
53
  bottom: var(--spacing-sm);
54
54
  right: var(--spacing-sm);
55
55
  display: flex;
56
56
  gap: var(--spacing-sm);
57
- `,children:[(0,S.jsx)(Do,{onCountChange:()=>O(L.count-1),countIcon:"decrement",disabled:L.count===1}),(0,S.jsx)(Do,{onCountChange:()=>O(L.count+1),countIcon:"increment"})]})]}),Array.isArray(v)&&v.length>0?(0,S.jsx)("div",{css:z.css`
57
+ `,children:[(0,C.jsx)(Aa,{onCountChange:()=>q(P.count-1),countIcon:"decrement",disabled:P.count===1}),(0,C.jsx)(Aa,{onCountChange:()=>q(P.count+1),countIcon:"increment"})]})]}),Array.isArray(m)&&m.length>0?(0,C.jsx)("div",{css:z.css`
58
58
  flex-grow: 1;
59
59
  ${(0,F.mq)("md")} {
60
60
  width: 33.333333%;
61
61
  }
62
- `,children:(0,S.jsx)(F.InputSelect,{id:"sort",name:"sort",label:"Sort",value:L.sort,onChange:p=>P({sort:p.target.value}),options:[{value:"",label:"Select a sort"},...v.map(p=>({value:p.sortKey,label:p.name}))]})}):null,Array.isArray(s)&&s.length>0?(0,S.jsx)("div",{css:z.css`
62
+ `,children:(0,C.jsx)(F.InputSelect,{id:"sort",name:"sort",label:"Sort",value:P.sort,onChange:u=>x({sort:u.target.value}),options:[{value:"",label:"Select a sort"},...m.map(u=>({value:u.sortKey,label:u.name}))]})}):null,Array.isArray(s)&&s.length>0?(0,C.jsx)("div",{css:z.css`
63
63
  flex-grow: 1;
64
- `,children:(0,S.jsx)(F.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:L.sortOrder,onChange:p=>P({sortOrder:p.target.value}),options:s.map(p=>({value:p.sortOrderKey,label:p.name}))})}):null]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{css:z.css`
64
+ `,children:(0,C.jsx)(F.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:P.sortOrder,onChange:u=>x({sortOrder:u.target.value}),options:s.map(u=>({value:u.sortOrderKey,label:u.name}))})}):null]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("h3",{css:z.css`
65
65
  font-size: var(--fs-md);
66
66
  line-height: var(--spacing-md);
67
67
  font-weight: var(--fw-bold);
68
68
  margin-bottom: var(--spacing-xs);
69
- `,children:"Result Preview"}),(0,S.jsx)(Kt,{products:(K=Ue.value)==null?void 0:K.products})]})]})})};function Mo(e,t){var n;let a=[],o=t?`${t.name} > `:"",r={id:e.id.toString(),name:`${o}${e.name}`};return a.push(r),(n=e.children)==null||n.forEach(i=>{let m=Mo(i,r);a.push(...m)}),a}function Do({onCountChange:e,countIcon:t,disabled:a}){return(0,S.jsx)("button",{css:z.css`
69
+ `,children:"Result Preview"}),(0,C.jsx)(Jt,{products:(K=Me.value)==null?void 0:K.products})]})]})})};function Ha(e,t){var n;let o=[],a=t?`${t.name} > `:"",r={id:e.id.toString(),name:`${a}${e.name}`};return o.push(r),(n=e.children)==null||n.forEach(i=>{let c=Ha(i,r);o.push(...c)}),o}function Aa({onCountChange:e,countIcon:t,disabled:o}){return(0,C.jsx)("button",{css:z.css`
70
70
  width: 2.25rem;
71
71
  height: 2.25rem;
72
72
  border: 1px solid var(--gray-300);
@@ -78,17 +78,17 @@
78
78
  &:hover {
79
79
  background-color: var(--gray-200);
80
80
  }
81
- ${a?z.css`
81
+ ${o?z.css`
82
82
  cursor: not-allowed;
83
83
  opacity: 0.3;
84
84
  `:""}
85
- `,onClick:e,disabled:a,children:t==="increment"?(0,S.jsx)(it,{css:z.css`
85
+ `,onClick:e,disabled:o,children:t==="increment"?(0,C.jsx)(lt,{css:z.css`
86
86
  width: 1rem;
87
87
  height: 1rem;
88
- `}):(0,S.jsx)(st,{css:z.css`
88
+ `}):(0,C.jsx)(st,{css:z.css`
89
89
  width: 1rem;
90
90
  height: 1rem;
91
- `})})}var Nt=de.default.createContext(void 0),Wt=()=>{let e=(0,de.useContext)(Nt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};var Qt=require("@emotion/react/jsx-runtime");function oe({src:e,alt:t,className:a}){let o=e&&typeof e!="string"?e:null;return o?(0,Qt.jsx)(o,{className:a}):(0,Qt.jsx)("img",{src:e,alt:t,className:a})}var Zt=require("@emotion/react"),Fo=require("@uniformdev/design-system");var J=require("@emotion/react"),Uo=J.css`
91
+ `})})}var Zt=ce.default.createContext(void 0),Xt=()=>{let e=(0,ce.useContext)(Zt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};var J=require("@emotion/react"),Ga=J.css`
92
92
  align-items: center;
93
93
  background: var(--white);
94
94
  border-radius: var(--rounded-base);
@@ -103,55 +103,90 @@
103
103
  &:hover {
104
104
  background: var(--gray-50);
105
105
  }
106
- `,Bo=J.css`
106
+ `,Oa=J.css`
107
107
  font-size: var(--fs-sm);
108
- `,zo=J.css`
108
+ `,qa=J.css`
109
109
  width: 1rem;
110
110
  height: 1rem;
111
- `,Yt=J.css`
111
+ `,jt=J.css`
112
112
  margin-right: var(--spacing-lg);
113
113
  font-size: var(--fs-sm);
114
- `,Ao=J.css`
114
+ `,Na=J.css`
115
115
  border: 1px solid var(--gray-200);
116
116
  border-radius: var(--rounded-md);
117
117
  background: var(--gray-50);
118
118
  margin: var(--spacing-base) 0;
119
- `,Ho=J.css`
119
+ `,$a=J.css`
120
120
  align-items: center;
121
121
  display: flex;
122
122
  flex-grow: 1;
123
123
  gap: var(--spacing-base);
124
124
  padding: var(--spacing-sm);
125
125
  margin-right: var(--spacing-sm);
126
- `,Go=J.css`
126
+ `,Fa=J.css`
127
127
  background: var(--gray-200);
128
128
  width: 3.5rem;
129
129
  height: 3.5rem;
130
130
  object-fit: cover;
131
- `,Oo=J.css`
131
+ `,Wa=J.css`
132
132
  background: var(--gray-100);
133
133
  height: 3.5rem;
134
134
  width: 3.5rem;
135
- `,qo=J.css`
135
+ `,Ka=J.css`
136
136
  margin-top: 0;
137
137
  font-weight: var(--fw-bold);
138
138
  font-size: var(--fs-sm);
139
139
  width: calc(100% / 3);
140
- `,$o=J.css`
140
+ `,Qa=J.css`
141
141
  display: block;
142
142
  font-weight: var(--fw-regular);
143
- `;var _=require("@emotion/react/jsx-runtime"),Kt=({products:e})=>{let{categories:t,logoIcon:a}=Wt();return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("p",{css:Zt.css`
143
+ `;var D=require("@emotion/react/jsx-runtime"),Jt=({products:e})=>{let{categories:t,logoIcon:o}=Xt();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("p",{css:er.css`
144
144
  margin-bottom: var(--spacing-base);
145
- `,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),(0,_.jsx)("ul",{css:[Zt.css`
145
+ `,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),(0,D.jsx)("ul",{css:[er.css`
146
146
  max-height: 24rem;
147
147
  overflow-x: auto;
148
- `,Fo.scrollbarStyles],children:e==null?void 0:e.map((o,r)=>{var m,d;let[n]=(o==null?void 0:o.categories)||[],i=typeof n=="undefined"||!t||(m=t.find(v=>v.id===n.id))==null?void 0:m.name;return(0,_.jsx)("li",{css:Ao,children:(0,_.jsxs)("div",{css:Ho,"data-test-id":`product-item-${o.sku||o.id}`,children:[o.thumbnailUrl?(0,_.jsx)("img",{src:o.thumbnailUrl,alt:typeof o.title=="string"?o.title:o.name||`Product ${r}`,css:Go,"data-test-id":"product-image"}):(0,_.jsx)("div",{css:Oo}),(0,_.jsxs)("h4",{css:qo,"data-test-id":"product-name",children:[o.title||o.name,i&&(0,_.jsx)("span",{css:$o,children:i})]}),o&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("p",{css:Yt,"data-test-id":"product-sku",children:["SKU: ",o.sku||o.id,(0,_.jsx)("br",{})]}),o.price!==void 0?(0,_.jsxs)("p",{css:Yt,"data-test-id":"product-price",children:["Price: ",o.price]}):null,o.editLink||o.url?(0,_.jsxs)("a",{css:Uo,href:(d=o.editLink)!=null?d:o.url,title:`Go to ${o.title||o.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[(0,_.jsx)("span",{css:Bo,children:"Edit"}),a?(0,_.jsx)(oe,{src:a,alt:"Logo",css:zo}):null]}):null]})]})},`product-${o.id}`)})})]})};var xe=se(require("react"));var ae=se(require("react"));var ut={};Co(ut,{Caution:()=>No,Checkmark:()=>dt,ChevronDown:()=>ct,Close:()=>Wo,Danger:()=>Ko,ExclamationPoint:()=>Qo,Info:()=>pt,Lightbulb:()=>Yo,MagnifyingGlass:()=>Zo,MaximizeAlt:()=>Xo,Minus:()=>st,MoreVerticalAlt:()=>Xe,Plus:()=>it});var Xt=require("@emotion/react/jsx-runtime"),Ja=e=>(0,Xt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:(0,Xt.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})}),No=Ja;var Jt=require("@emotion/react/jsx-runtime"),ja=e=>(0,Jt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Jt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})}),dt=ja;var jt=require("@emotion/react/jsx-runtime"),en=e=>(0,jt.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:(0,jt.jsx)("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})}),ct=en;var ze=require("@emotion/react/jsx-runtime"),tn=e=>(0,ze.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:(0,ze.jsxs)("g",{fillRule:"evenodd",children:[(0,ze.jsx)("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),(0,ze.jsx)("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"})]})}),Wo=tn;var er=require("@emotion/react/jsx-runtime"),rn=e=>(0,er.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,er.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})}),Ko=rn;var tr=require("@emotion/react/jsx-runtime"),on=e=>(0,tr.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:(0,tr.jsx)("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})}),Qo=on;var Ze=require("@emotion/react/jsx-runtime"),an=e=>(0,Ze.jsxs)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[(0,Ze.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),(0,Ze.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})]}),pt=an;var rr=require("@emotion/react/jsx-runtime"),nn=e=>(0,rr.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,rr.jsx)("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})}),Yo=nn;var ce=require("@emotion/react/jsx-runtime"),sn=e=>(0,ce.jsxs)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,ce.jsxs)("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[(0,ce.jsx)("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),(0,ce.jsx)("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})]}),(0,ce.jsx)("defs",{children:(0,ce.jsx)("clipPath",{id:"magnifying-glass_svg__a",children:(0,ce.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Zo=sn;var or=require("@emotion/react/jsx-runtime"),ln=e=>(0,or.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,or.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})}),Xo=ln;var ar=require("@emotion/react/jsx-runtime"),dn=e=>(0,ar.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,ar.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Xe=dn;var ta=require("react-use"),ra=require("uuid");var Pe=require("react");function gt(e,t){let a=window.open(e,"_blank"),o=setInterval(()=>{a!=null&&a.closed&&(clearInterval(o),t())},500)}var jo=require("timeago.js");var Q=require("@emotion/react"),Jo=require("@uniformdev/design-system"),nr=Q.css`
148
+ `,Ya.scrollbarStyles],children:e==null?void 0:e.map((a,r)=>{var c,d;let[n]=(a==null?void 0:a.categories)||[],i=typeof n=="undefined"||!t||(c=t.find(m=>m.id===n.id))==null?void 0:c.name;return(0,D.jsx)("li",{css:Na,children:(0,D.jsxs)("div",{css:$a,"data-test-id":`product-item-${a.sku||a.id}`,children:[a.thumbnailUrl?(0,D.jsx)("img",{src:a.thumbnailUrl,alt:typeof a.title=="string"?a.title:a.name||`Product ${r}`,css:Fa,"data-test-id":"product-image"}):(0,D.jsx)("div",{css:Wa}),(0,D.jsxs)("h4",{css:Ka,"data-test-id":"product-name",children:[a.title||a.name,i&&(0,D.jsx)("span",{css:Qa,children:i})]}),a&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("p",{css:jt,"data-test-id":"product-sku",children:["SKU: ",a.sku||a.id,(0,D.jsx)("br",{})]}),a.price!==void 0?(0,D.jsxs)("p",{css:jt,"data-test-id":"product-price",children:["Price: ",a.price]}):null,a.editLink||a.url?(0,D.jsxs)("a",{css:Ga,href:(d=a.editLink)!=null?d:a.url,title:`Go to ${a.title||a.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[(0,D.jsx)("span",{css:Oa,children:"Edit"}),o?(0,D.jsx)(ae,{src:o,alt:"Logo",css:qa}):null]}):null]})]})},`product-${a.id}`)})})]})};var ro=require("@uniformdev/design-system"),be=se(require("react")),Rt=require("react-use");var ir=require("@emotion/react"),Ce=require("react");var fe=require("@emotion/react"),tr=fe.css`
149
+ cursor: pointer;
150
+ padding: var(--spacing-sm);
151
+ position: relative;
152
+ transition: background-color var(--duration-fast) var(--timing-ease-out),
153
+ color var(--duration-fast) var(--timing-ease-out);
154
+ `,rr=fe.css`
155
+ padding-right: var(--spacing-lg);
156
+ `,ar=fe.css`
157
+ background: var(--brand-secondary-3);
158
+ color: var(--white);
159
+ `,gt=fe.css`
160
+ font-size: var(--fs-xs);
161
+ `,mt=fe.css`
162
+ font-weight: var(--fw-bold);
163
+ margin-right: var(--spacing-sm);
164
+ `,or=fe.css`
165
+ background: var(--white);
166
+ border-left: 4px solid var(--brand-secondary-3);
167
+ border-radius: var(--rounded-base);
168
+ box-shadow: var(--shadow-base);
169
+ color: var(--brand-secondary-1);
170
+ padding: var(--spacing-base);
171
+ position: absolute;
172
+ top: var(--spacing-base);
173
+ right: var(--spacing-xl);
174
+ z-index: var(--z-10);
175
+ width: max-content;
176
+ `,nr=fe.css`
177
+ position: absolute;
178
+ inset: 0 var(--spacing-sm) 0 auto;
179
+ `;var W=require("@emotion/react/jsx-runtime"),sr=({result:e,isSelected:t,triggerSelection:o})=>{let a=(0,Ce.useRef)(null),r=(0,Ce.useRef)(null),[n,i]=(0,Ce.useState)(!1);(0,Ce.useEffect)(()=>{function d(m){a.current&&!a.current.contains(m.target)&&r.current&&!r.current.contains(m.target)&&i(!1)}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[r]);let c=d=>{d.stopPropagation(),i(!n)};return(0,W.jsxs)("div",{css:[tr,t?ar:void 0,e.popoverData?rr:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),children:[e.title,e.popoverData&&t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("button",{type:"button",ref:a,css:nr,"aria-controls":"path-details",onClick:d=>c(d),"aria-expanded":n,children:(0,W.jsx)(it,{width:24,height:24})}),(0,W.jsxs)("div",{id:"path-details","aria-hidden":!n,ref:r,css:[or,n?ir.css`
180
+ visibility: visible;
181
+ `:ir.css`
182
+ visibility: hidden;
183
+ `],children:[e.metadata&&Object.entries(e.metadata).map(([d,m],s)=>(0,W.jsxs)("div",{css:gt,children:[(0,W.jsxs)("span",{css:mt,children:[d,":"]}),m]},s)),Object.entries(e.popoverData).map(([d,m],s)=>(0,W.jsxs)("div",{css:gt,children:[(0,W.jsxs)("span",{css:mt,children:[d,":"]}),m]},s))]})]}):null]},e.id)};var pe=require("@emotion/react"),vr=require("@uniformdev/design-system"),Re=require("react"),ht=require("react-icons/cg"),Xa=require("timeago.js");function ft(e,t){let o=window.open(e,"_blank"),a=setInterval(()=>{o!=null&&o.closed&&(clearInterval(a),t())},500)}var Q=require("@emotion/react"),Za=require("@uniformdev/design-system"),lr=Q.css`
149
184
  border: 1px solid var(--gray-200);
150
185
  background: var(--gray-50);
151
186
  border-radius: var(--rounded-base);
152
187
  display: flex;
153
188
  width: 100%;
154
- `,ir=Q.css`
189
+ `,dr=Q.css`
155
190
  align-items: center;
156
191
  display: flex;
157
192
  flex-grow: 1;
@@ -159,22 +194,22 @@
159
194
  margin-inline: 0 var(--spacing-sm);
160
195
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
161
196
  position: relative;
162
- `,sr=Q.css`
197
+ `,cr=Q.css`
163
198
  flex-grow: 1;
164
- `,lr=Q.css`
199
+ `,pr=Q.css`
165
200
  align-items: start;
166
201
  display: inline-flex;
167
202
  position: relative;
168
- `,dr=Q.css`
203
+ `,ur=Q.css`
169
204
  color: var(--brand-secondary-1);
170
205
  font-size: var(--fs-base);
171
206
  font-weight: var(--fw-bold);
172
207
  line-height: 1;
173
208
  margin: 0;
174
- `,cr=Q.css`
209
+ `,gr=Q.css`
175
210
  width: 1.5rem;
176
211
  height: 1.5rem;
177
- `,pr=Q.css`
212
+ `,mr=Q.css`
178
213
  background: var(--white);
179
214
  border-radius: var(--rounded-base);
180
215
  border-left: 4px solid var(--brand-secondary-3);
@@ -183,22 +218,22 @@
183
218
  padding: var(--spacing-base);
184
219
  z-index: var(--z-10);
185
220
  width: max-content;
186
- `,he=Q.css`
221
+ `,ve=Q.css`
187
222
  font-size: var(--fs-sm);
188
- `,Ae=Q.css`
223
+ `,ze=Q.css`
189
224
  font-weight: var(--fw-bold);
190
225
  margin-right: var(--spacing-sm);
191
- `,ur=Q.css`
226
+ `,fr=Q.css`
192
227
  display: flex;
193
228
  flex-direction: column;
194
229
  gap: var(--spacing-sm);
195
230
 
196
- ${(0,Jo.mq)("md")} {
231
+ ${(0,Za.mq)("md")} {
197
232
  flex-direction: row;
198
233
  min-width: 200px;
199
234
  justify-content: end;
200
235
  }
201
- `,mt=Q.css`
236
+ `,vt=Q.css`
202
237
  align-items: center;
203
238
  background: var(--white);
204
239
  border-radius: var(--rounded-base);
@@ -213,64 +248,29 @@
213
248
  &:hover {
214
249
  background: var(--gray-50);
215
250
  }
216
- `;var pe=require("@emotion/react");var gr=require("@uniformdev/design-system"),ft=require("react-icons/cg"),C=require("@emotion/react/jsx-runtime"),mr=({selectedItem:e,logoIcon:t,onDeselect:a,onEditClosed:o})=>{var v;let r=(0,Pe.useRef)(null),n=(0,Pe.useRef)(null),[i,m]=(0,Pe.useState)(!1);(0,Pe.useEffect)(()=>{let s=c=>{r.current&&!r.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&m(!1)},f=()=>{m(!1)};return window.addEventListener("resize",f,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",f,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[n]);let d=()=>{var s;if(m(!i),n.current&&r.current){let f=(s=r==null?void 0:r.current)==null?void 0:s.getBoundingClientRect(),c=n.current.offsetWidth;n.current.style.top=`${f.top+30}px`,n.current.style.left=`${f.left-c+30}px`}};return(0,C.jsx)("div",{css:nr,children:(0,C.jsxs)("div",{css:ir,children:[(0,C.jsxs)("div",{css:sr,children:[(0,C.jsxs)("div",{css:lr,children:[(0,C.jsx)("h4",{css:[dr,e.popoverData?pe.css`
251
+ `;var R=require("@emotion/react/jsx-runtime"),hr=({selectedItem:e,logoIcon:t,onDeselect:o,onEditClosed:a})=>{var m;let r=(0,Re.useRef)(null),n=(0,Re.useRef)(null),[i,c]=(0,Re.useState)(!1);(0,Re.useEffect)(()=>{let s=y=>{r.current&&!r.current.contains(y.target)&&n.current&&!n.current.contains(y.target)&&c(!1)},p=()=>{c(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[n]);let d=()=>{var s;if(c(!i),n.current&&r.current){let p=(s=r==null?void 0:r.current)==null?void 0:s.getBoundingClientRect(),y=n.current.offsetWidth;n.current.style.top=`${p.top+30}px`,n.current.style.left=`${p.left-y+30}px`}};return(0,R.jsx)("div",{css:lr,children:(0,R.jsxs)("div",{css:dr,children:[(0,R.jsxs)("div",{css:cr,children:[(0,R.jsxs)("div",{css:pr,children:[(0,R.jsx)("h4",{css:[ur,e.popoverData?pe.css`
217
252
  margin-bottom: var(--spacing-sm);
218
- `:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("button",{type:"button",ref:r,css:pe.css`
253
+ `:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("button",{type:"button",ref:r,css:pe.css`
219
254
  margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
220
- `,"aria-controls":"path-details","aria-expanded":i,onClick:d,children:(0,C.jsx)(gr.Icon,{icon:ft.CgInfo,iconColor:"gray",size:24,css:pe.css`
255
+ `,"aria-controls":"path-details","aria-expanded":i,onClick:d,children:(0,R.jsx)(vr.Icon,{icon:ht.CgInfo,iconColor:"gray",size:24,css:pe.css`
221
256
  opacity: var(--opacity-75);
222
- `})}),(0,C.jsx)("div",{id:"path-details","aria-hidden":!i,ref:n,css:[pr,i?pe.css`
257
+ `})}),(0,R.jsx)("div",{id:"path-details","aria-hidden":!i,ref:n,css:[mr,i?pe.css`
223
258
  visibility: visible;
224
259
  `:pe.css`
225
260
  visibility: hidden;
226
- `],children:Object.entries(e.popoverData).map(([s,f],c)=>(0,C.jsxs)("div",{css:he,children:[(0,C.jsxs)("span",{css:Ae,children:[s,":"]}),f]},c))})]}):null]}),e.createdDate&&(0,C.jsxs)("div",{css:he,children:[(0,C.jsx)("span",{css:Ae,children:"Created:"}),(0,jo.format)((v=e.createdDate)!=null?v:0)]}),e.metadata?Object.entries(e.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,f])=>(0,C.jsxs)("div",{css:[he,pe.css`
261
+ `],children:Object.entries(e.popoverData).map(([s,p],y)=>(0,R.jsxs)("div",{css:ve,children:[(0,R.jsxs)("span",{css:ze,children:[s,":"]}),p]},y))})]}):null]}),e.createdDate&&(0,R.jsxs)("div",{css:ve,children:[(0,R.jsx)("span",{css:ze,children:"Created:"}),(0,Xa.format)((m=e.createdDate)!=null?m:0)]}),e.metadata?Object.entries(e.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,R.jsxs)("div",{css:[ve,pe.css`
227
262
  order: 1;
228
- `],children:[(0,C.jsxs)("span",{css:Ae,children:[s,":"]}),f]},s)):null,e.metadata?Object.entries(e.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,f])=>(0,C.jsxs)("div",{css:[he,pe.css`
263
+ `],children:[(0,R.jsxs)("span",{css:ze,children:[s,":"]}),p]},s)):null,e.metadata?Object.entries(e.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,R.jsxs)("div",{css:[ve,pe.css`
229
264
  order: 1;
230
- `],children:[(0,C.jsxs)("span",{css:[Ae,pe.css`
265
+ `],children:[(0,R.jsxs)("span",{css:[ze,pe.css`
231
266
  order: 1;
232
- `],children:[s,":"]}),f]},s)):null]}),(0,C.jsxs)("div",{css:ur,children:[e.editLink?(0,C.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{o&&(gt(s.currentTarget.href,()=>o(e)),s.preventDefault())},css:mt,children:[(0,C.jsx)("span",{css:he,children:"Edit"}),(0,C.jsx)(oe,{src:t,css:cr,alt:"Logo"})]}):null,(0,C.jsxs)("button",{type:"button",onClick:()=>{a(e)},css:mt,children:[(0,C.jsx)("span",{css:he,children:"Unlink"}),(0,C.jsx)(gr.Icon,{icon:ft.CgClose,iconColor:"red",size:16})]})]})]})},e.id)};var ke=require("react");var ye=require("@emotion/react"),fr=ye.css`
233
- cursor: pointer;
234
- padding: var(--spacing-sm);
235
- position: relative;
236
- transition: background-color var(--duration-fast) var(--timing-ease-out),
237
- color var(--duration-fast) var(--timing-ease-out);
238
- `,vr=ye.css`
239
- padding-right: var(--spacing-lg);
240
- `,hr=ye.css`
241
- background: var(--brand-secondary-3);
242
- color: var(--white);
243
- `,vt=ye.css`
244
- font-size: var(--fs-xs);
245
- `,ht=ye.css`
246
- font-weight: var(--fw-bold);
247
- margin-right: var(--spacing-sm);
248
- `,yr=ye.css`
249
- background: var(--white);
250
- border-left: 4px solid var(--brand-secondary-3);
251
- border-radius: var(--rounded-base);
252
- box-shadow: var(--shadow-base);
253
- color: var(--brand-secondary-1);
254
- padding: var(--spacing-base);
255
- position: absolute;
256
- top: var(--spacing-base);
257
- right: var(--spacing-xl);
258
- z-index: var(--z-10);
259
- width: max-content;
260
- `,br=ye.css`
261
- position: absolute;
262
- inset: 0 var(--spacing-sm) 0 auto;
263
- `;var xr=require("@emotion/react"),N=require("@emotion/react/jsx-runtime"),wr=({result:e,isSelected:t,triggerSelection:a})=>{let o=(0,ke.useRef)(null),r=(0,ke.useRef)(null),[n,i]=(0,ke.useState)(!1);(0,ke.useEffect)(()=>{function d(v){o.current&&!o.current.contains(v.target)&&r.current&&!r.current.contains(v.target)&&i(!1)}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[r]);let m=d=>{d.stopPropagation(),i(!n)};return(0,N.jsxs)("div",{css:[fr,t?hr:void 0,e.popoverData?vr:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>a(),children:[e.title,e.popoverData&&t?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("button",{type:"button",ref:o,css:br,"aria-controls":"path-details",onClick:d=>m(d),"aria-expanded":n,children:(0,N.jsx)(pt,{width:24,height:24})}),(0,N.jsxs)("div",{id:"path-details","aria-hidden":!n,ref:r,css:[yr,n?xr.css`
264
- visibility: visible;
265
- `:xr.css`
266
- visibility: hidden;
267
- `],children:[e.metadata&&Object.entries(e.metadata).map(([d,v],s)=>(0,N.jsxs)("div",{css:vt,children:[(0,N.jsxs)("span",{css:ht,children:[d,":"]}),v]},s)),Object.entries(e.popoverData).map(([d,v],s)=>(0,N.jsxs)("div",{css:vt,children:[(0,N.jsxs)("span",{css:ht,children:[d,":"]}),v]},s))]})]}):null]},e.id)};var He=require("react-beautiful-dnd");var B=require("@emotion/react"),Sr=B.css`
267
+ `],children:[s,":"]}),p]},s)):null]}),(0,R.jsxs)("div",{css:fr,children:[e.editLink?(0,R.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{a&&(ft(s.currentTarget.href,()=>a(e)),s.preventDefault())},css:vt,children:[(0,R.jsx)("span",{css:ve,children:"Edit"}),(0,R.jsx)(ae,{src:t,css:gr,alt:"Logo"})]}):null,(0,R.jsxs)("button",{type:"button",onClick:()=>{o(e)},css:vt,children:[(0,R.jsx)("span",{css:ve,children:"Unlink"}),(0,R.jsx)(vr.Icon,{icon:ht.CgClose,iconColor:"red",size:16})]})]})]})},e.id)};var j=require("@emotion/react"),V=require("@uniformdev/design-system"),oe=se(require("react")),Ae=require("react-beautiful-dnd"),ja=require("react-use"),eo=require("uuid");var Pe=require("react");function Ja(e,{delay:t=500,minDuration:o=200}={delay:500,minDuration:200}){let[a,r]=(0,Pe.useState)("IDLE"),n=(0,Pe.useRef)(void 0);return(0,Pe.useEffect)(()=>{e&&a==="IDLE"&&(clearTimeout(n.current),n.current=setTimeout(()=>{if(!e)return r("IDLE");n.current=setTimeout(()=>{r("EXPIRE")},o),r("DISPLAY")},t),r("DELAY")),!e&&a!=="DISPLAY"&&(clearTimeout(n.current),r("IDLE"))},[e,a,t,o]),(0,Pe.useEffect)(()=>()=>clearTimeout(n.current),[]),a==="DISPLAY"||a==="EXPIRE"}var B=require("@emotion/react"),br=B.css`
268
268
  background: var(--white);
269
269
  border: 1px solid var(--gray-300);
270
270
  border-radius: var(--rounded-base);
271
271
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
272
272
  margin-bottom: var(--spacing-base);
273
- `,Cr=B.css`
273
+ `,yr=B.css`
274
274
  align-items: center;
275
275
  display: flex;
276
276
  position: relative;
@@ -278,7 +278,7 @@
278
278
  width: 100%;
279
279
  background-color: transparent;
280
280
  border: 0;
281
- `,Rr=B.css`
281
+ `,xr=B.css`
282
282
  color: var(--brand-secondary-1);
283
283
  display: block;
284
284
  font-weight: var(--fw-bold);
@@ -294,15 +294,15 @@
294
294
  background: var(--gray-100);
295
295
  outline: none;
296
296
  }
297
- `,Pr=B.css`
297
+ `,wr=B.css`
298
298
  background: var(--white);
299
299
  border: 1px solid var(--gray-300);
300
300
  border-radius: var(--rounded-base);
301
301
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
302
302
  display: block;
303
- `,kr=B.css`
303
+ `,Sr=B.css`
304
304
  display: none;
305
- `,Tr=B.css`
305
+ `,Cr=B.css`
306
306
  overflow-y: auto;
307
307
  height: 16rem;
308
308
  margin-bottom: var(--spacing-base);
@@ -311,26 +311,26 @@
311
311
  & > :not(:last-child) {
312
312
  border-bottom: 1px solid var(--gray-200);
313
313
  }
314
- `,cn=B.css`
314
+ `,gn=B.css`
315
315
  background-color: var(--gray-50);
316
316
  max-width: 33.33%;
317
- `,Lr=B.css`
317
+ `,Rr=B.css`
318
318
  align-items: center;
319
319
  display: flex;
320
320
  position: absolute;
321
321
  inset: 0 0 0 auto;
322
322
  pointer-events: none;
323
323
  padding-right: var(--spacing-sm);
324
- `,_r=B.css`
324
+ `,Pr=B.css`
325
325
  color: var(--brand-secondary-1);
326
326
  width: 1.25rem;
327
327
  height: 1.25rem;
328
328
  transition: transform var(--duration-fast) var(--timing-ease-out);
329
329
  transform: rotate(0);
330
- `,pn=B.css`
330
+ `,mn=B.css`
331
331
  background: var(--white);
332
332
  color: var(--brand-secondary-1);
333
- `,Ir=B.css`
333
+ `,Tr=B.css`
334
334
  position: relative;
335
335
  margin-block: var(--spacing-sm) 0;
336
336
 
@@ -342,96 +342,96 @@
342
342
  left: auto !important;
343
343
  top: auto !important;
344
344
  }
345
- `,Vr=B.css`
345
+ `,kr=B.css`
346
346
  align-items: center;
347
347
  display: flex;
348
348
  position: absolute;
349
349
  inset: 0 auto 0 0;
350
350
  margin-block: auto;
351
351
  opacity: 0;
352
- `,yt=B.css`
352
+ `,bt=B.css`
353
353
  color: var(--brand-secondary-1);
354
- `,Er=B.css`
354
+ `,Lr=B.css`
355
355
  position: absolute;
356
356
  left: 0.375rem;
357
- `,bt=B.css`
357
+ `,yt=B.css`
358
358
  width: calc(var(--spacing-lg) + var(--spacing-xs));
359
359
  height: calc(var(--spacing-lg) + var(--spacing-xs));
360
- `;var j=require("@emotion/react"),V=require("@uniformdev/design-system");var Te=require("react");function ea(e,{delay:t=500,minDuration:a=200}={delay:500,minDuration:200}){let[o,r]=(0,Te.useState)("IDLE"),n=(0,Te.useRef)(void 0);return(0,Te.useEffect)(()=>{e&&o==="IDLE"&&(clearTimeout(n.current),n.current=setTimeout(()=>{if(!e)return r("IDLE");n.current=setTimeout(()=>{r("EXPIRE")},a),r("DISPLAY")},t),r("DELAY")),!e&&o!=="DISPLAY"&&(clearTimeout(n.current),r("IDLE"))},[e,o,t,a]),(0,Te.useEffect)(()=>()=>clearTimeout(n.current),[]),o==="DISPLAY"||o==="EXPIRE"}var g=require("@emotion/react/jsx-runtime"),un=({searchText:e,selectedContentType:t})=>{let a="No content found";return t&&t!=="any"&&(a=`No ${t} content was found`),e&&(a=`${a} for keyword '${e}'.`),(0,g.jsx)(V.Callout,{type:"info",children:a})},Dr=({search:e,results:t,contentTypes:a,selectedItems:o,logoIcon:r,select:n,multiSelect:i,multiSelectId:m,rowComponent:d,selectedItemComponent:v,totalResults:s,cursor:f,resultsLoading:c,requireContentType:x,onAddNew:U,onEditClosed:P,onCancel:L,noResultsComponent:Ue,helpComponent:Fe,onSort:re,typeSelectorLabel:me="Content Type Select",typeSelectorAllTypesOptionText:ie="All content types",loadingIndicatorDelay:Ne=1e3})=>{var xo,wo,So;let Se=()=>x?Array.isArray(a)&&a.length>0?a[0].id:"":"any",[O,q]=ae.useState(""),[y,K]=ae.useState(Se),[p,Z]=ae.useState(!1),[E,Ce]=ae.useState([]),[ka,vo]=ae.useState(!1),Mt=ae.useRef(`x${(0,ra.v4)()}`);(0,ta.useDebounce)(()=>{e(O,{count:5,offset:0,contentType:y==="any"?void 0:y})},300,[O,y]);let Ta=ea(c,{delay:Ne}),La=u=>{E.some(R=>R.id===u.id)?Ce(R=>R.filter(fe=>fe.id!==u.id)):Ce(i?R=>[...R,u]:[u])},_a=o==null?void 0:o.map(u=>u.id+u.title).join(",");ae.useEffect(()=>{Array.isArray(o)&&Ce(o)},[_a]);let Ia=()=>{K(Se()),q(""),Ce(o!=null&&o.length?o:[])},Va=()=>{Z(u=>!u),p||Ia()},ho=u=>{let R=(E==null?void 0:E.filter(fe=>fe.id!==u.id))||[];Ce(R),n(R,"")},Ea=u=>{u.preventDefault(),n(E,y),Z(!1)},Da=u=>{u.preventDefault(),Z(!1),L&&L()},Ma=()=>{e(O,{count:5,offset:(t==null?void 0:t.length)||0,contentType:y==="any"?void 0:y,cursor:f}),vo(!0);let u=setTimeout(()=>{vo(!1)},750);return()=>clearTimeout(u)},Ua=!(o==null?void 0:o.length)||i,Ba=d||wr,yo=v||mr,za=Ue||un,bo=r&&typeof r!="string"?r:null,Aa=bo?(0,g.jsx)(bo,{css:bt}):(0,g.jsx)("img",{src:r,alt:"Logo",css:bt}),Ha=u=>{var R,fe;if(u.destination&&u.source.droppableId===((R=u.destination)==null?void 0:R.droppableId)){let $=[...o||[]],[Ut]=(fe=$==null?void 0:$.splice(u.source.index,1))!=null?fe:[];return $==null||$.splice(u.destination.index,0,Ut),re&&(Ce($),re==null||re($)),$}};return(0,g.jsx)("div",{css:j.css`
360
+ `;var f=require("@emotion/react/jsx-runtime"),fn=({searchText:e,selectedContentType:t})=>{let o="No content found";return t&&t!=="any"&&(o=`No ${t} content was found`),e&&(o=`${o} for keyword '${e}'.`),(0,f.jsx)(V.Callout,{type:"info",children:o})},_r=({search:e,results:t,contentTypes:o,selectedItems:a,logoIcon:r,select:n,multiSelect:i,multiSelectId:c,rowComponent:d,selectedItemComponent:m,totalResults:s,cursor:p,resultsLoading:y,requireContentType:v,onAddNew:I,onEditClosed:x,onCancel:P,noResultsComponent:Me,helpComponent:$e,onSort:re,typeSelectorLabel:ge="Content Type Select",typeSelectorAllTypesOptionText:ie="All content types",loadingIndicatorDelay:Fe=1e3})=>{var wa,Sa,Ca;let we=()=>v?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[q,N]=oe.useState(""),[b,K]=oe.useState(we),[u,Z]=oe.useState(!1),[E,Se]=oe.useState([]),[Vo,ha]=oe.useState(!1),Mt=oe.useRef(`x${(0,eo.v4)()}`);(0,ja.useDebounce)(()=>{e(q,{count:5,offset:0,contentType:b==="any"?void 0:b})},300,[q,b]);let Eo=Ja(y,{delay:Fe}),Mo=g=>{E.some(T=>T.id===g.id)?Se(T=>T.filter(me=>me.id!==g.id)):Se(i?T=>[...T,g]:[g])},Uo=a==null?void 0:a.map(g=>g.id+g.title).join(",");oe.useEffect(()=>{Array.isArray(a)&&Se(a)},[Uo]);let Bo=()=>{K(we()),N(""),Se(a!=null&&a.length?a:[])},zo=()=>{Z(g=>!g),u||Bo()},ba=g=>{let T=(E==null?void 0:E.filter(me=>me.id!==g.id))||[];Se(T),n(T,"")},Ao=g=>{g.preventDefault(),n(E,b),Z(!1)},Ho=g=>{g.preventDefault(),Z(!1),P&&P()},Go=()=>{e(q,{count:5,offset:(t==null?void 0:t.length)||0,contentType:b==="any"?void 0:b,cursor:p}),ha(!0);let g=setTimeout(()=>{ha(!1)},750);return()=>clearTimeout(g)},Oo=!(a==null?void 0:a.length)||i,qo=d||sr,ya=m||hr,No=Me||fn,xa=r&&typeof r!="string"?r:null,$o=xa?(0,f.jsx)(xa,{css:yt}):(0,f.jsx)("img",{src:r,alt:"Logo",css:yt}),Fo=g=>{var T,me;if(g.destination&&g.source.droppableId===((T=g.destination)==null?void 0:T.droppableId)){let $=[...a||[]],[Ut]=(me=$==null?void 0:$.splice(g.source.index,1))!=null?me:[];return $==null||$.splice(g.destination.index,0,Ut),re&&(Se($),re==null||re($)),$}};return(0,f.jsx)("div",{css:j.css`
361
361
  width: 100%;
362
- `,children:(0,g.jsxs)("div",{css:j.css`
362
+ `,children:(0,f.jsxs)("div",{css:j.css`
363
363
  position: relative;
364
364
  margin-block: var(--spacing-base);
365
- `,children:[Ua?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{css:Sr,"data-test-id":"component-search",children:(0,g.jsxs)("button",{css:Cr,onClick:Va,type:"button","aria-haspopup":!0,"aria-expanded":p,"aria-controls":`entry-search-config-${Mt.current}`,children:[Aa,(0,g.jsx)("span",{css:j.css`
365
+ `,children:[Oo?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{css:br,"data-test-id":"component-search",children:(0,f.jsxs)("button",{css:yr,onClick:zo,type:"button","aria-haspopup":!0,"aria-expanded":u,"aria-controls":`entry-search-config-${Mt.current}`,children:[$o,(0,f.jsx)("span",{css:j.css`
366
366
  margin-left: var(--spacing-base);
367
- `,children:"Select"}),(0,g.jsx)("span",{css:Lr,children:(0,g.jsx)(ct,{css:[_r,p?j.css`
367
+ `,children:"Select"}),(0,f.jsx)("span",{css:Rr,children:(0,f.jsx)(nt,{css:[Pr,u?j.css`
368
368
  transform: rotate(180deg);
369
- `:void 0]})})]})}),(0,g.jsxs)("div",{id:`entry-search-config-${Mt.current}`,"aria-hidden":!p,css:[Pr,p?void 0:kr],children:[Fe||null,(0,g.jsxs)("div",{css:j.css`
369
+ `:void 0]})})]})}),(0,f.jsxs)("div",{id:`entry-search-config-${Mt.current}`,"aria-hidden":!u,css:[wr,u?void 0:Sr],children:[$e||null,(0,f.jsxs)("div",{css:j.css`
370
370
  display: flex;
371
371
  gap: calc(var(--spacing-base) - 0.25rem);
372
372
  margin-bottom: var(--spacing-base);
373
- `,children:[(0,g.jsx)(V.InputSelect,{onChange:u=>K(u.target.value),value:y,label:me,showLabel:!1,options:[...x?[]:[{value:"any",label:ie}],...a?a.map(u=>({value:u.id,label:u.name})):[]]}),(0,g.jsx)("div",{css:j.css`
373
+ `,children:[(0,f.jsx)(V.InputSelect,{onChange:g=>K(g.target.value),value:b,label:ge,showLabel:!1,options:[...v?[]:[{value:"any",label:ie}],...o?o.map(g=>({value:g.id,label:g.name})):[]]}),(0,f.jsx)("div",{css:j.css`
374
374
  flex-grow: 1;
375
- `,children:(0,g.jsx)(V.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:q,disabledFieldSubmission:!0,value:O})})]}),(0,g.jsxs)("div",{css:[Tr,V.scrollbarStyles],id:Mt.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[(0,g.jsx)(V.LoadingOverlay,{isActive:Ta}),Array.isArray(t)&&t.length>0?t.map(u=>(0,g.jsx)(Ba,{isSelected:E.some(R=>R.id===u.id),result:u,triggerSelection:()=>La(u)},u.id)):c?null:(0,g.jsx)(za,{searchText:O||O,selectedContentType:(wo=(xo=a==null?void 0:a.find(u=>u.id===y))==null?void 0:xo.name)!=null?wo:y}),!c&&typeof s!="undefined"&&t&&(t==null?void 0:t.length)<s&&(0,g.jsx)("button",{type:"button",css:Rr,onClick:Ma,children:ka?(0,g.jsx)(V.LoadingIndicator,{}):"Load More"})]}),(0,g.jsxs)("div",{css:j.css`
375
+ `,children:(0,f.jsx)(V.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:N,disabledFieldSubmission:!0,value:q})})]}),(0,f.jsxs)("div",{css:[Cr,V.scrollbarStyles],id:Mt.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[(0,f.jsx)(V.LoadingOverlay,{isActive:Eo}),Array.isArray(t)&&t.length>0?t.map(g=>(0,f.jsx)(qo,{isSelected:E.some(T=>T.id===g.id),result:g,triggerSelection:()=>Mo(g)},g.id)):y?null:(0,f.jsx)(No,{searchText:q||q,selectedContentType:(Sa=(wa=o==null?void 0:o.find(g=>g.id===b))==null?void 0:wa.name)!=null?Sa:b}),!y&&typeof s!="undefined"&&t&&(t==null?void 0:t.length)<s&&(0,f.jsx)("button",{type:"button",css:xr,onClick:Go,children:Vo?(0,f.jsx)(V.LoadingIndicator,{}):"Load More"})]}),(0,f.jsxs)("div",{css:j.css`
376
376
  display: flex;
377
377
  justify-content: space-between;
378
- `,children:[(0,g.jsx)("div",{children:U&&((So=a==null?void 0:a.length)!=null?So:0)>0?(0,g.jsx)(V.Menu,{menuLabel:"Add new menu",menuTrigger:(0,g.jsx)(V.Button,{buttonType:"secondary",children:"Add New"}),children:a==null?void 0:a.map(u=>(0,g.jsx)(V.MenuItem,{css:j.css`
378
+ `,children:[(0,f.jsx)("div",{children:I&&((Ca=o==null?void 0:o.length)!=null?Ca:0)>0?(0,f.jsx)(V.Menu,{menuLabel:"Add new menu",menuTrigger:(0,f.jsx)(V.Button,{buttonType:"secondary",children:"Add New"}),children:o==null?void 0:o.map(g=>(0,f.jsx)(V.MenuItem,{css:j.css`
379
379
  background: var(--white);
380
380
  color: var(--brand-secondary-1);
381
- `,onClick:()=>U(u),children:u.name},u.id))}):null}),(0,g.jsxs)("div",{css:j.css`
381
+ `,onClick:()=>I(g),children:g.name},g.id))}):null}),(0,f.jsxs)("div",{css:j.css`
382
382
  display: flex;
383
383
  gap: var(--spacing-base);
384
- `,children:[(0,g.jsx)(V.Button,{buttonType:"unimportant",onClick:Da,children:"Cancel"}),(0,g.jsx)(V.Button,{disabled:!E.length,onClick:Ea,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,p?null:i&&E.length>1?(0,g.jsx)(He.DragDropContext,{onDragEnd:u=>Ha(u),children:(0,g.jsx)(He.Droppable,{droppableId:m||"canvas-multi-select",children:u=>(0,g.jsxs)("div",{...u.droppableProps,ref:u.innerRef,css:j.css`
384
+ `,children:[(0,f.jsx)(V.Button,{buttonType:"unimportant",onClick:Ho,children:"Cancel"}),(0,f.jsx)(V.Button,{disabled:!E.length,onClick:Ao,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,u?null:i&&E.length>1?(0,f.jsx)(Ae.DragDropContext,{onDragEnd:g=>Fo(g),children:(0,f.jsx)(Ae.Droppable,{droppableId:c||"canvas-multi-select",children:g=>(0,f.jsxs)("div",{...g.droppableProps,ref:g.innerRef,css:j.css`
385
385
  margin-block: var(--spacing-sm) 0;
386
- `,children:[E==null?void 0:E.map((R,fe)=>{if(R!=null&&R.id)return(0,g.jsx)(He.Draggable,{draggableId:R.id,index:fe,children:($,Ut)=>(0,g.jsxs)("div",{css:Ir,ref:$.innerRef,"data-dragging":Ut.isDragging,...$.draggableProps,...$.dragHandleProps,children:[(0,g.jsxs)("span",{css:Vr,children:[(0,g.jsx)(Xe,{css:[yt,Er],width:24,height:24}),(0,g.jsx)(Xe,{css:yt,width:24,height:24})]}),(0,g.jsx)(yo,{logoIcon:r,selectedItem:R,onDeselect:Bt=>ho(Bt),onEditClosed:P?Bt=>P(Bt):void 0},`selected-item-${R.id}`)]})},R.id)}),u.placeholder]})})}):E==null?void 0:E.map(u=>(0,g.jsx)(yo,{logoIcon:r,selectedItem:u,onDeselect:R=>ho(R),onEditClosed:P?R=>P(R):void 0},`selected-item-${u.id}`))]})})};var be=require("@emotion/react"),Mr=be.css`
386
+ `,children:[E==null?void 0:E.map((T,me)=>{if(T!=null&&T.id)return(0,f.jsx)(Ae.Draggable,{draggableId:T.id,index:me,children:($,Ut)=>(0,f.jsxs)("div",{css:Tr,ref:$.innerRef,"data-dragging":Ut.isDragging,...$.draggableProps,...$.dragHandleProps,children:[(0,f.jsxs)("span",{css:kr,children:[(0,f.jsx)(Ke,{css:[bt,Lr],width:24,height:24}),(0,f.jsx)(Ke,{css:bt,width:24,height:24})]}),(0,f.jsx)(ya,{logoIcon:r,selectedItem:T,onDeselect:Bt=>ba(Bt),onEditClosed:x?Bt=>x(Bt):void 0},`selected-item-${T.id}`)]})},T.id)}),g.placeholder]})})}):E==null?void 0:E.map(g=>(0,f.jsx)(ya,{logoIcon:r,selectedItem:g,onDeselect:T=>ba(T),onEditClosed:x?T=>x(T):void 0},`selected-item-${g.id}`))]})})};var zr=require("@emotion/react");var he=require("@emotion/react"),Ir=he.css`
387
387
  cursor: pointer;
388
388
  padding: var(--spacing-sm) 0;
389
389
  margin-right: var(--spacing-sm);
390
390
  position: relative;
391
391
  transition: background-color var(--duration-fast) var(--timing-ease-out),
392
392
  color var(--duration-fast) var(--timing-ease-out);
393
- `,Ur=be.css`
393
+ `,Dr=he.css`
394
394
  border: 2px solid transparent;
395
395
  border-radius: var(--rounded-base);
396
396
  display: flex;
397
397
  align-items: center;
398
398
  gap: var(--spacing-base);
399
399
  padding: var(--spacing-sm) var(--spacing-xs);
400
- `,Br=be.css`
400
+ `,Vr=he.css`
401
401
  background-color: var(--green-50);
402
- `,zr=be.css`
402
+ `,Er=he.css`
403
403
  font-size: var(--fs-sm);
404
404
  font-weight: var(--fw-bold);
405
405
  width: 50%;
406
- `,Ar=be.css`
406
+ `,Mr=he.css`
407
407
  font-weight: var(--fw-normal);
408
408
  display: block;
409
- `,Hr=be.css`
409
+ `,Ur=he.css`
410
410
  font-size: var(--fs-sm);
411
411
  > * {
412
412
  display: block;
413
413
  }
414
- `,Gr=be.css`
414
+ `,Br=he.css`
415
415
  display: block;
416
416
  height: 1.5rem;
417
417
  width: 1.5rem;
418
418
  color: var(--brand-secondary-3);
419
419
  margin-left: auto;
420
- `;var Or=require("@emotion/react");var ee=require("@emotion/react/jsx-runtime");function qr({result:e,isSelected:t,triggerSelection:a}){var m;let{categories:o,logoIcon:r}=Je(),[n]=e.categories||[{id:"",name:""}],i=typeof n=="undefined"||!o||(m=o.find(d=>d.id===n.id))==null?void 0:m.name;return(0,ee.jsx)("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>a(),css:[Mr],children:(0,ee.jsxs)("div",{css:[Ur,t?Br:void 0],children:[e.thumbnailUrl?(0,ee.jsx)("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:Or.css`
420
+ `;var ee=require("@emotion/react/jsx-runtime");function Ar({result:e,isSelected:t,triggerSelection:o}){var c;let{categories:a,logoIcon:r}=Qe(),[n]=e.categories||[{id:"",name:""}],i=typeof n=="undefined"||!a||(c=a.find(d=>d.id===n.id))==null?void 0:c.name;return(0,ee.jsx)("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Ir],children:(0,ee.jsxs)("div",{css:[Dr,t?Vr:void 0],children:[e.thumbnailUrl?(0,ee.jsx)("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:zr.css`
421
421
  background-color: var(--gray-200);
422
422
  width: 3rem;
423
423
  height: 3rem;
424
424
  object-fit: cover;
425
- `}):(0,ee.jsx)(oe,{src:r,alt:"Logo",css:Or.css`
425
+ `}):(0,ee.jsx)(ae,{src:r,alt:"Logo",css:zr.css`
426
426
  height: 2.25rem;
427
427
  width: 2.25rem;
428
- `}),(0,ee.jsxs)("h4",{css:[zr],children:[e.title,i?(0,ee.jsx)("span",{css:[Ar],children:i}):null]}),(0,ee.jsxs)("p",{css:[Hr],children:["SKU: ",e.sku||e.id,e.price!==void 0?(0,ee.jsx)("span",{children:e.price}):null]}),t?(0,ee.jsx)(dt,{css:[Gr]}):null]})},e.id)}var ue=require("@emotion/react"),$r=require("@uniformdev/design-system"),Fr=ue.css`
428
+ `}),(0,ee.jsxs)("h4",{css:[Er],children:[e.title,i?(0,ee.jsx)("span",{css:[Mr],children:i}):null]}),(0,ee.jsxs)("p",{css:[Ur],children:["SKU: ",e.sku||e.id,e.price!==void 0?(0,ee.jsx)("span",{children:e.price}):null]}),t?(0,ee.jsx)(ot,{css:[Br]}):null]})},e.id)}var Te=require("@emotion/react"),Ct=require("@uniformdev/design-system"),to=require("react-icons/cg");var ue=require("@emotion/react"),Hr=require("@uniformdev/design-system"),Gr=ue.css`
429
429
  border: 1px solid var(--gray-200);
430
430
  border-radius: var(--rounded-base);
431
431
  background: var(--gray-50);
432
432
  display: flex;
433
433
  width: 100%;
434
- `,Nr=ue.css`
434
+ `,Or=ue.css`
435
435
  align-items: center;
436
436
  display: flex;
437
437
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
@@ -439,13 +439,13 @@
439
439
  flex-grow: 1;
440
440
  gap: var(--spacing-sm);
441
441
  margin-inline: 0 var(--spacing-sm);
442
- `,Wr=ue.css`
442
+ `,qr=ue.css`
443
443
  display: flex;
444
444
  align-items: center;
445
445
  gap: var(--spacing-sm);
446
446
  flex-grow: 1;
447
447
 
448
- ${(0,$r.mq)("lg")} {
448
+ ${(0,Hr.mq)("lg")} {
449
449
  width: 50%;
450
450
  margin-bottom: 0;
451
451
  }
@@ -471,48 +471,48 @@
471
471
  }
472
472
  `,St=ue.css`
473
473
  font-size: var(--fs-sm);
474
- `,Kr=ue.css`
474
+ `,Nr=ue.css`
475
475
  display: block;
476
476
  width: 1rem;
477
477
  height: 1rem;
478
- `,Qr=ue.css`
478
+ `,$r=ue.css`
479
479
  display: flex;
480
480
  flex-direction: column;
481
481
  gap: var(--spacing-sm);
482
482
 
483
- ${(0,$r.mq)("md")} {
483
+ ${(0,Hr.mq)("md")} {
484
484
  flex-direction: row;
485
485
  min-width: 200px;
486
486
  justify-content: end;
487
487
  }
488
- `;var Le=require("@emotion/react"),Ct=require("@uniformdev/design-system"),oa=require("react-icons/cg"),k=require("@emotion/react/jsx-runtime");function Yr({selectedItem:e,onDeselect:t}){var i;let{categories:a,logoIcon:o}=Je(),[r]=e.categories||[{id:"",name:""}],n=typeof r=="undefined"||!a||(i=a.find(m=>m.id===r.id))==null?void 0:i.name;return(0,k.jsx)("div",{css:[Fr],children:(0,k.jsxs)("article",{css:[Nr],children:[(0,k.jsxs)("div",{css:[Wr],children:[e.thumbnailUrl?(0,k.jsx)("img",{src:e.thumbnailUrl,alt:n,css:[xt],loading:"lazy"}):(0,k.jsx)("div",{css:[xt]}),(0,k.jsxs)("div",{css:Le.css`
488
+ `;var L=require("@emotion/react/jsx-runtime");function Fr({selectedItem:e,onDeselect:t}){var i;let{categories:o,logoIcon:a}=Qe(),[r]=e.categories||[{id:"",name:""}],n=typeof r=="undefined"||!o||(i=o.find(c=>c.id===r.id))==null?void 0:i.name;return(0,L.jsx)("div",{css:[Gr],children:(0,L.jsxs)("article",{css:[Or],children:[(0,L.jsxs)("div",{css:[qr],children:[e.thumbnailUrl?(0,L.jsx)("img",{src:e.thumbnailUrl,alt:n,css:[xt],loading:"lazy"}):(0,L.jsx)("div",{css:[xt]}),(0,L.jsxs)("div",{css:Te.css`
489
489
  > :not(:last-child) {
490
490
  margin-bottom: var(--spacing-xs);
491
491
  }
492
- `,children:[(0,k.jsxs)("h4",{css:Le.css`
492
+ `,children:[(0,L.jsxs)("h4",{css:Te.css`
493
493
  margin-top: 0px;
494
494
  font-weight: var(--fw-bold);
495
- `,children:[e.title||e.id||"",n&&(0,k.jsx)("span",{css:Le.css`
495
+ `,children:[e.title||e.id||"",n&&(0,L.jsx)("span",{css:Te.css`
496
496
  display: block;
497
497
  font-weight: var(--fw-regular);
498
- `,children:n})]}),(0,k.jsxs)("ul",{css:Le.css`
498
+ `,children:n})]}),(0,L.jsxs)("ul",{css:Te.css`
499
499
  font-size: var(--fs-sm);
500
500
 
501
501
  ${(0,Ct.mq)("sm")} {
502
502
  display: flex;
503
503
  gap: var(--spacing-base);
504
504
  }
505
- `,children:[(0,k.jsxs)("li",{children:[(0,k.jsx)("span",{css:Le.css`
505
+ `,children:[(0,L.jsxs)("li",{children:[(0,L.jsx)("span",{css:Te.css`
506
506
  margin-right: var(--spacing-xs);
507
- `,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?(0,k.jsxs)("li",{children:[(0,k.jsx)("span",{css:Le.css`
507
+ `,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?(0,L.jsxs)("li",{children:[(0,L.jsx)("span",{css:Te.css`
508
508
  margin-right: var(--spacing-xs);
509
- `,children:"Price:"}),(0,k.jsx)("span",{children:e.price})]}):null]})]})]}),(0,k.jsxs)("div",{css:Qr,children:[e.editLink?(0,k.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:wt,children:[(0,k.jsx)("span",{css:St,children:"Edit"}),(0,k.jsx)(oe,{src:o,alt:"Logo",css:Kr})]}):null,(0,k.jsxs)("button",{type:"button",onClick:()=>{t==null||t(e)},css:wt,children:[(0,k.jsx)("span",{css:St,children:"Unlink"}),(0,k.jsx)(Ct.Icon,{icon:oa.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}var aa=require("@uniformdev/design-system"),Rt=require("react-use"),Ge=require("@emotion/react/jsx-runtime");function gn({selectedProducts:e,setSelectedProducts:t,onGetCategories:a,onSearchProducts:o,logoIcon:r,multiSelect:n,multiSelectId:i,selectedItemComponent:m,rowComponent:d,errorComponent:v,helpComponent:s,noResultsComponent:f,onSort:c,typeSelectorAllTypesOptionText:x="All categories",typeSelectorLabel:U="Select Category"}){var Se,O;let{value:P,loading:L,error:Ue}=(0,Rt.useAsync)(async()=>await a(),[a]),Fe=P==null?void 0:P.map(q=>q.id).join(","),re=(0,xe.useMemo)(()=>P?P.map(y=>({id:y.id,name:y.name})):void 0,[Fe]),me=(0,xe.useRef)(),[ie,Ne]=(0,Rt.useAsyncFn)(async(q,y)=>{let K=await o({text:q,options:{limit:y==null?void 0:y.count,offset:y==null?void 0:y.offset,categoryId:y==null?void 0:y.contentType,cursor:y==null?void 0:y.cursor}});return(y==null?void 0:y.offset)===0&&(me.current=[]),(me.current=me.current||[]).push(...K.products),K},[o]),et=async q=>{await t(q)};return Ue||ie.error?(0,Ge.jsx)(v||(({categoriesError:y,searchError:K})=>(0,Ge.jsxs)(aa.Callout,{type:"error",children:["There was an error: ",(y==null?void 0:y.message)||(K==null?void 0:K.message)]})),{categoriesError:Ue,searchError:ie.error}):(0,Ge.jsx)(Zr.Provider,{value:{categories:P,logoIcon:r},children:(0,Ge.jsx)(Dr,{search:Ne,results:me.current,logoIcon:r,selectedItems:e,select:et,multiSelectId:i||"product-search-multi-select",multiSelect:n,contentTypes:re,selectedItemComponent:m||Yr,rowComponent:d||qr,totalResults:(Se=ie.value)==null?void 0:Se.total,cursor:(O=ie.value)==null?void 0:O.cursor,resultsLoading:ie.loading||L,helpComponent:s,noResultsComponent:f,onSort:c,typeSelectorAllTypesOptionText:x,typeSelectorLabel:U})})}var Zr=xe.default.createContext(void 0),Je=()=>{let e=(0,xe.useContext)(Zr);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};var A=require("@emotion/react"),na=require("@uniformdev/design-system"),Xr=A.css`
509
+ `,children:"Price:"}),(0,L.jsx)("span",{children:e.price})]}):null]})]})]}),(0,L.jsxs)("div",{css:$r,children:[e.editLink?(0,L.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:wt,children:[(0,L.jsx)("span",{css:St,children:"Edit"}),(0,L.jsx)(ae,{src:a,alt:"Logo",css:Nr})]}):null,(0,L.jsxs)("button",{type:"button",onClick:()=>{t==null||t(e)},css:wt,children:[(0,L.jsx)("span",{css:St,children:"Unlink"}),(0,L.jsx)(Ct.Icon,{icon:to.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}var He=require("@emotion/react/jsx-runtime");function vn({selectedProducts:e,setSelectedProducts:t,onGetCategories:o,onSearchProducts:a,logoIcon:r,multiSelect:n,multiSelectId:i,selectedItemComponent:c,rowComponent:d,errorComponent:m,helpComponent:s,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:v="All categories",typeSelectorLabel:I="Select Category"}){var we,q;let{value:x,loading:P,error:Me}=(0,Rt.useAsync)(async()=>await o(),[o]),$e=x==null?void 0:x.map(N=>N.id).join(","),re=(0,be.useMemo)(()=>x?x.map(b=>({id:b.id,name:b.name})):void 0,[$e]),ge=(0,be.useRef)(),[ie,Fe]=(0,Rt.useAsyncFn)(async(N,b)=>{let K=await a({text:N,options:{limit:b==null?void 0:b.count,offset:b==null?void 0:b.offset,categoryId:b==null?void 0:b.contentType,cursor:b==null?void 0:b.cursor}});return(b==null?void 0:b.offset)===0&&(ge.current=[]),(ge.current=ge.current||[]).push(...K.products),K},[a]),tt=async N=>{await t(N)};return Me||ie.error?(0,He.jsx)(m||(({categoriesError:b,searchError:K})=>(0,He.jsxs)(ro.Callout,{type:"error",children:["There was an error: ",(b==null?void 0:b.message)||(K==null?void 0:K.message)]})),{categoriesError:Me,searchError:ie.error}):(0,He.jsx)(Wr.Provider,{value:{categories:x,logoIcon:r},children:(0,He.jsx)(_r,{search:Fe,results:ge.current,logoIcon:r,selectedItems:e,select:tt,multiSelectId:i||"product-search-multi-select",multiSelect:n,contentTypes:re,selectedItemComponent:c||Fr,rowComponent:d||Ar,totalResults:(we=ie.value)==null?void 0:we.total,cursor:(q=ie.value)==null?void 0:q.cursor,resultsLoading:ie.loading||P,helpComponent:s,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:v,typeSelectorLabel:I})})}var Wr=be.default.createContext(void 0),Qe=()=>{let e=(0,be.useContext)(Wr);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};var Le=require("@emotion/react"),aa=require("@uniformdev/design-system"),_e=require("react"),kt=require("react-icons/cg"),oo=require("timeago.js");var A=require("@emotion/react"),ao=require("@uniformdev/design-system"),Kr=A.css`
510
510
  border: 1px solid var(--gray-200);
511
511
  background: var(--gray-50);
512
512
  border-radius: var(--rounded-base);
513
513
  display: flex;
514
514
  width: 100%;
515
- `,Jr=A.css`
515
+ `,Qr=A.css`
516
516
  align-items: center;
517
517
  display: flex;
518
518
  flex-grow: 1;
@@ -520,23 +520,23 @@
520
520
  margin-inline: 0 var(--spacing-sm);
521
521
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
522
522
  position: relative;
523
- `,jr=A.css`
523
+ `,Yr=A.css`
524
524
  flex-grow: 1;
525
- `,eo=A.css`
525
+ `,Zr=A.css`
526
526
  align-items: center;
527
527
  display: flex;
528
528
  position: relative;
529
- `,to=A.css`
529
+ `,Xr=A.css`
530
530
  color: var(--brand-secondary-1);
531
531
  font-size: var(--fs-base);
532
532
  font-weight: var(--fw-bold);
533
533
  line-height: 1;
534
534
  margin: 0;
535
535
  word-break: break-word;
536
- `,ro=A.css`
536
+ `,Jr=A.css`
537
537
  width: 1.5rem;
538
538
  height: 1.5rem;
539
- `,oo=A.css`
539
+ `,jr=A.css`
540
540
  background: var(--white);
541
541
  border-radius: var(--rounded-base);
542
542
  border-left: 4px solid var(--brand-secondary-3);
@@ -545,17 +545,17 @@
545
545
  padding: var(--spacing-base);
546
546
  z-index: var(--z-10);
547
547
  width: max-content;
548
- `,_e=A.css`
548
+ `,ke=A.css`
549
549
  font-size: var(--fs-sm);
550
- `,je=A.css`
550
+ `,Ye=A.css`
551
551
  font-weight: var(--fw-bold);
552
552
  margin-right: var(--spacing-sm);
553
- `,ao=A.css`
553
+ `,ea=A.css`
554
554
  display: flex;
555
555
  flex-direction: column;
556
556
  gap: var(--spacing-sm);
557
557
 
558
- ${(0,na.mq)("md")} {
558
+ ${(0,ao.mq)("md")} {
559
559
  flex-direction: row;
560
560
  justify-content: end;
561
561
  min-width: 200px;
@@ -575,40 +575,52 @@
575
575
  &:hover {
576
576
  background: var(--gray-50);
577
577
  }
578
- `,no=A.css`
578
+ `,ta=A.css`
579
579
  display: flex;
580
580
  margin-top: var(--spacing-sm);
581
581
  gap: var(--spacing-sm);
582
- `,io=A.css`
582
+ `,ra=A.css`
583
583
  background: none;
584
584
  outline: none;
585
585
  border: none;
586
586
  margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
587
- `,kt=A.css`
587
+ `,Tt=A.css`
588
588
  display: block;
589
589
  max-width: 100%;
590
590
  min-width: 100px;
591
591
  height: auto;
592
- `;var Ve=require("react");var Tt=require("react-icons/cg"),ia=require("timeago.js");var Ie=require("@emotion/react");var so=require("@uniformdev/design-system"),b=require("@emotion/react/jsx-runtime");function mn({selectedItem:e,onDeselect:t,onEditClosed:a,logoIcon:o,itemDetailsRendererComponent:r}){let n=(0,Ve.useRef)(null),i=(0,Ve.useRef)(null),[m,d]=(0,Ve.useState)(!1);(0,Ve.useEffect)(()=>{let f=x=>{n.current&&!n.current.contains(x.target)&&i.current&&!i.current.contains(x.target)&&d(!1)},c=()=>{d(!1)};return window.addEventListener("resize",c,!0),document.addEventListener("scroll",f,!0),document.addEventListener("mousedown",f),()=>{window.removeEventListener("resize",c,!0),document.removeEventListener("scroll",f,!0),document.removeEventListener("mousedown",f)}},[i]);let v=()=>{var f;if(d(!m),i.current&&n.current){let c=(f=n==null?void 0:n.current)==null?void 0:f.getBoundingClientRect();i.current.style.top=`${c.top+30}px`}},s=r!=null?r:fn;return(0,b.jsx)("div",{css:[Xr,Ie.css`
592
+ `;var w=require("@emotion/react/jsx-runtime");function hn({selectedItem:e,onDeselect:t,onEditClosed:o,logoIcon:a,itemDetailsRendererComponent:r}){let n=(0,_e.useRef)(null),i=(0,_e.useRef)(null),[c,d]=(0,_e.useState)(!1);(0,_e.useEffect)(()=>{let p=v=>{n.current&&!n.current.contains(v.target)&&i.current&&!i.current.contains(v.target)&&d(!1)},y=()=>{d(!1)};return window.addEventListener("resize",y,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",y,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[i]);let m=()=>{var p;if(d(!c),i.current&&n.current){let y=(p=n==null?void 0:n.current)==null?void 0:p.getBoundingClientRect();i.current.style.top=`${y.top+30}px`}},s=r!=null?r:bn;return(0,w.jsx)("div",{css:[Kr,Le.css`
593
593
  margin: 0 0 1rem 0;
594
- `],children:(0,b.jsxs)("div",{css:Jr,children:[(0,b.jsxs)("div",{css:jr,children:[(0,b.jsxs)("div",{css:eo,children:[(0,b.jsx)("h4",{css:[to],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",ref:n,css:io,"aria-controls":"path-details","aria-expanded":m,onClick:v,children:(0,b.jsx)(so.Icon,{icon:Tt.CgInfo,iconColor:"gray",size:24,css:Ie.css`
594
+ `],children:(0,w.jsxs)("div",{css:Qr,children:[(0,w.jsxs)("div",{css:Yr,children:[(0,w.jsxs)("div",{css:Zr,children:[(0,w.jsx)("h4",{css:[Xr],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("button",{type:"button",ref:n,css:ra,"aria-controls":"path-details","aria-expanded":c,onClick:m,children:(0,w.jsx)(aa.Icon,{icon:kt.CgInfo,iconColor:"gray",size:24,css:Le.css`
595
595
  opacity: var(--opacity-75);
596
- `})}),(0,b.jsx)("div",{id:"path-details","aria-hidden":!m,ref:i,css:[oo,m?Ie.css`
596
+ `})}),(0,w.jsx)("div",{id:"path-details","aria-hidden":!c,ref:i,css:[jr,c?Le.css`
597
597
  visibility: visible;
598
- `:Ie.css`
598
+ `:Le.css`
599
599
  visibility: hidden;
600
- `],children:Object.entries(e.popoverData).map(([f,c],x)=>(0,b.jsxs)("div",{css:_e,children:[(0,b.jsxs)("span",{css:je,children:[f,":"]}),c]},x))})]}):null]}),(0,b.jsx)(s,{item:e})]}),(0,b.jsxs)("div",{css:ao,children:[e.editLink?typeof e.editLink=="string"?(0,b.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:f=>{a&&(gt(f.currentTarget.href,()=>a(e)),f.preventDefault())},css:Pt,children:[(0,b.jsx)("span",{css:_e,children:"Edit"}),o?(0,b.jsx)(oe,{src:o,css:ro,alt:"Logo"}):null]}):e.editLink:null,(0,b.jsxs)("button",{type:"button",onClick:()=>{t(e)},css:Pt,children:[(0,b.jsx)("span",{css:_e,children:"Unlink"}),(0,b.jsx)(so.Icon,{icon:Tt.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}function fn({item:e}){let t=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?t=(0,b.jsx)("img",{src:e.previewUrl,alt:e.id,width:"200",css:kt}):e.type==="video"&&(t=(0,b.jsx)("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:kt})):e.previewUrl&&typeof e.previewUrl!="string"&&(t=e.previewUrl),t||e.metadata?(0,b.jsxs)("div",{css:no,children:[t?(0,b.jsx)("div",{children:t}):null,(0,b.jsxs)("ul",{children:[e.metadata?Object.entries(e.metadata).map(([a,o])=>(0,b.jsxs)("li",{css:[_e,Ie.css`
600
+ `],children:Object.entries(e.popoverData).map(([p,y],v)=>(0,w.jsxs)("div",{css:ke,children:[(0,w.jsxs)("span",{css:Ye,children:[p,":"]}),y]},v))})]}):null]}),(0,w.jsx)(s,{item:e})]}),(0,w.jsxs)("div",{css:ea,children:[e.editLink?typeof e.editLink=="string"?(0,w.jsxs)("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(ft(p.currentTarget.href,()=>o(e)),p.preventDefault())},css:Pt,children:[(0,w.jsx)("span",{css:ke,children:"Edit"}),a?(0,w.jsx)(ae,{src:a,css:Jr,alt:"Logo"}):null]}):e.editLink:null,(0,w.jsxs)("button",{type:"button",onClick:()=>{t(e)},css:Pt,children:[(0,w.jsx)("span",{css:ke,children:"Unlink"}),(0,w.jsx)(aa.Icon,{icon:kt.CgClose,iconColor:"red",size:16})]})]})]})},e.id)}function bn({item:e}){let t=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?t=(0,w.jsx)("img",{src:e.previewUrl,alt:e.id,width:"200",css:Tt}):e.type==="video"&&(t=(0,w.jsx)("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:Tt})):e.previewUrl&&typeof e.previewUrl!="string"&&(t=e.previewUrl),t||e.metadata?(0,w.jsxs)("div",{css:ta,children:[t?(0,w.jsx)("div",{children:t}):null,(0,w.jsxs)("ul",{children:[e.metadata?Object.entries(e.metadata).map(([o,a])=>(0,w.jsxs)("li",{css:[ke,Le.css`
601
601
  order: 1;
602
- `],children:[(0,b.jsxs)("span",{css:[je,Ie.css`
602
+ `],children:[(0,w.jsxs)("span",{css:[Ye,Le.css`
603
603
  order: 1;
604
- `],children:[a,":"]}),o]},a)):null,e.createdDate?(0,b.jsxs)("li",{css:_e,children:[(0,b.jsx)("span",{css:je,children:"Date:"}),(0,ia.format)(e.createdDate)]}):null]})]}):null}var Lt=require("@uniformdev/design-system");var we=require("@emotion/react/jsx-runtime"),vn=({children:e,loadingComponent:t,errorComponent:a})=>{let{initializing:o,error:r,sdk:n}=Gt();if(o||!n){let i=t;return i?(0,we.jsx)(i,{}):(0,we.jsx)(Lt.LoadingIndicator,{})}if(r){let i=a;if(i)return(0,we.jsx)(i,{error:r});throw r}return(0,we.jsxs)(Ke.Provider,{value:{sdk:n},children:[(0,we.jsx)(Lt.Theme,{}),(0,we.jsx)(Qe,{children:e})]})};function lo(e){return Object.entries(e||{}).sort(([t,a],[o,r])=>{var n,i;return a.order&&r.order?a.order-r.order:a.order?1:r.order?-1:((n=a.displayName)!=null?n:t).localeCompare((i=r.displayName)!=null?i:o)}).map(([t,a])=>({name:t,...a}))}var Oe=se(require("react"));var Ee=require("@uniformdev/design-system"),It=require("formik");var _t=require("@emotion/react"),sa=_t.css`
604
+ `],children:[o,":"]}),a]},o)):null,e.createdDate?(0,w.jsxs)("li",{css:ke,children:[(0,w.jsx)("span",{css:Ye,children:"Date:"}),(0,oo.format)(e.createdDate)]}):null]})]}):null}var _t=require("@uniformdev/design-system");var no=require("@uniformdev/mesh-sdk"),Ie=require("react"),oa=({autoResizingDisabled:e}={})=>{let[t,o]=(0,Ie.useState)(),[a,r]=(0,Ie.useState)(),n=(0,Ie.useRef)(!1);return(0,Ie.useEffect)(()=>{typeof window=="undefined"||a||(typeof window.UniformMeshSDK=="undefined"&&!n.current?(n.current=!0,(0,no.initializeUniformMeshSDK)({autoResizingDisabled:e}).then(i=>{r(i)}).catch(i=>{o(i)}).finally(()=>{n.current=!1})):r(window.UniformMeshSDK))},[e]),{initializing:!a&&!t,error:t,sdk:a}};var ye=require("react");var io=require("@uniformdev/design-system"),Lt=require("react");var Ze=require("@emotion/react/jsx-runtime"),Xe=(0,Lt.createContext)(void 0),yn=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),(0,Ze.jsxs)(Xe.Provider,{value:t,children:[(0,Ze.jsx)(io.Theme,{}),(0,Ze.jsx)(Je,{children:e})]})},na=()=>{let e=(0,Lt.useContext)(Xe);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function ia(){let{sdk:e}=na();return e}var so=require("@emotion/react/jsx-runtime"),sa=(0,ye.createContext)(void 0),Je=({children:e})=>{let t=ia(),[o,a]=(0,ye.useState)(t.getCurrentLocation()),r=n=>{a(i=>({...i,value:n.newValue}))};return(0,ye.useEffect)(()=>(t.events.on("onValueChanged",r),()=>{t.events.off("onValueChanged",r)}),[t]),(0,so.jsx)(sa.Provider,{value:{location:o},children:e})},je=()=>{let e=(0,ye.useContext)(sa);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};var xe=require("@emotion/react/jsx-runtime"),xn=({children:e,loadingComponent:t,errorComponent:o})=>{let{initializing:a,error:r,sdk:n}=oa();if(a||!n){let i=t;return i?(0,xe.jsx)(i,{}):(0,xe.jsx)(_t.LoadingIndicator,{})}if(r){let i=o;if(i)return(0,xe.jsx)(i,{error:r});throw r}return(0,xe.jsxs)(Xe.Provider,{value:{sdk:n},children:[(0,xe.jsx)(_t.Theme,{}),(0,xe.jsx)(Je,{children:e})]})};var pa=require("@emotion/react"),mo=se(require("@monaco-editor/react")),fo=require("@uniformdev/design-system"),vo=require("react");var Ge=se(require("react")),co=require("@emotion/react/jsx-runtime"),lo=Ge.createContext(null);function wn({value:e,onChange:t,children:o}){let a=Ge.useMemo(()=>({dispatch:r=>{if(r.type==="setRelativeUrl")t(n=>({...n,relativeUrl:r.relativeUrl}));else if(r.type==="updateParameter")t(n=>{let i=[...n.parameters];return typeof r.index=="number"?i[r.index]=r.parameter:i.push(r.parameter),{...n,parameters:i}});else if(r.type==="removeParameter")t(n=>{let i=[...n.parameters];return i.splice(r.index,1),{...n,parameters:i}});else if(r.type==="updateHeader")t(n=>{let i=[...n.headers];return typeof r.index!="undefined"?i[r.index]=r.header:i.push(r.header),{...n,headers:i}});else if(r.type==="removeHeader")t(n=>{let i=[...n.headers];return i.splice(r.index,1),{...n,headers:i}});else if(r.type==="setMethod")t(n=>({...n,method:r.method}));else if(r.type==="setBody")t(n=>{let i=[...n.headers],c=i.findIndex(({key:d})=>d.trim().toLocaleLowerCase()==="content-type");return c>-1?i[c].value=r.contentType:i.push({key:"Content-Type",value:r.contentType}),{...n,body:r.body,headers:i}});else throw new Error(`Unknown event ${JSON.stringify(r)}`)},request:e}),[t,e]);return(0,co.jsx)(lo.Provider,{value:a,children:o})}function te(){let e=Ge.useContext(lo);if(!e)throw new Error("No RequestProvider present");return e}var la=require("@emotion/react"),It=la.css`
605
+ background: var(--white);
606
+ `,po=e=>la.css`
607
+ align-items: start;
608
+ background: ${e};
609
+ display: grid;
610
+ grid-template-columns: 12ch 1fr;
611
+ gap: var(--spacing-sm);
612
+ `;var uo=require("@emotion/react/jsx-runtime"),ca=({bgColor:e="transparent",children:t,...o})=>(0,uo.jsx)("div",{css:po(e),...o,children:t});var Oe=require("@emotion/react/jsx-runtime"),Sn=[{label:"Text",value:"plaintext"},{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"JavaScript",value:"javascript"},{label:"XML",value:"xml"},{label:"HTML",value:"html"}],go={plaintext:"text/plain",json:"application/json",yaml:"application/x-yaml",javascript:"application/javascript",xml:"application/xml",html:"text/html"};function Cn(){let{request:e,dispatch:t}=te(),[o,a]=(0,vo.useState)("json");return(0,Oe.jsxs)("div",{css:pa.css`
613
+ background: var(--white);
614
+ `,children:[(0,Oe.jsx)(ca,{bgColor:"var(--gray-100)",css:pa.css`
615
+ padding: var(--spacing-sm) var(--spacing-base);
616
+ `,children:(0,Oe.jsx)(fo.InputSelect,{label:"Language",showLabel:!1,options:Sn,value:o,onChange:r=>{let n=r.currentTarget.value;a(n),e.body&&t({type:"setBody",body:e.body,contentType:go[n]})}})}),(0,Oe.jsx)(mo.default,{height:200,value:e.body,language:o,options:{language:o,minimap:{enabled:!1},folding:!1},onChange:r=>{r&&t({type:"setBody",body:r,contentType:go[o]})}})]})}var M=require("@uniformdev/design-system");var H=require("@emotion/react/jsx-runtime");function Rn({disableVariables:e}){let{dispatch:t,request:o}=te(),a=[...o.headers,{key:"",value:""}];return(0,H.jsx)("div",{css:It,children:(0,H.jsxs)(M.Table,{children:[(0,H.jsx)(M.TableHead,{children:(0,H.jsxs)(M.TableRow,{children:[(0,H.jsx)(M.TableCellHead,{children:"Name"}),(0,H.jsx)(M.TableCellHead,{children:"Value"})]})}),(0,H.jsx)(M.TableBody,{children:a.map((r,n)=>(0,H.jsxs)(M.TableRow,{children:[(0,H.jsx)(M.TableCellData,{width:"50%",children:(0,H.jsx)(M.Input,{label:r.key,value:r.key,showLabel:!1,onChange:i=>{i.currentTarget.value?t({type:"updateHeader",header:{key:i.currentTarget.value,value:r.value},index:n}):t({type:"removeHeader",index:n})}})}),(0,H.jsx)(M.TableCellData,{width:"50%",children:r.key?(0,H.jsx)(M.Input,{showLabel:!1,label:r.value,value:r.value,onChange:i=>t({type:"updateHeader",header:{key:r.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}var ho=require("@uniformdev/design-system");var bo=require("@emotion/react/jsx-runtime");function Pn(e){var a;let{request:t,dispatch:o}=te();return(0,bo.jsx)(ho.InputSelect,{...e,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"HEAD",value:"HEAD"}],value:(a=t.method)!=null?a:"GET",onChange:r=>o({type:"setMethod",method:r.currentTarget.value})})}var U=require("@uniformdev/design-system");var G=require("@emotion/react/jsx-runtime");function Tn({disableVariables:e}){let{dispatch:t,request:o}=te(),a=[...o.parameters,{key:"",value:""}];return(0,G.jsx)("div",{css:It,children:(0,G.jsxs)(U.Table,{children:[(0,G.jsx)(U.TableHead,{children:(0,G.jsxs)(U.TableRow,{children:[(0,G.jsx)(U.TableCellHead,{children:"Name"}),(0,G.jsx)(U.TableCellHead,{children:"Value"})]})}),(0,G.jsx)(U.TableBody,{children:a.map((r,n)=>(0,G.jsxs)(U.TableRow,{children:[(0,G.jsx)(U.TableCellData,{width:"50%",children:(0,G.jsx)(U.Input,{label:r.key,value:r.key,showLabel:!1,onChange:i=>{i.currentTarget.value?t({type:"updateParameter",parameter:{key:i.currentTarget.value,value:r.value},index:n}):t({type:"removeParameter",index:n})}})}),(0,G.jsx)(U.TableCellData,{width:"50%",children:r.key?(0,G.jsx)(U.Input,{showLabel:!1,label:r.value,value:r.value,onChange:i=>t({type:"updateParameter",parameter:{key:r.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}var Ro=require("@emotion/react"),Po=se(require("@yaireo/tagify/dist/react.tagify")),O=se(require("react"));var Dt=require("@emotion/react"),yo=Dt.css`
605
617
  > * {
606
618
  margin: var(--spacing-base) 0 0;
607
619
  }
608
- `,la=_t.css`
620
+ `,xo=Dt.css`
609
621
  display: flex;
610
622
  gap: var(--spacing-sm);
611
- `,da=_t.css`
623
+ `,wo=Dt.css`
612
624
  :root {
613
625
  --tagify-dd-color-primary: rgb(53, 149, 246);
614
626
  --tagify-dd-bg-color: var(--white);
@@ -1105,33 +1117,45 @@
1105
1117
  opacity: 0;
1106
1118
  transition: inherit;
1107
1119
  }
1108
- `;var ne=require("@emotion/react/jsx-runtime");function co({variable:e,onSubmit:t,onCancel:a}){var r,n,i,m,d,v,s,f,c;let{variables:o}=De();return(0,ne.jsx)(It.Formik,{initialValues:{name:e,default:(n=(r=o[e])==null?void 0:r.default)!=null?n:"",displayName:(m=(i=o[e])==null?void 0:i.displayName)!=null?m:"",helpText:(v=(d=o[e])==null?void 0:d.helpText)!=null?v:"",order:(s=o[e])==null?void 0:s.order,type:(c=(f=o[e])==null?void 0:f.type)!=null?c:""},onSubmit:x=>{let U={...x,helpText:x.helpText||void 0,type:x.type||void 0,displayName:x.displayName||void 0};return t(U)},children:({getFieldProps:x})=>(0,ne.jsxs)(It.Form,{css:sa,children:[(0,ne.jsx)(Ee.Input,{...x("name"),label:"Name"}),(0,ne.jsx)(Ee.Input,{...x("helpText"),label:"Help Text",caption:"Appears in the composition data resource when entering a value for this variable.",autoComplete:"off"}),(0,ne.jsx)(Ee.Input,{...x("default"),label:"Default Value",autoComplete:"off"}),(0,ne.jsxs)("div",{css:la,children:[(0,ne.jsx)(Ee.Button,{type:"submit",children:"Save"}),(0,ne.jsx)(Ee.Button,{type:"button",buttonType:"ghost",onClick:a,children:"cancel"})]})]})})}var Vt=require("@emotion/react/jsx-runtime"),pa=Oe.createContext(null);function hn({value:e,onChange:t,editVariableComponent:a,children:o}){let[r,n]=Oe.useState(),i=a!=null?a:co,m={dispatch:d=>{if(d.type==="set"){let{name:v,...s}=d.variable;t({...m.variables,[d.variable.name]:s}),d.openEditor&&n(d.variable.name)}else if(d.type==="edit")n(d.variable);else if(d.type==="remove"){let v={...e};delete v[d.variable],t(v)}else throw new Error(`Unknown event ${JSON.stringify(d)}`)},variables:e};return(0,Vt.jsxs)(pa.Provider,{value:m,children:[o,typeof r!="undefined"?(0,Vt.jsx)(i,{onSubmit:d=>{n(void 0);let{name:v,...s}=d;t({...e,[v]:s})},onCancel:()=>n(void 0),variable:r}):null]})}function De(){let e=Oe.useContext(pa);if(!e)throw new Error("No VariablesProvider present");return e}var T=require("@uniformdev/design-system");var Et=require("@emotion/react"),I=require("@emotion/react/jsx-runtime");function yn(){let{variables:e,dispatch:t}=De(),a=lo(e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(T.Table,{children:[(0,I.jsx)(T.TableHead,{children:(0,I.jsxs)(T.TableRow,{children:[(0,I.jsx)(T.TableCellHead,{children:"Name"}),(0,I.jsx)(T.TableCellHead,{children:"Default Value"}),(0,I.jsx)(T.TableCellHead,{})]})}),(0,I.jsx)(T.TableBody,{children:a.map(({name:o,displayName:r,default:n})=>{let i=r!=null?r:o;return(0,I.jsxs)(T.TableRow,{id:i,children:[(0,I.jsx)(T.TableCellData,{children:(0,I.jsx)("button",{css:Et.css`
1109
- border: none;
1110
- color: var(--brand-secondary-5);
1111
- font-weight: var(--fw-medium);
1112
- padding: 0;
1113
- background: none;
1114
- overflow: hidden;
1115
- text-overflow: ellipsis;
1116
- white-space: nowrap;
1117
- max-width: 20ch;
1118
- `,type:"button",onClick:m=>{m.preventDefault(),t({type:"edit",variable:o})},title:i,children:i})}),(0,I.jsx)(T.TableCellData,{children:(0,I.jsx)("span",{css:Et.css`
1119
- overflow: hidden;
1120
- text-overflow: ellipsis;
1121
- white-space: nowrap;
1122
- max-width: 20ch;
1123
- `,title:n,children:n})}),(0,I.jsx)(T.TableCellData,{align:"right",children:(0,I.jsx)("button",{type:"button",title:`delete ${i}`,css:[T.button,Et.css`
1124
- background: transparent;
1125
- `],"aria-controls":i,onClick:()=>t({type:"remove",variable:o}),children:(0,I.jsx)(T.Icon,{icon:"trash",iconColor:"red"})})})]},o)})})]}),(0,I.jsx)(T.AddListButton,{onButtonClick:()=>t({type:"edit",variable:""}),"aria-label":"Add variable",buttonText:"add variable",icon:"math-plus",css:{marginLeft:"var(--spacing-md)"}})]})}var W=se(require("react")),ga=se(require("@yaireo/tagify/dist/react.tagify"));var ma=require("@emotion/react"),Me=require("@emotion/react/jsx-runtime");function ua(e){return e.replace(/\${{.*?"value":"([^"]+)".*?}}/g,"${$1}").replace(/[\r\n]+/g,"")}function po({label:e,value:t,disableVariables:a,onChange:o}){let{variables:r,dispatch:n}=De(),i=W.useRef(r),m=W.useRef(n),d=W.useRef(o),v=W.useRef();W.useEffect(()=>{i.current=r},[r]),W.useEffect(()=>{m.current=n},[n]),W.useEffect(()=>{d.current=o},[o]),W.useEffect(()=>{var x,U,P;let c=ua((U=(x=v.current)==null?void 0:x.getInputValue())!=null?U:"");t!==c&&((P=v.current)==null||P.loadOriginalValues(t))},[t]);let s=W.useCallback(c=>{d.current(ua(c))},[]),f=W.useCallback(c=>{i.current[c]||m.current({type:"set",variable:{name:c,default:""},openEditor:!0})},[]);return(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(ma.Global,{styles:da}),(0,Me.jsx)(ga.default,{tagifyRef:v,"aria-label":e,defaultValue:t,autoFocus:!1,whitelist:Object.entries(r).map(([c,x])=>{var U;return{name:(U=x.displayName)!=null?U:c,value:c}}),settings:{pattern:a?null:/\$/,enforceWhitelist:a,mixTagsInterpolator:["${","}"],duplicates:!0,tagTextProp:"name",dropdown:{position:"text",enabled:0,mapValueTo:c=>c.name,includeSelectedTags:!0,searchKeys:["name","value"],highlightFirst:!0}},InputMode:"textarea",onAdd:c=>{var U;let x=(U=c.detail.data)==null?void 0:U.value;x&&f(x)},onRemove:c=>{s(c.detail.tagify.getInputValue())},onChange:c=>{s(c.detail.value)},onInput:c=>{s(c.detail.tagify.getInputValue())}})]})}var xa=se(require("@monaco-editor/react")),wa=require("@uniformdev/design-system"),Sa=require("react");var qe=se(require("react")),ha=require("@emotion/react/jsx-runtime"),va=qe.createContext(null);function bn({value:e,onChange:t,children:a}){let o=qe.useMemo(()=>({dispatch:r=>{if(r.type==="setRelativeUrl")t({...e,relativeUrl:r.relativeUrl,parameters:ge(r.relativeUrl)});else if(r.type==="updateParameter"){let n=fa(e.relativeUrl,i=>{let m=`${r.parameter.key}=${r.parameter.value}`;typeof r.index!="undefined"?i[r.index]=m:i.push(m)});t({...e,relativeUrl:n,parameters:ge(n)})}else if(r.type==="removeParameter"){let n=fa(e.relativeUrl,i=>{i.splice(r.index,1)});t({...e,relativeUrl:n,parameters:ge(n)})}else if(r.type==="updateHeader"){let n=[...e.headers];typeof r.index!="undefined"?n[r.index]=r.header:n.push(r.header),t({...e,headers:n,parameters:ge(e.relativeUrl)})}else if(r.type==="removeHeader"){let n=[...e.headers];n.splice(r.index,1),t({...e,headers:n,parameters:ge(e.relativeUrl)})}else if(r.type==="setMethod")t({...e,method:r.method,parameters:ge(e.relativeUrl)});else if(r.type==="setBody")t({...e,body:r.body,parameters:ge(e.relativeUrl)});else throw new Error(`Unknown event ${JSON.stringify(r)}`)},request:{...e,parameters:ge(e.relativeUrl)}}),[t,e]);return(0,ha.jsx)(va.Provider,{value:o,children:a})}function te(){let e=qe.useContext(va);if(!e)throw new Error("No RequestProvider present");return e}function fa(e,t){let[a,o]=e.split("?"),r=a,n=(o!=null?o:"").split("&");return t(n),r+=`?${n.join("&")}`,r}function ge(e){var t,a;return((a=(t=e.split("?")[1])==null?void 0:t.split("&").map(o=>{let[r,n]=o.split("=");return{key:r,value:n!=null?n:""}}))!=null?a:[]).filter(o=>o.key)}function xn(e){let[t]=e.split("?");return[t,ge(e)]}var uo=require("@emotion/react"),Dt=uo.css`
1126
- background: var(--white);
1127
- `,ya=e=>uo.css`
1128
- align-items: start;
1129
- background: ${e};
1130
- display: grid;
1131
- grid-template-columns: 12ch 1fr;
1132
- gap: var(--spacing-sm);
1133
- `;var ba=require("@emotion/react/jsx-runtime"),mo=({bgColor:e="transparent",children:t,...a})=>(0,ba.jsx)("div",{css:ya(e),...a,children:t});var fo=require("@emotion/react"),$e=require("@emotion/react/jsx-runtime");function wn(){let{request:e,dispatch:t}=te(),[a,o]=(0,Sa.useState)("json");return(0,$e.jsxs)("div",{css:fo.css`
1134
- background: var(--white);
1135
- `,children:[(0,$e.jsx)(mo,{bgColor:"var(--gray-100)",css:fo.css`
1136
- padding: var(--spacing-sm) var(--spacing-base);
1137
- `,children:(0,$e.jsx)(wa.InputSelect,{label:"Language",showLabel:!1,options:[{label:"Text",value:"plaintext"},{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"JavaScript",value:"javascript"},{label:"XML",value:"xml"},{label:"HTML",value:"html"}],value:a,onChange:r=>{o(r.currentTarget.value)}})}),(0,$e.jsx)(xa.default,{height:200,value:e.body,language:a,options:{language:a,minimap:{enabled:!1},folding:!1},onChange:r=>{!r||t({type:"setBody",body:r})}})]})}var D=require("@uniformdev/design-system");var H=require("@emotion/react/jsx-runtime");function Sn({disableVariables:e}){let{dispatch:t,request:a}=te(),o=[...a.headers,{key:"",value:""}];return(0,H.jsx)("div",{css:Dt,children:(0,H.jsxs)(D.Table,{children:[(0,H.jsx)(D.TableHead,{children:(0,H.jsxs)(D.TableRow,{children:[(0,H.jsx)(D.TableCellHead,{children:"Name"}),(0,H.jsx)(D.TableCellHead,{children:"Value"})]})}),(0,H.jsx)(D.TableBody,{children:o.map((r,n)=>(0,H.jsxs)(D.TableRow,{children:[(0,H.jsx)(D.TableCellData,{width:"50%",children:(0,H.jsx)(D.Input,{label:r.key,value:r.key,showLabel:!1,onChange:i=>{i.currentTarget.value?t({type:"updateHeader",header:{key:i.currentTarget.value,value:r.value},index:n}):t({type:"removeHeader",index:n})}})}),(0,H.jsx)(D.TableCellData,{width:"50%",children:r.key?(0,H.jsx)(D.Input,{showLabel:!1,label:r.value,value:r.value,onChange:i=>t({type:"updateHeader",header:{key:r.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}var Ca=require("@uniformdev/design-system");var Ra=require("@emotion/react/jsx-runtime");function Cn(e){var o;let{request:t,dispatch:a}=te();return(0,Ra.jsx)(Ca.InputSelect,{...e,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"HEAD",value:"HEAD"}],value:(o=t.method)!=null?o:"GET",onChange:r=>a({type:"setMethod",method:r.currentTarget.value})})}var M=require("@uniformdev/design-system");var G=require("@emotion/react/jsx-runtime");function Rn({disableVariables:e}){let{dispatch:t,request:a}=te(),o=[...a.parameters,{key:"",value:""}];return(0,G.jsx)("div",{css:Dt,children:(0,G.jsxs)(M.Table,{children:[(0,G.jsx)(M.TableHead,{children:(0,G.jsxs)(M.TableRow,{children:[(0,G.jsx)(M.TableCellHead,{children:"Name"}),(0,G.jsx)(M.TableCellHead,{children:"Value"})]})}),(0,G.jsx)(M.TableBody,{children:o.map((r,n)=>(0,G.jsxs)(M.TableRow,{children:[(0,G.jsx)(M.TableCellData,{width:"50%",children:(0,G.jsx)(M.Input,{label:r.key,value:r.key,showLabel:!1,onChange:i=>{i.currentTarget.value?t({type:"updateParameter",parameter:{key:i.currentTarget.value,value:r.value},index:n}):t({type:"removeParameter",index:n})}})}),(0,G.jsx)(M.TableCellData,{width:"50%",children:r.key?(0,G.jsx)(M.Input,{showLabel:!1,label:r.value,value:r.value,onChange:i=>t({type:"updateParameter",parameter:{key:r.key,value:i.currentTarget.value},index:n})}):null})]},n))})]})})}var Pa=require("@emotion/react/jsx-runtime");function Pn(e){let{request:t,dispatch:a}=te();return(0,Pa.jsx)(po,{...e,value:t.relativeUrl,onChange:o=>{let r=o;t.baseUrl&&r.startsWith(t.baseUrl)&&(r=r.substring(t.baseUrl.length)),a({type:"setRelativeUrl",relativeUrl:r})}})}X(Y,require("@uniformdev/mesh-sdk"),module.exports);var h=require("@uniformdev/design-system");0&&(module.exports={AddListButton,Button,Callout,DamSelectedItem,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputComboBox,InputSelect,InputToggle,InputVariables,KeywordSearchInput,Label,LoadingIndicator,LoadingOverlay,Menu,MenuItem,MeshApp,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,RequestBody,RequestHeaders,RequestMethodSelect,RequestParameters,RequestProvider,RequestTypeContainer,RequestUrlInput,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Switch,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,VariableEditor,VariablesList,VariablesProvider,badgeIcon,damSelectItemImage,damSelectedItemContainer,damSelectedItemCopy,damSelectedItemDetails,damSelectedItemIcon,damSelectedItemInfoBtn,damSelectedItemInner,damSelectedItemLinkBtn,damSelectedItemLinkContainer,damSelectedItemMediaContainer,damSelectedItemPopover,damSelectedItemPopoverLabel,damSelectedItemSmallText,damSelectedItemTitle,decomposeRelativeUrl,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemIcon,productSelectedItemImage,productSelectedItemLinkContainer,productedSelectedItemLinkBtn,productedSelectedItemSmallText,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useMeshLocation,useProductQueryContext,useProductSearchContext,useRequest,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext,useVariables,variablesToList});
1120
+ `;var qe=se(require("react"));var De=require("@uniformdev/design-system"),Vt=require("formik");var ne=require("@emotion/react/jsx-runtime");function ua({variable:e,onSubmit:t,onCancel:o}){var r,n,i,c,d,m,s,p,y;let{variables:a}=Ve();return(0,ne.jsx)(Vt.Formik,{initialValues:{name:e,default:(n=(r=a[e])==null?void 0:r.default)!=null?n:"",displayName:(c=(i=a[e])==null?void 0:i.displayName)!=null?c:"",helpText:(m=(d=a[e])==null?void 0:d.helpText)!=null?m:"",order:(s=a[e])==null?void 0:s.order,type:(y=(p=a[e])==null?void 0:p.type)!=null?y:""},onSubmit:v=>{let I={...v,helpText:v.helpText||void 0,type:v.type||void 0,displayName:v.displayName||void 0};return t(I)},children:({getFieldProps:v,initialValues:I})=>(0,ne.jsxs)(Vt.Form,{css:yo,children:[(0,ne.jsx)(De.Input,{...v("name"),label:"Name",disabled:I.name!=="",caption:"This cannot change once created."}),(0,ne.jsx)(De.Input,{...v("helpText"),label:"Help Text",caption:"Appears in the composition data resource when entering a value for this variable.",autoComplete:"off"}),(0,ne.jsx)(De.Input,{...v("default"),label:"Default Value",autoComplete:"off"}),(0,ne.jsxs)("div",{css:xo,children:[(0,ne.jsx)(De.Button,{type:"submit",children:"Save"}),(0,ne.jsx)(De.Button,{type:"button",buttonType:"ghost",onClick:o,children:"cancel"})]})]})})}var Et=require("@emotion/react/jsx-runtime"),Co=qe.createContext(null);function kn({value:e,onChange:t,editVariableComponent:o,children:a}){let[r,n]=qe.useState(),i=o!=null?o:ua,c={dispatch:d=>{if(d.type==="set"){let{name:m,...s}=d.variable;t({...c.variables,[d.variable.name]:s}),d.openEditor&&n(d.variable.name)}else if(d.type==="edit")n(d.variable);else if(d.type==="remove"){let m={...e};delete m[d.variable],t(m)}else if(d.type==="reorder")t(d.result);else throw new Error(`Unknown event ${JSON.stringify(d)}`)},variables:e};return(0,Et.jsxs)(Co.Provider,{value:c,children:[a,typeof r!="undefined"?(0,Et.jsx)(i,{onSubmit:d=>{n(void 0);let{name:m,...s}=d;t({...e,[m]:s})},onCancel:()=>n(void 0),variable:r}):null]})}function Ve(){let e=qe.useContext(Co);if(!e)throw new Error("No VariablesProvider present");return e}var Ee=require("@emotion/react/jsx-runtime");function ga(e){return e.replace(/\${{.*?"value":"([^"]+)".*?}}/g,"${$1}").replace(/[\r\n]+/g,"")}function ma({label:e,value:t,disableVariables:o,onChange:a,onPaste:r}){let{variables:n,dispatch:i}=Ve(),c=O.useRef(n),d=O.useRef(i),m=O.useRef(a),s=O.useRef();O.useEffect(()=>{c.current=n},[n]),O.useEffect(()=>{d.current=i},[i]),O.useEffect(()=>{m.current=a},[a]),O.useEffect(()=>{var v;((v=s==null?void 0:s.current)==null?void 0:v.DOM)&&r&&(s.current.DOM.input.onpaste=()=>{var I,x;return r(ga((x=(I=s.current)==null?void 0:I.getInputValue())!=null?x:""))})}),O.useEffect(()=>{var I,x,P;let v=ga((x=(I=s.current)==null?void 0:I.getInputValue())!=null?x:"");t!==v&&((P=s.current)==null||P.loadOriginalValues(t))},[t]);let p=O.useCallback(v=>{m.current(ga(v))},[]),y=O.useCallback(v=>{c.current[v]||d.current({type:"set",variable:{name:v,default:""},openEditor:!0})},[]);return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(Ro.Global,{styles:wo}),(0,Ee.jsx)(Po.default,{tagifyRef:s,"aria-label":e,defaultValue:t,autoFocus:!1,whitelist:Object.entries(n).map(([v,I])=>{var x;return{name:(x=I.displayName)!=null?x:v,value:v}}),settings:{pattern:o?null:/\$/,enforceWhitelist:o,mixTagsInterpolator:["${","}"],duplicates:!0,tagTextProp:"name",dropdown:{position:"text",enabled:0,mapValueTo:v=>v.name,includeSelectedTags:!0,searchKeys:["name","value"],highlightFirst:!0}},InputMode:"textarea",onAdd:v=>{var x;let I=(x=v.detail.data)==null?void 0:x.value;I&&y(I)},onRemove:v=>{p(v.detail.tagify.getInputValue())},onChange:v=>{p(v.detail.value)},onInput:v=>{p(v.detail.tagify.getInputValue())}})]})}var Io=require("@emotion/react"),_=require("@uniformdev/design-system"),Ne=require("react-beautiful-dnd");var et=require("@emotion/react"),To=e=>et.css`
1121
+ position: relative;
1122
+ ${e?`
1123
+ display: table;
1124
+ left: auto !important;
1125
+ top: auto !important;
1126
+ `:void 0}
1127
+ `,ko=et.css`
1128
+ &::after {
1129
+ content: '';
1130
+ display: block;
1131
+ position: absolute;
1132
+ left: 2px;
1133
+ top: var(--spacing-base);
1134
+ bottom: var(--spacing-base);
1135
+ width: 5px;
1136
+ border-left: 2px dotted var(--gray-300);
1137
+ border-right: 2px dotted var(--gray-300);
1138
+ opacity: 0;
1139
+ }
1140
+
1141
+ &:hover::after {
1142
+ opacity: 1;
1143
+ }
1144
+ `,Lo=et.css`
1145
+ border: none;
1146
+ color: var(--brand-secondary-5);
1147
+ font-weight: var(--fw-medium);
1148
+ padding: 0;
1149
+ background: none;
1150
+ overflow: hidden;
1151
+ text-overflow: ellipsis;
1152
+ white-space: nowrap;
1153
+ max-width: 20ch;
1154
+ `,_o=et.css`
1155
+ overflow: hidden;
1156
+ text-overflow: ellipsis;
1157
+ white-space: nowrap;
1158
+ max-width: 20ch;
1159
+ `;function fa(e){return Object.entries(e||{}).sort(([t,o],[a,r])=>{var n,i;return o.order&&r.order?o.order-r.order:o.order?1:r.order?-1:((n=o.displayName)!=null?n:t).localeCompare((i=r.displayName)!=null?i:a)}).map(([t,o])=>({name:t,...o}))}var k=require("@emotion/react/jsx-runtime");function _n(){let{variables:e,dispatch:t}=Ve(),o=fa(e),a=r=>{var n,i;if(r.destination&&r.source.droppableId===((n=r.destination)==null?void 0:n.droppableId)){let c=[...o||[]],[d]=(i=c==null?void 0:c.splice(r.source.index,1))!=null?i:[];c==null||c.splice(r.destination.index,0,d);let m=c.reduce((s,p,y)=>({...s,[p.name]:{type:p.type,default:p.default,order:y}}),{});return t({type:"reorder",result:m}),c}};return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ne.DragDropContext,{onDragEnd:r=>a(r),children:(0,k.jsx)(Ne.Droppable,{droppableId:"variables-table",children:r=>(0,k.jsxs)(_.Table,{...r.droppableProps,ref:r.innerRef,children:[(0,k.jsx)(_.TableHead,{children:(0,k.jsxs)(_.TableRow,{children:[(0,k.jsx)(_.TableCellHead,{children:"Name"}),(0,k.jsx)(_.TableCellHead,{children:"Default Value"}),(0,k.jsx)(_.TableCellHead,{})]})}),(0,k.jsxs)(_.TableBody,{children:[o.map(({name:n,displayName:i,default:c},d)=>{let m=i!=null?i:n;return(0,k.jsx)(Ne.Draggable,{draggableId:n,index:d,isDragDisabled:o.length===1,children:(s,p)=>(0,k.jsxs)(_.TableRow,{ref:s.innerRef,...s.dragHandleProps,...s.draggableProps,id:m,css:To(p.isDragging),"data-dragging":p.isDragging,children:[(0,k.jsx)(_.TableCellData,{css:o.length>1?ko:void 0,children:(0,k.jsx)("button",{css:Lo,type:"button",onClick:y=>{y.preventDefault(),t({type:"edit",variable:n})},title:m,children:m})}),(0,k.jsx)(_.TableCellData,{children:(0,k.jsx)("span",{css:_o,title:c,children:c})}),(0,k.jsx)(_.TableCellData,{align:"right",children:(0,k.jsx)("button",{type:"button",title:`delete ${m}`,css:[_.button,Io.css`
1160
+ background: transparent;
1161
+ `],"aria-controls":m,onClick:()=>t({type:"remove",variable:n}),children:(0,k.jsx)(_.Icon,{icon:"trash",iconColor:"red"})})})]})},n)}),r.placeholder]})]})})}),(0,k.jsx)(_.AddListButton,{onButtonClick:()=>t({type:"edit",variable:""}),"aria-label":"Add variable",buttonText:"add variable",icon:"math-plus",css:{marginLeft:"var(--spacing-md)"}})]})}var Do=require("@emotion/react/jsx-runtime");function In(e){let{request:t,dispatch:o}=te();return(0,Do.jsx)(ma,{...e,value:t.relativeUrl,onPaste:a=>{let r=a.indexOf("?");if(r>=0){let n=a.substring(0,r);o({type:"setRelativeUrl",relativeUrl:n});for(let i=t.parameters.length-1;i>=0;i--)o({type:"removeParameter",index:i});try{new URLSearchParams(a.substring(r)).forEach((c,d)=>{o({type:"updateParameter",parameter:{key:d,value:c}})})}catch(i){}}},onChange:a=>{let r=a;t.baseUrl&&r.startsWith(t.baseUrl)&&(r=r.substring(t.baseUrl.length)),o({type:"setRelativeUrl",relativeUrl:r})}})}function Dn(e,t){return va(encodeURI(e),t)}function Vn(e,t){return{key:va(encodeURIComponent(e.key),t),value:va(encodeURIComponent(e.value),t)}}function va(e,t){return e.replace(/(\$|%24)%7B(.*?)%7D/g,(o,a,r)=>{var i;let n=decodeURIComponent(r);return(i=t==null?void 0:t[n])!=null&&i.default?t[n].default:`\${${n}}`})}function En(e){let{location:t}=je();if(e&&t.type!==e)throw new Error(`Expected location type ${e} but got ${t.type}`);return t}function Mn(){let{location:e}=je();return e}var h=require("@uniformdev/design-system");X(Y,require("@uniformdev/mesh-sdk"),module.exports);0&&(module.exports={AddListButton,Button,Callout,DamSelectedItem,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputComboBox,InputSelect,InputToggle,InputVariables,KeywordSearchInput,Label,LoadingIndicator,LoadingOverlay,Menu,MenuItem,MeshApp,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,RequestBody,RequestHeaders,RequestMethodSelect,RequestParameters,RequestProvider,RequestTypeContainer,RequestUrlInput,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Switch,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,VariableEditor,VariablesList,VariablesProvider,badgeIcon,damSelectItemImage,damSelectedItemContainer,damSelectedItemCopy,damSelectedItemDetails,damSelectedItemIcon,damSelectedItemInfoBtn,damSelectedItemInner,damSelectedItemLinkBtn,damSelectedItemLinkContainer,damSelectedItemMediaContainer,damSelectedItemPopover,damSelectedItemPopoverLabel,damSelectedItemSmallText,damSelectedItemTitle,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemIcon,productSelectedItemImage,productSelectedItemLinkContainer,productedSelectedItemLinkBtn,productedSelectedItemSmallText,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,urlEncodeRequestParameter,urlEncodeRequestUrl,useInitializeUniformMeshSdk,useMeshLocation,useProductQueryContext,useProductSearchContext,useRequest,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext,useVariables,variablesToList});