@openlettermarketing/olc-react-sdk 1.8.7-beta.1 → 1.8.7-beta.2

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/build/index.js CHANGED
@@ -597,5 +597,5 @@ function we(){return we=Object.assign?Object.assign.bind():function(e){for(var t
597
597
  * @copyright ReactTooltip Team
598
598
  * @license MIT
599
599
  */
600
- const vm="react-tooltip-core-styles",gm="react-tooltip-base-styles",ym={core:!1,base:!1};function bm({css:e,id:t=gm,type:n="base",ref:r}){var a,o;if(!e||"undefined"==typeof document||ym[n])return;if("core"===n&&"undefined"!=typeof process&&(null===(a=null===process||void 0===process?void 0:process.env)||void 0===a?void 0:a.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==n&&"undefined"!=typeof process&&(null===(o=null===process||void 0===process?void 0:process.env)||void 0===o?void 0:o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===n&&(t=vm),r||(r={});const{insertAt:i}=r;if(document.getElementById(t))return;const l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css","top"===i&&l.firstChild?l.insertBefore(c,l.firstChild):l.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),ym[n]=!0}const Lm=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:a=10,strategy:o="absolute",middlewares:i=[Hd(Number(a)),Vd({fallbackAxisSideDirection:"start"}),Rd({padding:5})],border:l})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=i;return n?(c.push(Td({element:n,padding:5})),Nd(e,t,{placement:r,strategy:o,middleware:c}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var a,o;const i={left:`${e}px`,top:`${t}px`,border:l},{x:c,y:s}=null!==(a=r.arrow)&&void 0!==a?a:{x:0,y:0},u=null!==(o={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==o?o:"bottom",d=l&&{borderBottom:l,borderRight:l};let f=0;if(l){const e=`${l}`.match(/(\d+)px/);f=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",...d,[u]:`-${4+f}px`},place:n}}))):Nd(e,t,{placement:"bottom",strategy:o,middleware:c}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},Em=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),wm=(e,t,n)=>{let r=null;const a=function(...a){const o=()=>{r=null,n||e.apply(this,a)};n&&!r&&(e.apply(this,a),r=setTimeout(o,t)),n||(r&&clearTimeout(r),r=setTimeout(o,t))};return a.cancel=()=>{r&&(clearTimeout(r),r=null)},a},Mm=e=>null!==e&&!Array.isArray(e)&&"object"==typeof e,zm=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>zm(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Mm(e)||!Mm(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>zm(e[n],t[n])))},Sm=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const n=t.getPropertyValue(e);return"auto"===n||"scroll"===n}))},xm=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Sm(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Hm="undefined"!=typeof window?l.useLayoutEffect:l.useEffect,Rm=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Vm="DEFAULT_TOOLTIP_ID",Tm={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Nm=(0,l.createContext)({getTooltipData:()=>Tm});function Om(e=Vm){return(0,l.useContext)(Nm).getTooltipData(e)}var Pm={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},km={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Dm=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:a="dark",anchorId:o,anchorSelect:i,place:c="top",offset:s=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:p,wrapper:h,delayShow:C=0,delayHide:A=0,float:m=!1,hidden:v=!1,noArrow:g=!1,clickable:y=!1,closeOnEsc:b=!1,closeOnScroll:L=!1,closeOnResize:E=!1,openEvents:w,closeEvents:M,globalCloseEvents:z,imperativeModeOnly:S,style:x,position:H,afterShow:R,afterHide:V,disableTooltip:T,content:N,contentWrapperRef:O,isOpen:P,defaultIsOpen:k=!1,setIsOpen:D,activeAnchor:B,setActiveAnchor:I,border:F,opacity:G,arrowColor:j,role:U="tooltip"})=>{var W;const q=(0,l.useRef)(null),Y=(0,l.useRef)(null),Q=(0,l.useRef)(null),Z=(0,l.useRef)(null),X=(0,l.useRef)(null),[K,J]=(0,l.useState)({tooltipStyles:{},tooltipArrowStyles:{},place:c}),[_,$]=(0,l.useState)(!1),[ee,te]=(0,l.useState)(!1),[ne,re]=(0,l.useState)(null),ae=(0,l.useRef)(!1),oe=(0,l.useRef)(null),{anchorRefs:ie,setActiveAnchor:le}=Om(t),ce=(0,l.useRef)(!1),[se,ue]=(0,l.useState)([]),de=(0,l.useRef)(!1),fe=d||u.includes("click"),pe=fe||(null==w?void 0:w.click)||(null==w?void 0:w.dblclick)||(null==w?void 0:w.mousedown),he=w?{...w}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!w&&fe&&Object.assign(he,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Ce=M?{...M}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!M&&fe&&Object.assign(Ce,{mouseleave:!1,blur:!1,mouseout:!1});const Ae=z?{...z}:{escape:b||!1,scroll:L||!1,resize:E||!1,clickOutsideAnchor:pe||!1};S&&(Object.assign(he,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Ce,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ae,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Hm((()=>(de.current=!0,()=>{de.current=!1})),[]);const me=e=>{de.current&&(e&&te(!0),setTimeout((()=>{de.current&&(null==D||D(e),void 0===P&&$(e))}),10))};(0,l.useEffect)((()=>{if(void 0===P)return()=>null;P&&te(!0);const e=setTimeout((()=>{$(P)}),10);return()=>{clearTimeout(e)}}),[P]),(0,l.useEffect)((()=>{if(_!==ae.current)if(Rm(X),ae.current=_,_)null==R||R();else{const e=(e=>{const t=getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay").match(/^([\d.]+)(ms|s)$/);if(!t)return 0;const[,n,r]=t;return Number(n)*("ms"===r?1:1e3)})();X.current=setTimeout((()=>{te(!1),re(null),null==V||V()}),e+25)}}),[_]);const ve=e=>{J((t=>zm(t,e)?t:e))},ge=(e=C)=>{Rm(Q),ee?me(!0):Q.current=setTimeout((()=>{me(!0)}),e)},ye=(e=A)=>{Rm(Z),Z.current=setTimeout((()=>{ce.current||me(!1)}),e)},be=e=>{var t;if(!e)return;const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==n?void 0:n.isConnected))return I(null),void le({current:null});C?ge():me(!0),I(n),le({current:n}),Rm(Z)},Le=()=>{y?ye(A||100):A?ye():me(!1),Rm(Q)},Ee=({x:e,y:t})=>{var n;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};Lm({place:null!==(n=null==ne?void 0:ne.place)&&void 0!==n?n:c,offset:s,elementReference:r,tooltipReference:q.current,tooltipArrowReference:Y.current,strategy:f,middlewares:p,border:F}).then((e=>{ve(e)}))},we=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};Ee(n),oe.current=n},Me=e=>{var t;if(!_)return;const n=e.target;n.isConnected&&((null===(t=q.current)||void 0===t?void 0:t.contains(n))||[document.querySelector(`[id='${o}']`),...se].some((e=>null==e?void 0:e.contains(n)))||(me(!1),Rm(Q)))},ze=wm(be,50,!0),Se=wm(Le,50,!0),xe=e=>{Se.cancel(),ze(e)},He=()=>{ze.cancel(),Se()},Re=(0,l.useCallback)((()=>{var e,t;const n=null!==(e=null==ne?void 0:ne.position)&&void 0!==e?e:H;n?Ee(n):m?oe.current&&Ee(oe.current):(null==B?void 0:B.isConnected)&&Lm({place:null!==(t=null==ne?void 0:ne.place)&&void 0!==t?t:c,offset:s,elementReference:B,tooltipReference:q.current,tooltipArrowReference:Y.current,strategy:f,middlewares:p,border:F}).then((e=>{de.current&&ve(e)}))}),[_,B,N,x,c,null==ne?void 0:ne.place,s,f,H,null==ne?void 0:ne.position,m]);(0,l.useEffect)((()=>{var e,t;const n=new Set(ie);se.forEach((e=>{(null==T?void 0:T(e))||n.add({current:e})}));const r=document.querySelector(`[id='${o}']`);r&&!(null==T?void 0:T(r))&&n.add({current:r});const a=()=>{me(!1)},i=xm(B),l=xm(q.current);Ae.scroll&&(window.addEventListener("scroll",a),null==i||i.addEventListener("scroll",a),null==l||l.addEventListener("scroll",a));let c=null;Ae.resize?window.addEventListener("resize",a):B&&q.current&&(c=xd(B,q.current,Re,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&me(!1)};Ae.escape&&window.addEventListener("keydown",s),Ae.clickOutsideAnchor&&window.addEventListener("click",Me);const u=[],d=e=>{_&&(null==e?void 0:e.target)===B||be(e)},f=e=>{_&&(null==e?void 0:e.target)===B&&Le()},p=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],h=["click","dblclick","mousedown","mouseup"];Object.entries(he).forEach((([e,t])=>{t&&(p.includes(e)?u.push({event:e,listener:xe}):h.includes(e)&&u.push({event:e,listener:d}))})),Object.entries(Ce).forEach((([e,t])=>{t&&(p.includes(e)?u.push({event:e,listener:He}):h.includes(e)&&u.push({event:e,listener:f}))})),m&&u.push({event:"pointermove",listener:we});const C=()=>{ce.current=!0},A=()=>{ce.current=!1,Le()};return y&&!pe&&(null===(e=q.current)||void 0===e||e.addEventListener("mouseenter",C),null===(t=q.current)||void 0===t||t.addEventListener("mouseleave",A)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;Ae.scroll&&(window.removeEventListener("scroll",a),null==i||i.removeEventListener("scroll",a),null==l||l.removeEventListener("scroll",a)),Ae.resize?window.removeEventListener("resize",a):null==c||c(),Ae.clickOutsideAnchor&&window.removeEventListener("click",Me),Ae.escape&&window.removeEventListener("keydown",s),y&&!pe&&(null===(e=q.current)||void 0===e||e.removeEventListener("mouseenter",C),null===(t=q.current)||void 0===t||t.removeEventListener("mouseleave",A)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[B,Re,ee,ie,se,w,M,z,fe,C,A]),(0,l.useEffect)((()=>{var e,n;let r=null!==(n=null!==(e=null==ne?void 0:ne.anchorSelect)&&void 0!==e?e:i)&&void 0!==n?n:"";!r&&t&&(r=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const a=new MutationObserver((e=>{const n=[],a=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName&&(e.target.getAttribute("data-tooltip-id")===t?n.push(e.target):e.oldValue===t&&a.push(e.target)),"childList"===e.type){if(B){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(r)try{a.push(...t.filter((e=>e.matches(r)))),a.push(...t.flatMap((e=>[...e.querySelectorAll(r)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,B))&&(te(!1),me(!1),I(null),Rm(Q),Rm(Z),!0)}))}if(r)try{const t=[...e.addedNodes].filter((e=>1===e.nodeType));n.push(...t.filter((e=>e.matches(r)))),n.push(...t.flatMap((e=>[...e.querySelectorAll(r)])))}catch(e){}}})),(n.length||a.length)&&ue((e=>[...e.filter((e=>!a.includes(e))),...n]))}));return a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{a.disconnect()}}),[t,i,null==ne?void 0:ne.anchorSelect,B]),(0,l.useEffect)((()=>{Re()}),[Re]),(0,l.useEffect)((()=>{if(!(null==O?void 0:O.current))return()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>Re()))}));return e.observe(O.current),()=>{e.disconnect()}}),[N,null==O?void 0:O.current]),(0,l.useEffect)((()=>{var e;const t=document.querySelector(`[id='${o}']`),n=[...se,t];B&&n.includes(B)||I(null!==(e=se[0])&&void 0!==e?e:t)}),[o,se,B]),(0,l.useEffect)((()=>(k&&me(!0),()=>{Rm(Q),Rm(Z)})),[]),(0,l.useEffect)((()=>{var e;let n=null!==(e=null==ne?void 0:ne.anchorSelect)&&void 0!==e?e:i;if(!n&&t&&(n=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),n)try{const e=Array.from(document.querySelectorAll(n));ue(e)}catch(e){ue([])}}),[t,i,null==ne?void 0:ne.anchorSelect]),(0,l.useEffect)((()=>{Q.current&&(Rm(Q),ge(C))}),[C]);const Ve=null!==(W=null==ne?void 0:ne.content)&&void 0!==W?W:N,Te=_&&Object.keys(K.tooltipStyles).length>0;return(0,l.useImperativeHandle)(e,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}re(null!=e?e:null),(null==e?void 0:e.delay)?ge(e.delay):me(!0)},close:e=>{(null==e?void 0:e.delay)?ye(e.delay):me(!1)},activeAnchor:B,place:K.place,isOpen:Boolean(ee&&!v&&Ve&&Te)}))),ee&&!v&&Ve?l.createElement(h,{id:t,role:U,className:mm("react-tooltip",Pm.tooltip,km.tooltip,km[a],n,`react-tooltip__place-${K.place}`,Pm[Te?"show":"closing"],Te?"react-tooltip__show":"react-tooltip__closing","fixed"===f&&Pm.fixed,y&&Pm.clickable),onTransitionEnd:e=>{Rm(X),_||"opacity"!==e.propertyName||(te(!1),re(null),null==V||V())},style:{...x,...K.tooltipStyles,opacity:void 0!==G&&Te?G:void 0},ref:q},Ve,l.createElement(h,{className:mm("react-tooltip-arrow",Pm.arrow,km.arrow,r,g&&Pm.noArrow),style:{...K.tooltipArrowStyles,background:j?`linear-gradient(to right bottom, transparent 50%, ${j} 50%)`:void 0},ref:Y})):null},Bm=({content:e})=>l.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Im=l.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:a,render:o,className:i,classNameArrow:c,variant:s="dark",place:u="top",offset:d=10,wrapper:f="div",children:p=null,events:h=["hover"],openOnClick:C=!1,positionStrategy:A="absolute",middlewares:m,delayShow:v=0,delayHide:g=0,float:y=!1,hidden:b=!1,noArrow:L=!1,clickable:E=!1,closeOnEsc:w=!1,closeOnScroll:M=!1,closeOnResize:z=!1,openEvents:S,closeEvents:x,globalCloseEvents:H,imperativeModeOnly:R=!1,style:V,position:T,isOpen:N,defaultIsOpen:O=!1,disableStyleInjection:P=!1,border:k,opacity:D,arrowColor:B,setIsOpen:I,afterShow:F,afterHide:G,disableTooltip:j,role:U="tooltip"},W)=>{const[q,Y]=(0,l.useState)(r),[Q,Z]=(0,l.useState)(a),[X,K]=(0,l.useState)(u),[J,_]=(0,l.useState)(s),[$,ee]=(0,l.useState)(d),[te,ne]=(0,l.useState)(v),[re,ae]=(0,l.useState)(g),[oe,ie]=(0,l.useState)(y),[le,ce]=(0,l.useState)(b),[se,ue]=(0,l.useState)(f),[de,fe]=(0,l.useState)(h),[pe,he]=(0,l.useState)(A),[Ce,Ae]=(0,l.useState)(null),[me,ve]=(0,l.useState)(null),ge=(0,l.useRef)(P),{anchorRefs:ye,activeAnchor:be}=Om(e),Le=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;return n.startsWith("data-tooltip-")&&(t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null),t}),{}),Ee=e=>{const t={place:e=>{var t;K(null!==(t=e)&&void 0!==t?t:u)},content:e=>{Y(null!=e?e:r)},html:e=>{Z(null!=e?e:a)},variant:e=>{var t;_(null!==(t=e)&&void 0!==t?t:s)},offset:e=>{ee(null===e?d:Number(e))},wrapper:e=>{var t;ue(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");fe(null!=t?t:h)},"position-strategy":e=>{var t;he(null!==(t=e)&&void 0!==t?t:A)},"delay-show":e=>{ne(null===e?v:Number(e))},"delay-hide":e=>{ae(null===e?g:Number(e))},float:e=>{ie(null===e?y:"true"===e)},hidden:e=>{ce(null===e?b:"true"===e)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};(0,l.useEffect)((()=>{Y(r)}),[r]),(0,l.useEffect)((()=>{Z(a)}),[a]),(0,l.useEffect)((()=>{K(u)}),[u]),(0,l.useEffect)((()=>{_(s)}),[s]),(0,l.useEffect)((()=>{ee(d)}),[d]),(0,l.useEffect)((()=>{ne(v)}),[v]),(0,l.useEffect)((()=>{ae(g)}),[g]),(0,l.useEffect)((()=>{ie(y)}),[y]),(0,l.useEffect)((()=>{ce(b)}),[b]),(0,l.useEffect)((()=>{he(A)}),[A]),(0,l.useEffect)((()=>{ge.current!==P&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[P]),(0,l.useEffect)((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===P,disableBase:P}}))}),[]),(0,l.useEffect)((()=>{var r;const a=new Set(ye);let o=n;if(!o&&e&&(o=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),o)try{document.querySelectorAll(o).forEach((e=>{a.add({current:e})}))}catch(r){console.warn(`[react-tooltip] "${o}" is not a valid CSS selector`)}const i=document.querySelector(`[id='${t}']`);if(i&&a.add({current:i}),!a.size)return()=>null;const l=null!==(r=null!=me?me:i)&&void 0!==r?r:be.current,c=new MutationObserver((e=>{e.forEach((e=>{var t;if(!l||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=Le(l);Ee(n)}))})),s={attributes:!0,childList:!1,subtree:!1};if(l){const e=Le(l);Ee(e),c.observe(l,s)}return()=>{c.disconnect()}}),[ye,be,me,t,n]),(0,l.useEffect)((()=>{(null==V?void 0:V.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),k&&!Em("border",`${k}`)&&console.warn(`[react-tooltip] "${k}" is not a valid \`border\`.`),(null==V?void 0:V.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),D&&!Em("opacity",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`opacity\`.`)}),[]);let we=p;const Me=(0,l.useRef)(null);if(o){const e=o({content:(null==me?void 0:me.getAttribute("data-tooltip-content"))||q||null,activeAnchor:me});we=e?l.createElement("div",{ref:Me,className:"react-tooltip-content-wrapper"},e):null}else q&&(we=q);Q&&(we=l.createElement(Bm,{content:Q}));const ze={forwardRef:W,id:e,anchorId:t,anchorSelect:n,className:mm(i,Ce),classNameArrow:c,content:we,contentWrapperRef:Me,place:X,variant:J,offset:$,wrapper:se,events:de,openOnClick:C,positionStrategy:pe,middlewares:m,delayShow:te,delayHide:re,float:oe,hidden:le,noArrow:L,clickable:E,closeOnEsc:w,closeOnScroll:M,closeOnResize:z,openEvents:S,closeEvents:x,globalCloseEvents:H,imperativeModeOnly:R,style:V,position:T,isOpen:N,defaultIsOpen:O,border:k,opacity:D,arrowColor:B,setIsOpen:I,afterShow:F,afterHide:G,disableTooltip:j,activeAnchor:me,setActiveAnchor:e=>ve(e),role:U};return l.createElement(Dm,{...ze})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||bm({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||bm({css:"\n.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}",type:"base"})}));var Fm=a(27455),Gm={};Gm.styleTagTransform=qc(),Gm.setAttributes=Gc(),Gm.insert=Ic().bind(null,"head"),Gm.domAPI=Dc(),Gm.insertStyleElement=Uc();Pc()(Fm.A,Gm);Fm.A&&Fm.A.locals&&Fm.A.locals;var jm=a(99197),Um={};Um.styleTagTransform=qc(),Um.setAttributes=Gc(),Um.insert=Ic().bind(null,"head"),Um.domAPI=Dc(),Um.insertStyleElement=Uc();Pc()(jm.A,Um);jm.A&&jm.A.locals&&jm.A.locals;const Wm=function(e){var t=e.anchorSelect,n=e.place,r=e.title;return l.createElement(Im,{className:"basic-tooltip",anchorSelect:t,place:n},r)};const qm=function(e){var t=e.className,n=void 0===t?{}:t,r=e.fill;return l.createElement("svg",{width:"12",className:n,height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{clipPath:"url(#clip0_1555_2219)"},l.createElement("path",{d:"M6.80169 8.45472C6.67902 8.46615 6.55586 8.43847 6.44987 8.37562C6.37243 8.29612 6.33531 8.18575 6.34897 8.07562C6.35183 7.98393 6.36278 7.89266 6.38169 7.8029C6.4 7.69991 6.42364 7.59796 6.45259 7.49744L6.77441 6.39015C6.8076 6.28087 6.82954 6.16846 6.83987 6.05469C6.83987 5.93197 6.85623 5.84741 6.85623 5.79833C6.86307 5.57959 6.76968 5.36969 6.60259 5.22833C6.39707 5.07055 6.14113 4.993 5.88259 5.01015C5.69732 5.01294 5.51347 5.04327 5.33713 5.10015C5.1444 5.16015 4.94167 5.23197 4.72895 5.31562L4.63623 5.67561C4.69895 5.65379 4.77533 5.62926 4.86259 5.60197C4.94584 5.57732 5.03214 5.56445 5.11895 5.56379C5.24073 5.5506 5.36331 5.58051 5.46531 5.64833C5.53459 5.731 5.5671 5.83839 5.55531 5.94562C5.555 6.03733 5.54495 6.12876 5.52531 6.21833C5.50621 6.3138 5.48167 6.41469 5.45167 6.52105L5.12713 7.63377C5.10097 7.7372 5.08004 7.84187 5.06441 7.94741C5.05166 8.03776 5.04529 8.12889 5.04531 8.22013C5.04397 8.44037 5.14468 8.64883 5.31803 8.78467C5.52672 8.94491 5.78631 9.02434 6.04893 9.00831C6.23385 9.01211 6.41814 8.98539 6.59439 8.92921C6.74893 8.87647 6.9553 8.80103 7.21349 8.70285L7.30077 8.35921C7.23083 8.38822 7.15881 8.41192 7.08531 8.43011C6.99236 8.45134 6.89692 8.45959 6.80169 8.45472Z",fill:r}),l.createElement("path",{d:"M7.14277 3.20479C6.99434 3.06848 6.79878 2.99514 6.59731 3.00025C6.39596 2.9957 6.20059 3.06897 6.05185 3.20479C5.77923 3.43987 5.74878 3.85145 5.98388 4.1241C6.00484 4.14841 6.02755 4.17112 6.05185 4.19207C6.36244 4.46988 6.83218 4.46988 7.14275 4.19207C7.41537 3.95467 7.44394 3.54123 7.20655 3.26861C7.18681 3.2459 7.16548 3.22457 7.14277 3.20479Z",fill:r}),l.createElement("path",{d:"M6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0ZM6 11.4545C2.98753 11.4545 0.545461 9.01247 0.545461 6C0.545461 2.98753 2.98753 0.545461 6 0.545461C9.01247 0.545461 11.4545 2.98753 11.4545 6C11.4545 9.01247 9.01247 11.4545 6 11.4545Z",fill:r})),l.createElement("defs",null,l.createElement("clipPath",{id:"clip0_1555_2219"},l.createElement("rect",{width:"12",height:"12",fill:"white"}))))};const Ym=function(e){var t=e.className,n=void 0===t?{}:t;return l.createElement("svg",{width:"19",className:n,height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M3.5 15.025H3.975V15.5C3.975 16.1697 4.24103 16.8119 4.71456 17.2854C5.18809 17.759 5.83033 18.025 6.5 18.025H15.5C16.1697 18.025 16.8119 17.759 17.2854 17.2854C17.759 16.8119 18.025 16.1697 18.025 15.5V6.5C18.025 5.83033 17.759 5.18809 17.2854 4.71456C16.8119 4.24103 16.1697 3.975 15.5 3.975H15.025V3.5C15.025 2.83033 14.759 2.18808 14.2854 1.71456C13.8119 1.24103 13.1697 0.975 12.5 0.975H3.5C2.83033 0.975 2.18808 1.24103 1.71456 1.71456C1.24103 2.18808 0.975 2.83033 0.975 3.5V12.5C0.975 13.1697 1.24103 13.8119 1.71456 14.2854C2.18808 14.759 2.83033 15.025 3.5 15.025ZM15.5 5.025C15.8912 5.025 16.2664 5.1804 16.543 5.45702C16.8196 5.73363 16.975 6.10881 16.975 6.5V15.5C16.975 15.8912 16.8196 16.2664 16.543 16.543C16.2664 16.8196 15.8912 16.975 15.5 16.975H6.5C6.10881 16.975 5.73363 16.8196 5.45702 16.543C5.1804 16.2664 5.025 15.8912 5.025 15.5V15.025H12.5C13.1697 15.025 13.8119 14.759 14.2854 14.2854C14.759 13.8119 15.025 13.1697 15.025 12.5V5.025H15.5ZM2.025 3.5C2.025 3.10881 2.1804 2.73363 2.45702 2.45702C2.73363 2.1804 3.10881 2.025 3.5 2.025H12.5C12.8912 2.025 13.2664 2.1804 13.543 2.45702C13.8196 2.73363 13.975 3.10881 13.975 3.5V12.5C13.975 12.8912 13.8196 13.2664 13.543 13.543C13.2664 13.8196 12.8912 13.975 12.5 13.975H3.5C3.10881 13.975 2.73363 13.8196 2.45702 13.543C2.1804 13.2664 2.025 12.8912 2.025 12.5V3.5Z",fill:"",stroke:"",strokeWidth:"0.05"}))};const Qm=function(e){var t=e.fill;return l.createElement("svg",{width:"23",height:"23",viewBox:"0 0 23 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M20.3047 5.21094H18.5078C18.0116 5.21094 17.6094 5.61317 17.6094 6.10938C17.6094 6.60558 18.0116 7.00781 18.5078 7.00781H20.3047C20.8001 7.00781 21.2031 7.41085 21.2031 7.90625V15.0938C21.2031 15.5891 20.8001 15.9922 20.3047 15.9922H18.5078C18.0116 15.9922 17.6094 16.3944 17.6094 16.8906C17.6094 17.3868 18.0116 17.7891 18.5078 17.7891H20.3047C21.7909 17.7891 23 16.5799 23 15.0938V7.90625C23 6.42005 21.7909 5.21094 20.3047 5.21094Z",fill:t}),l.createElement("path",{d:"M4.49219 10.6016H5.39062V13.2969C5.39062 13.7931 5.79286 14.1953 6.28906 14.1953C6.78527 14.1953 7.1875 13.7931 7.1875 13.2969V10.6016H8.08594C8.58214 10.6016 8.98438 10.1993 8.98438 9.70312C8.98438 9.20692 8.58214 8.80469 8.08594 8.80469H4.49219C3.99598 8.80469 3.59375 9.20692 3.59375 9.70312C3.59375 10.1993 3.99598 10.6016 4.49219 10.6016Z",fill:t}),l.createElement("path",{d:"M2.69531 17.7891H14.0156V19.5859H13.1172C12.621 19.5859 12.2188 19.9882 12.2188 20.4844C12.2188 20.9806 12.621 21.3828 13.1172 21.3828H16.7109C17.2071 21.3828 17.6094 20.9806 17.6094 20.4844C17.6094 19.9882 17.2071 19.5859 16.7109 19.5859H15.8125V3.41406H16.7109C17.2071 3.41406 17.6094 3.01183 17.6094 2.51562C17.6094 2.01942 17.2071 1.61719 16.7109 1.61719H13.1172C12.621 1.61719 12.2188 2.01942 12.2188 2.51562C12.2188 3.01183 12.621 3.41406 13.1172 3.41406H14.0156V5.21094H2.69531C1.20912 5.21094 0 6.42005 0 7.90625V15.0938C0 16.5799 1.20912 17.7891 2.69531 17.7891ZM1.79688 7.90625C1.79688 7.41085 2.19991 7.00781 2.69531 7.00781H14.0156V15.9922H2.69531C2.19991 15.9922 1.79688 15.5891 1.79688 15.0938V7.90625Z",fill:t}))};var Zm=a(17528),Xm={};Xm.styleTagTransform=qc(),Xm.setAttributes=Gc(),Xm.insert=Ic().bind(null,"head"),Xm.domAPI=Dc(),Xm.insertStyleElement=Uc();Pc()(Zm.A,Xm);Zm.A&&Zm.A.locals&&Zm.A.locals;function Km(e){return Km="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Km(e)}function Jm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Jm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Km(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Km(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function _m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_m(Object(n),!0).forEach((function(t){ev(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ev(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Km(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Km(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Km(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=av(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function nv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||av(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function av(e,t){if(e){if("string"==typeof e)return ov(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ov(e,t):void 0}}function ov(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iv(){return iv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iv.apply(null,arguments)}var lv={backgroundColor:"transparent"},cv={name:"Fields",Tab:(0,oA.observer)((function(e){return l.createElement(aA.SectionTab,iv({name:"Fields"},e),l.createElement(Qm,{fill:"var(--text-color)"}))})),Panel:(0,oA.observer)((function(e){e.store;var t,n=e.onGetCustomFields,r=e.allowSenderFields,a=e.excludedFields,o=e.allowPropertyFields,i=e.platformName,c=rv((0,l.useState)(!1),2),s=(c[0],c[1]),u=rv((0,l.useState)(""),2),d=u[0],f=u[1],p=rv((0,l.useState)([]),2),h=p[0],C=p[1],A=rv((0,l.useState)([]),2),m=A[0],v=A[1],g=rv((0,l.useState)([]),2),y=g[0],b=g[1],L=rv((0,l.useState)([]),2),E=L[0],w=L[1],M=rv((0,l.useState)([]),2),z=M[0],S=M[1],x=rv((0,l.useState)([]),2),H=x[0],R=x[1],V=rv((0,l.useState)([]),2),T=V[0],N=V[1],O=lt(),P=Ke((function(e){return e.customFields.customFields})),k=Ke((function(e){return e.customFields.customFieldsV2})),D=Ke((function(e){return e.customFields.platformFields})),B=Ke((function(e){return e.customFields.defaultDynamicFields})),I=Ke((function(e){return e.templates.defaultSenderFields})),F=Ke((function(e){return e.templates.defaultPropertyFields})),G=Ke((function(e){return e.templates.defaultMiscFields})),j=Ke((function(e){return e.templates.product})),U=null==j?void 0:j.productType,W=function(){s((function(e){return!e}))},q=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nv(o,r,a,i,l,"next",e)}function l(e){nv(o,r,a,i,l,"throw",e)}i(void 0)}))}}(Jm().mark((function e(){var t,r,a,o,i,l,c,s,u,d,f,p;return Jm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=7;break}return e.next=3,n();case 3:if(t=e.sent,r=[],a=[],"v2"===(null==t?void 0:t.version)){i=t.customFields.flatMap((function(e){return e.fields})),l=tv(i);try{for(l.s();!(c=l.n()).done;)((s=c.value).isPlatformField?r:a).push(s)}catch(e){l.e(e)}finally{l.f()}u=null==t?void 0:t.customFields.map((function(e){return $m($m({},e),{},{fields:e.fields.filter((function(e){return a.includes(e)}))})})).filter((function(e){return e.fields.length>0})),null!=t&&null!==(o=t.customFields)&&void 0!==o&&o.length?(O({type:Cr,payload:[]}),O({type:Ar,payload:u})):(O({type:Cr,payload:[]}),O({type:Ar,payload:[]})),O(r.length?{type:mr,payload:r}:{type:mr,payload:[]})}else{d=tv(t);try{for(d.s();!(f=d.n()).done;)((p=f.value).isPlatformField?r:a).push(p)}catch(e){d.e(e)}finally{d.f()}a.length?O({type:Cr,payload:a}):O({type:Cr,payload:[]}),O(r.length?{type:mr,payload:r}:{type:mr,payload:[]})}case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("Real Penned Letter"===U){var n=e.replace(/{{/g,"((").replace(/}}/g,"))");pa(n),O(Kh("".concat(t," Copied")))}else pa(e),O(Kh("".concat(t," Copied")))};return(0,l.useEffect)((function(){q()}),[]),(0,l.useEffect)((function(){var e,t,n,i;if(C(null==B?void 0:B.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})).filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),b(G.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),w(o?null==F||null===(e=F.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===e?void 0:e.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})):[]),R(r?null==I||null===(t=I.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===t?void 0:t.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})):[]),N(null==D||null===(n=D.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===n?void 0:n.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),v(null==P||null===(i=P.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===i?void 0:i.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),k.length){var l=k.map((function(e){return $m($m({},e),{},{fields:e.fields.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))})})).filter((function(e){var t;return(null==e||null===(t=e.fields)||void 0===t?void 0:t.length)>0}));S(l)}else{var c;C(null==B||null===(c=B.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===c?void 0:c.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})))}}),[d,I,D,P,B,k]),l.createElement("div",{style:{height:"100%",display:"flex",flexDirection:"column"}},l.createElement("div",{className:"bp5-input-group fields-search"},l.createElement("span",{"aria-hidden":"true",className:"bp5-icon bp5-icon-search"},l.createElement("svg",{"data-icon":"search",height:"16",role:"img",viewBox:"0 0 16 16",width:"16"},l.createElement("path",{d:"M15.55 13.43l-2.67-2.68a6.94 6.94 0 001.11-3.76c0-3.87-3.13-7-7-7s-7 3.13-7 7 3.13 7 7 7c1.39 0 2.68-.42 3.76-1.11l2.68 2.67a1.498 1.498 0 102.12-2.12zm-8.56-1.44c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z",fillRule:"evenodd"}))),l.createElement("input",{type:"search",placeholder:"Search...",className:"bp5-input",onChange:function(e){return f(e.target.value)},value:d})),l.createElement("div",{className:"dynamic-content"},h.length>0&&l.createElement(l.Fragment,null,l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Contact Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"infoIcon"}),l.createElement(Wm,{anchorSelect:".infoIcon",place:"bottom",title:"Merge fields allow you to personalize your mailer with contact information."}))),null==h?void 0:h.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_contact"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),o&&E.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Property Address"),l.createElement(qm,{fill:"var(--primary-color)",className:"property"}),l.createElement(Wm,{anchorSelect:".property",place:"bottom",title:"You can add property fields to your template."}))),null==E?void 0:E.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_property"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),r&&H.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Sender Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"sender"}),l.createElement(Wm,{anchorSelect:".sender",place:"bottom",title:"You can add sender fields to your template."}))),null==H?void 0:H.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_sender"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),l.createElement(Wm,{anchorSelect:".copy",place:"bottom",title:"Copy"}),n&&(null==D?void 0:D.length)>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},i?"".concat(i," Fields"):"OLC Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"platform"}),l.createElement(Wm,{anchorSelect:".platform",place:"bottom",title:"You can add ".concat(i?"".concat(i," Fields"):"OLC Fields"," to your template.")})),l.createElement(Jc,{onClick:W})),null==T?void 0:T.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_platform"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),n&&z.length>0?z.map((function(e,t){return l.createElement("div",{key:t+"custom-section"},l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},null==e?void 0:e.section),l.createElement(qm,{fill:"var(--primary-color)",className:null==e?void 0:e.section.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().replace(/\s+/g,"-")}),l.createElement(Wm,{anchorSelect:".".concat(null==e?void 0:e.section.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().replace(/\s+/g,"-")),place:"bottom",title:"You can add ".concat(null==e?void 0:e.section," to your template.")})),l.createElement(Jc,{onClick:W})),e.fields.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+r},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))})))})):n&&(null==P?void 0:P.length)>0&&m.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Custom Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"custom"}),l.createElement(Wm,{anchorSelect:".custom",place:"bottom",title:"You can add custom fields to your template."})),l.createElement(Jc,{onClick:W})),null==m?void 0:m.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_custom"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),G&&y.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Miscellaneous Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"miscellaneous"}),l.createElement(Wm,{anchorSelect:".miscellaneous",place:"bottom",title:"You can add miscellaneous fields to your template."}))),null==y||null===(t=y.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===t?void 0:t.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_property"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),h.length<=0&&z.length<=0&&E.length<=0&&H.length<=0&&T.length<=0&&m.length<=0&&y.length<=0&&l.createElement("div",{className:"no-result"},"No results")))}))};const sv=cv;var uv=a(59195);function dv(e){return dv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dv(e)}function fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fv(Object(n),!0).forEach((function(t){hv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hv(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=dv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=dv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==dv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cv(e){return function(e){if(Array.isArray(e))return Lv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bv(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Av(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=bv(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function mv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */mv=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==dv(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(dv(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function vv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function gv(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){vv(o,r,a,i,l,"next",e)}function l(e){vv(o,r,a,i,l,"throw",e)}i(void 0)}))}}function yv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||bv(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bv(e,t){if(e){if("string"==typeof e)return Lv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lv(e,t):void 0}}function Lv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ev=(0,oA.observer)((function(e){var t=e.store,n=yv((0,l.useState)([]),2),r=n[0],a=n[1],o=yv((0,l.useState)(!1),2),i=o[0],c=o[1],s=yv((0,l.useState)(!1),2),u=s[0],d=s[1],f=lt(),p=Ke((function(e){return e.templates.uploadedImages})),h=function(){var e=gv(mv().mark((function e(){return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:p&&(d(!0),a(p),d(!1));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(e){return e&&ra.includes(null==e?void 0:e.type)?!(e.size>=73e5)||(f(Jh(lo.CUSTOM_UPLOAD_SECTION.SIZE_VALIDATION)),!1):(f(Jh(lo.CUSTOM_UPLOAD_SECTION.TYPE_VALIDATION)),!1)},A=function(){var e=gv(mv().mark((function e(t){var n,o,i,l,s,u,d;return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,n=t.target,o=Av(n.files),e.prev=3,o.s();case 5:if((i=o.n()).done){e.next=21;break}if(l=i.value,s=ga(l),C(l)){e.next=12;break}return n.value=null,e.abrupt("return");case 12:return c(!0),e.next=15,Wa(l);case 15:u=e.sent,d=[].concat(Cv(r),[{url:u,type:s}]),a(d),f({type:lr,payload:d});case 19:e.next=5;break;case 21:e.next=26;break;case 23:e.prev=23,e.t0=e.catch(3),o.e(e.t0);case 26:return e.prev=26,o.f(),e.finish(26);case 29:c(!1),n.value=null,e.next=36;break;case 33:return e.prev=33,e.t1=e.catch(0),e.abrupt("return",e.t1);case 36:return e.prev=36,c(!1),e.finish(36);case 39:case"end":return e.stop()}}),e,null,[[0,33,36,39],[3,23,26,29]])})));return function(t){return e.apply(this,arguments)}}();return(0,l.useEffect)((function(){h()}),[]),l.createElement("div",{style:{height:"100%",display:"flex",flexDirection:"column"}},l.createElement("div",{style:{height:"40px",paddingTop:"5px"}},lo.CUSTOM_UPLOAD_SECTION.HEADING),l.createElement("div",{style:{height:"35px"}},l.createElement("strong",null,lo.CUSTOM_UPLOAD_SECTION.ACCEPTED_FORMATS)),l.createElement("div",{style:{height:"35px",paddingBottom:"15px"}},l.createElement("strong",null,lo.CUSTOM_UPLOAD_SECTION.MAX_SIZE)),l.createElement("div",{style:{marginBottom:"20px"}},l.createElement("label",{htmlFor:"input-file"},i?l.createElement("button",{type:"button",className:"bp5-button bp5-disabled bp5-loading bp5-intent-primary",style:{width:"100%",backgroundColor:"rgb(246, 247, 249)",boxShadow:"rgba(17, 20, 24, 0.2) 0px 0px 0px 1px inset, rgba(17, 20, 24, 0.1) 0px 1px 2px",color:"rgb(28, 33, 39)"},disabled:!0},l.createElement("div",{"aria-label":"loading",className:"bp5-spinner bp5-button-spinner"},l.createElement("div",{className:"bp5-spinner-animation"},l.createElement("svg",{width:"20",height:"20",strokeWidth:"16",viewBox:"-3 -3 106 106"},l.createElement("path",{className:"bp5-spinner-track",d:"M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90"}),l.createElement("path",{className:"bp5-spinner-head",d:"M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90",pathLength:"280",strokeDasharray:"280 280",strokeDashoffset:"210"}))))):l.createElement("button",{type:"button",className:"custom-upload-image-btn bp5-button bp5-intent-primary",style:{width:"100%",backgroundColor:"#f6f7f9",boxShadow:"inset 0 0 0 1px #11141833, 0 1px 2px #1114181a",color:"#1c2127"},onClick:function(){var e;return null===(e=document.getElementById("input-file"))||void 0===e?void 0:e.click()}},l.createElement("svg",{"data-icon":"upload",width:"16",height:"16",role:"img",viewBox:"0 0 16 16"},l.createElement("path",{d:"M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm3 8c-.28 0-.53-.11-.71-.29L9 6.41V12c0 .55-.45 1-1 1s-1-.45-1-1V6.41l-1.29 1.3a1.003 1.003 0 01-1.42-1.42l3-3C7.47 3.11 7.72 3 8 3s.53.11.71.29l3 3A1.003 1.003 0 0111 8z",fillRule:"evenodd"})),l.createElement("span",{className:"bp5-button-text"}," Upload Image")),l.createElement("input",{type:"file",id:"input-file",style:{display:"none"},onChange:A,multiple:!0}))),l.createElement(aA.ImagesGrid,{images:r,getPreview:function(e){return null==e?void 0:e.url},crossOrigin:void 0,isLoading:u,onSelect:function(){var e=gv(mv().mark((function e(n,r,a){var o,i,l,c,s,u,d,f,p,h;return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null==n?void 0:n.url,l=null==n?void 0:n.type,e.next=4,(0,uv.getImageSize)(i);case 4:if(c=e.sent,s=c.width,u=c.height,!a||"svg"!==a.type||!a.contentEditable||"image"!==l){e.next=10;break}return a.set({maskSrc:i}),e.abrupt("return");case 10:if(!a||"image"!==a.type||!a.contentEditable||"image"!=l){e.next=14;break}return d=(0,uv.getCrop)(a,{width:s,height:u}),a.set(pv({src:i},d)),e.abrupt("return");case 14:f=Math.min(t.width/s,t.height/u,1),s*=f,u*=f,p=((null==r?void 0:r.x)||t.width/2)-s/2,h=((null==r?void 0:r.y)||t.height/2)-u/2,null===(o=t.activePage)||void 0===o||o.addElement({type:l,src:i,x:p,y:h,width:s,height:u});case 20:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}()}))}));aA.UploadSection.Panel=Ev;const wv=Ev;const Mv=function(){return l.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},l.createElement("title",null,"ic_fluent_apps_add_in_24_filled"),l.createElement("desc",null,"Created with Sketch."),l.createElement("g",{id:"🔍-Product-Icons",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},l.createElement("g",{id:"ic_fluent_apps_add_in_24_filled",fill:"#212121",fillRule:"nonzero"},l.createElement("path",{d:"M10.5,3 C11.8807119,3 13,4.11928813 13,5.5 L13,11 L18.5,11 C19.8807119,11 21,12.1192881 21,13.5 L21,18.5 C21,19.8807119 19.8807119,21 18.5,21 L5.5,21 C4.11928813,21 3,19.8807119 3,18.5 L3,5.5 C3,4.11928813 4.11928813,3 5.5,3 L10.5,3 Z M11,13 L5,13 L5,18.5 C5,18.7761424 5.22385763,19 5.5,19 L11,19 L11,13 Z M18.5,13 L13,13 L13,19 L18.5,19 C18.7761424,19 19,18.7761424 19,18.5 L19,13.5 C19,13.2238576 18.7761424,13 18.5,13 Z M10.5,5 L5.5,5 C5.22385763,5 5,5.22385763 5,5.5 L5,11 L11,11 L11,5.5 C11,5.22385763 10.7761424,5 10.5,5 Z M17.8833789,2.00672773 L18,2 C18.5128358,2 18.9355072,2.38604019 18.9932723,2.88337887 L19,3 L19,5 L21,5 C21.5128358,5 21.9355072,5.38604019 21.9932723,5.88337887 L22,6 C22,6.51283584 21.6139598,6.93550716 21.1166211,6.99327227 L21,7 L19,7 L19,9 C19,9.51283584 18.6139598,9.93550716 18.1166211,9.99327227 L18,10 C17.4871642,10 17.0644928,9.61395981 17.0067277,9.11662113 L17,9 L17,7 L15,7 C14.4871642,7 14.0644928,6.61395981 14.0067277,6.11662113 L14,6 C14,5.48716416 14.3860402,5.06449284 14.8833789,5.00672773 L15,5 L17,5 L17,3 C17,2.48716416 17.3860402,2.06449284 17.8833789,2.00672773 L18,2 L17.8833789,2.00672773 Z",id:"🎨-Color"}))))};const zv=function(){return l.createElement("svg",{width:"685",height:"497",viewBox:"0 0 685 497",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("circle",{cx:"285.5",cy:"146.5",r:"56",stroke:"black",strokeWidth:"23"}),l.createElement("rect",{x:"12.5",y:"12.5",width:"660",height:"472",rx:"28.5",stroke:"black",strokeWidth:"25"}),l.createElement("path",{d:"M13 316L126.663 218.694C138.981 208.149 157.344 208.878 168.787 220.366L275.5 327.5M275.5 327.5L124 482M275.5 327.5L467.765 137.481C479.819 125.568 499.206 125.542 511.29 137.424L668 291.5",stroke:"black",strokeWidth:"24"}))};const Sv=function(){return l.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 66.9 66.8",fill:"#7f7f7f"},l.createElement("path",{className:"st0",d:"M44.3,15.7c0,.9-.7,1.6-1.6,1.6s-1.6-.7-1.6-1.6.7-1.6,1.6-1.6,1.6.7,1.6,1.6ZM39.1,15.7c0,2,1.6,3.7,3.6,3.7s3.6-1.6,3.6-3.7-1.6-3.7-3.6-3.7-3.6,1.6-3.6,3.7Z"}),l.createElement("path",{className:"st0",d:"M16.9,61.6c0,.1,0,.3,0,.4,0,.1-.1.2-.2.3,0,0-.2.2-.3.2-.1,0-.3,0-.4,0s-.3,0-.4,0c-.1,0-.2-.1-.3-.2,0,0-.2-.2-.2-.3,0-.1,0-.3,0-.4s0-.3,0-.4c0-.1.1-.2.2-.3,0,0,.2-.2.3-.2s.3,0,.4,0,.3,0,.4,0,.2.1.3.2c0,0,.2.2.2.3,0,.1,0,.3,0,.4Z"}),l.createElement("path",{className:"st0",d:"M41.9,2.5c.5-.5,1.3-.5,1.8,0l13.7,15.1v14.6c.5-.2,1.2-.4,1.9-.4h.2v-11.9l3.4,3.8c.4.4,1,.5,1.5,0,.4-.4.5-1,0-1.5L45.1,1.1c-.6-.7-1.5-1.1-2.4-1.1s-1.8.4-2.4,1.1l-9.8,10.8c.7.3,1.3.6,1.9,1,0,0,9.3-10.4,9.4-10.4Z"}),l.createElement("path",{className:"st0",d:"M26.2,15.1c4,0,7.3,3.3,7.3,7.3s-3.2,7.3-7.3,7.3-7.3-3.3-7.3-7.3,3.3-7.3,7.3-7.3ZM26.2,31.9c5.2,0,9.3-4.2,9.3-9.4s-4.2-9.4-9.3-9.4-9.3,4.2-9.3,9.4,4.2,9.4,9.3,9.4Z"}),l.createElement("path",{className:"st0",d:"M25.8,23.6h.7c.4,0,.7.2.7.5s0,.5-.7.5h-2c-.6,0-1,.5-1,1s.5,1,1,1h1v.5c0,.6.5,1,1,1s1-.5,1-1v-.7c1.1-.4,1.7-1.5,1.7-2.4s-.9-2.6-2.8-2.6h-.7c-.2,0-.4,0-.5-.2-.1-.1-.2-.2-.2-.4s.1-.5.7-.5h2c.6,0,1-.5,1-1s-.5-1-1-1h-.2v-.6c0-.6-.5-1-1-1s-1,.5-1,1v.6c-1.6.1-2.5,1.4-2.5,2.6s.9,2.6,2.7,2.6Z"}),l.createElement("path",{className:"st0",d:"M66.6,34.7c-.3-.5-.9-.8-1.6-.8h-5.6c-.6,0-1.1.2-1.5.4-.5.2-1.2.7-2.9,3.1l-1.3,1.7h-4.6v-12c0-.6-.5-1-1-1h-10.4c-.6,0-1,.5-1,1v6.7h2.1v-5.6h8.4v6.8c1.3,1,2.1,2.6,2.1,4.3v1.8h5.1c.3,0,.6-.2.8-.4l1.6-2.1c1.6-2.1,2-2.4,2.1-2.4.3-.1.5-.2.7-.2h5.2l-3.3,7.7c-.2.4-.7,1-1.1,1.3l-11.4,7.4c-.2.1-.5.3-1.7.3h-21.8c-.3,0-.5.1-.7.3l-2.7,2.6-12.2-12.2,7.3-6.9c.3-.3.9-.5,1.4-.5h11.2c.5,0,1.4.2,1.9.4l2.6,1c.7.3,1.9.5,2.7.5h6.9c.7,0,1.4.6,1.4,1.4v3.7c0,.8-.6,1.4-1.4,1.4h-13.9c-.6,0-1,.5-1,1s.5,1,1,1h13.8c1.9,0,3.4-1.6,3.4-3.4v-3.7c0-1.9-1.6-3.4-3.4-3.4h-6.9c-.5,0-1.4-.2-1.9-.4l-2.6-1c-.7-.3-1.9-.5-2.7-.5h-11.1c-.9,0-2.1.5-2.8,1.1l-7.3,6.9c-1.5-1.5-3.8-1.7-5.1-.6l-2.6,2.1c-.5.4-.5,1-.2,1.5.4.5,1,.5,1.5.2l2.6-2.1c.5-.4,1.6-.3,2.4.5l14.4,14.4c.7.7.7,1.9,0,2.6l-4.3,4.5c-.4.4-.4,1.1,0,1.5.4.4,1.1.4,1.5,0l4.3-4.5c.7-.7,1.1-1.7,1.1-2.7s-.2-1.5-.6-2.1l2.5-2.3h21.4c.9,0,2.1,0,2.9-.6l11.4-7.4c.7-.5,1.6-1.4,1.9-2.2l3.4-8c.3-.6.3-1.2,0-1.7Z"}))};var xv=a(70490),Hv={};Hv.styleTagTransform=qc(),Hv.setAttributes=Gc(),Hv.insert=Ic().bind(null,"head"),Hv.domAPI=Dc(),Hv.insertStyleElement=Uc();Pc()(xv.A,Hv);xv.A&&xv.A.locals&&xv.A.locals;function Rv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vv(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Tv(){return Tv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tv.apply(null,arguments)}var Nv={backgroundColor:"transparent",marginLeft:"70%",marginTop:"-40%",position:"absolute"},Ov={name:"CustomAddOns",Tab:(0,oA.observer)((function(e){return l.createElement(aA.SectionTab,Tv({name:"Add On's"},e,{iconSize:20}),l.createElement(Mv,null))})),Panel:(0,oA.observer)((function(e){var t=e.store,n=e.allowedAddOns,r=Rv((0,l.useState)(""),2),a=r[0],o=r[1],i=Ke((function(e){return e.templates.template})),c=Ke((function(e){return e.templates.offerPercentage})),s=lt(),u=("local"===ma()||"staging"===ma()?Jr:Aa()?_r:$r)+"/default_images/dummyGSV.png",d=("local"===ma()||"staging"===ma()?"https://staging.offer-generator.com/property-offers":Aa()?"https://demo.offer-generator.com/property-offers":"https://offer-generator.com/property-offers")+"?apiKey=".concat(ha()),f="{{ROS.PROPERTY_OFFER}}",p=function(e,n,r){e.preventDefault();var o=t.activePage.toJSON();if("gsv"===r){var i,l;if(null!=o&&null!==(i=o.children)&&void 0!==i&&i.length&&o.children.find((function(e){return e.id==="gsv-image_".concat(t.activePage.id)})))return void s(Jh(lo.GSV_RESTRICT_ONE_PER_PAGE));null===(l=t.activePage)||void 0===l||l.addElement({id:"gsv-image_".concat(t.activePage.id),type:"image",src:u,width:287,height:188,contentEditable:!1,keepRatio:!0,opacity:1,custom:{elementType:n}})}else if("rpo"===r){var c=Math.random().toString(36).substring(2,7);t.activePage.addElement({id:"ros_".concat(c),type:"text",x:100,y:100,text:n,width:175,contentEditable:!1})}else if("custom_rpo"===r){if(!a)return void h();if(!C())return!1;s({type:cr,payload:a});var d=Math.random().toString(36).substring(2,7);t.activePage.addElement({id:"ros_".concat(d),type:"text",x:100,y:100,text:n,width:175,contentEditable:!1,custom:{ros_custom_value:a}})}},h=function(){return s(Jh("Please enter the offer percentage"))},C=function(){return!(+a<1||+a>100)||(s(Jh("Please enter an offer percentage between 1 and 100")),!1)},A=function(e){if(e.stopPropagation(),!C())return!1;pa(f),s({type:cr,payload:a}),s(Kh("ROS Property Offer Copied"))};return(0,l.useEffect)((function(){var e;null!=i&&null!==(e=i.meta)&&void 0!==e&&e.rosOfferPercentage&&!c?o(i.meta.rosOfferPercentage):c&&o(c)}),[]),l.createElement("div",{className:"dynamic-content"},l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},lo.CUSTOM_ADD_ONS.TITLE)," ",l.createElement(qm,{fill:"var(--primary-color)",className:"infoIcon"}),l.createElement(Wm,{anchorSelect:".infoIcon",place:"bottom",title:lo.CUSTOM_ADD_ONS.DESCRIPTION}))),(!n||(null==n?void 0:n.includes("gsv")))&&l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,"GOOGLE_STREET_VIEW","gsv")}},l.createElement(zv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.GSV.TITLE),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.GSV.DESCRIPTION)),(null==n?void 0:n.includes("property_offer"))&&l.createElement("div",null,l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,f,"rpo")}},l.createElement(Jc,{style:Nv,onClick:A,backdrop:!1},l.createElement(Ym,{className:"copy"})),l.createElement(Sv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.TITLE),l.createElement(Zc,{className:"no-margin"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.DESCRIPTION),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.PRICE))),(null==n?void 0:n.includes("custom_property_offer"))&&l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,f,"custom_rpo")}},l.createElement(Jc,{style:Nv,onClick:a?A:h,backdrop:!1,className:"custom-po"},l.createElement(Ym,{className:"copy"})),l.createElement(Sv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.TITLE),l.createElement(Zc,{variant:"h3",className:"no-margin s-font"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.DESCRIPTION),l.createElement("div",{style:{margin:"12px"},className:"plain-text"},l.createElement("a",{href:d,target:"_blank",onClick:function(e){e.stopPropagation()}},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CLICK)," ",lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CSV_IMPORT),l.createElement(Zc,{className:"no-margin s-font"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CUSTOM_PRICE),l.createElement("div",{onClick:function(e){return e.stopPropagation()},style:{width:"18rem",marginBottom:"15px"}},l.createElement(xh,{type:"number",placeholder:"Type in a Number between 1-100",qrField:!0,value:a,onChange:function(e){o(e.target.value)}}))),l.createElement("div",{className:"no-result-addOns"},!n||0===(null==n?void 0:n.length)&&l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.NO_RESULT)),l.createElement(Wm,{anchorSelect:".copy",place:"bottom",title:"Copy"}))}))};const Pv=Ov;var kv=a(87583),Dv=a(93120);const Bv=function(){return l.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",version:"1.1",viewBox:"0 0 16 16",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{fill:"#000000",d:"M5 1h-4v4h4v-4zM6 0v0 6h-6v-6h6zM2 2h2v2h-2zM15 1h-4v4h4v-4zM16 0v0 6h-6v-6h6zM12 2h2v2h-2zM5 11h-4v4h4v-4zM6 10v0 6h-6v-6h6zM2 12h2v2h-2zM7 0h1v1h-1zM8 1h1v1h-1zM7 2h1v1h-1zM8 3h1v1h-1zM7 4h1v1h-1zM8 5h1v1h-1zM7 6h1v1h-1zM7 8h1v1h-1zM8 9h1v1h-1zM7 10h1v1h-1zM8 11h1v1h-1zM7 12h1v1h-1zM8 13h1v1h-1zM7 14h1v1h-1zM8 15h1v1h-1zM15 8h1v1h-1zM1 8h1v1h-1zM2 7h1v1h-1zM0 7h1v1h-1zM4 7h1v1h-1zM5 8h1v1h-1zM6 7h1v1h-1zM9 8h1v1h-1zM10 7h1v1h-1zM11 8h1v1h-1zM12 7h1v1h-1zM13 8h1v1h-1zM14 7h1v1h-1zM15 10h1v1h-1zM9 10h1v1h-1zM10 9h1v1h-1zM11 10h1v1h-1zM13 10h1v1h-1zM14 9h1v1h-1zM15 12h1v1h-1zM9 12h1v1h-1zM10 11h1v1h-1zM12 11h1v1h-1zM13 12h1v1h-1zM14 11h1v1h-1zM15 14h1v1h-1zM10 13h1v1h-1zM11 14h1v1h-1zM12 13h1v1h-1zM13 14h1v1h-1zM10 15h1v1h-1zM12 15h1v1h-1zM14 15h1v1h-1z"}))};function Iv(e){return Iv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Iv(e)}function Fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gv(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Iv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Iv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Iv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */jv=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Iv(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Iv(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function Uv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Wv(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Uv(o,r,a,i,l,"next",e)}function l(e){Uv(o,r,a,i,l,"throw",e)}i(void 0)}))}}function qv(e){return function(e){if(Array.isArray(e))return Yv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Yv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yv(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qv(){return Qv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qv.apply(null,arguments)}var Zv={name:"QR-Section",Tab:function(e){return l.createElement(aA.SectionTab,Qv({name:"QR"},e,{iconSize:20}),l.createElement(Bv,null))},Panel:(0,oA.observer)((function(e){var t=e.store,n=e.allowSenderFields,r=e.allowPropertyFields,a=e.excludedFields,o=Ke((function(e){return e.customQRCode.url})),i=Ke((function(e){return e.customQRCode.utmSource})),c=Ke((function(e){return e.customQRCode.utmMedium})),s=Ke((function(e){return e.customQRCode.utmCampaignName})),u=Ke((function(e){return e.customQRCode.customUtms})),d=Ke((function(e){return e.customQRCode.isQR})),f=lt(),p=Ke((function(e){return e.templates.defaultDynamicFields})),h=Ke((function(e){return e.templates.defaultSenderFields})),C=Ke((function(e){return e.customFields.customFields})),A=Ke((function(e){return e.customFields.customFieldsV2})),m=Ke((function(e){return e.templates.defaultPropertyFields})),v=["utm_c_first_name c_last_name"],g=[];A.length>0&&(g=null==A?void 0:A.flatMap((function(e){return e.fields})));var y=[].concat(qv(p),qv(C),qv(g),qv(n?h:[]),qv(r?m:[]),qv(r?[{value:"ROS.PROPERTY_OFFER",key:"{{ROS.PROPERTY_OFFER}}",defaultValue:"$123,456.00"}]:[])).filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})),b=y.map((function(e){var t=e.key;return{label:"utm_".concat(t.toLowerCase().replaceAll(".","_").replaceAll(/[{}]/g,""))}})).filter((function(e){return!v.includes(e.label)})),L=["custom_utm_1","custom_utm_2","custom_utm_3"],E=t.selectedElements[0],w=function(){t.selectElements([]),f(eo())},M=function(e,t){var n="",r=sa.find((function(t){return t.key===e}));return r&&(n="".concat(r.value,"=").concat(t)),n},z=function(){for(var e=0,t=[{value:i,label:"UTM Source"},{value:c,label:"UTM Medium"},{value:s,label:"UTM Campaign"}];e<t.length;e++){var n=t[e],r=n.value,a=n.label;if(r.length>=150)return f(Jh("".concat(a," must be less than 150 characters"))),!1;if(na.test(r))return f(Jh("Emoji are not allowed in ".concat(a))),!1}return!0},S=function(e){return ca.some((function(t){return e.includes(t)}))},x=function(e){return new Promise((function(t){kv.toString(e||"no-data",{type:"svg",margin:0,color:{dark:"#000000",light:"#0000"}},(function(e,n){t(Dv.svgToURL(n))}))}))},H=function(e){var t,n,r,a=e,o=[];if(i&&o.push("utm_source=".concat(i.replace(/ /g,"_"))),c&&o.push("utm_medium=".concat(c.replace(/ /g,"_"))),s&&o.push("utm_campaign=".concat(s.replace(/ /g,"_"))),null!==(t=u[L[0]])&&void 0!==t&&t.label){var l,d,f,p,h,C="{{".concat(null===(l=u[L[0]])||void 0===l?void 0:l.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),A=null===(d=y.find((function(e){return e.key===C})))||void 0===d?void 0:d.defaultValue,m=M(C,A),v=m&&"{{C.PHONE_NUMBER}}"==C?encodeURIComponent("".concat(null===(f=u[L[0]])||void 0===f?void 0:f.label,"=").concat(A,"&").concat(m)).replace(/[\s\(\)]/g,""):m?"".concat(null===(p=u[L[0]])||void 0===p?void 0:p.label,"=").concat(A,"&").concat(m):"".concat(null===(h=u[L[0]])||void 0===h?void 0:h.label,"=").concat(A);o.push(v)}if(null!==(n=u[L[1]])&&void 0!==n&&n.label){var g,b,E,w,z,S="{{".concat(null===(g=u[L[1]])||void 0===g?void 0:g.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),x=null===(b=y.find((function(e){return e.key===S})))||void 0===b?void 0:b.defaultValue,H=M(S,x),R=H&&"{{C.PHONE_NUMBER}}"==S?encodeURIComponent("".concat(null===(E=u[L[1]])||void 0===E?void 0:E.label,"=").concat(x,"&").concat(H)).replace(/[\s\(\)]/g,""):H?"".concat(null===(w=u[L[1]])||void 0===w?void 0:w.label,"=").concat(x,"&").concat(H):"".concat(null===(z=u[L[1]])||void 0===z?void 0:z.label,"=").concat(x);o.push(R)}if(null!==(r=u[L[2]])&&void 0!==r&&r.label){var V,T,N,O,P,k="{{".concat(null===(V=u[L[2]])||void 0===V?void 0:V.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),D=null===(T=y.find((function(e){return e.key===k})))||void 0===T?void 0:T.defaultValue,B=M(k,D),I=B&&"{{C.PHONE_NUMBER}}"==k?encodeURIComponent("".concat(null===(N=u[L[2]])||void 0===N?void 0:N.label,"=").concat(D,"&").concat(B)).replace(/[\s\(\)]/g,""):B?"".concat(null===(O=u[L[2]])||void 0===O?void 0:O.label,"=").concat(D,"&").concat(B):"".concat(null===(P=u[L[2]])||void 0===P?void 0:P.label,"=").concat(D);o.push(I)}return o.length>0&&(a+="/?".concat(o.join("&"))),encodeURI(a)},R=function(){var e=Wv(jv().mark((function e(){var n,r,a;return jv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o){e.next=17;break}if(!va(o)||S(o)){e.next=14;break}if(z()){e.next=5;break}return e.abrupt("return",!1);case 5:return n=Math.random().toString(36).substring(2,7),r=H(o),e.next=9,x(r);case 9:a=e.sent,t.activePage.addElement({id:"qr-".concat(n),type:"svg",name:"qr",x:50,y:50,width:100,height:100,blurRadius:0,keepRatio:!0,src:a,custom:{url:o,utm_source:i,utm_medium:c,utm_campaign_name:s,custom_utms:u}}),w(),e.next=15;break;case 14:f(Jh(lo.QR_SECTION.INVALID_URL));case 15:e.next=18;break;case 17:f(Jh(lo.QR_SECTION.EMPTY_QR));case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){var e=Wv(jv().mark((function e(){var t,n;return jv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("qr"!==(null==E?void 0:E.name)||!o){e.next=16;break}if(!va(o)||S(o)){e.next=13;break}if(z()){e.next=5;break}return e.abrupt("return",!1);case 5:return t=H(o),e.next=8,x(t);case 8:n=e.sent,E.set({src:n,custom:{url:o,utm_source:i,utm_medium:c,utm_campaign_name:s,custom_utms:u}}),w(),e.next=14;break;case 13:f(Jh(lo.QR_SECTION.INVALID_URL));case 14:e.next=17;break;case 16:f(Jh(lo.QR_SECTION.EMPTY_QR));case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fv(Object(n),!0).forEach((function(t){Gv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},u);null===t?delete n[e]:n[e]=t,f($a(n))};return(0,l.useEffect)((function(){var e,t,n,r,a,o,i;"qr"===(null==E?void 0:E.name)?(f(function(e){return{type:wr,payload:e}}("qr"===(null==E?void 0:E.name))),f(Xa((null==E||null===(e=E.custom)||void 0===e?void 0:e.url)||(null==E||null===(t=E.custom)||void 0===t?void 0:t.value)||"")),f(Ka((null==E||null===(n=E.custom)||void 0===n?void 0:n.utm_source)||"direct mail")),f(Ja((null==E||null===(r=E.custom)||void 0===r?void 0:r.utm_medium)||"QR Code")),f(_a((null==E||null===(a=E.custom)||void 0===a?void 0:a.utm_campaign_name)||"")),Object.values((null==E||null===(o=E.custom)||void 0===o?void 0:o.custom_utms)||{}).length?f($a(null==E||null===(i=E.custom)||void 0===i?void 0:i.custom_utms)):f($a({}))):d&&"qr"!==(null==E?void 0:E.name)&&f(eo())}),[d,E]),l.createElement(l.Fragment,null,l.createElement("button",{className:"qr-submit-btn",onClick:d?V:R},d?lo.QR_SECTION.UPDATE_BUTTON:lo.QR_SECTION.SUBMIT_BUTTON),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"QR URL:"),l.createElement(xh,{type:"text",onChange:function(e){f(Xa(e.target.value))},placeholder:lo.QR_SECTION.QR_PLACEHOLDER,value:o,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Source:"),l.createElement(xh,{type:"text",onChange:function(e){f(Ka(e.target.value))},placeholder:"Enter UTM Source",value:i,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Medium:"),l.createElement(xh,{type:"text",onChange:function(e){f(Ja(e.target.value))},placeholder:"Enter UTM Medium",value:c,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Campaign Name:"),l.createElement(xh,{type:"text",onChange:function(e){f(_a(e.target.value))},placeholder:"Enter UTM Campaign Name",value:s,qrField:!0})),null==L?void 0:L.map((function(e,t){return l.createElement("div",{className:"qr-input-wrapper",key:t},l.createElement("label",null,e.toUpperCase().replace(/\_/g," "),":"),l.createElement(_p,{placeholder:"Select Custom UTM ".concat(t+1),options:b,setSelectedValue:function(t){return T(e,t)},selectedValue:u[e]||null,builderSelect:!0,clearField:!0,search:function(){},updateErrors:function(){},disableClearable:!1,templateBuilder:!0,qrField:!0}))})))}))};const Xv=Zv;function Kv(e){return Kv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kv(e)}function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jv.apply(null,arguments)}function _v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_v(Object(n),!0).forEach((function(t){eg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eg(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Kv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Kv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Kv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tg(e){return function(e){if(Array.isArray(e))return ag(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ng(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||rg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rg(e,t){if(e){if("string"==typeof e)return ag(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ag(e,t):void 0}}function ag(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const og=function(e){var t=ng((0,l.useState)(!1),2),n=t[0],r=t[1],a="Real Penned Letter"===e.currentTemplateType?aA.DEFAULT_SECTIONS.filter((function(e){return""===e.name})):aA.DEFAULT_SECTIONS.filter((function(e){return!["photos","size","templates"].includes(e.name)}));return l.createElement(qh.SidePanelWrap,null,l.createElement(aA.SidePanel,{store:e.store,sections:[].concat(tg("Real Penned Letter"!==e.currentTemplateType?[$v($v($v({},Am),wv),{},{Panel:function(t){return l.createElement(Am.Panel,Jv({},t,{platformName:e.platformName,templateGalleryModal:e.templateGalleryModal,designerQueryAmount:e.designerQueryAmount,selectedSection:e.selectedSection,allowedTemplateSections:e.allowedTemplateSections,hireDesignerModal:n,setHireDesignerModal:r,onCreateCustomTemplateQuery:e.onCreateCustomTemplateQuery,onGetTemplates:e.onGetTemplates,onGetOneTemplate:e.onGetOneTemplate}))}})]:[]),tg(a),[$v($v($v({},sv),wv),{},{Panel:function(t){return l.createElement(sv.Panel,Jv({},t,{onGetCustomFields:e.onGetCustomFields,allowSenderFields:e.allowSenderFields,excludedFields:e.excludedFields,allowPropertyFields:e.allowPropertyFields,platformName:e.platformName}))}})],tg("Real Penned Letter"!==e.currentTemplateType?[$v($v({},Xv),{},{Panel:function(t){return l.createElement(Xv.Panel,Jv({},t,{allowSenderFields:e.allowSenderFields,allowPropertyFields:e.allowPropertyFields,excludedFields:e.excludedFields}))}}),$v($v({},Pv),{},{Panel:function(t){return l.createElement(Pv.Panel,Jv({},t,{allowedAddOns:e.allowedAddOns}))}})]:[])),defaultSection:"text"}))};var ig=a(22995),lg={};lg.styleTagTransform=qc(),lg.setAttributes=Gc(),lg.insert=Ic().bind(null,"head"),lg.domAPI=Dc(),lg.insertStyleElement=Uc();Pc()(ig.A,lg);ig.A&&ig.A.locals&&ig.A.locals;function cg(e){return cg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cg(e)}function sg(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */sg=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==cg(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(cg(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function ug(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function dg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ug(Object(n),!0).forEach((function(t){fg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fg(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=cg(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=cg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==cg(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pg(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=mg(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function hg(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Cg(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){hg(o,r,a,i,l,"next",e)}function l(e){hg(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ag(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||mg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mg(e,t){if(e){if("string"==typeof e)return vg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vg(e,t):void 0}}function vg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const gg=function(e){var t=e.store,n=e.platformName,r=e.templateGalleryModal,a=e.createTemplateRoute,o=e.designerTemplateQuery,i=e.olcTemplate,c=e.allowSenderFields,s=e.excludedFields,u=e.designerQueryAmount,d=e.allowPropertyFields,f=e.allowedAddOns,p=e.allowedTemplateSections,h=e.onCreateCustomTemplateQuery,C=e.onReturnAndNavigate,A=e.onGetOneTemplate,m=e.onGetCustomFields,v=e.onGetTemplates,g=e.onSubmit,y=Ag((0,l.useState)(!1),2),b=y[0],L=y[1],E=Ag((0,l.useState)(1),2),w=E[0],M=E[1],z=Ag((0,l.useState)("text"),2),S=z[0],x=z[1],H=ie().id,R=lt(),V=oe(),T=(Ke((function(e){return e.templates.template})),Ke((function(e){return e.templates.product}))),N=Ke((function(e){return e.templates.envelopeType})),O=Ke((function(e){return e.templates.products})),P=null==T?void 0:T.productType;(0,l.useEffect)((function(){i&&F()}),[i]),(0,l.useEffect)((function(){o&&setTimeout((function(){I()}),100)}),[o]),(0,l.useEffect)((function(){var e=function(){document.hidden&&M((function(e){return e+1}))},n=function(e){e.target instanceof Element&&e.target.closest(".polotno-side-tabs-container")&&"Templates"!==(null==t?void 0:t.openedSidePanel)&&x(null==t?void 0:t.openedSidePanel)};return document.addEventListener("click",n),document.addEventListener("visibilitychange",e),function(){document.removeEventListener("visibilitychange",e),document.removeEventListener("click",n)}}),[]),(0,l.useEffect)((function(){ro("hireDesignerFormState"),ro("queryFiles")}),[]),(0,l.useEffect)((function(){T||i||H||o||V(a||"/create-template")}),[]),(0,l.useEffect)((function(){if(T||H&&A){if((0,Xh.O3)(iC),H&&A)try{A(H).then((function(e){var n;e?(R({type:ar,payload:{data:e}}),co(null==e||null===(n=e.product)||void 0===n?void 0:n.id,t),R({type:or,payload:!0})):(R(Jh("Unable to load the Template")),setTimeout((function(){V(a||"/create-template")}),1e3))}))}catch(e){return e}finally{R({type:or,payload:!1})}else 0!==t.pages.length||i||D();k();var e=t.on("change",(function(){b||L(!0)}));return function(){t.history.clear(),t.clear(),e()}}}),[]),(0,l.useEffect)((function(){H||i||!T||0!==t.pages.length||D()}),[T]),(0,l.useEffect)((function(){var e=function(e){var t="Are you sure you want to leave?";return e.returnValue=t,t};return b&&(window.removeEventListener("beforeunload",e),window.addEventListener("beforeunload",e)),function(){window.removeEventListener("beforeunload",e)}}),[b]);var k=function(){var e=Cg(sg().mark((function e(){var t,n,r,a,o,i,l,c,s,u,d,f;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m){e.next=7;break}return e.next=3,m();case 3:if(t=e.sent,n=[],r=[],"v2"===(null==t?void 0:t.version)){o=t.customFields.flatMap((function(e){return e.fields})),i=pg(o);try{for(i.s();!(l=i.n()).done;)((c=l.value).isPlatformField?n:r).push(c)}catch(e){i.e(e)}finally{i.f()}s=null==t?void 0:t.customFields.map((function(e){return dg(dg({},e),{},{fields:e.fields.filter((function(e){return r.includes(e)}))})})).filter((function(e){return e.fields.length>0})),null!=t&&null!==(a=t.customFields)&&void 0!==a&&a.length?(R({type:Cr,payload:[]}),R({type:Ar,payload:s})):(R({type:Cr,payload:[]}),R({type:Ar,payload:[]})),R(n.length?{type:mr,payload:n}:{type:mr,payload:[]})}else{u=pg(t);try{for(u.s();!(d=u.n()).done;)((f=d.value).isPlatformField?n:r).push(f)}catch(e){u.e(e)}finally{u.f()}r.length?R({type:Cr,payload:r}):R({type:Cr,payload:[]}),R(n.length?{type:mr,payload:n}:{type:mr,payload:[]})}case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=Cg(sg().mark((function e(){var n,r;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:T&&(t.openSidePanel("text"),t.addPage(),r=null==T||null===(n=T.selectedSize)||void 0===n?void 0:n.split("x"),t.setUnit({unit:"in",dpi:ea}),t.setSize(+r[1]*ea,+r[0]*ea),ta.includes(T.productType)&&(t.addPage(),t.selectPage(t.pages[0].id)),Lo(t,T,N),aC(T.id,t),"Real Penned Letter"===P&&B(),t.history.clear()),L(!1);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=Cg(sg().mark((function e(){var n,r,a;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.addFont({fontFamily:"lexi Regular",url:lC}),oC(t),e.next=5,fetch(lC);case 5:return n=e.sent,e.next=8,n.blob();case 8:r=e.sent,(a=new FileReader).onloadend=function(){t.addFont({fontFamily:"lexi Regular",url:a.result})},a.readAsDataURL(r),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.error("Error loading the font file:",e.t0);case 17:case"end":return e.stop()}}),e,null,[[0,14]])})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=Cg(sg().mark((function e(){var n,r,i;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==o||!o.title||null==o||!o.product){e.next=11;break}if(n=O.flatMap((function(e){return e.size.map((function(t){return dg({id:t.id||e.id,title:e.title,productType:e.productType,size:[{id:t.id||e.id,size:t.size}]},void 0!==e.windowed&&{windowed:e.windowed})}))})),r=n.find((function(e){var t;return e.id===(null==o||null===(t=o.product)||void 0===t?void 0:t.id)})),!r){e.next=11;break}return R({type:Mr}),t.clear(),t.history.clear(),R(Qa("title",null==o?void 0:o.title)),"Professional Letters"===r.productType&&(i=2==r.id?"#10 Double-Window":"#10 Grey",R(Qa("envelopeType",i))),R(Ya(r)),e.abrupt("return");case 11:C?C():V(a||"/");case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F=function(){var e=Cg(sg().mark((function e(){var n,r,a,o,l,c,s,u;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=i)){e.next=19;break}return R({type:ar,payload:{data:n}}),(l=document.querySelector(".polotno-workspace-container"))&&l.classList.add("show-loader"),c=null==n||null===(r=n.product)||void 0===r?void 0:r.paperSize.split("x"),t.setUnit({unit:"in",dpi:96}),t.setSize(+c[1]*ea,+c[0]*ea),e.next=10,vo(null==n?void 0:n.templateUrl);case 10:return s=e.sent,"Real Penned Letter"===(null==n||null===(a=n.product)||void 0===a?void 0:a.productType)&&(u=JSON.stringify(s).replace(/{{/g,"((").replace(/}}/g,"))"),s=JSON.parse(u)),t.loadJSON(s),e.next=15,t.waitLoading();case 15:L(!1),co(null==n||null===(o=n.product)||void 0===o?void 0:o.id,t),R({type:or,payload:!1}),l&&l.classList.add("hide-loader");case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return l.createElement(l.Fragment,null,l.createElement(Zc,{className:"hideTemplateBuilder"},ao),l.createElement("div",{className:"polotno-container"},w>0&&l.createElement("div",{className:"builder-wrapper"},l.createElement(rA,{store:t,isStoreUpdated:b,olcTemplate:i,onReturnAndNavigate:C,onSubmit:g}),l.createElement(qh.PolotnoContainer,{style:{width:"100vw",height:"90vh",position:"relative"}},l.createElement(og,{store:t,currentTemplateType:P,platformName:n,templateGalleryModal:r,allowSenderFields:c,allowPropertyFields:d,excludedFields:s,designerQueryAmount:u,allowedAddOns:f,allowedTemplateSections:p,onGetTemplates:v,onGetOneTemplate:A,onGetCustomFields:m,selectedSection:S,onCreateCustomTemplateQuery:h}),l.createElement(qh.WorkspaceWrap,null,"Real Penned Letter"!==P&&l.createElement(Yh.Toolbar,{store:t,downloadButtonEnabled:!1}),"Real Penned Letter"!==P?l.createElement(Zh.Workspace,{store:t,pageControlsEnabled:!1}):l.createElement(Zh.Workspace,{store:t,pageControlsEnabled:!1,components:{Tooltip:function(){return null}}}),l.createElement(Qh.ZoomButtons,{store:t}))),l.createElement(ah,null))))};var yg,bg;function Lg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Eg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wg(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Mg=function(e){return(0,Kr.createStore)({key:e,showCredit:!1})};const zg=function(e){var t,n=e.secretKey,r=e.platformName,a=e.templateGalleryModal,o=e.createTemplateRoute,i=e.templateBuilderRoute,c=e.olcTemplate,s=e.designerTemplateQuery,u=e.allowSenderFields,d=e.excludedFields,f=e.designerQueryAmount,p=e.allowPropertyFields,h=e.allowedAddOns,C=e.allowedTemplateSections,A=e.restrictedProducts,m=e.styles,v=e.onReturnAndNavigate,g=e.onCreateCustomTemplateQuery,y=e.onGetOneTemplate,b=e.onGetCustomFields,L=e.onGetTemplates,E=e.onSubmit,w=Eg((0,l.useState)(Mg(n)),2),M=w[0],z=w[1],S=null===(t=window)||void 0===t||null===(t=t.location)||void 0===t?void 0:t.pathname;(0,l.useEffect)((function(){if(S===o||"/create-template"===S||s){var e=Mg(n);z(e)}}),[S]);var x=m&&Object.keys(m).length?Lc(yg||(yg=Lg(["\n :root {\n ","\n }\n "])),m?Object.entries(m.root).map((function(e){var t=Eg(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r,";")})).join(" "):""):Lc(bg||(bg=Lg(["<></>"])));return l.createElement("div",{className:"builder-wrapper"},l.createElement(ah,null),l.createElement(x,null),l.createElement(Le,null,l.createElement(ye,{path:o||"/create-template",element:l.createElement(Wh,{createTemplateRoute:o,templateBuilderRoute:i,restrictedProducts:A,onReturnAndNavigate:v})}),l.createElement(ye,{path:i||"/template-builder/:id?",element:l.createElement(gg,{store:M,olcTemplate:c,designerTemplateQuery:s,platformName:r,templateGalleryModal:a,allowSenderFields:u,excludedFields:d,designerQueryAmount:f,allowPropertyFields:p,createTemplateRoute:o,allowedAddOns:h,allowedTemplateSections:C,onReturnAndNavigate:v,onCreateCustomTemplateQuery:g,onGetOneTemplate:y,onGetTemplates:L,onGetCustomFields:b,onSubmit:E})})))};var Sg=a(10002),xg={};xg.styleTagTransform=qc(),xg.setAttributes=Gc(),xg.insert=Ic().bind(null,"head"),xg.domAPI=Dc(),xg.insertStyleElement=Uc();Pc()(Sg.A,xg);Sg.A&&Sg.A.locals&&Sg.A.locals;var Hg=a(75487),Rg={};Rg.styleTagTransform=qc(),Rg.setAttributes=Gc(),Rg.insert=Ic().bind(null,"head"),Rg.domAPI=Dc(),Rg.insertStyleElement=Uc();Pc()(Hg.A,Rg);Hg.A&&Hg.A.locals&&Hg.A.locals;var Vg=a(88498),Tg={};Tg.styleTagTransform=qc(),Tg.setAttributes=Gc(),Tg.insert=Ic().bind(null,"head"),Tg.domAPI=Dc(),Tg.insertStyleElement=Uc();Pc()(Vg.A,Tg);Vg.A&&Vg.A.locals&&Vg.A.locals;var Ng=a(60137),Og={};Og.styleTagTransform=qc(),Og.setAttributes=Gc(),Og.insert=Ic().bind(null,"head"),Og.domAPI=Dc(),Og.insertStyleElement=Uc();Pc()(Ng.A,Og);Ng.A&&Ng.A.locals&&Ng.A.locals;var Pg=a(72804),kg={};kg.styleTagTransform=qc(),kg.setAttributes=Gc(),kg.insert=Ic().bind(null,"head"),kg.domAPI=Dc(),kg.insertStyleElement=Uc();Pc()(Pg.A,kg);Pg.A&&Pg.A.locals&&Pg.A.locals;const Dg=function(e){var t=e.container,n=e.secretKey,r=e.publicApiKey,a=e.platformName,o=e.templateGalleryModal,i=void 0===o||o,c=e.createTemplateRoute,u=e.templateBuilderRoute,d=e.olcTemplate,f=e.designerTemplateQuery,p=e.sandbox,h=e.allowSenderFields,C=e.allowPropertyFields,A=e.excludedFields,m=e.designerQueryAmount,v=e.allowedAddOns,g=e.allowedTemplateSections,y=e.env,b=e.restrictedProducts,L=e.onReturnAndNavigate,E=e.onCreateCustomTemplateQuery,w=e.onGetOneTemplate,M=e.onGetTemplates,z=e.onGetCustomFields,S=e.onSubmit,x=e.styles;if(!t)throw new Error("Root element not found");if(!n)throw new Error("secretKey not found");if(!r)throw new Error("publicApiKey not found");p&&function(e){da=e}(p),y&&"1.8.7-beta.1".includes("beta")&&function(e){fa=e}(y),Ca(r);var H=s.createRoot(t);return H.render(l.createElement(l.Fragment,null,l.createElement(rt,{store:Xr},l.createElement(Re,null,l.createElement(zg,{secretKey:n,styles:x,olcTemplate:d,designerTemplateQuery:f,platformName:a,templateGalleryModal:i,createTemplateRoute:c,templateBuilderRoute:u,allowSenderFields:h,allowPropertyFields:C,excludedFields:A,designerQueryAmount:m,allowedAddOns:v,allowedTemplateSections:g,restrictedProducts:b,onReturnAndNavigate:L,onCreateCustomTemplateQuery:E,onGetOneTemplate:w,onGetTemplates:M,onGetCustomFields:z,onSubmit:S}))))),{destroy:function(){console.log("React template builder destroyed"),H.unmount()}}};var Bg=o.A;export{Bg as default};
600
+ const vm="react-tooltip-core-styles",gm="react-tooltip-base-styles",ym={core:!1,base:!1};function bm({css:e,id:t=gm,type:n="base",ref:r}){var a,o;if(!e||"undefined"==typeof document||ym[n])return;if("core"===n&&"undefined"!=typeof process&&(null===(a=null===process||void 0===process?void 0:process.env)||void 0===a?void 0:a.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==n&&"undefined"!=typeof process&&(null===(o=null===process||void 0===process?void 0:process.env)||void 0===o?void 0:o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===n&&(t=vm),r||(r={});const{insertAt:i}=r;if(document.getElementById(t))return;const l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css","top"===i&&l.firstChild?l.insertBefore(c,l.firstChild):l.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),ym[n]=!0}const Lm=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:a=10,strategy:o="absolute",middlewares:i=[Hd(Number(a)),Vd({fallbackAxisSideDirection:"start"}),Rd({padding:5})],border:l})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=i;return n?(c.push(Td({element:n,padding:5})),Nd(e,t,{placement:r,strategy:o,middleware:c}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var a,o;const i={left:`${e}px`,top:`${t}px`,border:l},{x:c,y:s}=null!==(a=r.arrow)&&void 0!==a?a:{x:0,y:0},u=null!==(o={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==o?o:"bottom",d=l&&{borderBottom:l,borderRight:l};let f=0;if(l){const e=`${l}`.match(/(\d+)px/);f=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",...d,[u]:`-${4+f}px`},place:n}}))):Nd(e,t,{placement:"bottom",strategy:o,middleware:c}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},Em=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),wm=(e,t,n)=>{let r=null;const a=function(...a){const o=()=>{r=null,n||e.apply(this,a)};n&&!r&&(e.apply(this,a),r=setTimeout(o,t)),n||(r&&clearTimeout(r),r=setTimeout(o,t))};return a.cancel=()=>{r&&(clearTimeout(r),r=null)},a},Mm=e=>null!==e&&!Array.isArray(e)&&"object"==typeof e,zm=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>zm(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Mm(e)||!Mm(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>zm(e[n],t[n])))},Sm=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const n=t.getPropertyValue(e);return"auto"===n||"scroll"===n}))},xm=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Sm(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Hm="undefined"!=typeof window?l.useLayoutEffect:l.useEffect,Rm=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Vm="DEFAULT_TOOLTIP_ID",Tm={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Nm=(0,l.createContext)({getTooltipData:()=>Tm});function Om(e=Vm){return(0,l.useContext)(Nm).getTooltipData(e)}var Pm={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},km={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Dm=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:a="dark",anchorId:o,anchorSelect:i,place:c="top",offset:s=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:p,wrapper:h,delayShow:C=0,delayHide:A=0,float:m=!1,hidden:v=!1,noArrow:g=!1,clickable:y=!1,closeOnEsc:b=!1,closeOnScroll:L=!1,closeOnResize:E=!1,openEvents:w,closeEvents:M,globalCloseEvents:z,imperativeModeOnly:S,style:x,position:H,afterShow:R,afterHide:V,disableTooltip:T,content:N,contentWrapperRef:O,isOpen:P,defaultIsOpen:k=!1,setIsOpen:D,activeAnchor:B,setActiveAnchor:I,border:F,opacity:G,arrowColor:j,role:U="tooltip"})=>{var W;const q=(0,l.useRef)(null),Y=(0,l.useRef)(null),Q=(0,l.useRef)(null),Z=(0,l.useRef)(null),X=(0,l.useRef)(null),[K,J]=(0,l.useState)({tooltipStyles:{},tooltipArrowStyles:{},place:c}),[_,$]=(0,l.useState)(!1),[ee,te]=(0,l.useState)(!1),[ne,re]=(0,l.useState)(null),ae=(0,l.useRef)(!1),oe=(0,l.useRef)(null),{anchorRefs:ie,setActiveAnchor:le}=Om(t),ce=(0,l.useRef)(!1),[se,ue]=(0,l.useState)([]),de=(0,l.useRef)(!1),fe=d||u.includes("click"),pe=fe||(null==w?void 0:w.click)||(null==w?void 0:w.dblclick)||(null==w?void 0:w.mousedown),he=w?{...w}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!w&&fe&&Object.assign(he,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Ce=M?{...M}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!M&&fe&&Object.assign(Ce,{mouseleave:!1,blur:!1,mouseout:!1});const Ae=z?{...z}:{escape:b||!1,scroll:L||!1,resize:E||!1,clickOutsideAnchor:pe||!1};S&&(Object.assign(he,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Ce,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ae,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Hm((()=>(de.current=!0,()=>{de.current=!1})),[]);const me=e=>{de.current&&(e&&te(!0),setTimeout((()=>{de.current&&(null==D||D(e),void 0===P&&$(e))}),10))};(0,l.useEffect)((()=>{if(void 0===P)return()=>null;P&&te(!0);const e=setTimeout((()=>{$(P)}),10);return()=>{clearTimeout(e)}}),[P]),(0,l.useEffect)((()=>{if(_!==ae.current)if(Rm(X),ae.current=_,_)null==R||R();else{const e=(e=>{const t=getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay").match(/^([\d.]+)(ms|s)$/);if(!t)return 0;const[,n,r]=t;return Number(n)*("ms"===r?1:1e3)})();X.current=setTimeout((()=>{te(!1),re(null),null==V||V()}),e+25)}}),[_]);const ve=e=>{J((t=>zm(t,e)?t:e))},ge=(e=C)=>{Rm(Q),ee?me(!0):Q.current=setTimeout((()=>{me(!0)}),e)},ye=(e=A)=>{Rm(Z),Z.current=setTimeout((()=>{ce.current||me(!1)}),e)},be=e=>{var t;if(!e)return;const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==n?void 0:n.isConnected))return I(null),void le({current:null});C?ge():me(!0),I(n),le({current:n}),Rm(Z)},Le=()=>{y?ye(A||100):A?ye():me(!1),Rm(Q)},Ee=({x:e,y:t})=>{var n;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};Lm({place:null!==(n=null==ne?void 0:ne.place)&&void 0!==n?n:c,offset:s,elementReference:r,tooltipReference:q.current,tooltipArrowReference:Y.current,strategy:f,middlewares:p,border:F}).then((e=>{ve(e)}))},we=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};Ee(n),oe.current=n},Me=e=>{var t;if(!_)return;const n=e.target;n.isConnected&&((null===(t=q.current)||void 0===t?void 0:t.contains(n))||[document.querySelector(`[id='${o}']`),...se].some((e=>null==e?void 0:e.contains(n)))||(me(!1),Rm(Q)))},ze=wm(be,50,!0),Se=wm(Le,50,!0),xe=e=>{Se.cancel(),ze(e)},He=()=>{ze.cancel(),Se()},Re=(0,l.useCallback)((()=>{var e,t;const n=null!==(e=null==ne?void 0:ne.position)&&void 0!==e?e:H;n?Ee(n):m?oe.current&&Ee(oe.current):(null==B?void 0:B.isConnected)&&Lm({place:null!==(t=null==ne?void 0:ne.place)&&void 0!==t?t:c,offset:s,elementReference:B,tooltipReference:q.current,tooltipArrowReference:Y.current,strategy:f,middlewares:p,border:F}).then((e=>{de.current&&ve(e)}))}),[_,B,N,x,c,null==ne?void 0:ne.place,s,f,H,null==ne?void 0:ne.position,m]);(0,l.useEffect)((()=>{var e,t;const n=new Set(ie);se.forEach((e=>{(null==T?void 0:T(e))||n.add({current:e})}));const r=document.querySelector(`[id='${o}']`);r&&!(null==T?void 0:T(r))&&n.add({current:r});const a=()=>{me(!1)},i=xm(B),l=xm(q.current);Ae.scroll&&(window.addEventListener("scroll",a),null==i||i.addEventListener("scroll",a),null==l||l.addEventListener("scroll",a));let c=null;Ae.resize?window.addEventListener("resize",a):B&&q.current&&(c=xd(B,q.current,Re,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&me(!1)};Ae.escape&&window.addEventListener("keydown",s),Ae.clickOutsideAnchor&&window.addEventListener("click",Me);const u=[],d=e=>{_&&(null==e?void 0:e.target)===B||be(e)},f=e=>{_&&(null==e?void 0:e.target)===B&&Le()},p=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],h=["click","dblclick","mousedown","mouseup"];Object.entries(he).forEach((([e,t])=>{t&&(p.includes(e)?u.push({event:e,listener:xe}):h.includes(e)&&u.push({event:e,listener:d}))})),Object.entries(Ce).forEach((([e,t])=>{t&&(p.includes(e)?u.push({event:e,listener:He}):h.includes(e)&&u.push({event:e,listener:f}))})),m&&u.push({event:"pointermove",listener:we});const C=()=>{ce.current=!0},A=()=>{ce.current=!1,Le()};return y&&!pe&&(null===(e=q.current)||void 0===e||e.addEventListener("mouseenter",C),null===(t=q.current)||void 0===t||t.addEventListener("mouseleave",A)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;Ae.scroll&&(window.removeEventListener("scroll",a),null==i||i.removeEventListener("scroll",a),null==l||l.removeEventListener("scroll",a)),Ae.resize?window.removeEventListener("resize",a):null==c||c(),Ae.clickOutsideAnchor&&window.removeEventListener("click",Me),Ae.escape&&window.removeEventListener("keydown",s),y&&!pe&&(null===(e=q.current)||void 0===e||e.removeEventListener("mouseenter",C),null===(t=q.current)||void 0===t||t.removeEventListener("mouseleave",A)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[B,Re,ee,ie,se,w,M,z,fe,C,A]),(0,l.useEffect)((()=>{var e,n;let r=null!==(n=null!==(e=null==ne?void 0:ne.anchorSelect)&&void 0!==e?e:i)&&void 0!==n?n:"";!r&&t&&(r=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const a=new MutationObserver((e=>{const n=[],a=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName&&(e.target.getAttribute("data-tooltip-id")===t?n.push(e.target):e.oldValue===t&&a.push(e.target)),"childList"===e.type){if(B){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(r)try{a.push(...t.filter((e=>e.matches(r)))),a.push(...t.flatMap((e=>[...e.querySelectorAll(r)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,B))&&(te(!1),me(!1),I(null),Rm(Q),Rm(Z),!0)}))}if(r)try{const t=[...e.addedNodes].filter((e=>1===e.nodeType));n.push(...t.filter((e=>e.matches(r)))),n.push(...t.flatMap((e=>[...e.querySelectorAll(r)])))}catch(e){}}})),(n.length||a.length)&&ue((e=>[...e.filter((e=>!a.includes(e))),...n]))}));return a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{a.disconnect()}}),[t,i,null==ne?void 0:ne.anchorSelect,B]),(0,l.useEffect)((()=>{Re()}),[Re]),(0,l.useEffect)((()=>{if(!(null==O?void 0:O.current))return()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>Re()))}));return e.observe(O.current),()=>{e.disconnect()}}),[N,null==O?void 0:O.current]),(0,l.useEffect)((()=>{var e;const t=document.querySelector(`[id='${o}']`),n=[...se,t];B&&n.includes(B)||I(null!==(e=se[0])&&void 0!==e?e:t)}),[o,se,B]),(0,l.useEffect)((()=>(k&&me(!0),()=>{Rm(Q),Rm(Z)})),[]),(0,l.useEffect)((()=>{var e;let n=null!==(e=null==ne?void 0:ne.anchorSelect)&&void 0!==e?e:i;if(!n&&t&&(n=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),n)try{const e=Array.from(document.querySelectorAll(n));ue(e)}catch(e){ue([])}}),[t,i,null==ne?void 0:ne.anchorSelect]),(0,l.useEffect)((()=>{Q.current&&(Rm(Q),ge(C))}),[C]);const Ve=null!==(W=null==ne?void 0:ne.content)&&void 0!==W?W:N,Te=_&&Object.keys(K.tooltipStyles).length>0;return(0,l.useImperativeHandle)(e,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}re(null!=e?e:null),(null==e?void 0:e.delay)?ge(e.delay):me(!0)},close:e=>{(null==e?void 0:e.delay)?ye(e.delay):me(!1)},activeAnchor:B,place:K.place,isOpen:Boolean(ee&&!v&&Ve&&Te)}))),ee&&!v&&Ve?l.createElement(h,{id:t,role:U,className:mm("react-tooltip",Pm.tooltip,km.tooltip,km[a],n,`react-tooltip__place-${K.place}`,Pm[Te?"show":"closing"],Te?"react-tooltip__show":"react-tooltip__closing","fixed"===f&&Pm.fixed,y&&Pm.clickable),onTransitionEnd:e=>{Rm(X),_||"opacity"!==e.propertyName||(te(!1),re(null),null==V||V())},style:{...x,...K.tooltipStyles,opacity:void 0!==G&&Te?G:void 0},ref:q},Ve,l.createElement(h,{className:mm("react-tooltip-arrow",Pm.arrow,km.arrow,r,g&&Pm.noArrow),style:{...K.tooltipArrowStyles,background:j?`linear-gradient(to right bottom, transparent 50%, ${j} 50%)`:void 0},ref:Y})):null},Bm=({content:e})=>l.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Im=l.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:a,render:o,className:i,classNameArrow:c,variant:s="dark",place:u="top",offset:d=10,wrapper:f="div",children:p=null,events:h=["hover"],openOnClick:C=!1,positionStrategy:A="absolute",middlewares:m,delayShow:v=0,delayHide:g=0,float:y=!1,hidden:b=!1,noArrow:L=!1,clickable:E=!1,closeOnEsc:w=!1,closeOnScroll:M=!1,closeOnResize:z=!1,openEvents:S,closeEvents:x,globalCloseEvents:H,imperativeModeOnly:R=!1,style:V,position:T,isOpen:N,defaultIsOpen:O=!1,disableStyleInjection:P=!1,border:k,opacity:D,arrowColor:B,setIsOpen:I,afterShow:F,afterHide:G,disableTooltip:j,role:U="tooltip"},W)=>{const[q,Y]=(0,l.useState)(r),[Q,Z]=(0,l.useState)(a),[X,K]=(0,l.useState)(u),[J,_]=(0,l.useState)(s),[$,ee]=(0,l.useState)(d),[te,ne]=(0,l.useState)(v),[re,ae]=(0,l.useState)(g),[oe,ie]=(0,l.useState)(y),[le,ce]=(0,l.useState)(b),[se,ue]=(0,l.useState)(f),[de,fe]=(0,l.useState)(h),[pe,he]=(0,l.useState)(A),[Ce,Ae]=(0,l.useState)(null),[me,ve]=(0,l.useState)(null),ge=(0,l.useRef)(P),{anchorRefs:ye,activeAnchor:be}=Om(e),Le=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;return n.startsWith("data-tooltip-")&&(t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null),t}),{}),Ee=e=>{const t={place:e=>{var t;K(null!==(t=e)&&void 0!==t?t:u)},content:e=>{Y(null!=e?e:r)},html:e=>{Z(null!=e?e:a)},variant:e=>{var t;_(null!==(t=e)&&void 0!==t?t:s)},offset:e=>{ee(null===e?d:Number(e))},wrapper:e=>{var t;ue(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");fe(null!=t?t:h)},"position-strategy":e=>{var t;he(null!==(t=e)&&void 0!==t?t:A)},"delay-show":e=>{ne(null===e?v:Number(e))},"delay-hide":e=>{ae(null===e?g:Number(e))},float:e=>{ie(null===e?y:"true"===e)},hidden:e=>{ce(null===e?b:"true"===e)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};(0,l.useEffect)((()=>{Y(r)}),[r]),(0,l.useEffect)((()=>{Z(a)}),[a]),(0,l.useEffect)((()=>{K(u)}),[u]),(0,l.useEffect)((()=>{_(s)}),[s]),(0,l.useEffect)((()=>{ee(d)}),[d]),(0,l.useEffect)((()=>{ne(v)}),[v]),(0,l.useEffect)((()=>{ae(g)}),[g]),(0,l.useEffect)((()=>{ie(y)}),[y]),(0,l.useEffect)((()=>{ce(b)}),[b]),(0,l.useEffect)((()=>{he(A)}),[A]),(0,l.useEffect)((()=>{ge.current!==P&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[P]),(0,l.useEffect)((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===P,disableBase:P}}))}),[]),(0,l.useEffect)((()=>{var r;const a=new Set(ye);let o=n;if(!o&&e&&(o=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),o)try{document.querySelectorAll(o).forEach((e=>{a.add({current:e})}))}catch(r){console.warn(`[react-tooltip] "${o}" is not a valid CSS selector`)}const i=document.querySelector(`[id='${t}']`);if(i&&a.add({current:i}),!a.size)return()=>null;const l=null!==(r=null!=me?me:i)&&void 0!==r?r:be.current,c=new MutationObserver((e=>{e.forEach((e=>{var t;if(!l||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=Le(l);Ee(n)}))})),s={attributes:!0,childList:!1,subtree:!1};if(l){const e=Le(l);Ee(e),c.observe(l,s)}return()=>{c.disconnect()}}),[ye,be,me,t,n]),(0,l.useEffect)((()=>{(null==V?void 0:V.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),k&&!Em("border",`${k}`)&&console.warn(`[react-tooltip] "${k}" is not a valid \`border\`.`),(null==V?void 0:V.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),D&&!Em("opacity",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`opacity\`.`)}),[]);let we=p;const Me=(0,l.useRef)(null);if(o){const e=o({content:(null==me?void 0:me.getAttribute("data-tooltip-content"))||q||null,activeAnchor:me});we=e?l.createElement("div",{ref:Me,className:"react-tooltip-content-wrapper"},e):null}else q&&(we=q);Q&&(we=l.createElement(Bm,{content:Q}));const ze={forwardRef:W,id:e,anchorId:t,anchorSelect:n,className:mm(i,Ce),classNameArrow:c,content:we,contentWrapperRef:Me,place:X,variant:J,offset:$,wrapper:se,events:de,openOnClick:C,positionStrategy:pe,middlewares:m,delayShow:te,delayHide:re,float:oe,hidden:le,noArrow:L,clickable:E,closeOnEsc:w,closeOnScroll:M,closeOnResize:z,openEvents:S,closeEvents:x,globalCloseEvents:H,imperativeModeOnly:R,style:V,position:T,isOpen:N,defaultIsOpen:O,border:k,opacity:D,arrowColor:B,setIsOpen:I,afterShow:F,afterHide:G,disableTooltip:j,activeAnchor:me,setActiveAnchor:e=>ve(e),role:U};return l.createElement(Dm,{...ze})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||bm({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||bm({css:"\n.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}",type:"base"})}));var Fm=a(27455),Gm={};Gm.styleTagTransform=qc(),Gm.setAttributes=Gc(),Gm.insert=Ic().bind(null,"head"),Gm.domAPI=Dc(),Gm.insertStyleElement=Uc();Pc()(Fm.A,Gm);Fm.A&&Fm.A.locals&&Fm.A.locals;var jm=a(99197),Um={};Um.styleTagTransform=qc(),Um.setAttributes=Gc(),Um.insert=Ic().bind(null,"head"),Um.domAPI=Dc(),Um.insertStyleElement=Uc();Pc()(jm.A,Um);jm.A&&jm.A.locals&&jm.A.locals;const Wm=function(e){var t=e.anchorSelect,n=e.place,r=e.title;return l.createElement(Im,{className:"basic-tooltip",anchorSelect:t,place:n},r)};const qm=function(e){var t=e.className,n=void 0===t?{}:t,r=e.fill;return l.createElement("svg",{width:"12",className:n,height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{clipPath:"url(#clip0_1555_2219)"},l.createElement("path",{d:"M6.80169 8.45472C6.67902 8.46615 6.55586 8.43847 6.44987 8.37562C6.37243 8.29612 6.33531 8.18575 6.34897 8.07562C6.35183 7.98393 6.36278 7.89266 6.38169 7.8029C6.4 7.69991 6.42364 7.59796 6.45259 7.49744L6.77441 6.39015C6.8076 6.28087 6.82954 6.16846 6.83987 6.05469C6.83987 5.93197 6.85623 5.84741 6.85623 5.79833C6.86307 5.57959 6.76968 5.36969 6.60259 5.22833C6.39707 5.07055 6.14113 4.993 5.88259 5.01015C5.69732 5.01294 5.51347 5.04327 5.33713 5.10015C5.1444 5.16015 4.94167 5.23197 4.72895 5.31562L4.63623 5.67561C4.69895 5.65379 4.77533 5.62926 4.86259 5.60197C4.94584 5.57732 5.03214 5.56445 5.11895 5.56379C5.24073 5.5506 5.36331 5.58051 5.46531 5.64833C5.53459 5.731 5.5671 5.83839 5.55531 5.94562C5.555 6.03733 5.54495 6.12876 5.52531 6.21833C5.50621 6.3138 5.48167 6.41469 5.45167 6.52105L5.12713 7.63377C5.10097 7.7372 5.08004 7.84187 5.06441 7.94741C5.05166 8.03776 5.04529 8.12889 5.04531 8.22013C5.04397 8.44037 5.14468 8.64883 5.31803 8.78467C5.52672 8.94491 5.78631 9.02434 6.04893 9.00831C6.23385 9.01211 6.41814 8.98539 6.59439 8.92921C6.74893 8.87647 6.9553 8.80103 7.21349 8.70285L7.30077 8.35921C7.23083 8.38822 7.15881 8.41192 7.08531 8.43011C6.99236 8.45134 6.89692 8.45959 6.80169 8.45472Z",fill:r}),l.createElement("path",{d:"M7.14277 3.20479C6.99434 3.06848 6.79878 2.99514 6.59731 3.00025C6.39596 2.9957 6.20059 3.06897 6.05185 3.20479C5.77923 3.43987 5.74878 3.85145 5.98388 4.1241C6.00484 4.14841 6.02755 4.17112 6.05185 4.19207C6.36244 4.46988 6.83218 4.46988 7.14275 4.19207C7.41537 3.95467 7.44394 3.54123 7.20655 3.26861C7.18681 3.2459 7.16548 3.22457 7.14277 3.20479Z",fill:r}),l.createElement("path",{d:"M6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0ZM6 11.4545C2.98753 11.4545 0.545461 9.01247 0.545461 6C0.545461 2.98753 2.98753 0.545461 6 0.545461C9.01247 0.545461 11.4545 2.98753 11.4545 6C11.4545 9.01247 9.01247 11.4545 6 11.4545Z",fill:r})),l.createElement("defs",null,l.createElement("clipPath",{id:"clip0_1555_2219"},l.createElement("rect",{width:"12",height:"12",fill:"white"}))))};const Ym=function(e){var t=e.className,n=void 0===t?{}:t;return l.createElement("svg",{width:"19",className:n,height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M3.5 15.025H3.975V15.5C3.975 16.1697 4.24103 16.8119 4.71456 17.2854C5.18809 17.759 5.83033 18.025 6.5 18.025H15.5C16.1697 18.025 16.8119 17.759 17.2854 17.2854C17.759 16.8119 18.025 16.1697 18.025 15.5V6.5C18.025 5.83033 17.759 5.18809 17.2854 4.71456C16.8119 4.24103 16.1697 3.975 15.5 3.975H15.025V3.5C15.025 2.83033 14.759 2.18808 14.2854 1.71456C13.8119 1.24103 13.1697 0.975 12.5 0.975H3.5C2.83033 0.975 2.18808 1.24103 1.71456 1.71456C1.24103 2.18808 0.975 2.83033 0.975 3.5V12.5C0.975 13.1697 1.24103 13.8119 1.71456 14.2854C2.18808 14.759 2.83033 15.025 3.5 15.025ZM15.5 5.025C15.8912 5.025 16.2664 5.1804 16.543 5.45702C16.8196 5.73363 16.975 6.10881 16.975 6.5V15.5C16.975 15.8912 16.8196 16.2664 16.543 16.543C16.2664 16.8196 15.8912 16.975 15.5 16.975H6.5C6.10881 16.975 5.73363 16.8196 5.45702 16.543C5.1804 16.2664 5.025 15.8912 5.025 15.5V15.025H12.5C13.1697 15.025 13.8119 14.759 14.2854 14.2854C14.759 13.8119 15.025 13.1697 15.025 12.5V5.025H15.5ZM2.025 3.5C2.025 3.10881 2.1804 2.73363 2.45702 2.45702C2.73363 2.1804 3.10881 2.025 3.5 2.025H12.5C12.8912 2.025 13.2664 2.1804 13.543 2.45702C13.8196 2.73363 13.975 3.10881 13.975 3.5V12.5C13.975 12.8912 13.8196 13.2664 13.543 13.543C13.2664 13.8196 12.8912 13.975 12.5 13.975H3.5C3.10881 13.975 2.73363 13.8196 2.45702 13.543C2.1804 13.2664 2.025 12.8912 2.025 12.5V3.5Z",fill:"",stroke:"",strokeWidth:"0.05"}))};const Qm=function(e){var t=e.fill;return l.createElement("svg",{width:"23",height:"23",viewBox:"0 0 23 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M20.3047 5.21094H18.5078C18.0116 5.21094 17.6094 5.61317 17.6094 6.10938C17.6094 6.60558 18.0116 7.00781 18.5078 7.00781H20.3047C20.8001 7.00781 21.2031 7.41085 21.2031 7.90625V15.0938C21.2031 15.5891 20.8001 15.9922 20.3047 15.9922H18.5078C18.0116 15.9922 17.6094 16.3944 17.6094 16.8906C17.6094 17.3868 18.0116 17.7891 18.5078 17.7891H20.3047C21.7909 17.7891 23 16.5799 23 15.0938V7.90625C23 6.42005 21.7909 5.21094 20.3047 5.21094Z",fill:t}),l.createElement("path",{d:"M4.49219 10.6016H5.39062V13.2969C5.39062 13.7931 5.79286 14.1953 6.28906 14.1953C6.78527 14.1953 7.1875 13.7931 7.1875 13.2969V10.6016H8.08594C8.58214 10.6016 8.98438 10.1993 8.98438 9.70312C8.98438 9.20692 8.58214 8.80469 8.08594 8.80469H4.49219C3.99598 8.80469 3.59375 9.20692 3.59375 9.70312C3.59375 10.1993 3.99598 10.6016 4.49219 10.6016Z",fill:t}),l.createElement("path",{d:"M2.69531 17.7891H14.0156V19.5859H13.1172C12.621 19.5859 12.2188 19.9882 12.2188 20.4844C12.2188 20.9806 12.621 21.3828 13.1172 21.3828H16.7109C17.2071 21.3828 17.6094 20.9806 17.6094 20.4844C17.6094 19.9882 17.2071 19.5859 16.7109 19.5859H15.8125V3.41406H16.7109C17.2071 3.41406 17.6094 3.01183 17.6094 2.51562C17.6094 2.01942 17.2071 1.61719 16.7109 1.61719H13.1172C12.621 1.61719 12.2188 2.01942 12.2188 2.51562C12.2188 3.01183 12.621 3.41406 13.1172 3.41406H14.0156V5.21094H2.69531C1.20912 5.21094 0 6.42005 0 7.90625V15.0938C0 16.5799 1.20912 17.7891 2.69531 17.7891ZM1.79688 7.90625C1.79688 7.41085 2.19991 7.00781 2.69531 7.00781H14.0156V15.9922H2.69531C2.19991 15.9922 1.79688 15.5891 1.79688 15.0938V7.90625Z",fill:t}))};var Zm=a(17528),Xm={};Xm.styleTagTransform=qc(),Xm.setAttributes=Gc(),Xm.insert=Ic().bind(null,"head"),Xm.domAPI=Dc(),Xm.insertStyleElement=Uc();Pc()(Zm.A,Xm);Zm.A&&Zm.A.locals&&Zm.A.locals;function Km(e){return Km="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Km(e)}function Jm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Jm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Km(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Km(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function _m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_m(Object(n),!0).forEach((function(t){ev(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ev(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Km(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Km(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Km(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=av(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function nv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||av(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function av(e,t){if(e){if("string"==typeof e)return ov(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ov(e,t):void 0}}function ov(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iv(){return iv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iv.apply(null,arguments)}var lv={backgroundColor:"transparent"},cv={name:"Fields",Tab:(0,oA.observer)((function(e){return l.createElement(aA.SectionTab,iv({name:"Fields"},e),l.createElement(Qm,{fill:"var(--text-color)"}))})),Panel:(0,oA.observer)((function(e){e.store;var t,n=e.onGetCustomFields,r=e.allowSenderFields,a=e.excludedFields,o=e.allowPropertyFields,i=e.platformName,c=rv((0,l.useState)(!1),2),s=(c[0],c[1]),u=rv((0,l.useState)(""),2),d=u[0],f=u[1],p=rv((0,l.useState)([]),2),h=p[0],C=p[1],A=rv((0,l.useState)([]),2),m=A[0],v=A[1],g=rv((0,l.useState)([]),2),y=g[0],b=g[1],L=rv((0,l.useState)([]),2),E=L[0],w=L[1],M=rv((0,l.useState)([]),2),z=M[0],S=M[1],x=rv((0,l.useState)([]),2),H=x[0],R=x[1],V=rv((0,l.useState)([]),2),T=V[0],N=V[1],O=lt(),P=Ke((function(e){return e.customFields.customFields})),k=Ke((function(e){return e.customFields.customFieldsV2})),D=Ke((function(e){return e.customFields.platformFields})),B=Ke((function(e){return e.customFields.defaultDynamicFields})),I=Ke((function(e){return e.templates.defaultSenderFields})),F=Ke((function(e){return e.templates.defaultPropertyFields})),G=Ke((function(e){return e.templates.defaultMiscFields})),j=Ke((function(e){return e.templates.product})),U=null==j?void 0:j.productType,W=function(){s((function(e){return!e}))},q=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nv(o,r,a,i,l,"next",e)}function l(e){nv(o,r,a,i,l,"throw",e)}i(void 0)}))}}(Jm().mark((function e(){var t,r,a,o,i,l,c,s,u,d,f,p;return Jm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=7;break}return e.next=3,n();case 3:if(t=e.sent,r=[],a=[],"v2"===(null==t?void 0:t.version)){i=t.customFields.flatMap((function(e){return e.fields})),l=tv(i);try{for(l.s();!(c=l.n()).done;)((s=c.value).isPlatformField?r:a).push(s)}catch(e){l.e(e)}finally{l.f()}u=null==t?void 0:t.customFields.map((function(e){return $m($m({},e),{},{fields:e.fields.filter((function(e){return a.includes(e)}))})})).filter((function(e){return e.fields.length>0})),null!=t&&null!==(o=t.customFields)&&void 0!==o&&o.length?(O({type:Cr,payload:[]}),O({type:Ar,payload:u})):(O({type:Cr,payload:[]}),O({type:Ar,payload:[]})),O(r.length?{type:mr,payload:r}:{type:mr,payload:[]})}else{d=tv(t);try{for(d.s();!(f=d.n()).done;)((p=f.value).isPlatformField?r:a).push(p)}catch(e){d.e(e)}finally{d.f()}a.length?O({type:Cr,payload:a}):O({type:Cr,payload:[]}),O(r.length?{type:mr,payload:r}:{type:mr,payload:[]})}case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("Real Penned Letter"===U){var n=e.replace(/{{/g,"((").replace(/}}/g,"))");pa(n),O(Kh("".concat(t," Copied")))}else pa(e),O(Kh("".concat(t," Copied")))};return(0,l.useEffect)((function(){q()}),[]),(0,l.useEffect)((function(){var e,t,n,i;if(C(null==B?void 0:B.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})).filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),b(G.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),w(o?null==F||null===(e=F.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===e?void 0:e.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})):[]),R(r?null==I||null===(t=I.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===t?void 0:t.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})):[]),N(null==D||null===(n=D.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===n?void 0:n.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),v(null==P||null===(i=P.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===i?void 0:i.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))),k.length){var l=k.map((function(e){return $m($m({},e),{},{fields:e.fields.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())}))})})).filter((function(e){var t;return(null==e||null===(t=e.fields)||void 0===t?void 0:t.length)>0}));S(l)}else{var c;C(null==B||null===(c=B.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===c?void 0:c.filter((function(e){return e.value.toLowerCase().includes(d.toLowerCase())})))}}),[d,I,D,P,B,k]),l.createElement("div",{style:{height:"100%",display:"flex",flexDirection:"column"}},l.createElement("div",{className:"bp5-input-group fields-search"},l.createElement("span",{"aria-hidden":"true",className:"bp5-icon bp5-icon-search"},l.createElement("svg",{"data-icon":"search",height:"16",role:"img",viewBox:"0 0 16 16",width:"16"},l.createElement("path",{d:"M15.55 13.43l-2.67-2.68a6.94 6.94 0 001.11-3.76c0-3.87-3.13-7-7-7s-7 3.13-7 7 3.13 7 7 7c1.39 0 2.68-.42 3.76-1.11l2.68 2.67a1.498 1.498 0 102.12-2.12zm-8.56-1.44c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z",fillRule:"evenodd"}))),l.createElement("input",{type:"search",placeholder:"Search...",className:"bp5-input",onChange:function(e){return f(e.target.value)},value:d})),l.createElement("div",{className:"dynamic-content"},h.length>0&&l.createElement(l.Fragment,null,l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Contact Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"infoIcon"}),l.createElement(Wm,{anchorSelect:".infoIcon",place:"bottom",title:"Merge fields allow you to personalize your mailer with contact information."}))),null==h?void 0:h.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_contact"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),o&&E.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Property Address"),l.createElement(qm,{fill:"var(--primary-color)",className:"property"}),l.createElement(Wm,{anchorSelect:".property",place:"bottom",title:"You can add property fields to your template."}))),null==E?void 0:E.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_property"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),r&&H.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Sender Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"sender"}),l.createElement(Wm,{anchorSelect:".sender",place:"bottom",title:"You can add sender fields to your template."}))),null==H?void 0:H.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_sender"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),l.createElement(Wm,{anchorSelect:".copy",place:"bottom",title:"Copy"}),n&&(null==D?void 0:D.length)>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},i?"".concat(i," Fields"):"OLC Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"platform"}),l.createElement(Wm,{anchorSelect:".platform",place:"bottom",title:"You can add ".concat(i?"".concat(i," Fields"):"OLC Fields"," to your template.")})),l.createElement(Jc,{onClick:W})),null==T?void 0:T.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_platform"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),n&&z.length>0?z.map((function(e,t){return l.createElement("div",{key:t+"custom-section"},l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},null==e?void 0:e.section),l.createElement(qm,{fill:"var(--primary-color)",className:null==e?void 0:e.section.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().replace(/\s+/g,"-")}),l.createElement(Wm,{anchorSelect:".".concat(null==e?void 0:e.section.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().replace(/\s+/g,"-")),place:"bottom",title:"You can add ".concat(null==e?void 0:e.section," to your template.")})),l.createElement(Jc,{onClick:W})),e.fields.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+r},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))})))})):n&&(null==P?void 0:P.length)>0&&m.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Custom Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"custom"}),l.createElement(Wm,{anchorSelect:".custom",place:"bottom",title:"You can add custom fields to your template."})),l.createElement(Jc,{onClick:W})),null==m?void 0:m.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_custom"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),G&&y.length>0&&l.createElement(l.Fragment,null,l.createElement("hr",{className:"divider"}),l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},"Miscellaneous Fields"),l.createElement(qm,{fill:"var(--primary-color)",className:"miscellaneous"}),l.createElement(Wm,{anchorSelect:".miscellaneous",place:"bottom",title:"You can add miscellaneous fields to your template."}))),null==y||null===(t=y.filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})))||void 0===t?void 0:t.map((function(e,t){var n=e.key,r=e.value;return l.createElement("div",{style:{display:"flex",alignItems:"center"},key:t+"_property"},l.createElement("span",{className:"contact-element",onClick:function(){return Y(n,r)}},r),l.createElement(Jc,{style:lv,onClick:function(){return Y(n,r)},backdrop:!1},l.createElement(Ym,{className:"copy"})))}))),h.length<=0&&z.length<=0&&E.length<=0&&H.length<=0&&T.length<=0&&m.length<=0&&y.length<=0&&l.createElement("div",{className:"no-result"},"No results")))}))};const sv=cv;var uv=a(59195);function dv(e){return dv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dv(e)}function fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fv(Object(n),!0).forEach((function(t){hv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hv(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=dv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=dv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==dv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cv(e){return function(e){if(Array.isArray(e))return Lv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bv(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Av(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=bv(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function mv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */mv=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==dv(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(dv(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function vv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function gv(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){vv(o,r,a,i,l,"next",e)}function l(e){vv(o,r,a,i,l,"throw",e)}i(void 0)}))}}function yv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||bv(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bv(e,t){if(e){if("string"==typeof e)return Lv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lv(e,t):void 0}}function Lv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ev=(0,oA.observer)((function(e){var t=e.store,n=yv((0,l.useState)([]),2),r=n[0],a=n[1],o=yv((0,l.useState)(!1),2),i=o[0],c=o[1],s=yv((0,l.useState)(!1),2),u=s[0],d=s[1],f=lt(),p=Ke((function(e){return e.templates.uploadedImages})),h=function(){var e=gv(mv().mark((function e(){return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:p&&(d(!0),a(p),d(!1));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(e){return e&&ra.includes(null==e?void 0:e.type)?!(e.size>=73e5)||(f(Jh(lo.CUSTOM_UPLOAD_SECTION.SIZE_VALIDATION)),!1):(f(Jh(lo.CUSTOM_UPLOAD_SECTION.TYPE_VALIDATION)),!1)},A=function(){var e=gv(mv().mark((function e(t){var n,o,i,l,s,u,d;return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,n=t.target,o=Av(n.files),e.prev=3,o.s();case 5:if((i=o.n()).done){e.next=21;break}if(l=i.value,s=ga(l),C(l)){e.next=12;break}return n.value=null,e.abrupt("return");case 12:return c(!0),e.next=15,Wa(l);case 15:u=e.sent,d=[].concat(Cv(r),[{url:u,type:s}]),a(d),f({type:lr,payload:d});case 19:e.next=5;break;case 21:e.next=26;break;case 23:e.prev=23,e.t0=e.catch(3),o.e(e.t0);case 26:return e.prev=26,o.f(),e.finish(26);case 29:c(!1),n.value=null,e.next=36;break;case 33:return e.prev=33,e.t1=e.catch(0),e.abrupt("return",e.t1);case 36:return e.prev=36,c(!1),e.finish(36);case 39:case"end":return e.stop()}}),e,null,[[0,33,36,39],[3,23,26,29]])})));return function(t){return e.apply(this,arguments)}}();return(0,l.useEffect)((function(){h()}),[]),l.createElement("div",{style:{height:"100%",display:"flex",flexDirection:"column"}},l.createElement("div",{style:{height:"40px",paddingTop:"5px"}},lo.CUSTOM_UPLOAD_SECTION.HEADING),l.createElement("div",{style:{height:"35px"}},l.createElement("strong",null,lo.CUSTOM_UPLOAD_SECTION.ACCEPTED_FORMATS)),l.createElement("div",{style:{height:"35px",paddingBottom:"15px"}},l.createElement("strong",null,lo.CUSTOM_UPLOAD_SECTION.MAX_SIZE)),l.createElement("div",{style:{marginBottom:"20px"}},l.createElement("label",{htmlFor:"input-file"},i?l.createElement("button",{type:"button",className:"bp5-button bp5-disabled bp5-loading bp5-intent-primary",style:{width:"100%",backgroundColor:"rgb(246, 247, 249)",boxShadow:"rgba(17, 20, 24, 0.2) 0px 0px 0px 1px inset, rgba(17, 20, 24, 0.1) 0px 1px 2px",color:"rgb(28, 33, 39)"},disabled:!0},l.createElement("div",{"aria-label":"loading",className:"bp5-spinner bp5-button-spinner"},l.createElement("div",{className:"bp5-spinner-animation"},l.createElement("svg",{width:"20",height:"20",strokeWidth:"16",viewBox:"-3 -3 106 106"},l.createElement("path",{className:"bp5-spinner-track",d:"M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90"}),l.createElement("path",{className:"bp5-spinner-head",d:"M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90",pathLength:"280",strokeDasharray:"280 280",strokeDashoffset:"210"}))))):l.createElement("button",{type:"button",className:"custom-upload-image-btn bp5-button bp5-intent-primary",style:{width:"100%",backgroundColor:"#f6f7f9",boxShadow:"inset 0 0 0 1px #11141833, 0 1px 2px #1114181a",color:"#1c2127"},onClick:function(){var e;return null===(e=document.getElementById("input-file"))||void 0===e?void 0:e.click()}},l.createElement("svg",{"data-icon":"upload",width:"16",height:"16",role:"img",viewBox:"0 0 16 16"},l.createElement("path",{d:"M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm3 8c-.28 0-.53-.11-.71-.29L9 6.41V12c0 .55-.45 1-1 1s-1-.45-1-1V6.41l-1.29 1.3a1.003 1.003 0 01-1.42-1.42l3-3C7.47 3.11 7.72 3 8 3s.53.11.71.29l3 3A1.003 1.003 0 0111 8z",fillRule:"evenodd"})),l.createElement("span",{className:"bp5-button-text"}," Upload Image")),l.createElement("input",{type:"file",id:"input-file",style:{display:"none"},onChange:A,multiple:!0}))),l.createElement(aA.ImagesGrid,{images:r,getPreview:function(e){return null==e?void 0:e.url},crossOrigin:void 0,isLoading:u,onSelect:function(){var e=gv(mv().mark((function e(n,r,a){var o,i,l,c,s,u,d,f,p,h;return mv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null==n?void 0:n.url,l=null==n?void 0:n.type,e.next=4,(0,uv.getImageSize)(i);case 4:if(c=e.sent,s=c.width,u=c.height,!a||"svg"!==a.type||!a.contentEditable||"image"!==l){e.next=10;break}return a.set({maskSrc:i}),e.abrupt("return");case 10:if(!a||"image"!==a.type||!a.contentEditable||"image"!=l){e.next=14;break}return d=(0,uv.getCrop)(a,{width:s,height:u}),a.set(pv({src:i},d)),e.abrupt("return");case 14:f=Math.min(t.width/s,t.height/u,1),s*=f,u*=f,p=((null==r?void 0:r.x)||t.width/2)-s/2,h=((null==r?void 0:r.y)||t.height/2)-u/2,null===(o=t.activePage)||void 0===o||o.addElement({type:l,src:i,x:p,y:h,width:s,height:u});case 20:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}()}))}));aA.UploadSection.Panel=Ev;const wv=Ev;const Mv=function(){return l.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},l.createElement("title",null,"ic_fluent_apps_add_in_24_filled"),l.createElement("desc",null,"Created with Sketch."),l.createElement("g",{id:"🔍-Product-Icons",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},l.createElement("g",{id:"ic_fluent_apps_add_in_24_filled",fill:"#212121",fillRule:"nonzero"},l.createElement("path",{d:"M10.5,3 C11.8807119,3 13,4.11928813 13,5.5 L13,11 L18.5,11 C19.8807119,11 21,12.1192881 21,13.5 L21,18.5 C21,19.8807119 19.8807119,21 18.5,21 L5.5,21 C4.11928813,21 3,19.8807119 3,18.5 L3,5.5 C3,4.11928813 4.11928813,3 5.5,3 L10.5,3 Z M11,13 L5,13 L5,18.5 C5,18.7761424 5.22385763,19 5.5,19 L11,19 L11,13 Z M18.5,13 L13,13 L13,19 L18.5,19 C18.7761424,19 19,18.7761424 19,18.5 L19,13.5 C19,13.2238576 18.7761424,13 18.5,13 Z M10.5,5 L5.5,5 C5.22385763,5 5,5.22385763 5,5.5 L5,11 L11,11 L11,5.5 C11,5.22385763 10.7761424,5 10.5,5 Z M17.8833789,2.00672773 L18,2 C18.5128358,2 18.9355072,2.38604019 18.9932723,2.88337887 L19,3 L19,5 L21,5 C21.5128358,5 21.9355072,5.38604019 21.9932723,5.88337887 L22,6 C22,6.51283584 21.6139598,6.93550716 21.1166211,6.99327227 L21,7 L19,7 L19,9 C19,9.51283584 18.6139598,9.93550716 18.1166211,9.99327227 L18,10 C17.4871642,10 17.0644928,9.61395981 17.0067277,9.11662113 L17,9 L17,7 L15,7 C14.4871642,7 14.0644928,6.61395981 14.0067277,6.11662113 L14,6 C14,5.48716416 14.3860402,5.06449284 14.8833789,5.00672773 L15,5 L17,5 L17,3 C17,2.48716416 17.3860402,2.06449284 17.8833789,2.00672773 L18,2 L17.8833789,2.00672773 Z",id:"🎨-Color"}))))};const zv=function(){return l.createElement("svg",{width:"685",height:"497",viewBox:"0 0 685 497",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("circle",{cx:"285.5",cy:"146.5",r:"56",stroke:"black",strokeWidth:"23"}),l.createElement("rect",{x:"12.5",y:"12.5",width:"660",height:"472",rx:"28.5",stroke:"black",strokeWidth:"25"}),l.createElement("path",{d:"M13 316L126.663 218.694C138.981 208.149 157.344 208.878 168.787 220.366L275.5 327.5M275.5 327.5L124 482M275.5 327.5L467.765 137.481C479.819 125.568 499.206 125.542 511.29 137.424L668 291.5",stroke:"black",strokeWidth:"24"}))};const Sv=function(){return l.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 66.9 66.8",fill:"#7f7f7f"},l.createElement("path",{className:"st0",d:"M44.3,15.7c0,.9-.7,1.6-1.6,1.6s-1.6-.7-1.6-1.6.7-1.6,1.6-1.6,1.6.7,1.6,1.6ZM39.1,15.7c0,2,1.6,3.7,3.6,3.7s3.6-1.6,3.6-3.7-1.6-3.7-3.6-3.7-3.6,1.6-3.6,3.7Z"}),l.createElement("path",{className:"st0",d:"M16.9,61.6c0,.1,0,.3,0,.4,0,.1-.1.2-.2.3,0,0-.2.2-.3.2-.1,0-.3,0-.4,0s-.3,0-.4,0c-.1,0-.2-.1-.3-.2,0,0-.2-.2-.2-.3,0-.1,0-.3,0-.4s0-.3,0-.4c0-.1.1-.2.2-.3,0,0,.2-.2.3-.2s.3,0,.4,0,.3,0,.4,0,.2.1.3.2c0,0,.2.2.2.3,0,.1,0,.3,0,.4Z"}),l.createElement("path",{className:"st0",d:"M41.9,2.5c.5-.5,1.3-.5,1.8,0l13.7,15.1v14.6c.5-.2,1.2-.4,1.9-.4h.2v-11.9l3.4,3.8c.4.4,1,.5,1.5,0,.4-.4.5-1,0-1.5L45.1,1.1c-.6-.7-1.5-1.1-2.4-1.1s-1.8.4-2.4,1.1l-9.8,10.8c.7.3,1.3.6,1.9,1,0,0,9.3-10.4,9.4-10.4Z"}),l.createElement("path",{className:"st0",d:"M26.2,15.1c4,0,7.3,3.3,7.3,7.3s-3.2,7.3-7.3,7.3-7.3-3.3-7.3-7.3,3.3-7.3,7.3-7.3ZM26.2,31.9c5.2,0,9.3-4.2,9.3-9.4s-4.2-9.4-9.3-9.4-9.3,4.2-9.3,9.4,4.2,9.4,9.3,9.4Z"}),l.createElement("path",{className:"st0",d:"M25.8,23.6h.7c.4,0,.7.2.7.5s0,.5-.7.5h-2c-.6,0-1,.5-1,1s.5,1,1,1h1v.5c0,.6.5,1,1,1s1-.5,1-1v-.7c1.1-.4,1.7-1.5,1.7-2.4s-.9-2.6-2.8-2.6h-.7c-.2,0-.4,0-.5-.2-.1-.1-.2-.2-.2-.4s.1-.5.7-.5h2c.6,0,1-.5,1-1s-.5-1-1-1h-.2v-.6c0-.6-.5-1-1-1s-1,.5-1,1v.6c-1.6.1-2.5,1.4-2.5,2.6s.9,2.6,2.7,2.6Z"}),l.createElement("path",{className:"st0",d:"M66.6,34.7c-.3-.5-.9-.8-1.6-.8h-5.6c-.6,0-1.1.2-1.5.4-.5.2-1.2.7-2.9,3.1l-1.3,1.7h-4.6v-12c0-.6-.5-1-1-1h-10.4c-.6,0-1,.5-1,1v6.7h2.1v-5.6h8.4v6.8c1.3,1,2.1,2.6,2.1,4.3v1.8h5.1c.3,0,.6-.2.8-.4l1.6-2.1c1.6-2.1,2-2.4,2.1-2.4.3-.1.5-.2.7-.2h5.2l-3.3,7.7c-.2.4-.7,1-1.1,1.3l-11.4,7.4c-.2.1-.5.3-1.7.3h-21.8c-.3,0-.5.1-.7.3l-2.7,2.6-12.2-12.2,7.3-6.9c.3-.3.9-.5,1.4-.5h11.2c.5,0,1.4.2,1.9.4l2.6,1c.7.3,1.9.5,2.7.5h6.9c.7,0,1.4.6,1.4,1.4v3.7c0,.8-.6,1.4-1.4,1.4h-13.9c-.6,0-1,.5-1,1s.5,1,1,1h13.8c1.9,0,3.4-1.6,3.4-3.4v-3.7c0-1.9-1.6-3.4-3.4-3.4h-6.9c-.5,0-1.4-.2-1.9-.4l-2.6-1c-.7-.3-1.9-.5-2.7-.5h-11.1c-.9,0-2.1.5-2.8,1.1l-7.3,6.9c-1.5-1.5-3.8-1.7-5.1-.6l-2.6,2.1c-.5.4-.5,1-.2,1.5.4.5,1,.5,1.5.2l2.6-2.1c.5-.4,1.6-.3,2.4.5l14.4,14.4c.7.7.7,1.9,0,2.6l-4.3,4.5c-.4.4-.4,1.1,0,1.5.4.4,1.1.4,1.5,0l4.3-4.5c.7-.7,1.1-1.7,1.1-2.7s-.2-1.5-.6-2.1l2.5-2.3h21.4c.9,0,2.1,0,2.9-.6l11.4-7.4c.7-.5,1.6-1.4,1.9-2.2l3.4-8c.3-.6.3-1.2,0-1.7Z"}))};var xv=a(70490),Hv={};Hv.styleTagTransform=qc(),Hv.setAttributes=Gc(),Hv.insert=Ic().bind(null,"head"),Hv.domAPI=Dc(),Hv.insertStyleElement=Uc();Pc()(xv.A,Hv);xv.A&&xv.A.locals&&xv.A.locals;function Rv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vv(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Tv(){return Tv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tv.apply(null,arguments)}var Nv={backgroundColor:"transparent",marginLeft:"70%",marginTop:"-40%",position:"absolute"},Ov={name:"CustomAddOns",Tab:(0,oA.observer)((function(e){return l.createElement(aA.SectionTab,Tv({name:"Add On's"},e,{iconSize:20}),l.createElement(Mv,null))})),Panel:(0,oA.observer)((function(e){var t=e.store,n=e.allowedAddOns,r=Rv((0,l.useState)(""),2),a=r[0],o=r[1],i=Ke((function(e){return e.templates.template})),c=Ke((function(e){return e.templates.offerPercentage})),s=lt(),u=("local"===ma()||"staging"===ma()?Jr:Aa()?_r:$r)+"/default_images/dummyGSV.png",d=("local"===ma()||"staging"===ma()?"https://staging.offer-generator.com/property-offers":Aa()?"https://demo.offer-generator.com/property-offers":"https://offer-generator.com/property-offers")+"?apiKey=".concat(ha()),f="{{ROS.PROPERTY_OFFER}}",p=function(e,n,r){e.preventDefault();var o=t.activePage.toJSON();if("gsv"===r){var i,l;if(null!=o&&null!==(i=o.children)&&void 0!==i&&i.length&&o.children.find((function(e){return e.id==="gsv-image_".concat(t.activePage.id)})))return void s(Jh(lo.GSV_RESTRICT_ONE_PER_PAGE));null===(l=t.activePage)||void 0===l||l.addElement({id:"gsv-image_".concat(t.activePage.id),type:"image",src:u,width:287,height:188,contentEditable:!1,keepRatio:!0,opacity:1,custom:{elementType:n}})}else if("rpo"===r){var c=Math.random().toString(36).substring(2,7);t.activePage.addElement({id:"ros_".concat(c),type:"text",x:100,y:100,text:n,width:175,contentEditable:!1})}else if("custom_rpo"===r){if(!a)return void h();if(!C())return!1;s({type:cr,payload:a});var d=Math.random().toString(36).substring(2,7);t.activePage.addElement({id:"ros_".concat(d),type:"text",x:100,y:100,text:n,width:175,contentEditable:!1,custom:{ros_custom_value:a}})}},h=function(){return s(Jh("Please enter the offer percentage"))},C=function(){return!(+a<1||+a>100)||(s(Jh("Please enter an offer percentage between 1 and 100")),!1)},A=function(e){if(e.stopPropagation(),!C())return!1;pa(f),s({type:cr,payload:a}),s(Kh("ROS Property Offer Copied"))};return(0,l.useEffect)((function(){var e;null!=i&&null!==(e=i.meta)&&void 0!==e&&e.rosOfferPercentage&&!c?o(i.meta.rosOfferPercentage):c&&o(c)}),[]),l.createElement("div",{className:"dynamic-content"},l.createElement("div",{className:"dynamic-content__top"},l.createElement("div",null,l.createElement("span",{className:"title"},lo.CUSTOM_ADD_ONS.TITLE)," ",l.createElement(qm,{fill:"var(--primary-color)",className:"infoIcon"}),l.createElement(Wm,{anchorSelect:".infoIcon",place:"bottom",title:lo.CUSTOM_ADD_ONS.DESCRIPTION}))),(!n||(null==n?void 0:n.includes("gsv")))&&l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,"GOOGLE_STREET_VIEW","gsv")}},l.createElement(zv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.GSV.TITLE),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.GSV.DESCRIPTION)),(null==n?void 0:n.includes("property_offer"))&&l.createElement("div",null,l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,f,"rpo")}},l.createElement(Jc,{style:Nv,onClick:A,backdrop:!1},l.createElement(Ym,{className:"copy"})),l.createElement(Sv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.TITLE),l.createElement(Zc,{className:"no-margin"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.DESCRIPTION),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.PRICE))),(null==n?void 0:n.includes("custom_property_offer"))&&l.createElement("div",{className:"addonBox",onClick:function(e){return p(e,f,"custom_rpo")}},l.createElement(Jc,{style:Nv,onClick:a?A:h,backdrop:!1,className:"custom-po"},l.createElement(Ym,{className:"copy"})),l.createElement(Sv,null),l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.TITLE),l.createElement(Zc,{variant:"h3",className:"no-margin s-font"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.DESCRIPTION),l.createElement("div",{style:{margin:"12px"},className:"plain-text"},l.createElement("a",{href:d,target:"_blank",onClick:function(e){e.stopPropagation()}},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CLICK)," ",lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CSV_IMPORT),l.createElement(Zc,{className:"no-margin s-font"},lo.CUSTOM_ADD_ONS.PROPERTY_OFFER.CUSTOM.CUSTOM_PRICE),l.createElement("div",{onClick:function(e){return e.stopPropagation()},style:{width:"18rem",marginBottom:"15px"}},l.createElement(xh,{type:"number",placeholder:"Type in a Number between 1-100",qrField:!0,value:a,onChange:function(e){o(e.target.value)}}))),l.createElement("div",{className:"no-result-addOns"},!n||0===(null==n?void 0:n.length)&&l.createElement(Zc,null,lo.CUSTOM_ADD_ONS.NO_RESULT)),l.createElement(Wm,{anchorSelect:".copy",place:"bottom",title:"Copy"}))}))};const Pv=Ov;var kv=a(87583),Dv=a(93120);const Bv=function(){return l.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",version:"1.1",viewBox:"0 0 16 16",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{fill:"#000000",d:"M5 1h-4v4h4v-4zM6 0v0 6h-6v-6h6zM2 2h2v2h-2zM15 1h-4v4h4v-4zM16 0v0 6h-6v-6h6zM12 2h2v2h-2zM5 11h-4v4h4v-4zM6 10v0 6h-6v-6h6zM2 12h2v2h-2zM7 0h1v1h-1zM8 1h1v1h-1zM7 2h1v1h-1zM8 3h1v1h-1zM7 4h1v1h-1zM8 5h1v1h-1zM7 6h1v1h-1zM7 8h1v1h-1zM8 9h1v1h-1zM7 10h1v1h-1zM8 11h1v1h-1zM7 12h1v1h-1zM8 13h1v1h-1zM7 14h1v1h-1zM8 15h1v1h-1zM15 8h1v1h-1zM1 8h1v1h-1zM2 7h1v1h-1zM0 7h1v1h-1zM4 7h1v1h-1zM5 8h1v1h-1zM6 7h1v1h-1zM9 8h1v1h-1zM10 7h1v1h-1zM11 8h1v1h-1zM12 7h1v1h-1zM13 8h1v1h-1zM14 7h1v1h-1zM15 10h1v1h-1zM9 10h1v1h-1zM10 9h1v1h-1zM11 10h1v1h-1zM13 10h1v1h-1zM14 9h1v1h-1zM15 12h1v1h-1zM9 12h1v1h-1zM10 11h1v1h-1zM12 11h1v1h-1zM13 12h1v1h-1zM14 11h1v1h-1zM15 14h1v1h-1zM10 13h1v1h-1zM11 14h1v1h-1zM12 13h1v1h-1zM13 14h1v1h-1zM10 15h1v1h-1zM12 15h1v1h-1zM14 15h1v1h-1z"}))};function Iv(e){return Iv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Iv(e)}function Fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gv(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Iv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Iv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Iv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */jv=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Iv(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Iv(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function Uv(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Wv(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Uv(o,r,a,i,l,"next",e)}function l(e){Uv(o,r,a,i,l,"throw",e)}i(void 0)}))}}function qv(e){return function(e){if(Array.isArray(e))return Yv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Yv(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yv(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qv(){return Qv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qv.apply(null,arguments)}var Zv={name:"QR-Section",Tab:function(e){return l.createElement(aA.SectionTab,Qv({name:"QR"},e,{iconSize:20}),l.createElement(Bv,null))},Panel:(0,oA.observer)((function(e){var t=e.store,n=e.allowSenderFields,r=e.allowPropertyFields,a=e.excludedFields,o=Ke((function(e){return e.customQRCode.url})),i=Ke((function(e){return e.customQRCode.utmSource})),c=Ke((function(e){return e.customQRCode.utmMedium})),s=Ke((function(e){return e.customQRCode.utmCampaignName})),u=Ke((function(e){return e.customQRCode.customUtms})),d=Ke((function(e){return e.customQRCode.isQR})),f=lt(),p=Ke((function(e){return e.templates.defaultDynamicFields})),h=Ke((function(e){return e.templates.defaultSenderFields})),C=Ke((function(e){return e.customFields.customFields})),A=Ke((function(e){return e.customFields.customFieldsV2})),m=Ke((function(e){return e.templates.defaultPropertyFields})),v=["utm_c_first_name c_last_name"],g=[];A.length>0&&(g=null==A?void 0:A.flatMap((function(e){return e.fields})));var y=[].concat(qv(p),qv(C),qv(g),qv(n?h:[]),qv(r?m:[]),qv(r?[{value:"ROS.PROPERTY_OFFER",key:"{{ROS.PROPERTY_OFFER}}",defaultValue:"$123,456.00"}]:[])).filter((function(e){var t=e.key;return!(null!=a&&a.includes(t))})),b=y.map((function(e){var t=e.key;return{label:"utm_".concat(t.toLowerCase().replaceAll(".","_").replaceAll(/[{}]/g,""))}})).filter((function(e){return!v.includes(e.label)})),L=["custom_utm_1","custom_utm_2","custom_utm_3"],E=t.selectedElements[0],w=function(){t.selectElements([]),f(eo())},M=function(e,t){var n="",r=sa.find((function(t){return t.key===e}));return r&&(n="".concat(r.value,"=").concat(t)),n},z=function(){for(var e=0,t=[{value:i,label:"UTM Source"},{value:c,label:"UTM Medium"},{value:s,label:"UTM Campaign"}];e<t.length;e++){var n=t[e],r=n.value,a=n.label;if(r.length>=150)return f(Jh("".concat(a," must be less than 150 characters"))),!1;if(na.test(r))return f(Jh("Emoji are not allowed in ".concat(a))),!1}return!0},S=function(e){return ca.some((function(t){return e.includes(t)}))},x=function(e){return new Promise((function(t){kv.toString(e||"no-data",{type:"svg",margin:0,color:{dark:"#000000",light:"#0000"}},(function(e,n){t(Dv.svgToURL(n))}))}))},H=function(e){var t,n,r,a=e,o=[];if(i&&o.push("utm_source=".concat(i.replace(/ /g,"_"))),c&&o.push("utm_medium=".concat(c.replace(/ /g,"_"))),s&&o.push("utm_campaign=".concat(s.replace(/ /g,"_"))),null!==(t=u[L[0]])&&void 0!==t&&t.label){var l,d,f,p,h,C="{{".concat(null===(l=u[L[0]])||void 0===l?void 0:l.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),A=null===(d=y.find((function(e){return e.key===C})))||void 0===d?void 0:d.defaultValue,m=M(C,A),v=m&&"{{C.PHONE_NUMBER}}"==C?encodeURIComponent("".concat(null===(f=u[L[0]])||void 0===f?void 0:f.label,"=").concat(A,"&").concat(m)).replace(/[\s\(\)]/g,""):m?"".concat(null===(p=u[L[0]])||void 0===p?void 0:p.label,"=").concat(A,"&").concat(m):"".concat(null===(h=u[L[0]])||void 0===h?void 0:h.label,"=").concat(A);o.push(v)}if(null!==(n=u[L[1]])&&void 0!==n&&n.label){var g,b,E,w,z,S="{{".concat(null===(g=u[L[1]])||void 0===g?void 0:g.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),x=null===(b=y.find((function(e){return e.key===S})))||void 0===b?void 0:b.defaultValue,H=M(S,x),R=H&&"{{C.PHONE_NUMBER}}"==S?encodeURIComponent("".concat(null===(E=u[L[1]])||void 0===E?void 0:E.label,"=").concat(x,"&").concat(H)).replace(/[\s\(\)]/g,""):H?"".concat(null===(w=u[L[1]])||void 0===w?void 0:w.label,"=").concat(x,"&").concat(H):"".concat(null===(z=u[L[1]])||void 0===z?void 0:z.label,"=").concat(x);o.push(R)}if(null!==(r=u[L[2]])&&void 0!==r&&r.label){var V,T,N,O,P,k="{{".concat(null===(V=u[L[2]])||void 0===V?void 0:V.label.replace("utm_","").replace("_",".").toUpperCase(),"}}"),D=null===(T=y.find((function(e){return e.key===k})))||void 0===T?void 0:T.defaultValue,B=M(k,D),I=B&&"{{C.PHONE_NUMBER}}"==k?encodeURIComponent("".concat(null===(N=u[L[2]])||void 0===N?void 0:N.label,"=").concat(D,"&").concat(B)).replace(/[\s\(\)]/g,""):B?"".concat(null===(O=u[L[2]])||void 0===O?void 0:O.label,"=").concat(D,"&").concat(B):"".concat(null===(P=u[L[2]])||void 0===P?void 0:P.label,"=").concat(D);o.push(I)}return o.length>0&&(a+="/?".concat(o.join("&"))),encodeURI(a)},R=function(){var e=Wv(jv().mark((function e(){var n,r,a;return jv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o){e.next=17;break}if(!va(o)||S(o)){e.next=14;break}if(z()){e.next=5;break}return e.abrupt("return",!1);case 5:return n=Math.random().toString(36).substring(2,7),r=H(o),e.next=9,x(r);case 9:a=e.sent,t.activePage.addElement({id:"qr-".concat(n),type:"svg",name:"qr",x:50,y:50,width:100,height:100,blurRadius:0,keepRatio:!0,src:a,custom:{url:o,utm_source:i,utm_medium:c,utm_campaign_name:s,custom_utms:u}}),w(),e.next=15;break;case 14:f(Jh(lo.QR_SECTION.INVALID_URL));case 15:e.next=18;break;case 17:f(Jh(lo.QR_SECTION.EMPTY_QR));case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){var e=Wv(jv().mark((function e(){var t,n;return jv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("qr"!==(null==E?void 0:E.name)||!o){e.next=16;break}if(!va(o)||S(o)){e.next=13;break}if(z()){e.next=5;break}return e.abrupt("return",!1);case 5:return t=H(o),e.next=8,x(t);case 8:n=e.sent,E.set({src:n,custom:{url:o,utm_source:i,utm_medium:c,utm_campaign_name:s,custom_utms:u}}),w(),e.next=14;break;case 13:f(Jh(lo.QR_SECTION.INVALID_URL));case 14:e.next=17;break;case 16:f(Jh(lo.QR_SECTION.EMPTY_QR));case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fv(Object(n),!0).forEach((function(t){Gv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},u);null===t?delete n[e]:n[e]=t,f($a(n))};return(0,l.useEffect)((function(){var e,t,n,r,a,o,i;"qr"===(null==E?void 0:E.name)?(f(function(e){return{type:wr,payload:e}}("qr"===(null==E?void 0:E.name))),f(Xa((null==E||null===(e=E.custom)||void 0===e?void 0:e.url)||(null==E||null===(t=E.custom)||void 0===t?void 0:t.value)||"")),f(Ka((null==E||null===(n=E.custom)||void 0===n?void 0:n.utm_source)||"direct mail")),f(Ja((null==E||null===(r=E.custom)||void 0===r?void 0:r.utm_medium)||"QR Code")),f(_a((null==E||null===(a=E.custom)||void 0===a?void 0:a.utm_campaign_name)||"")),Object.values((null==E||null===(o=E.custom)||void 0===o?void 0:o.custom_utms)||{}).length?f($a(null==E||null===(i=E.custom)||void 0===i?void 0:i.custom_utms)):f($a({}))):d&&"qr"!==(null==E?void 0:E.name)&&f(eo())}),[d,E]),l.createElement(l.Fragment,null,l.createElement("button",{className:"qr-submit-btn",onClick:d?V:R},d?lo.QR_SECTION.UPDATE_BUTTON:lo.QR_SECTION.SUBMIT_BUTTON),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"QR URL:"),l.createElement(xh,{type:"text",onChange:function(e){f(Xa(e.target.value))},placeholder:lo.QR_SECTION.QR_PLACEHOLDER,value:o,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Source:"),l.createElement(xh,{type:"text",onChange:function(e){f(Ka(e.target.value))},placeholder:"Enter UTM Source",value:i,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Medium:"),l.createElement(xh,{type:"text",onChange:function(e){f(Ja(e.target.value))},placeholder:"Enter UTM Medium",value:c,qrField:!0})),l.createElement("div",{className:"qr-input-wrapper"},l.createElement("label",null,"UTM Campaign Name:"),l.createElement(xh,{type:"text",onChange:function(e){f(_a(e.target.value))},placeholder:"Enter UTM Campaign Name",value:s,qrField:!0})),null==L?void 0:L.map((function(e,t){return l.createElement("div",{className:"qr-input-wrapper",key:t},l.createElement("label",null,e.toUpperCase().replace(/\_/g," "),":"),l.createElement(_p,{placeholder:"Select Custom UTM ".concat(t+1),options:b,setSelectedValue:function(t){return T(e,t)},selectedValue:u[e]||null,builderSelect:!0,clearField:!0,search:function(){},updateErrors:function(){},disableClearable:!1,templateBuilder:!0,qrField:!0}))})))}))};const Xv=Zv;function Kv(e){return Kv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kv(e)}function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jv.apply(null,arguments)}function _v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_v(Object(n),!0).forEach((function(t){eg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eg(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Kv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Kv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Kv(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tg(e){return function(e){if(Array.isArray(e))return ag(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ng(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||rg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rg(e,t){if(e){if("string"==typeof e)return ag(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ag(e,t):void 0}}function ag(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const og=function(e){var t=ng((0,l.useState)(!1),2),n=t[0],r=t[1],a="Real Penned Letter"===e.currentTemplateType?aA.DEFAULT_SECTIONS.filter((function(e){return""===e.name})):aA.DEFAULT_SECTIONS.filter((function(e){return!["photos","size","templates"].includes(e.name)}));return l.createElement(qh.SidePanelWrap,null,l.createElement(aA.SidePanel,{store:e.store,sections:[].concat(tg("Real Penned Letter"!==e.currentTemplateType?[$v($v($v({},Am),wv),{},{Panel:function(t){return l.createElement(Am.Panel,Jv({},t,{platformName:e.platformName,templateGalleryModal:e.templateGalleryModal,designerQueryAmount:e.designerQueryAmount,selectedSection:e.selectedSection,allowedTemplateSections:e.allowedTemplateSections,hireDesignerModal:n,setHireDesignerModal:r,onCreateCustomTemplateQuery:e.onCreateCustomTemplateQuery,onGetTemplates:e.onGetTemplates,onGetOneTemplate:e.onGetOneTemplate}))}})]:[]),tg(a),[$v($v($v({},sv),wv),{},{Panel:function(t){return l.createElement(sv.Panel,Jv({},t,{onGetCustomFields:e.onGetCustomFields,allowSenderFields:e.allowSenderFields,excludedFields:e.excludedFields,allowPropertyFields:e.allowPropertyFields,platformName:e.platformName}))}})],tg("Real Penned Letter"!==e.currentTemplateType?[$v($v({},Xv),{},{Panel:function(t){return l.createElement(Xv.Panel,Jv({},t,{allowSenderFields:e.allowSenderFields,allowPropertyFields:e.allowPropertyFields,excludedFields:e.excludedFields}))}}),$v($v({},Pv),{},{Panel:function(t){return l.createElement(Pv.Panel,Jv({},t,{allowedAddOns:e.allowedAddOns}))}})]:[])),defaultSection:"text"}))};var ig=a(22995),lg={};lg.styleTagTransform=qc(),lg.setAttributes=Gc(),lg.insert=Ic().bind(null,"head"),lg.domAPI=Dc(),lg.insertStyleElement=Uc();Pc()(ig.A,lg);ig.A&&ig.A.locals&&ig.A.locals;function cg(e){return cg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cg(e)}function sg(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */sg=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:z(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",C="completed",A={};function m(){}function v(){}function g(){}var y={};s(y,i,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(V([])));L&&L!==n&&r.call(L,i)&&(y=L);var E=g.prototype=m.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(a,o,i,l){var c=d(e[a],e,o);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==cg(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function z(t,n,r){var a=f;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===C){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=S(l,r);if(c){if(c===A)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var s=d(t,n,r);if("normal"===s.type){if(a=r.done?C:p,s.arg===A)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=C,r.method="throw",r.arg=s.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),A;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,A;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,A):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,A)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function H(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(cg(t)+" is not iterable")}return v.prototype=g,a(E,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:v,configurable:!0}),v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},w(M.prototype),s(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new M(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(E),s(E,c,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=V,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),H(n),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;H(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:V(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),A}},t}function ug(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function dg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ug(Object(n),!0).forEach((function(t){fg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fg(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=cg(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=cg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==cg(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pg(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=mg(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function hg(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Cg(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){hg(o,r,a,i,l,"next",e)}function l(e){hg(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ag(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||mg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mg(e,t){if(e){if("string"==typeof e)return vg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vg(e,t):void 0}}function vg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const gg=function(e){var t=e.store,n=e.platformName,r=e.templateGalleryModal,a=e.createTemplateRoute,o=e.designerTemplateQuery,i=e.olcTemplate,c=e.allowSenderFields,s=e.excludedFields,u=e.designerQueryAmount,d=e.allowPropertyFields,f=e.allowedAddOns,p=e.allowedTemplateSections,h=e.onCreateCustomTemplateQuery,C=e.onReturnAndNavigate,A=e.onGetOneTemplate,m=e.onGetCustomFields,v=e.onGetTemplates,g=e.onSubmit,y=Ag((0,l.useState)(!1),2),b=y[0],L=y[1],E=Ag((0,l.useState)(1),2),w=E[0],M=E[1],z=Ag((0,l.useState)("text"),2),S=z[0],x=z[1],H=ie().id,R=lt(),V=oe(),T=(Ke((function(e){return e.templates.template})),Ke((function(e){return e.templates.product}))),N=Ke((function(e){return e.templates.envelopeType})),O=Ke((function(e){return e.templates.products})),P=null==T?void 0:T.productType;(0,l.useEffect)((function(){i&&F()}),[i]),(0,l.useEffect)((function(){o&&setTimeout((function(){I()}),100)}),[o]),(0,l.useEffect)((function(){var e=function(){document.hidden&&M((function(e){return e+1}))},n=function(e){e.target instanceof Element&&e.target.closest(".polotno-side-tabs-container")&&"Templates"!==(null==t?void 0:t.openedSidePanel)&&x(null==t?void 0:t.openedSidePanel)};return document.addEventListener("click",n),document.addEventListener("visibilitychange",e),function(){document.removeEventListener("visibilitychange",e),document.removeEventListener("click",n)}}),[]),(0,l.useEffect)((function(){ro("hireDesignerFormState"),ro("queryFiles")}),[]),(0,l.useEffect)((function(){T||i||H||o||V(a||"/create-template")}),[]),(0,l.useEffect)((function(){if(T||H&&A){if((0,Xh.O3)(iC),H&&A)try{A(H).then((function(e){var n;e?(R({type:ar,payload:{data:e}}),co(null==e||null===(n=e.product)||void 0===n?void 0:n.id,t),R({type:or,payload:!0})):(R(Jh("Unable to load the Template")),setTimeout((function(){V(a||"/create-template")}),1e3))}))}catch(e){return e}finally{R({type:or,payload:!1})}else 0!==t.pages.length||i||D();k();var e=t.on("change",(function(){b||L(!0)}));return function(){t.history.clear(),t.clear(),R(eo()),e()}}}),[]),(0,l.useEffect)((function(){H||i||!T||0!==t.pages.length||D()}),[T]),(0,l.useEffect)((function(){var e=function(e){var t="Are you sure you want to leave?";return e.returnValue=t,t};return b&&(window.removeEventListener("beforeunload",e),window.addEventListener("beforeunload",e)),function(){window.removeEventListener("beforeunload",e)}}),[b]);var k=function(){var e=Cg(sg().mark((function e(){var t,n,r,a,o,i,l,c,s,u,d,f;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m){e.next=7;break}return e.next=3,m();case 3:if(t=e.sent,n=[],r=[],"v2"===(null==t?void 0:t.version)){o=t.customFields.flatMap((function(e){return e.fields})),i=pg(o);try{for(i.s();!(l=i.n()).done;)((c=l.value).isPlatformField?n:r).push(c)}catch(e){i.e(e)}finally{i.f()}s=null==t?void 0:t.customFields.map((function(e){return dg(dg({},e),{},{fields:e.fields.filter((function(e){return r.includes(e)}))})})).filter((function(e){return e.fields.length>0})),null!=t&&null!==(a=t.customFields)&&void 0!==a&&a.length?(R({type:Cr,payload:[]}),R({type:Ar,payload:s})):(R({type:Cr,payload:[]}),R({type:Ar,payload:[]})),R(n.length?{type:mr,payload:n}:{type:mr,payload:[]})}else{u=pg(t);try{for(u.s();!(d=u.n()).done;)((f=d.value).isPlatformField?n:r).push(f)}catch(e){u.e(e)}finally{u.f()}r.length?R({type:Cr,payload:r}):R({type:Cr,payload:[]}),R(n.length?{type:mr,payload:n}:{type:mr,payload:[]})}case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=Cg(sg().mark((function e(){var n,r;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:T&&(t.openSidePanel("text"),t.addPage(),r=null==T||null===(n=T.selectedSize)||void 0===n?void 0:n.split("x"),t.setUnit({unit:"in",dpi:ea}),t.setSize(+r[1]*ea,+r[0]*ea),ta.includes(T.productType)&&(t.addPage(),t.selectPage(t.pages[0].id)),Lo(t,T,N),aC(T.id,t),"Real Penned Letter"===P&&B(),R(eo()),t.history.clear()),L(!1);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=Cg(sg().mark((function e(){var n,r,a;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.addFont({fontFamily:"lexi Regular",url:lC}),oC(t),e.next=5,fetch(lC);case 5:return n=e.sent,e.next=8,n.blob();case 8:r=e.sent,(a=new FileReader).onloadend=function(){t.addFont({fontFamily:"lexi Regular",url:a.result})},a.readAsDataURL(r),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.error("Error loading the font file:",e.t0);case 17:case"end":return e.stop()}}),e,null,[[0,14]])})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=Cg(sg().mark((function e(){var n,r,i;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==o||!o.title||null==o||!o.product){e.next=11;break}if(n=O.flatMap((function(e){return e.size.map((function(t){return dg({id:t.id||e.id,title:e.title,productType:e.productType,size:[{id:t.id||e.id,size:t.size}]},void 0!==e.windowed&&{windowed:e.windowed})}))})),r=n.find((function(e){var t;return e.id===(null==o||null===(t=o.product)||void 0===t?void 0:t.id)})),!r){e.next=11;break}return R({type:Mr}),t.clear(),t.history.clear(),R(Qa("title",null==o?void 0:o.title)),"Professional Letters"===r.productType&&(i=2==r.id?"#10 Double-Window":"#10 Grey",R(Qa("envelopeType",i))),R(Ya(r)),e.abrupt("return");case 11:C?C():V(a||"/");case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F=function(){var e=Cg(sg().mark((function e(){var n,r,a,o,l,c,s,u;return sg().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=i)){e.next=20;break}return R({type:ar,payload:{data:n}}),(l=document.querySelector(".polotno-workspace-container"))&&l.classList.add("show-loader"),c=null==n||null===(r=n.product)||void 0===r?void 0:r.paperSize.split("x"),t.setUnit({unit:"in",dpi:96}),t.setSize(+c[1]*ea,+c[0]*ea),e.next=10,vo(null==n?void 0:n.templateUrl);case 10:return s=e.sent,"Real Penned Letter"===(null==n||null===(a=n.product)||void 0===a?void 0:a.productType)&&(u=JSON.stringify(s).replace(/{{/g,"((").replace(/}}/g,"))"),s=JSON.parse(u)),t.loadJSON(s),e.next=15,t.waitLoading();case 15:R(eo()),L(!1),co(null==n||null===(o=n.product)||void 0===o?void 0:o.id,t),R({type:or,payload:!1}),l&&l.classList.add("hide-loader");case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return l.createElement(l.Fragment,null,l.createElement(Zc,{className:"hideTemplateBuilder"},ao),l.createElement("div",{className:"polotno-container"},w>0&&l.createElement("div",{className:"builder-wrapper"},l.createElement(rA,{store:t,isStoreUpdated:b,olcTemplate:i,onReturnAndNavigate:C,onSubmit:g}),l.createElement(qh.PolotnoContainer,{style:{width:"100vw",height:"90vh",position:"relative"}},l.createElement(og,{store:t,currentTemplateType:P,platformName:n,templateGalleryModal:r,allowSenderFields:c,allowPropertyFields:d,excludedFields:s,designerQueryAmount:u,allowedAddOns:f,allowedTemplateSections:p,onGetTemplates:v,onGetOneTemplate:A,onGetCustomFields:m,selectedSection:S,onCreateCustomTemplateQuery:h}),l.createElement(qh.WorkspaceWrap,null,"Real Penned Letter"!==P&&l.createElement(Yh.Toolbar,{store:t,downloadButtonEnabled:!1}),"Real Penned Letter"!==P?l.createElement(Zh.Workspace,{store:t,pageControlsEnabled:!1}):l.createElement(Zh.Workspace,{store:t,pageControlsEnabled:!1,components:{Tooltip:function(){return null}}}),l.createElement(Qh.ZoomButtons,{store:t}))),l.createElement(ah,null))))};var yg,bg;function Lg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Eg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wg(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Mg=function(e){return(0,Kr.createStore)({key:e,showCredit:!1})};const zg=function(e){var t,n=e.secretKey,r=e.platformName,a=e.templateGalleryModal,o=e.createTemplateRoute,i=e.templateBuilderRoute,c=e.olcTemplate,s=e.designerTemplateQuery,u=e.allowSenderFields,d=e.excludedFields,f=e.designerQueryAmount,p=e.allowPropertyFields,h=e.allowedAddOns,C=e.allowedTemplateSections,A=e.restrictedProducts,m=e.styles,v=e.onReturnAndNavigate,g=e.onCreateCustomTemplateQuery,y=e.onGetOneTemplate,b=e.onGetCustomFields,L=e.onGetTemplates,E=e.onSubmit,w=Eg((0,l.useState)(Mg(n)),2),M=w[0],z=w[1],S=null===(t=window)||void 0===t||null===(t=t.location)||void 0===t?void 0:t.pathname;(0,l.useEffect)((function(){if(S===o||"/create-template"===S||s){var e=Mg(n);z(e)}}),[S]);var x=m&&Object.keys(m).length?Lc(yg||(yg=Lg(["\n :root {\n ","\n }\n "])),m?Object.entries(m.root).map((function(e){var t=Eg(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r,";")})).join(" "):""):Lc(bg||(bg=Lg(["<></>"])));return l.createElement("div",{className:"builder-wrapper"},l.createElement(ah,null),l.createElement(x,null),l.createElement(Le,null,l.createElement(ye,{path:o||"/create-template",element:l.createElement(Wh,{createTemplateRoute:o,templateBuilderRoute:i,restrictedProducts:A,onReturnAndNavigate:v})}),l.createElement(ye,{path:i||"/template-builder/:id?",element:l.createElement(gg,{store:M,olcTemplate:c,designerTemplateQuery:s,platformName:r,templateGalleryModal:a,allowSenderFields:u,excludedFields:d,designerQueryAmount:f,allowPropertyFields:p,createTemplateRoute:o,allowedAddOns:h,allowedTemplateSections:C,onReturnAndNavigate:v,onCreateCustomTemplateQuery:g,onGetOneTemplate:y,onGetTemplates:L,onGetCustomFields:b,onSubmit:E})})))};var Sg=a(10002),xg={};xg.styleTagTransform=qc(),xg.setAttributes=Gc(),xg.insert=Ic().bind(null,"head"),xg.domAPI=Dc(),xg.insertStyleElement=Uc();Pc()(Sg.A,xg);Sg.A&&Sg.A.locals&&Sg.A.locals;var Hg=a(75487),Rg={};Rg.styleTagTransform=qc(),Rg.setAttributes=Gc(),Rg.insert=Ic().bind(null,"head"),Rg.domAPI=Dc(),Rg.insertStyleElement=Uc();Pc()(Hg.A,Rg);Hg.A&&Hg.A.locals&&Hg.A.locals;var Vg=a(88498),Tg={};Tg.styleTagTransform=qc(),Tg.setAttributes=Gc(),Tg.insert=Ic().bind(null,"head"),Tg.domAPI=Dc(),Tg.insertStyleElement=Uc();Pc()(Vg.A,Tg);Vg.A&&Vg.A.locals&&Vg.A.locals;var Ng=a(60137),Og={};Og.styleTagTransform=qc(),Og.setAttributes=Gc(),Og.insert=Ic().bind(null,"head"),Og.domAPI=Dc(),Og.insertStyleElement=Uc();Pc()(Ng.A,Og);Ng.A&&Ng.A.locals&&Ng.A.locals;var Pg=a(72804),kg={};kg.styleTagTransform=qc(),kg.setAttributes=Gc(),kg.insert=Ic().bind(null,"head"),kg.domAPI=Dc(),kg.insertStyleElement=Uc();Pc()(Pg.A,kg);Pg.A&&Pg.A.locals&&Pg.A.locals;const Dg=function(e){var t=e.container,n=e.secretKey,r=e.publicApiKey,a=e.platformName,o=e.templateGalleryModal,i=void 0===o||o,c=e.createTemplateRoute,u=e.templateBuilderRoute,d=e.olcTemplate,f=e.designerTemplateQuery,p=e.sandbox,h=e.allowSenderFields,C=e.allowPropertyFields,A=e.excludedFields,m=e.designerQueryAmount,v=e.allowedAddOns,g=e.allowedTemplateSections,y=e.env,b=e.restrictedProducts,L=e.onReturnAndNavigate,E=e.onCreateCustomTemplateQuery,w=e.onGetOneTemplate,M=e.onGetTemplates,z=e.onGetCustomFields,S=e.onSubmit,x=e.styles;if(!t)throw new Error("Root element not found");if(!n)throw new Error("secretKey not found");if(!r)throw new Error("publicApiKey not found");p&&function(e){da=e}(p),y&&"1.8.7-beta.2".includes("beta")&&function(e){fa=e}(y),Ca(r);var H=s.createRoot(t);return H.render(l.createElement(l.Fragment,null,l.createElement(rt,{store:Xr},l.createElement(Re,null,l.createElement(zg,{secretKey:n,styles:x,olcTemplate:d,designerTemplateQuery:f,platformName:a,templateGalleryModal:i,createTemplateRoute:c,templateBuilderRoute:u,allowSenderFields:h,allowPropertyFields:C,excludedFields:A,designerQueryAmount:m,allowedAddOns:v,allowedTemplateSections:g,restrictedProducts:b,onReturnAndNavigate:L,onCreateCustomTemplateQuery:E,onGetOneTemplate:w,onGetTemplates:M,onGetCustomFields:z,onSubmit:S}))))),{destroy:function(){console.log("React template builder destroyed"),H.unmount()}}};var Bg=o.A;export{Bg as default};
601
601
  //# sourceMappingURL=index.js.map