"use strict";(globalThis.webpackChunkhelpgent=globalThis.webpackChunkhelpgent||[]).push([[278],{17331(e,t,n){n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSIjMUUzMDUwIiBkPSJNNDk1LjkgMTY2LjZjMy4yIDguNyAuNSAxOC40LTYuNCAyNC42bC00My4zIDM5LjRjMS4xIDguMyAxLjcgMTYuOCAxLjcgMjUuNHMtLjYgMTcuMS0xLjcgMjUuNGw0My4zIDM5LjRjNi45IDYuMiA5LjYgMTUuOSA2LjQgMjQuNmMtNC40IDExLjktOS43IDIzLjMtMTUuOCAzNC4zbC00LjcgOC4xYy02LjYgMTEtMTQgMjEuNC0yMi4xIDMxLjJjLTUuOSA3LjItMTUuNyA5LjYtMjQuNSA2LjhsLTU1LjctMTcuN2MtMTMuNCAxMC4zLTI4LjIgMTguOS00NCAyNS40bC0xMi41IDU3LjFjLTIgOS4xLTkgMTYuMy0xOC4yIDE3LjhjLTEzLjggMi4zLTI4IDMuNS00Mi41IDMuNXMtMjguNy0xLjItNDIuNS0zLjVjLTkuMi0xLjUtMTYuMi04LjctMTguMi0xNy44bC0xMi41LTU3LjFjLTE1LjgtNi41LTMwLjYtMTUuMS00NC0yNS40TDgzLjEgNDI1LjljLTguOCAyLjgtMTguNiAuMy0yNC41LTYuOGMtOC4xLTkuOC0xNS41LTIwLjItMjIuMS0zMS4ybC00LjctOC4xYy02LjEtMTEtMTEuNC0yMi40LTE1LjgtMzQuM2MtMy4yLTguNy0uNS0xOC40IDYuNC0yNC42bDQzLjMtMzkuNEM2NC42IDI3My4xIDY0IDI2NC42IDY0IDI1NnMuNi0xNy4xIDEuNy0yNS40TDIyLjQgMTkxLjJjLTYuOS02LjItOS42LTE1LjktNi40LTI0LjZjNC40LTExLjkgOS43LTIzLjMgMTUuOC0zNC4zbDQuNy04LjFjNi42LTExIDE0LTIxLjQgMjIuMS0zMS4yYzUuOS03LjIgMTUuNy05LjYgMjQuNS02LjhsNTUuNyAxNy43YzEzLjQtMTAuMyAyOC4yLTE4LjkgNDQtMjUuNGwxMi41LTU3LjFjMi05LjEgOS0xNi4zIDE4LjItMTcuOEMyMjcuMyAxLjIgMjQxLjUgMCAyNTYgMHMyOC43IDEuMiA0Mi41IDMuNWM5LjIgMS41IDE2LjIgOC43IDE4LjIgMTcuOGwxMi41IDU3LjFjMTUuOCA2LjUgMzAuNiAxNS4xIDQ0IDI1LjRsNTUuNy0xNy43YzguOC0yLjggMTguNi0uMyAyNC41IDYuOGM4LjEgOS44IDE1LjUgMjAuMiAyMi4xIDMxLjJsNC43IDguMWM2LjEgMTEgMTEuNCAyMi40IDE1LjggMzQuM3pNMjU2IDMzNmE4MCA4MCAwIDEgMCAwLTE2MCA4MCA4MCAwIDEgMCAwIDE2MHoiLz48L3N2Zz4="},278(e,t,n){n.r(t),n.d(t,{default:()=>Q});var l=n(27723),i=n(47143),o=n(86087),s=n(65604),r=n(34164),a=n(76753),c=n(27442),g=n(17331),h=n(128),p=n(93145),d=n(34551),m=n(82529),u=n(10790);function _(e){const{singleFormState:t,setSingleFormState:n}=(0,h.$)(),{singleForm:l,deviceType:o,isTypeChangeModalActive:s}=t,r=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getActiveElement()),a=(0,i.useDispatch)("helpgent/singleFormStore").setActiveElement,{baseApiRoute:c}=e,{id:g,element_type:p,attributes:_}=r,y=(0,i.useSelect)(e=>e("helpgent/builder").getRegisteredElement(p),[p]);return(0,u.jsx)(m.z,{className:"helpgent-screen-setting-wrap",children:y?(0,u.jsx)(d.A,{controls:y.controls,attributes:_,singleForm:t.singleForm,setAttributes:e=>{const{singleForm:l}=t,{elements:i,global:o}=l.content,s=i.map(t=>t.id===r.id?{...t,attributes:{...t.attributes,...e}}:t),c=s.find(e=>e.id===r.id),g={...l,content:{elements:s,global:o}};a(c),n(e=>({...e,singleForm:g}))},formId:l.id,activeElementId:g,baseApiRoute:c,elementType:p,deviceType:o,isTypeChangeModalActive:s,singleFormState:t,setSingleFormState:n}):""})}var y=n(68993),x=n(79533),b=n(76012),M=n(38267);const j=M.default.div`
    padding: 20px;
	.helpgent-btn--add-theme{
		margin-top: 20px;
	}
`,f=M.default.div`
    .helpgent-my-themes__header{
		display: flex;
		justify-content: space-between;
		align-items: center;
		.helpgent-my-themes__title{
			font-size: 16px;
			font-weight: 600;
			color: var(--helpgent-color-gray-900);
		}
		.helpgent-my-themes__header-count{
			font-size: 12px;
			color: var(--helpgent-color-gray-500);
		}
	}
`,N=M.default.div`
	border: 1px solid var(--helpgent-color-gray-200);
	border-radius: 8px;
	padding: 8px 10px;
	box-sizing: border-box;
	cursor: pointer;
	&.helpgent-active {
		border-color: var(--helpgent-color-primary);
	}
	&:not(:last-child){
		margin-bottom: 10px;
	}
	.helpgent-theme-list-item__label,
	.helpgent-theme-list-item__title{
		font-size: 13px;
		font-weight: 500;
		margin: 0;
		color: var(--helpgent-color-gray-900);
	}
	.helpgent-theme-list-item__title{
		font-size: 12px;
		color: var(--helpgent-color-gray-500);
	}
   .helpgent-theme-list-item__top{
    display: flex;
	justify-content: space-between;
	align-items: center;

	.helpgent-theme-list-item__check{
		svg{
			width: 12px;
			height: 12px;
			path{
				fill: var(--helpgent-color-primary);
			}
		}
	}
   }
	.helpgent-theme-list-item__dots{
		display: flex;
		align-items: center;
		gap: 4px;
		margin: 10px 0;
		.helpgent-theme-list-item__dot-single{
			width: 8px;
			height: 8px;
			border-radius: 50%;
		}
	}
	.helpgent-theme-list-item__bottom{
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
	}
	.helpgent-theme-list-item__title{
		flex: 1;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.helpgent-theme-list-item__actions{
		position: relative;
		display: flex;
		align-items: center;
		flex-shrink: 0;
	}
	.helpgent-theme-list-item__action-button{
		width: 24px;
		height: 24px;
		padding: 0;
		border: 0 none;
		background: transparent;
		outline: none;
		box-shadow: none;
		cursor: pointer;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border-radius: 4px;
		color: var(--helpgent-color-gray-500);
		&:hover{
			background-color: var(--helpgent-color-gray-100);
			color: var(--helpgent-color-primary);
		}
		&.helpgent-theme-list-item__action-button--delete:hover{
			background-color: rgba( 239, 0, 0, 0.08 );
			color: var(--helpgent-color-danger);
		}
		svg{
			width: 14px;
			height: 14px;
		}
		&:focus{
			outline: none;
			box-shadow: 0 0 0 3px rgba( 59, 130, 246, 0.25 );
		}
	}
`,v=M.default.div`
	--helpgent-theme-editor-header-height: 53px;
	--helpgent-theme-editor-sticky-overlap: 12px;
	display: flex;
	flex-direction: column;
	min-height: 100%;
	.helpgent-theme-editor__header{
		position: sticky;
		top: 0;
		z-index: 20;
		padding: 16px 20px;
		background-color: var(--helpgent-color-white);
		border-bottom: 1px solid var(--helpgent-color-gray-200);
		display: flex;
		gap: 10px;
	}
	.helpgent-theme-editor__back-button{
		display: flex;
		align-items: center;
		gap: 4px;
		cursor: pointer;
		background: transparent;
		box-shadow: none;
		border: 0 none;
		outline: none;
		box-shadow: none;
		padding: 0;
		&:focus{
			outline: none;
			box-shadow: none;
		}
		&:hover{
			color: var(--helpgent-color-primary);
			svg{
				path{
					fill: var(--helpgent-color-primary);
				}
			}
		}
		svg{
			width: 14px;
			height: 14px;
			path{
				fill: var(--helpgent-color-gray-500);
			}
		}
	}
	.helpgent-theme-editor__title{
		font-size: 14px;
		font-weight: 600;
		margin: 0;
		color: var(--helpgent-color-gray-900);
	}
	.helpgent-theme-editor-typography + .components-panel__body{
		position: sticky;
		top: calc(var(--helpgent-theme-editor-header-height) - var(--helpgent-theme-editor-sticky-overlap));
		z-index: 19;
		background-color: var(--helpgent-color-white);
		border-top: 0 none;
		border-bottom: 1px solid var(--helpgent-color-gray-200);
		box-shadow: 0 -12px 0 var(--helpgent-color-white);
	}

	.helpgent-field-element__label{
		font-size: 14px;
		font-weight: 600;
		color: var(--helpgent-color-gray-900);
		display: block;
	}
	.helpgent-field-element__top,
	.helpgent-field-element__info{
		.helpgent-field-element__label{
			margin-bottom: 12px;
		}
	}
	.helpgent-field-element--typography{
		.helpgent-field-element__top{
			.helpgent-field-element__label{
				margin-bottom: 0;
			}
		}
	}
	.helpgent-form-group{
		&:last-child{
			margin-bottom: 0;
		}
	}

	.helpgent-theme-editor-typography{
		padding: 20px;
		.helpgent-field-element__top{
			display: flex;
			flex-direction: column;
			gap: 4px;
			margin-bottom: 12px;
		}
	}
	.helpgent-color-picker{
		width: auto !important;
		border: 0 none !important;
	}
	.helpgent-field-element__color-board{
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-width: 140px;
        border-radius: 4px;
        padding: 3px 4px 3px 14px;
        border: 1px solid var(--helpgent-color-gray-300);
        box-shadow: 0px 1px 2px var(--helpgent-shadow-xs);
        .helpgent-color-picker__trigger{
            width: 32px;
            height: 32px;
            border-radius: 4px;
            margin-left: 11px;
        }
        .helpgent-field-element__color-code{
            font-size: 14px;
            font-weight: 500;
            color: var(--helpgent-color-gray-700);
        }
    }
	.helpgent-media-uploader {
		position: relative;
		min-height: 160px;
		border-radius: 12px;
		overflow: hidden;
	}
	.helpgent-media-actions{
		display: flex;
		justify-content: center;
		align-items: center;
		gap: 8px;
		position: absolute;
		bottom: 16px;
		inset-inline-start: 50%;
		transform: translateX(-50%);
		z-index: 4;
		width: calc(100% - 32px);
		.helpgent-btn{
			min-height: 38px;
			border-radius: 6px;
			box-shadow: 0 8px 24px rgba( 16, 24, 40, 0.12 );
			svg{
				margin-inline-end: 10px;
			}
		}
		.helpgent-btn-remove{
			min-width: 56px;
			padding: 0 13px;
			svg{
				margin: 0;
			}
			&:hover{
				background: var(--helpgent-color-danger);
				border-color: var(--helpgent-color-danger);
				svg path{
					fill: var(--helpgent-color-white);
				}
			}
		}
	}
	.helpgent-theme-editor__actions{
		position: sticky;
		bottom: 0;
		background-color: var(--helpgent-color-white);
		padding: 20px;
		border-top: 1px solid var(--helpgent-color-gray-200);
		z-index: 99;
	}
`;var I=n(44329);const L=JSON.parse('{"id":"","type":"custom","description":"Custom theme","attributes":{"name":{"type":"string","default":"Custom Theme"},"font_family":{"type":"object","default":{"family":"Inter","category":"sans-serif"}},"font_weight_variations":{"type":"array","default":[400,500,600]},"icon_color":{"type":"string","default":"#000000"},"title_color":{"type":"string","default":"#101828"},"description_color":{"type":"string","default":"#747C89"},"button_color":{"type":"string","default":"#6551F2"},"button_text_color":{"type":"string","default":"#ffffff"},"options_color":{"type":"string","default":"#3c3c3c"},"promoter_score_active_color":{"type":"string","default":"#6551F2"},"info_color":{"type":"string","default":"#3c3c3c"},"step_navigation_color":{"type":"string","default":"#4d5761"},"field_background_color":{"type":"string","default":"#EFEFEF"},"field_icon_color":{"type":"string","default":"#4d5761"},"rating_color":{"type":"string","default":"#747C89"},"rating_active_color":{"type":"string","default":"#3c3c3c"},"range_track_color":{"type":"string","default":"#D5D5D5"},"range_track_active_color":{"type":"string","default":"#6551F2"},"placeholder_color":{"type":"string","default":"#3c3c3c"},"background_color":{"type":"string","default":"#FFFFFF"},"background_image":{"type":"object","default":{}},"background_overlay":{"type":"string","default":"0"},"overlay_color":{"type":"string","default":"#000000"},"overlay_opacity":{"type":"string","default":"50"},"corner":{"type":"string","default":"partiallyRound"}}}');function T(){const e=(0,i.useDispatch)(),{addTheme:t,setActiveThemeId:n,startEditTheme:o}=e("helpgent/singleFormStore");return(0,u.jsxs)("button",{className:"helpgent-btn helpgent-btn-block helpgent-btn-primary helpgent-btn-bordered helpgent-btn-sm helpgent-btn--add-theme",onClick:()=>{(()=>{const e=function(e){const t=e.attributes;let n={};for(let e in t)n[e]=t[e].default;return n}(L),l=function(e){return{...structuredClone(e),id:(0,I.Ak)(),name:"My new theme"}}({...L,attributes:e,__isNew:!0});t(l),n(l.id),o(l.id)})()},children:[(0,u.jsx)(s.A,{src:b.A}),(0,l.__)("Add new theme","helpgent")]})}var D=n(66087),S=n(72230),w=n(9716),A=n(94928),C=n(38930);function E({theme:e}){const{setSingleFormState:t}=(0,h.$)(),[n,a]=(0,o.useState)(!1),{setActiveThemeId:g,setThemes:p,startEditTheme:d}=(0,i.useDispatch)("helpgent/singleFormStore"),m=e=>{e!==x&&(g(e),t(t=>t?.singleForm?.content?.global?{...t,singleForm:{...t.singleForm,content:{...t.singleForm.content,global:{...t.singleForm.content.global,activeThemeId:e}}}}:t))},{isActive:_,themes:y,activeThemeId:x}=(0,i.useSelect)(t=>({isActive:t("helpgent/singleFormStore").getActiveTheme()?.id===e.id,themes:t("helpgent/singleFormStore").getThemes(),activeThemeId:t("helpgent/singleFormStore").getActiveThemeId()}));return(0,u.jsxs)(N,{className:(0,r.A)("helpgent-theme-list-item",{"helpgent-active":_}),role:"button",tabIndex:0,"aria-label":(0,l.__)("Select theme","helpgent"),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),m(e.id))},onClick:()=>m(e.id),children:[n&&(0,u.jsx)(S.A,{onCancel:()=>a(!1),onSubmit:()=>{const n=e?.id;if(!n)return;const l=y||{};if(!l?.[n])return;const i={...l};delete i[n];const o=x===n?Object.keys(i)[0]||null:x;p(i),g(o),t(e=>e?.singleForm?.content?.global?{...e,singleForm:{...e.singleForm,content:{...e.singleForm.content,global:{...e.singleForm.content.global,themes:i,activeThemeId:o}}}}:e),a(!1)},hasCancelButton:!0,hasSubmitButton:!0,cancelBtnType:"white",cancelText:(0,l.__)("No, cancel","helpgent"),submitBtnType:"danger",submitText:(0,l.__)("Delete","helpgent"),isDismissible:!1,className:"helpgent-popup-alert helpgent-delete-alert-modal",children:(0,u.jsx)(c.fZ,{children:(0,u.jsxs)("div",{className:"helpgent-alert-content",children:[(0,u.jsx)("h4",{className:"helpgent-alert-content__label",children:(0,l.__)("Are you sure you want to delete this theme?","helpgent")}),(0,u.jsxs)("div",{className:"helpgent-alert-content__description",children:[(0,u.jsxs)("p",{children:[(0,l.__)("Theme:","helpgent")," ",(0,u.jsx)("strong",{children:e?.attributes?.name})]}),(0,u.jsx)("p",{children:(0,l.__)("Deleting this theme will remove its design settings from the form.","helpgent")})]})]})})}),(0,u.jsxs)("div",{className:"helpgent-theme-list-item__top",children:[(0,u.jsx)("h4",{className:"helpgent-theme-list-item__label",children:_?(0,l.__)("Current theme","helpgent"):(0,l.__)("Custom theme","helpgent")}),_&&(0,u.jsx)("span",{className:"helpgent-theme-list-item__check",children:(0,u.jsx)(s.A,{src:w.A})})]}),(0,u.jsxs)("div",{className:"helpgent-theme-list-item__dots",children:[(0,u.jsx)("span",{className:"helpgent-theme-list-item__dot-single",style:{backgroundColor:e?.attributes?.title_color}}),(0,u.jsx)("span",{className:"helpgent-theme-list-item__dot-single",style:{backgroundColor:e?.attributes?.description_color}}),(0,u.jsx)("span",{className:"helpgent-theme-list-item__dot-single",style:{backgroundColor:e?.attributes?.button_color}})]}),(0,u.jsxs)("div",{className:"helpgent-theme-list-item__bottom",children:[(0,u.jsx)("h4",{className:"helpgent-theme-list-item__title",children:e?.attributes?.name}),(0,u.jsxs)("div",{className:"helpgent-theme-list-item__actions",children:[(0,u.jsx)("button",{type:"button",className:"helpgent-theme-list-item__action-button","aria-label":(0,l.__)("Edit theme","helpgent"),title:(0,l.__)("Edit theme","helpgent"),onClick:t=>{t?.stopPropagation?.(),g(e?.id),d(e?.id)},onKeyDown:e=>e?.stopPropagation?.(),children:(0,u.jsx)(s.A,{src:A.A})}),(0,u.jsx)("button",{type:"button",className:(0,r.A)("helpgent-theme-list-item__action-button","helpgent-theme-list-item__action-button--delete"),"aria-label":(0,l.__)("Delete theme","helpgent"),title:(0,l.__)("Delete theme","helpgent"),onClick:e=>{e?.stopPropagation?.(),a(!0)},onKeyDown:e=>e?.stopPropagation?.(),children:(0,u.jsx)(s.A,{src:C.A})})]})]})]})}function k(){const e=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getThemes());return(0,D.isEmpty)(e)?null:(0,u.jsxs)(f,{className:"helpgent-my-themes",children:[(0,u.jsxs)("div",{className:"helpgent-my-themes__header",children:[(0,u.jsx)("h3",{className:"helpgent-my-themes__title",children:(0,l.__)("My themes","helpgent")}),(0,u.jsx)("span",{className:"helpgent-my-themes__header-count",children:Object.keys(e).length})]}),(0,u.jsx)("div",{className:"helpgent-my-themes__body",children:Object.values(e).map(e=>(0,u.jsx)(E,{theme:e},e.id))})]})}var F=n(24707),z=n(88869),O=n(85597);function Y(e){const{isFamily:t,availableFonts:n,isFontsFetching:i,global:s,setAttributes:r}=e,{singleFormState:a}=(0,h.$)(),c=(0,o.useRef)(null),g=s?.font_family?.family,p=Object.keys(n?.system||{}).map(e=>({label:e,value:e})),d=Object.entries(n?.google||{}).map(([e,t])=>({label:e,value:e,variations:t.variations,category:t.category})),m=[{label:(0,l.__)("System Fonts","helpgent"),options:p},{label:(0,l.__)("Goggle Fonts","helpgent"),options:d}];return(0,u.jsxs)("div",{className:"helpgent-field-element helpgent-field-element--typography",style:{"--helpgent-selected-font":s?.font_weight_variations&&"string"!=typeof s.font_family?`${s?.font_family?.family}, ${s?.font_family?.category}`:s.font_family},children:[(0,u.jsxs)("div",{className:"helpgent-field-element__top",children:[(0,u.jsx)("span",{className:"helpgent-field-element__label",children:(0,l.__)("Font","helpgent")}),(0,u.jsx)("span",{className:"helpgent-field-element__description",children:(0,l.__)("Select Font Style","helpgent")})]}),t&&(0,u.jsx)("div",{className:"helpgent-field-element__content",children:(0,u.jsx)(z.SelectField,{name:"helpgent-font",isMulti:!1,options:m,components:{Option:e=>(0,u.jsx)(z.SelectComponents.Option,{...e,children:(0,u.jsx)("span",{className:"helpgent-font-option","data-font":e?.value,"data-font_weight_variation":e?.data?.variations,style:{fontFamily:`${e?.value}, ${e?.data?.category}`},children:e.value})})},isLoading:i,selectRef:c,onMenuOpen:function(){c.current&&setTimeout(()=>{c.current.menuListRef.addEventListener("scroll",e=>{const t=e.target.scrollTop,n=t+e.target.offsetHeight,l=e.target.querySelectorAll(".helpgent-font-option");for(const e of[...l])if(e.offsetTop>=t&&e.offsetTop<=n){const t=document.body||document.getElementsByTagName("body")[0],n=(0,O.Xd)("admin",`helpgent_form_${a?.singleForm?.id}`,null),l=["Inter","Arial","Tahoma","Verdana","Helvetica","Times New Roman","Trebuchet MX","Georgia"];if(!n?.hasOwnProperty(e.dataset.font)&&!l.includes(e.dataset.font)){const l={...n,[e.dataset.font]:e.dataset.font};(0,O.CS)("admin",`helpgent_form_${a?.singleForm?.id}`,l);const i=document.createElement("link");i.href=`https://fonts.googleapis.com/css?family=${e?.dataset?.font}:${e?.dataset?.font_weight_variation}`,i.rel="stylesheet",i.type="text/css",t.appendChild(i)}}})},0)},value:p.concat(d).filter(e=>e.value===g)[0]??(0,l.__)("Select font","helpgent"),defaultValue:p.concat(d).filter(e=>e.value===g)[0]??(0,l.__)("Select font","helpgent"),onChange:e=>{const t=p.concat(d).filter(t=>t.value===e)[0];r({font_family:{family:t.value,category:t.category},font_weight_variations:t.variations})},placeholder:(0,l.__)("Select...","helpgent")})})]})}n(51609);const U=(e,t)=>e?.formElements?.some(e=>e?.element_type===t),Z={theme:{type:"panel",children:{name:{type:"text",label:(0,l.__)("Theme name","helpgent")}}},general:{type:"panel",children:{icon_color:{type:"color",label:(0,l.__)("Icon color","helpgent"),condition:function(e){return"statement"===e.element_type}},title_color:{type:"color",label:(0,l.__)("Title color","helpgent")},description_color:{type:"color",label:(0,l.__)("Description color","helpgent")},chat_title_color:{type:"color",label:(0,l.__)("Chat title","helpgent"),condition:function(e){return"open_ended"===e.element_type}},button_color:{type:"color",label:(0,l.__)("Button fill","helpgent")},button_text_color:{type:"color",label:(0,l.__)("Button text","helpgent")},options_color:{type:"color",label:(0,l.__)("Options color","helpgent")},promoter_score_active_color:{type:"color",label:(0,l.__)("Promoter score active color","helpgent"),condition:(e,t)=>U(t,"promoter_score")},info_color:{type:"color",label:(0,l.__)("Info color","helpgent")},step_navigation_color:{type:"color",label:(0,l.__)("Step count & navigation","helpgent")},field_background_color:{type:"color",label:(0,l.__)("Field background","helpgent")},field_icon_color:{type:"color",label:(0,l.__)("Field icon color","helpgent")},placeholder_color:{type:"color",label:(0,l.__)("Placeholder color","helpgent")},rating_color:{type:"color",label:(0,l.__)("Rating color","helpgent"),condition:function(e,t){return U(t,"rating_star")}},rating_active_color:{type:"color",label:(0,l.__)("Rating active color","helpgent"),condition:function(e,t){return U(t,"rating_star")}},range_track_color:{type:"color",label:(0,l.__)("Track color","helpgent"),condition:function(e,t){return U(t,"range_slider")}},range_track_active_color:{type:"color",label:(0,l.__)("Track active color","helpgent"),condition:function(e,t){return U(t,"range_slider")}}}},background_style:{type:"panel",label:(0,l.__)("Background style","helpgent"),children:{background_style_control:{type:"theme_background_style"}}},corner_style:{type:"panel",children:{corner:{type:"selectable_options",label:(0,l.__)("Rounded corner","helpgent"),isSvg:!0,style:"inline",options:[{value:"round",icon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBpZD0iUGF0aF8xNjIyIiBkYXRhLW5hbWU9IlBhdGggMTYyMiIgZD0iTTEwOCw2My40NDZoOFY2MS42aC04YTgsOCwwLDEsMCwwLDE2aDhWNzUuNzU0aC04YTYuMTU0LDYuMTU0LDAsMSwxLDAtMTIuMzA4WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwMCAtNjEuNikiIGZpbGw9IiMzYzNjM2MiLz4KPC9zdmc+Cg=="},{value:"partiallyRound",icon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBpZD0iUGF0aF8xNjI0IiBkYXRhLW5hbWU9IlBhdGggMTYyNCIgZD0iTTY4LjEwOCw2My40NDZINzkuOFY2MS42SDY4LjEwOEE0LjI4MSw0LjI4MSwwLDAsMCw2My44LDY1LjkwOHY3LjM4NUE0LjI4MSw0LjI4MSwwLDAsMCw2OC4xMDgsNzcuNkg3OS44Vjc1Ljc1NEg2OC4xMDhhMi40NjksMi40NjksMCwwLDEtMi40NjItMi40NjJWNjUuOTA4QTIuNDMsMi40MywwLDAsMSw2OC4xMDgsNjMuNDQ2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTYzLjggLTYxLjYpIiBmaWxsPSIjZmZmIi8+Cjwvc3ZnPgo="},{value:"square",icon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBpZD0iUGF0aF8xNjIzIiBkYXRhLW5hbWU9IlBhdGggMTYyMyIgZD0iTTQyLDYzLjQ0NlY2MS42SDI2djE2SDQyVjc1Ljc1NEgyNy44NDZWNjMuNDQ2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI2IC02MS42KSIgZmlsbD0iIzNjM2MzYyIvPgo8L3N2Zz4K"}]}}}};function B({activeElement:e}){const{cancelEditingTheme:t,setActiveThemeId:n,setThemes:r}=(0,i.useDispatch)("helpgent/singleFormStore"),{singleFormState:a,setSingleFormState:c}=(0,h.$)(),g=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getActiveThemeId()),p=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getEditingThemeId()),m=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getThemes()),_=a?.singleForm?.content?.elements||[],y=(0,i.useSelect)(e=>{const t=e("helpgent/singleFormStore"),n=t.getEditingThemeId()||t.getActiveThemeId(),l=t.getThemes()||{};return n?l[n]:null}),[x,b]=(0,o.useState)(y?.attributes||{}),[M,j]=(0,o.useState)(!1),[f,N]=(0,o.useState)(!1),{data:I,isLoading:L,errorMessage:T,isError:D}=(0,F.A)(["helpgent-forms-fonts"],"/helpgent/fonts",{queryConfig:{refetchOnWindowFocus:!1,keepPreviousData:!1,staleTime:1e4}});if(!y)return null;(0,o.useEffect)(()=>{b(y?.attributes||{}),j(!!y?.__isNew)},[y?.id]);const w=e=>{const t=p||g;if(!t)return;const n={...y?.attributes||{},...e||{}},l={...m||{},[t]:{...m?.[t]||y,id:t,attributes:n}};r(l),j(JSON.stringify(n)!==JSON.stringify(x||{}))},A=()=>{const e=p||g;if(!e)return;const l={...m||{},[e]:{...m?.[e]||y,__isNew:!1}};r(l),n(e),t(),c(t=>t?.singleForm?.content?.global?{...t,singleForm:{...t.singleForm,content:{...t.singleForm.content,global:{...t.singleForm.content.global,themes:l,activeThemeId:e}}}}:t)};return(0,u.jsxs)(v,{className:"helpgent-theme-editor",children:[(0,u.jsxs)("div",{className:"helpgent-theme-editor__header",children:[(0,u.jsxs)("button",{className:"helpgent-theme-editor__back-button",onClick:()=>{if(M)N(!0);else{if(y?.__isNew){const e=p||g;if(e){const t={...m||{}};delete t[e],r(t),g===e&&n(Object.keys(t)[0]||null)}}t()}},children:[(0,u.jsx)(s.A,{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik04LjgwMzIgMy42MDQyMUM5LjE2NDggMy45NjU4IDkuMTY0OCA0LjU1MjA3IDguODAzMiA0LjkxMzY2TDQuODI4MyA4Ljg4ODU2SDE3LjQwNzdDMTcuOTE5MSA4Ljg4ODU2IDE4LjMzMzcgOS4zMDMxMSAxOC4zMzM3IDkuODE0NDlDMTguMzMzNyAxMC4zMjU5IDE3LjkxOTEgMTAuNzQwNCAxNy40MDc3IDEwLjc0MDRINC44MjgzTDguODAzMiAxNC43MTUzQzkuMTY0OCAxNS4wNzY5IDkuMTY0OCAxNS42NjMyIDguODAzMiAxNi4wMjQ4QzguNDQxNjEgMTYuMzg2NCA3Ljg1NTM0IDE2LjM4NjQgNy40OTM3NSAxNi4wMjQ4TDEuOTM4MTkgMTAuNDY5MkMxLjU3NjU5IDEwLjEwNzYgMS41NzY1OSA5LjUyMTM2IDEuOTM4MTkgOS4xNTk3Nkw3LjQ5Mzc1IDMuNjA0MjFDNy44NTUzNCAzLjI0MjYxIDguNDQxNjEgMy4yNDI2MSA4LjgwMzIgMy42MDQyMVoiIGZpbGw9IiMxNDE5MjEiLz4KPC9zdmc+Cg=="}),(0,l.__)("Back","helpgent")]}),(0,u.jsx)("h2",{className:"helpgent-theme-editor__title",children:(0,l.__)("Theme Editor","helpgent")})]}),f&&(0,u.jsx)(S.A,{title:(0,l.__)("Unsaved changes","helpgent"),className:"helpgent-theme-editor-confirm-back",onCancel:()=>{const e=p||g;if(e)if(y?.__isNew){const t={...m||{}};delete t[e],r(t),g===e&&n(Object.keys(t)[0]||null)}else r({...m||{},[e]:{...m?.[e]||y,id:e,attributes:x||{}}});N(!1),t()},hasCancelButton:!0,cancelBtnType:"light",cancelText:(0,l.__)("Discard","helpgent"),hasSubmitButton:!0,submitBtnType:"primary",submitText:(0,l.__)("Save changes","helpgent"),onSubmit:()=>{A(),N(!1)},isDismissible:!0,size:"small",children:(0,u.jsx)("div",{className:"helpgent-unsaved-changes-alert",children:(0,u.jsx)("p",{children:(0,l.__)("You have unsaved changes. Please save before leaving.","helpgent")})})}),(0,u.jsx)("div",{className:"helpgent-theme-editor-typography",children:(0,u.jsx)(Y,{isFamily:!0,availableFonts:I?.fonts,isFontsFetching:L,global:y?.attributes,setAttributes:w})}),(0,u.jsx)(d.A,{controls:Z,attributes:{...e,...y?.attributes},formElements:_,setAttributes:w}),M&&(0,u.jsx)("div",{className:"helpgent-theme-editor__actions",children:(0,u.jsx)("button",{className:"helpgent-btn helpgent-btn-primary",onClick:A,children:(0,l.__)("Save changes","helpgent")})})]})}function G({activeElement:e}){const{isEditingTheme:t,themes:n,state:o}=(0,i.useSelect)(e=>({isEditingTheme:e("helpgent/singleFormStore").isEditingTheme(),themes:e("helpgent/singleFormStore").getThemes(),state:e("helpgent/singleFormStore").getState()}));return t?(0,u.jsx)(B,{activeElement:e}):(0,u.jsxs)(j,{children:[(0,u.jsx)(y.A,{status:"info",icon:x.A,content:(0,l.__)("These are global theme settings. Changes apply to the entire form.","helpgent"),hasExternalBtn:!1}),(0,u.jsx)(T,{}),(0,u.jsx)(k,{})]})}var R=n(92684);function Q(e){const{baseApiRoute:t,baseLinkRoute:n}=e,{singleFormState:d,setSingleFormState:m}=(0,h.$)(),{singleForm:y,screenSettingType:x,isActiveTextFieldScreen:b}=d,M=(0,i.useSelect)(e=>e("helpgent/singleFormStore").getActiveElement()),j=(0,a.v4)(d,M?.id),f=(0,o.useRef)(null),N=(0,o.useRef)(null),v=(0,o.useRef)({}),[I,L]=(0,o.useState)(!1),[T,D]=(0,o.useState)(),[S,w]=(0,o.useState)();function A(e){m({...d,screenSettingType:e})}function C(e,t){const n=["element","theme"],l=n.indexOf(t);let i=l;if("ArrowRight"===e.key||"ArrowDown"===e.key)i=(l+1)%n.length;else if("ArrowLeft"===e.key||"ArrowUp"===e.key)i=(l-1+n.length)%n.length;else if("Home"===e.key)i=0;else{if("End"!==e.key)return;i=n.length-1}e.preventDefault();const o=n[i];A(o),v.current[o]?.focus()}return(0,o.useEffect)(()=>{const e=()=>(0,p.A)(f,D,w,window.innerWidth<=575||window.innerWidth<=1199?290:280);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,o.useEffect)(()=>{const e=e=>{if(I&&f.current&&!f.current.contains(e.target)&&!N.current.contains(e.target)){const e=f.current;e&&e.classList.add("helpgent-screen-settings--collapsed"),T<1040&&e.classList.remove("helpgent-screen-settings--float"),L(!1)}};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[I]),(0,u.jsxs)(u.Fragment,{children:[T&&T<1040?(0,u.jsx)("button",{type:"button",className:"helpgent-settings-float",onClick:e=>{!function(e){e.preventDefault();const t=f.current;t&&t.classList.toggle("helpgent-screen-settings--collapsed"),T<1040&&t.classList.toggle("helpgent-screen-settings--float"),L(!I),f.current.clientWidth!==S&&w(window.innerWidth<=575||window.innerWidth<=1199?290:340)}(e)},"aria-expanded":I,"aria-label":I?(0,l.__)("Collapse settings panel","helpgent"):(0,l.__)("Expand settings panel","helpgent"),style:{right:I?`${S+20}px`:"20px",top:"0"},ref:N,children:(0,u.jsx)(s.A,{src:g.A})}):null,(0,u.jsxs)(R.xk,{className:"helpgent-screen-settings "+(T&&T<1040?"helpgent-screen-settings--collapsed":""),ref:f,children:[(0,u.jsx)("div",{className:"helpgent-screen-setting-header",children:(0,u.jsx)("ul",{className:"helpgent-screen-setting-list",role:"tablist","aria-label":(0,l.__)("Builder settings panels","helpgent"),children:"design"===x?(0,u.jsx)("li",{className:"helpgent-design-settings",children:(0,l.__)("Design Settings","helpgent")}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("li",{className:(0,r.A)({"helpgent-active":"element"===x}),children:(0,u.jsx)("button",{type:"button",role:"tab","aria-selected":"element"===x,tabIndex:"element"===x?0:-1,ref:e=>{v.current.element=e},onClick:()=>A("element"),onKeyDown:e=>C(e,"element"),children:(0,l.__)("Screen Settings","helpgent")})}),(0,u.jsx)("li",{className:(0,r.A)({"helpgent-active":"theme"===x}),children:(0,u.jsx)("button",{type:"button",role:"tab","aria-selected":"theme"===x,tabIndex:"theme"===x?0:-1,ref:e=>{v.current.theme=e},onClick:()=>A("theme"),onKeyDown:e=>C(e,"theme"),children:(0,l.__)("Theme","helpgent")})})]})})}),(0,u.jsxs)("div",{className:"helpgent-screen-setting-content helpgent-scrollbar-style",children:[j&&(0,u.jsx)(c.dC,{children:(0,u.jsx)(j,{...e,singleFormState:d,setSingleFormState:m,activeElementId:M?.id})}),"element"===x?(0,u.jsx)(_,{activeScreen:M,baseApiRoute:t,baseLinkRoute:n}):"theme"===x?(0,u.jsx)(G,{activeElement:M}):void 0]})]})]})}},93145(e,t,n){function l(e,t,n,l){const i=e?.current.closest(".helpgent-form-wrapper--adaptive");t(i&&i.clientWidth),n(l)}n.d(t,{A:()=>l})}}]);