"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core");const NoDataState=({title:e,description:t,elementType:r,builderAttrs:n,descriptionActions:s,primaryBtnTitle:l,secondaryBtnTitle:p,primaryBtnCb:i,secondaryBtnCb:c,additionalMedia:o,customClass:a,icon:d=!0,rawMode:g,children:u})=>{let x=React.useRef(null),{isEditMode:m,isPreviewSharePageMode:b}=core.useRenderMode(),[f,j]=React.useState("row"),h=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},C=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},w=()=>{if(m)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:n?.["data-uid"]??n?.uid,value:!0,tag:n?.["data-component-tag"]??n?.tag}});window.dispatchEvent(e)},R={syncProduct:h,syncArticle:C};return(React.useEffect(()=>{let e=new ResizeObserver(()=>{let e=x.current?x.current?.offsetWidth:0;j(e>272?"row":"column")});return x.current&&e.observe(x.current),()=>{e?.disconnect()}},[]),b)?null:jsxRuntime.jsxs("div",{...n,ref:x,className:core.cls("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",g?"gp-p-0":"gp-p-2"),onClick:w,children:[jsxRuntime.jsxs("div",{className:core.cls("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===r?"gp-bg-[#FFF1DF]":"",g?"gp-justify-center":"",a||""),style:{flexDirection:f},children:[d&&!g&&jsxRuntime.jsx("div",{className:core.cls("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===r?"":"gp-bg-[#FDB913]"),children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===r?"#916A00":"#212121"})]})}),jsxRuntime.jsxs("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[e&&jsxRuntime.jsx("p",{className:core.cls("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:e}}),t&&jsxRuntime.jsxs("p",{className:core.cls(g?"gp-mb-0":"gp-mb-[4px]","primary"===r?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[t," ",s?.map((e,t)=>{let r=t?"or":"",n="string"==typeof e.callback?R?.[e.callback]:e.callback;return jsxRuntime.jsxs("span",{children:[" ",r," ",jsxRuntime.jsx("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:n,children:e.text})]},`description-action-${t}`)})]}),(l||p)&&jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[jsxRuntime.jsx("button",{onClick:i,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:l}),jsxRuntime.jsx("button",{onClick:c,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:p})]})]})]}),o&&jsxRuntime.jsx("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:o}}),core.filterToolbarPreview(u,!0)]})};exports.default=NoDataState;
