PageSourceSearch

https://safe-phone.ru/libs/wp-content/plugins/yop-poll/build/frontend.js

js safe-phone.ru collected 2026-10-02 11:55:41 UTC 44,060 bytes, 1 lines download raw bytes

1(()=>{"use strict";const e=window.wp.element,t=window.wp.i18n;async function o({url:e,method:t="GET",data:o,headers:n={}}){const s={method:t,credentials:"same-origin",headers:{Accept:"application/json, */*;q=0.1",...n}};void 0!==o&&(s.headers["Content-Type"]="application/json",s.body=JSON.stringify(o));const l=await fetch(e,s),r=await l.text();let a=null;if(r)try{a=JSON.parse(r)}catch(e){a=null}if(!l.ok)throw a&&"object"==typeof a?a:{code:"yop_poll_request_failed",message:l.statusText||"Request failed",data:{status:l.status}};return a}function n(e,t,o){if(t<=0||0===e.length)return e.map(()=>0);const n=Math.pow(10,o),s=e.reduce((e,t)=>e+t,0),l=Math.round(s/t*100*n),r=e.map(e=>e/t*100*n),a=r.map(e=>Math.floor(e));let i=l-a.reduce((e,t)=>e+t,0);return i>0&&r.map((e,t)=>({idx:t,frac:e-Math.floor(e)})).sort((e,t)=>t.frac-e.frac).slice(0,i).forEach(e=>{a[e.idx]+=1}),a.map(e=>e/n)}function s(e){const t=(e||"#000000").replace("#",""),o=3===t.length?t.split("").map(e=>e+e).join(""):t;return(299*parseInt(o.substring(0,2),16)+587*parseInt(o.substring(2,4),16)+114*parseInt(o.substring(4,6),16))/1e3<128?"#ffffff":"#000000"}const l=window.ReactJSXRuntime;function r(e){return("undefined"!=typeof window&&window.yopPollFront&&window.yopPollFront.restUrl?window.yopPollFront.restUrl:"/wp-json/yop-poll/v1/")+e}function a(e,t=""){return`${window.yopPollFront?.adminAjaxUrl||"/wp-admin/admin-ajax.php"}?action=${e}${t}`}function i(e,t,o){return e?a("yop_poll_results",`&poll_id=${t}${o}`):r(`polls/${t}/results?${o.replace(/^&/,"")}`)}function p(e){const t=String(e||"").trim();return/^(https?:|mailto:|\/|#)/i.test(t)?t:null}function c(e,t,n){return new Promise((s,l)=>{const r=e+"?redirect_to="+encodeURIComponent(t),a=(screen.width-800)/2,i=(screen.height-600)/2,p=window.open(r,"yop_poll_wp_login",`width=800,height=600,left=${a},top=${i}`);if(!p)return void l(new Error("Popup blocked"));let c=!1,d=null;const u=()=>{c=!0,window.removeEventListener("message",m),_&&clearInterval(_),x&&clearInterval(x),d&&clearTimeout(d)},h=()=>o({url:`${window.yopPollFront?.adminAjaxUrl||""}?action=yop_poll_auth_status&poll_id=${encodeURIComponent(n||0)}`}).then(e=>!(!e||!e.loggedIn||((e=>{if(!c){u();try{p.close()}catch(e){}s({nonce:e.nonce,authNonce:e.authNonce})}})(e),0)),()=>null),y=()=>{c||h()},m=e=>{e.source===p&&e.origin===window.location.origin&&("yop_poll_wp_login_success"===e.data?.type?y():"yop_poll_wp_login_failed"===e.data?.type&&(u(),l(new Error("Login failed"))))};window.addEventListener("message",m);const _=setInterval(y,1500);let g=0;const f=()=>{c||(g+=1,h().then(e=>{c||!0===e||(null===e&&g<3?d=setTimeout(f,300):c||(u(),l(new Error("Login cancelled"))))}))},x=setInterval(()=>{c||p.closed&&(clearInterval(x),clearInterval(_),f())},700)})}function d(e){return e?function(e){const t=e?.options?.results?.showResultsMoment;return Array.isArray(t)&&t.includes("after-end-date")?{...e,options:{...e.options,results:{...e.options.results,showResultsMoment:t.map(e=>"after-end-date"===e?"after-poll-end-date":e)}}}:e}("string"==typeof e.meta_data?JSON.parse(e.meta_data):e.meta_data||{}):{}}function u(e,t,o,n){return e?.[t]?.[o]||n}function h(e,t){return`rgba(${parseInt(e.slice(1,3),16)}, ${parseInt(e.slice(3,5),16)}, ${parseInt(e.slice(5,7),16)}, ${t})`}function y(e,t){return e.replace(/\{(\w+)\}/g,(e,o)=>t[o]??"")}function m(e,t){if(!e)return"";const o=new Date(e);if(isNaN(o.getTime()))return e;const n={Y:String(o.getFullYear()),y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),n:String(o.getMonth()+1),d:String(o.getDate()).padStart(2,"0"),j:String(o.getDate()),H:String(o.getHours()).padStart(2,"0"),G:String(o.getHours()),h:String(o.getHours()%12||12).padStart(2,"0"),g:String(o.getHours()%12||12),i:String(o.getMinutes()).padStart(2,"0"),s:String(o.getSeconds()).padStart(2,"0"),A:o.getHours()>=12?"PM":"AM",a:o.getHours()>=12?"pm":"am",F:["January","February","March","April","May","June","July","August","September","October","November","December"][o.getMonth()],M:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][o.getMonth()],l:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1ay","Saturday"][o.getDay()],D:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][o.getDay()],N:0===o.getDay()?"7":String(o.getDay())};return t.replace(/\\(.)|(.)/g,(e,t,o)=>void 0!==t?t:void 0!==n[o]?n[o]:o)}function _(){const e="yop_poll_voter_id";let t=localStorage.getItem(e);return t||(t="yop_"+Math.random().toString(36).substring(2)+Date.now().toString(36),localStorage.setItem(e,t)),t}function g(e){const t=window.yopPollFront?.captcha;return{recaptcha_v2_checkbox:t?.recaptchaV2?.siteKey,recaptcha_v2_invisible:t?.recaptchaV2Invisible?.siteKey,recaptcha_v3:t?.recaptchaV3?.siteKey,hcaptcha:t?.hcaptcha?.siteKey,turnstile:t?.turnstile?.siteKey}[e]||""}function f(e){return"function"==typeof function(e){switch(e){case"recaptcha_v2_checkbox":case"recaptcha_v2_invisible":return window.grecaptcha?.render;case"recaptcha_v3":return window.grecaptcha?.execute;case"hcaptcha":return window.hcaptcha?.render;case"turnstile":return window.turnstile?.render}}(e)}function x({breakEl:e,currentPage:o,onNext:n,onPrev:s}){const r=e?.meta_data||{},a=void 0!==r.next_label?r.next_label:(0,t.__)("Next","yop-poll"),i=void 0!==r.prev_label?r.prev_label:(0,t.__)("Previous","yop-poll"),p=o>0&&!1!==r.display_prev_btn,c=`yop-poll-page-nav yop-poll-page-nav--${r.btn_align||"center"}`,d={padding:`${r.btn_paddingTop??6}px ${r.btn_paddingRight??16}px ${r.btn_paddingBottom??6}px ${r.btn_paddingLeft??16}px`},u={padding:`${r.prev_btn_paddingTop??6}px ${r.prev_btn_paddingRight??16}px ${r.prev_btn_paddingBottom??6}px ${r.prev_btn_paddingLeft??16}px`};return(0,l.jsxs)("div",{className:c,children:[p&&(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button yop-poll-btn-prev",style:u,onClick:s,children:i}),(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button yop-poll-btn-next",style:d,onClick:n,children:a})]})}function b({poll:o,elements:s,templateBase:r,wrapperStyle:a,pollMeta:i,submitted:p,onBackToVote:c,messages:d,successMessage:y,forceResultsOnly:m}){const[_,g]=(0,e.useState)(!1),[f,x]=(0,e.useState)(null);(0,e.useEffect)(()=>{const e=requestAnimationFrame(()=>g(!0));return()=>cancelAnimationFrame(e)},[]);const b=parseInt(o.total_submits,10)||0,w=i?.options?.results||{},v=Array.isArray(w.resultsDetails)?w.resultsDetails:[w.resultsDetails||"percentages"],k=v.includes("votes-number")||v.includes("percentages-votes-number"),j=v.includes("percentages")||v.includes("percentages-votes-number"),S=w.sortResults||"as-defined",N=w.sortResultsRule||"ascending",$=w.displayResultsAs||"bar",A=Number.isFinite(parseInt(w.percentagesDecimals,10))?parseInt(w.percentagesDecimals,10):2,C="yes"===w.roundPercentage?0:A,I="yes"===w.backToVoteOption&&!m,L=w.backToVoteCaption||(0,t.__)("← Back to Vote","yop-poll"),R=["question-text"];return(0,l.jsxs)("div",{className:"yop-poll","data-template":r,style:a,children:[y&&(0,l.jsx)("div",{className:"yop-poll-message yop-poll-message--success",children:y}),s.map(e=>{if(!R.includes(e.etype)||!e.subelements?.length)return null;let t=[...e.subelements];const o=e.meta_data||{};if("as-defined"!==S){const e="ascending"===N;"alphabetical"===S?t.sort((t,o)=>e?(t.stext||"").localeCompare(o.stext||""):(o.stext||"").localeCompare(t.stext||"")):t.sort((t,o)=>e?(t.total_submits||0)-(o.total_submits||0):(o.total_submits||0)-(t.total_submits||0))}const s=parseInt(e.other_votes_count,10)||0,r=(e.subelements||[]).reduce((e,t)=>e+(parseInt(t.total_submits,10)||0),0)+s||b,a="yes"===o.allowOtherAnswers,i=a&&"yes"===o.displayOtherAnswersInResults&&Array.isArray(e.other_answers_list),p=i?e.other_answers_list:[],c=t.map(e=>parseInt(e.total_submits,10)||0),y=n(a?[...c,s]:c,r,C),m=y.slice(0,t.length),g=a?y[t.length]??0:0,f=`${s} ${1===s?u(d,"results","single-vote","vote"):u(d,"results","multiple-votes","votes")}`,x=o.answersAlign||"left",w="horizontal"===o.answersDisplay?"yop-poll-answers yop-poll-answers--horizontal":"columns"===o.answersDisplay?`yop-poll-answers yop-poll-answers--columns-${o.answersColumns||2}`:"",v="left"!==x?`${w?w+" ":"yop-poll-answers "}yop-poll-answers--align-${x}`.trim():w;return(0,l.jsxs)("div",{className:"yop-poll-element",children:[e.etext&&(0,l.jsx)("div",{className:"yop-poll-question",dangerouslySetInnerHTML:{__html:e.etext}}),(0,l.jsxs)("div",{className:v,children:[t.map((e,t)=>{const o=parseInt(e.total_submits,10)||0,n=m[t]??0,s=["#058dc7","#ed561b","#50b432","#990000","#2f7ed8","#f28f43"],r=e.meta_data?.resultsColor||s[t%s.length],a=h(r,.15),i=`${o} ${1===o?u(d,"results","single-vote","vote"):u(d,"results","multiple-votes","votes")}`;return(0,l.jsxs)("div",{className:"yop-poll-answer-row",style:{marginBottom:"8px"},children:[(0,l.jsxs)("div",{className:"yop-poll-result-text",children:[(0,l.jsx)("span",{style:{display:"flex",alignItems:"center",gap:"7px"},dangerouslySetInnerHTML:{__html:e.stext||""}}),(0,l.jsxs)("span",{children:[k&&j&&`${n}% (${i})`,k&&!j&&i,!k&&j&&`${n}%`]})]}),"bar"===$&&(0,l.jsx)("div",{className:"yop-poll-result-bar",style:a?{background:a}:{},children:(0,l.jsx)("div",{className:"yop-poll-result-fill",style:{width:`${_?n:0}%`,...r?{background:r}:{}}})})]},e.id)}),a&&s>0&&"pie"!==$&&(0,l.jsxs)("div",{className:"yop-poll-answer-row",style:{marginBottom:"8px"},children:[(0,l.jsxs)("div",{className:"yop-poll-result-text",children:[(0,l.jsx)("span",{style:{display:"flex",alignItems:"center",gap:"7px"},dangerouslySetInnerHTML:{__html:o.otherAnswersLabel||"Other"}}),(0,l.jsxs)("span",{children:[k&&j&&`${g}% (${f})`,k&&!j&&f,!k&&j&&`${g}%`]})]}),"bar"===$&&(0,l.jsx)("div",{className:"yop-poll-result-bar",style:{background:h(o.resultsColorForOtherAnswers||"#058dc7",.15)},children:(0,l.jsx)("div",{className:"yop-poll-result-fill",style:{width:`${_?g:0}%`,background:o.resultsColorForOtherAnswers||"#058dc7"}})}),i&&p.length>0&&(0,l.jsx)("div",{style:{marginTop:"4px",paddingLeft:"8px",borderLeft:"3px solid #eee"},children:p.map((e,t)=>(0,l.jsxs)("div",{style:{fontSize:"13px",color:"#555",padding:"2px 0"},children:[e.answer," (",parseInt(e.count,10)||0,")"]},`__other__${t}`))})]})]})]},e.id)}),I&&(0,l.jsx)("div",{className:"yop-poll-footer",children:(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button",onClick:c,children:L})})]})}function w({pollId:w,initialData:v=null}){const k=v?.tracking_id||"",j=function(e,t){if(!t)return"unknown";if(t.show_results)return"voted";const o=d(t.poll),n=Array.isArray(o.options?.results?.showResultsMoment)?o.options.results.showResultsMoment:["after-vote"];return n.includes("after-vote")||n.includes("always")||n.includes("before-vote")?t.already_voted?"voted":"unknown":"not-voted"}(0,v),[S,N]=(0,e.useState)(null),[$,A]=(0,e.useState)([]),[C,I]=(0,e.useState)({}),[L,R]=(0,e.useState)("F j, Y"),[T,M]=(0,e.useState)({}),[P,D]=(0,e.useState)({}),F=(0,e.useRef)({}),O=(0,e.useRef)({}),[E,B]=(0,e.useState)(0),[H,q]=(0,e.useState)(!1),[z,W]=(0,e.useState)(null),[U,V]=(0,e.useState)(null),[J,G]=(0,e.useState)(null),[Y,K]=(0,e.useState)(!1),[X,Q]=(0,e.useState)(!1),[Z,ee]=(0,e.useState)(!1),te=(0,e.useRef)(null),oe=(0,e.useRef)(null),ne=(0,e.useRef)(null),[se,le]=(0,e.useState)(!1),[re,ae]=(0,e.useState)(null),[ie,pe]=(0,e.useState)("voted"===j),[ce,de]=(0,e.useState)(!1),[ue,he]=(0,e.useState)(""),[ye,me]=(0,e.useState)(""),[_e,ge]=(0,e.useState)("unknown"===j),[fe,xe]=(0,e.useState)(!1),[be,we]=(0,e.useState)(v?.nonce||""),[ve,ke]=(0,e.useState)(v?.auth_nonce||""),[je,Se]=(0,e.useState)(!1),[Ne,$e]=(0,e.useState)(()=>!!window.yopPollFront?.wpUserLoggedIn),Ae=(0,e.useRef)(!1),Ce=(0,e.useRef)(null);function Ie(e){N(e.poll),A(e.elements||[]),I(e.messages||{}),R(e.date_format||"F j, Y"),we(e.nonce||""),ke(e.auth_nonce||"");const t=d(e.poll),n=Array.isArray(t.options?.results?.showResultsMoment)?t.options.results.showResultsMoment:["after-vote"];ae(e);let s=!!e.show_results;if(!s){if(n.includes("after-vote")&&e.already_voted&&(s=!0),!s&&n.includes("custom-date")){const e=t.options?.results?.customDateResults;e&&new Date(e)<=new Date&&(s=!0)}if(!s&&n.includes("after-poll-end-date")){const e=t.options?.poll?.endDateOption||"never",o=t.options?.poll?.endDateCustom||"";"custom"===e&&o&&new Date(o)<=new Date&&(s=!0)}if(!s&&n.includes("after-vote")){const e=t.options?.poll?.endDateOption||"never",o=t.options?.poll?.endDateCustom||"";"custom"===e&&o&&new Date(o)<=new Date&&(s=!0)}}s&&pe(!0);const l=t.style?.custom||{};if(l.css){const e=document.createElement("style");e.textContent=`@scope ([data-yop-poll-id="${w}"]) { ${l.css} }`,document.head.appendChild(e)}const a={},i={};for(const t of e.elements||[]){const e="yes"===(t.meta_data||{}).allowMultipleAnswers;
1for(const o of t.subelements||[])"1"===(o.meta_data||{}).makeDefault&&(e?a[t.id]=[...a[t.id]||[],String(o.id)]:a[t.id]||(a[t.id]=String(o.id)))}Object.keys(a).length&&M(a),Object.keys(i).length&&D(i);const p=d(e.poll);"built_in"===(p.options?.poll?.useCaptcha||"no")&&o({url:r(`captcha?poll_id=${w}`)}).then(W).catch(()=>{});const c=void 0!==e.already_voted,u=n.includes("after-vote")||n.includes("always")||n.includes("before-vote");(s||c||!u)&&ge(!1)}function Le(e,t){M(o=>({...o,[e]:t}))}function Re(e,t,o){M(n=>{const s=Array.isArray(n[e])?n[e]:[];return{...n,[e]:o?[...s,t]:s.filter(e=>e!==t)}})}function Te(e,t){D(o=>({...o,[e]:t}))}(0,e.useEffect)(()=>{const e=O.current;Object.entries(T).forEach(([t,o])=>{const n=Array.isArray(e[t])?e[t].includes("__other__"):"__other__"===e[t],s="other_"+t+"_0";(Array.isArray(o)?o.includes("__other__"):"__other__"===o)&&!n&&F.current[s]&&F.current[s].focus()}),O.current=T},[T]),(0,e.useEffect)(()=>{if(!re)return void de(!1);const e=d(S);if(!(Array.isArray(e?.options?.results?.showResultsMoment)?e.options.results.showResultsMoment:[]).includes("before-vote"))return;const t=requestAnimationFrame(()=>de(!0));return()=>cancelAnimationFrame(t)},[re]),(0,e.useEffect)(()=>{v?Ie(v):async function(){try{Ie(await o({url:i(Ne,w,`&tracking_id=${encodeURIComponent(k)}&voter_id=${encodeURIComponent(_())}`)}))}catch(e){he((0,t.__)("Failed to load poll.","yop-poll")),ge(!1)}}()},[w]),(0,e.useEffect)(()=>{if(!v)return;const e=localStorage.getItem(`yop_poll_voted_${w}`)||"",t=e?`&email=${encodeURIComponent(e)}`:"";o({url:i(Ne,w,`&tracking_id=${encodeURIComponent(k)}&voter_id=${encodeURIComponent(_())}${t}`)}).then(e=>{if(we(e.nonce||""),ke(e.auth_nonce||""),!v?.show_results){if(N(e.poll),A(e.elements||[]),I(e.messages||{}),ae(e),e.already_voted){const t=d(e.poll),o=Array.isArray(t.options?.results?.showResultsMoment)?t.options.results.showResultsMoment:["always"];(o.includes("after-vote")||o.includes("always")||o.includes("before-vote"))&&pe(!0)}ge(!1)}}).catch(()=>{ge(!1)})},[w]),(0,e.useEffect)(()=>{if(_e)return;Ce.current?.offsetHeight>0&&localStorage.setItem(`yop_poll_h_${w}`,Ce.current.offsetHeight);const e=Ce.current?.closest(".yop-poll-container");e&&(e.style.minHeight="")},[_e]);const Me=(0,e.useCallback)(()=>{V(null),o({url:r(`captcha?poll_id=${w}`)}).then(W).catch(()=>{})},[w]);(0,e.useEffect)(()=>{if(!S)return;const e=d(S).options?.poll?.useCaptcha||"no";if("no"===e||"built_in"===e)return;const t=g(e);
1if(!t)return;if(f(e))return void K(!0);const o=`yop-poll-captcha-${e}`;if(document.getElementById(o)){let t,o=0;const n=()=>{f(e)?K(!0):++o>150||(t=window.setTimeout(n,100))};return t=window.setTimeout(n,100),()=>window.clearTimeout(t)}const n=e.startsWith("recaptcha")?"yopPollRecaptchaLoaded":"hcaptcha"===e?"yopPollHCaptchaLoaded":"yopPollTurnstileLoaded";window[n]=()=>K(!0);const s=document.createElement("script");s.id=o,s.src=function(e,t){switch(e){case"recaptcha_v2_checkbox":case"recaptcha_v2_invisible":return"https://www.google.com/recaptcha/api.js?onload=yopPollRecaptchaLoaded&render=explicit";case"recaptcha_v3":return`https://www.google.com/recaptcha/api.js?onload=yopPollRecaptchaLoaded&render=${t}`;case"hcaptcha":return"https://js.hcaptcha.com/1/api.js?onload=yopPollHCaptchaLoaded&render=explicit";case"turnstile":return"https://challenges.cloudflare.com/turnstile/v0/api.js?onload=yopPollTurnstileLoaded"}}(e,t),s.async=!0,document.head.appendChild(s)},[S]),(0,e.useEffect)(()=>{if(!Y||!X)return;if(null!==oe.current)return;const e=d(S).options?.poll?.useCaptcha||"no";if("no"===e||"built_in"===e)return;const t=g(e),o=te.current;if(!o||!t)return;const n=e=>G(e),s=()=>G(null);switch(e){case"recaptcha_v2_checkbox":oe.current=window.grecaptcha.render(o,{sitekey:t,callback:n,"expired-callback":s});break;case"recaptcha_v2_invisible":oe.current=window.grecaptcha.render(o,{sitekey:t,size:"invisible",callback:n,"expired-callback":s});break;case"recaptcha_v3":oe.current=0;break;case"hcaptcha":oe.current=window.hcaptcha.render(o,{sitekey:t,callback:n,"expired-callback":s});break;case"turnstile":oe.current=window.turnstile.render(o,{sitekey:t,callback:n,"expired-callback":s})}},[Y,X]),(0,e.useEffect)(()=>{if(!Z||!J)return;const e=ne.current;ne.current=null,ee(!1),xe(!0),He(e,J)},[Z,J]);const Pe=[{elements:$,breakEl:null}],De=E>=Pe.length-1,Fe=Pe[E]||{elements:[],breakEl:null},Oe=E>0&&Pe[E-1]?.breakEl?.meta_data||{},Ee=E>0&&!1!==Oe.display_prev_btn;function Be(e){for(const t of e){const e=t.meta_data||{},o=t.etype;if("question-text"===o){if("yes"!==(e.makeRequired??"yes")&&!0!==e.makeRequired)continue;const o=T[t.id],n=o?Array.isArray(o)?o:[o]:[],s=n.includes("__other__"),l=n.filter(e=>"__other__"!==e).length+(s?1:0);if(0===l)return u(C,"voting","no-answers-selected","Please select an answer.");if("yes"===e.allowMultipleAnswers){const t=parseInt(e.multipleAnswersMinim,10);if(t>0&&l<t)return y(u(C,"voting","min-answers-required","Please select at least {min_answers_allowed} answer(s)."),{min_answers_allowed:t});const o=parseInt(e.multipleAnswersMaxim,10);if(o>0&&l>o)return y(u(C,"voting","max-answers-required","Please select at most {max_answers_allowed} answer(s)."),{max_answers_allowed:o})}if(s){const o="number"==typeof e.otherAnswersCount?e.otherAnswersCount:1,n=Array.from({length:o}).map((e,o)=>(P["other_"+t.id+"_"+o]||"").trim());if(n.every(e=>""===e))return u(C,"voting","no-answer-for-other",'Please enter a value for the "Other" field.');const s=parseInt(e.otherMaxCharsAllowed,10);if(s>0&&n.some(e=>e.length>s))return u(C,"voting","answer-for-other-too-long",'Your "Other" answer is too long.')}}if("standard-single-line-text"===o){const o=(P[t.id]||"").trim(),n=t.etext?t.etext.replace(/<[^>]*>/g,""):"";if(("yes"===e.makeRequired||!0===e.makeRequired)&&""===o)return y(u(C,"voting","no-value-for-custom-field","{custom_field_name} is required."),{custom_field_name:n});const s=parseInt(e.maxCharsAllowed,10);if(s>0&&o.length>s)return y(u(C,"voting","too-many-chars-for-custom-field","Text for {custom_field_name} is too long."),{custom_field_name:n})}}return null}async function He(e,n,s=null,l=null,i=null){const c=l??ve,h=!!c;try{const l=(await o({url:h?a("yop_poll_vote"):r("votes"),method:"POST",data:{...h?{auth_nonce:c}:{},poll_id:w,page_id:v?.page_id??0,answers:e,tracking_id:k,voter_id:_(),nonce:s??be,...z?{captcha_token:z.token}:{},...U?{captcha_value:U}:{},...n?{captcha_response:n}:{},...i?{selected_perm:i}:{}}})).poll_data;ae(l),we(l?.nonce||""),ke(l?.auth_nonce||""),le(!0),l?.poll&&N(e=>({...e,total_submits:l.poll.total_submits,total_submited_answers:l.poll.total_submited_answers})),l?.elements&&A(l.elements);const y=d(S),m=y.options?.poll||{},g=Array.isArray(y.options?.results?.showResultsMoment)?y.options.results.showResultsMoment:["always"];(g.includes("after-vote")||g.includes("always")||g.includes("before-vote"))&&pe(!0),me(u(C,"voting","thank-you",(0,t.__)("Thank y
1ou for voting!","yop-poll")));const f="yes"===m.redirectAfterVote?p(m.redirectUrl):null;if(f){const e=parseInt(m.redirectAfter,10)||0;setTimeout(()=>{window.location.href=f},1e3*e)}}catch(e){if("yop_poll_limit_reached"===e?.code)he(u(C,"voting","not-allowed-by-limit",e.message));else if("yop_poll_block_reached"===e?.code)he(u(C,"voting","not-allowed-by-block",e.message));else if("yop_poll_ban_reached"===e?.code)he(u(C,"voting","not-allowed-by-ban",e.message));else{const o=e?.message||(0,t.__)("Failed to submit vote.","yop-poll");he(o),z&&Me(),function(e){G(null);const t=oe.current;null!==t&&0!==t&&(["recaptcha_v2_checkbox","recaptcha_v2_invisible"].includes(e)?window.grecaptcha?.reset(t):"hcaptcha"===e?window.hcaptcha?.reset(t):"turnstile"===e&&window.turnstile?.reset(te.current))}(d(S).options?.poll?.useCaptcha||"no")}}xe(!1)}async function qe({skipOverlay:e=!1,nonceOverride:o=null,authNonceOverride:n=null,selectedPerm:s=null}={}){if(he(""),it)return;if(dt)return;const l=Be(Fe.elements);if(l)return void he(l);const r=d(S),a=r.options?.poll?.useCaptcha||"no";if(["recaptcha_v2_checkbox","hcaptcha","turnstile"].includes(a)&&!J)return void he(u(C,"voting","no-captcha-selected",(0,t.__)("Please complete the captcha.","yop-poll")));if("yes"===(r.options?.poll?.enableGdpr||"no")&&["ask_consent","consent"].includes(r.options?.poll?.gdprSolution||"ask_consent")&&!H)return void he(u(C,"voting","consent-not-checked","Please accept the terms and conditions."));if(Ye&&!e)return void Se(!0);if(!e&&!Ye&&"wordpress"===Ge[0]&&!Ne){if(Ae.current)return;Ae.current=!0;const e=window.yopPollFront?.wpLoginUrl||"",o=`${window.yopPollFront?.adminAjaxUrl||""}?action=yop_poll_wp_login_redirect&poll_id=${w}`;try{const{nonce:t,authNonce:n}=await c(e,o,w);ke(n),$e(!0),we(t),await qe({skipOverlay:!0,nonceOverride:t,authNonceOverride:n})}catch(e){he(e.message||(0,t.__)("WordPress login failed.","yop-poll"))}finally{Ae.current=!1}return}xe(!0);const i=[];Object.entries(T).forEach(([e,t])=>{(Array.isArray(t)?t:[t]).forEach(t=>{if("__other__"===t){const t=parseInt(e,10),o=$.find(e=>e.id===t),n=o&&o.meta_data||{},s="number"==typeof n.otherAnswersCount?n.otherAnswersCount:1;Array.from({length:s}).forEach((o,n)=>{const s=(P["other_"+e+"_"+n]||"").trim();s&&i.push({element_id:t,answer_id:0,answer_value:s})})}else i.push({element_id:parseInt(e,10),answer_id:parseInt(t,10),answer_value:""})})}),Object.entries(P).forEach(([e,t])=>{e.startsWith("other_")||i.push({element_id:parseInt(e,10),answer_id:0,answer_value:String(t)})});const p=d(S).options?.poll?.useCaptcha||"no";if("recaptcha_v3"===p){const e=g(p);return window.grecaptcha&&e?void window.grecaptcha.ready(async()=>{const t=await window.grecaptcha.execute(e,{action:"vote"});await He(i,t,o,n,s)}):(he((0,t.__)("Captcha not configured.","yop-poll")),void xe(!1))}if("recaptcha_v2_invisible"===p&&!J)return window.grecaptcha?(ne.current=i,ee(!0),window.grecaptcha.execute(oe.current),void xe(!1)):(he((0,t.__)("Captcha not configured.","yop-poll")),void xe(!1));await He(i,"built_in"!==p&&"no"!==p?J:null,o,n,s)}function ze(e,o,r=null){const a="yes"===o.allowMultipleAnswers,i="material"===S.template_base,c="bootstrap"===S.template_base;e.etype;let y=[...e.subelements||[]];const m=o.answersAlign||"left",_="horizontal"===o.answersDisplay?"yop-poll-answers yop-poll-answers--horizontal":"columns"===o.answersDisplay?`yop-poll-answers yop-poll-answers--columns-${o.answersColumns||2}`:"yop-poll-answers",g="left"!==m?`${_} yop-poll-answers--align-${m}`:_,f=d(S),x=f.style?.answers?.colorScheme||"#f44336",b=d(S),v=b?.options?.results||{},k=(Array.isArray(v.showResultsMoment)?v.showResultsMoment:[]).includes("before-vote")&&!!re,j=v.displayResultsAs||"bar",N=parseInt(re?.poll?.total_submits,10)||0,$=(e.subelements||[]).reduce((e,t)=>e+(parseInt(t.total_submits,10)||0),0)||N,A=Number.isFinite(parseInt(v.percentagesDecimals,10))?parseInt(v.percentagesDecimals,10):2,I="yes"===v.roundPercentage?0:A,L=Array.isArray(v.resultsDetails)?v.resultsDetails:[v.resultsDetails||"percentages"],R=L.includes("votes-number")||L.includes("percentages-votes-number"),M=L.includes("percentages")||L.includes("percentages-votes-number"),D=["#058dc7","#ed561b","#50b432","#990000","#2f7ed8","#f28f43"],O=n(y.map(e=>parseInt(e.total_submits,10)||0),$,I);function E(e,t){if(!k||"bar"!==j)return null;const o=parseInt(e.total_submits,10)||0,n=O[t]??0,s=1===o?u(C,"results","single-vote","vote"):u(C,"results","multiple-votes","votes"),r=R&&M?`${n}% (${o} ${s})`:R?`${o} ${s}`:`${n}%`;return(0,l.jsx)("span",{className:"yop-poll-inline-detail",children:r})}function B(e,t){if(!k||"bar"!==j)return null;const o=O[t]??0,n=e.meta_data?.resultsColor||D[t%D.length],s=h(n,.15);return(0,l.jsx)("div",{className:"yop-poll-inline-result",children:(0,l.jsx)("div",{className:"yop-poll-result-bar",style:{background:s},children:(0,l.jsx)("div",{className:"yop-poll-result-fill",style:{width:`${ce?o:0}%`,background:n}})})})}return(0,l.jsxs)("div",{className:g,role:"group","aria-labelledby":r||void 0,children:[y.map((t,o)=>{const n=String(t.id);if(c){const r=t.meta_data||{},i=a?Array.isArray(T[e.id])&&T[e.id].includes(n):T[e.id]===n;return(0,l.jsxs)("div",{className:"yop-poll-answer-row",children:[(0,l.jsxs)("label",{className:"yop-poll-answer",children:[(0,l.jsx)("input",{type:a?"checkbox":"radio",className:"yop-poll-bootstrap-input",n
1ame:`yop-poll-${w}-${e.id}`,value:n,checked:i,onChange:t=>a?Re(e.id,n,t.target.checked):Le(e.id,n)}),(0,l.jsx)("span",{className:"yop-poll-bootstrap-outer",children:(0,l.jsx)("svg",{className:"yop-poll-bootstrap-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:s(x),strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,l.jsx)("span",{className:"yop-poll-answer-text",children:"1"===r.makeLink&&p(r.link)?(0,l.jsx)("a",{href:p(r.link),target:"_blank",rel:"noopener noreferrer",dangerouslySetInnerHTML:{__html:t.stext||""}}):(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:t.stext||""}})}),E(t,o)]}),B(t,o)]},t.id)}if(i&&a){const s=t.meta_data||{},r=!!Array.isArray(T[e.id])&&T[e.id].includes(n);return(0,l.jsxs)("div",{className:"yop-poll-answer-row",children:[(0,l.jsxs)("label",{className:"yop-poll-answer",children:[(0,l.jsx)("input",{type:"checkbox",className:"yop-poll-checkbox-input",name:`yop-poll-${w}-${e.id}`,value:n,checked:r,onChange:t=>Re(e.id,n,t.target.checked)}),(0,l.jsx)("span",{className:"yop-poll-checkbox-outer",children:(0,l.jsx)("svg",{className:"yop-poll-checkbox-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:"#fff",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,l.jsx)("span",{className:"yop-poll-answer-text",children:"1"===s.makeLink&&p(s.link)?(0,l.jsx)("a",{href:p(s.link),target:"_blank",rel:"noopener noreferrer",dangerouslySetInnerHTML:{__html:t.stext||""}}):(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:t.stext||""}})}),E(t,o)]}),B(t,o)]},t.id)}if(i){const s=t.meta_data||{};return(0,l.jsxs)("div",{className:"yop-poll-answer-row",children:[(0,l.jsxs)("label",{className:"yop-poll-answer",children:[(0,l.jsx)("input",{type:"radio",className:"yop-poll-radio-input",name:`yop-poll-${w}-${e.id}`,value:n,checked:T[e.id]===n,onChange:()=>Le(e.id,n)}),(0,l.jsx)("span",{className:"yop-poll-radio-outer",children:(0,l.jsx)("span",{className:"yop-poll-radio-inner"})}),(0,l.jsx)("span",{className:"yop-poll-answer-text",children:"1"===s.makeLink&&p(s.link)?(0,l.jsx)("a",{href:p(s.link),target:"_blank",rel:"noopener noreferrer",dangerouslySetInnerHTML:{__html:t.stext||""}}):(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:t.stext||""}})}),E(t,o)]}),B(t,o)]},t.id)}const r=t.meta_data||{};return(0,l.jsxs)("div",{className:"yop-poll-answer-row",children:[(0,l.jsxs)("label",{className:"yop-poll-answer",children:[(0,l.jsx)("input",{type:a?"checkbox":"radio",name:`yop-poll-${w}-${e.id}`,value:n,checked:a?Array.isArray(T[e.id])&&T[e.id].includes(n):T[e.id]===n,onChange:t=>a?Re(e.id,n,t.target.checked):Le(e.id,n)}),(0,l.jsx)("span",{className:"yop-poll-answer-text",children:"1"===r.makeLink&&p(r.link)?(0,l.jsx)("a",{href:p(r.link),target:"_blank",rel:"noopener noreferrer",dangerouslySetInnerHTML:{__html:t.stext||""}}):(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:t.stext||""}})}),E(t,o)]}),B(t,o)]},t.id)}),"yes"===o.allowOtherAnswers&&(0,l.jsxs)("label",{className:"yop-poll-answer yop-poll-other-answer",children:[c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:a?"checkbox":"radio",className:"yop-poll-bootstrap-input",name:`yop-poll-${w}-${e.id}`,value:"__other__",checked:a?Array.isArray(T[e.id])&&T[e.id].includes("__other__"):"__other__"===T[e.id],onChange:t=>a?Re(e.id,"__other__",t.target.checked):Le(e.id,"__other__")}),(0,l.jsx)("span",{className:"yop-poll-bootstrap-outer",children:(0,l.jsx)("svg",{className:"yop-poll-bootstrap-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:s(x),strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):i&&a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"checkbox",className:"yop-poll-checkbox-input",name:`yop-poll-${w}-${e.id}`,value:"__other__",checked:Array.isArray(T[e.id])&&T[e.id].includes("__other__"),onChange:t=>Re(e.id,"__other__",t.target.checked)}),(0,l.jsx)("span",{className:"yop-poll-checkbox-outer",children:(0,l.jsx)("svg",{className:"yop-poll-checkbox-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:"#fff",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"radio",className:"yop-poll-radio-input",n
1ame:`yop-poll-${w}-${e.id}`,value:"__other__",checked:"__other__"===T[e.id],onChange:()=>Le(e.id,"__other__")}),(0,l.jsx)("span",{className:"yop-poll-radio-outer",children:(0,l.jsx)("span",{className:"yop-poll-radio-inner"})})]}):(0,l.jsx)("input",{type:a?"checkbox":"radio",name:`yop-poll-${w}-${e.id}`,value:"__other__",checked:a?Array.isArray(T[e.id])&&T[e.id].includes("__other__"):"__other__"===T[e.id],onChange:t=>a?Re(e.id,"__other__",t.target.checked):Le(e.id,"__other__")}),(0,l.jsxs)("div",{className:"yop-poll-other-wrap",children:[(0,l.jsx)("span",{className:"yop-poll-other-label",dangerouslySetInnerHTML:{__html:o.otherAnswersLabel||(0,t.__)("Other","yop-poll")}}),("no"!==o.otherFieldAlwaysVisible||(Array.isArray(T[e.id])?T[e.id].includes("__other__"):"__other__"===T[e.id]))&&(()=>{const t="number"==typeof o.otherAnswersCount?o.otherAnswersCount:1;return Array.from({length:t}).map((t,n)=>{const s="other_"+e.id+"_"+n,r="multi-line"===o.otherFieldType?(0,l.jsx)("textarea",{ref:e=>{F.current[s]=e},className:`yop-poll-textarea yop-poll-text-input--${o.otherFieldSize||"small"} yop-poll-other-input`,maxLength:parseInt(o.otherMaxCharsAllowed,10)>0?parseInt(o.otherMaxCharsAllowed,10):void 0,value:P[s]||"",onChange:e=>Te(s,e.target.value),onClick:e=>e.stopPropagation(),onFocus:()=>{a?(Array.isArray(T[e.id])?T[e.id]:[]).includes("__other__")||Re(e.id,"__other__",!0):Le(e.id,"__other__")}}):(0,l.jsx)("input",{ref:e=>{F.current[s]=e},type:"text",className:`yop-poll-text-input yop-poll-text-input--${o.otherFieldSize||"small"} yop-poll-other-input`,maxLength:parseInt(o.otherMaxCharsAllowed,10)>0?parseInt(o.otherMaxCharsAllowed,10):void 0,value:P[s]||"",onChange:e=>Te(s,e.target.value),onClick:e=>e.stopPropagation(),onFocus:()=>{a?(Array.isArray(T[e.id])?T[e.id]:[]).includes("__other__")||Re(e.id,"__other__",!0):Le(e.id,"__other__")}});return(0,l.jsx)("div",{className:"yop-poll-other-field",children:r},n)})})()]})]})]})}if(_e)return(0,l.jsx)("div",{className:"yop-poll-loading",children:(0,t.__)("Loading poll…","yop-poll")});if(!S)return(0,l.jsx)("div",{className:"yop-poll-error",children:ue||(0,t.__)("Poll could not be loaded.","yop-poll")});const We=d(S),Ue=We?.style?.buttons?.align||"center",Ve="bottom"===We?.options?.poll?.notificationMessageLocation?"bottom":"top",Je=We?.options?.access?.votePermissions,Ge=Array.isArray(Je)?Je:["guest"],Ye=Ge.length>1,Ke=We?.options?.poll?.voteButtonLabel||"",Xe={guest:"anonymous",wordpress:"wordpress",facebook:"facebook",google:"google"},Qe={guest:"Vote Now",wordpress:"Sign in with WordPress",facebook:"Sign in with Facebook",google:"Sign in with Google",email:"Vote Now"},Ze=We?.style?.poll||{},et=We?.style?.questions||{},tt=We?.style?.answers?.colorScheme||"#f44336",ot=We?.style?.errors||{},nt=We?.style?.answers||{},st=We?.style?.buttons||{},lt={...void 0!==Ze.backgroundColor&&{backgroundColor:Ze.backgroundColor},...Ze.backgroundImageUrl&&{backgroundImage:`url(${JSON.stringify(Ze.backgroundImageUrl)})`,backgroundSize:Ze.backgroundSize||"cover",backgroundPosition:Ze.backgroundPosition||"center center",backgroundRepeat:Ze.backgroundRepeat||"no-repeat"},borderWidth:(Ze.borderSize??0)+"px",borderStyle:Ze.borderStyle??"none",borderColor:Ze.borderColor??"#ffffff",borderRadius:(Ze.borderRadius??0)+"px",...void 0!==Ze.paddingTopBottom&&{paddingTop:Ze.paddingTopBottom+"px",paddingBottom:Ze.paddingTopBottom+"px"},...void 0!==Ze.paddingLeftRight&&{paddingLeft:Ze.paddingLeftRight+"px",paddingRight:Ze.paddingLeftRight+"px"},..."material"===S.template_base||"bootstrap"===S.template_base?{"--yop-radio-color":tt}:{},"--yop-ans-ts":(nt.textSize??14)+"px","--yop-ans-tw":nt.textWeight??"normal",...nt.textColor?{"--yop-ans-tc":nt.textColor}:{},...void 0!==nt.paddingTopBottom&&{"--yop-ans-pt":`${nt.paddingTopBottom}px`,"--yop-ans-pb":`${nt.paddingTopBottom}px`},...void 0!==nt.paddingLeftRight&&{"--yop-ans-pl":`${nt.paddingLeftRight}px`,"--yop-ans-pr":`${nt.paddingLeftRight}px`},"--yop-msg-bcs":ot.borderLeftColorForSuccess??"#008000","--yop-msg-bce":ot.borderLeftColorForError??"#ff0000","--yop-msg-blw":(ot.borderLeftSize??10)+"px","--yop-msg-pt":(ot.paddingTopBottom??0)+"px","--yop-msg-pb":(ot.paddingTopBottom??0)+"px","--yop-msg-tc":ot.textColor??"#000000","--yop-msg-ts":(ot.textSize??14)+"px","--yop-msg-tw":ot.textWeight??"normal",...void 0!==st.backgroundColor&&{"--yop-btn-bg":st.backgroundColor},...void 0!==st.textColor&&{"--yop-btn-tc":st.textColor},...void 0!==st.borderSize&&{"--yop-btn-bw":`${st.borderSize}px`},...void 0!==st.borderStyle&&{"--yop-btn-bs":st.borderStyle},...void 0!==st.borderColor&&{"--yop-btn-bc":st.borderColor},...void 0!==st.borderRadius&&{"--yop-btn-br":`${st.borderRadius}px`},...void 0!==st.paddingTopBottom&&{"--yop-btn-pt":`${st.paddingTopBottom}px`,"--yop-btn-pb":`${st.paddingTopBottom}px`},...void 0!==st.paddingLeftRight&&{"--yop-btn-pl":`${st.paddingLeftRight}px`,"--yop-btn-pr":`${st.paddingLeftRight}px`},...void 0!==st.textSize&&{"--yop-btn-ts":`${st.textSize}px`}
1,...void 0!==st.textWeight&&{"--yop-btn-tw":st.textWeight},...void 0!==et.paddingTopBottom&&{"--yop-el-pt":`${et.paddingTopBottom}px`,"--yop-el-pb":`${et.paddingTopBottom}px`},...void 0!==et.paddingLeftRight&&{"--yop-el-pl":`${et.paddingLeftRight}px`,"--yop-el-pr":`${et.paddingLeftRight}px`},...void 0!==et.textAlign&&{"--yop-el-ta":et.textAlign},...void 0!==et.textColor&&{"--yop-q-tc":et.textColor},...void 0!==et.textSize&&{"--yop-q-ts":`${et.textSize}px`},...void 0!==et.textWeight&&{"--yop-q-tw":et.textWeight},...void 0!==et.labelGap&&{"--yop-q-gap":`${et.labelGap}px`}},rt=We?.options?.poll?.startDateOption||"now",at=We?.options?.poll?.startDateCustom||"",it="custom"===rt&&!!at&&new Date(at)>new Date,pt=We?.options?.poll?.endDateOption||"never",ct=We?.options?.poll?.endDateCustom||"",dt="custom"===pt&&!!ct&&new Date(ct)<new Date;if(ie&&re)return(0,l.jsx)(b,{poll:re.poll,elements:re.elements,templateBase:S.template_base,wrapperStyle:lt,pollMeta:We,submitted:se,onBackToVote:()=>{pe(!1),B(0),me("")},messages:C,successMessage:se?ye:"",forceResultsOnly:!!v?.show_results});const ut=ue?(0,l.jsx)("div",{className:"yop-poll-message yop-poll-message--error",children:ue}):null,ht=ye?(0,l.jsx)("div",{className:"yop-poll-message yop-poll-message--success",children:ye}):null,yt=it?(0,l.jsx)("div",{className:"yop-poll-message yop-poll-message--error",children:u(C,"voting","poll-not-started",(0,t.__)("This poll has not started yet.","yop-poll")).replace(/%START-DATE%/g,m(at,L))}):null,mt=dt?(0,l.jsx)("div",{className:"yop-poll-message yop-poll-message--error",children:u(C,"voting","poll-ended",(0,t.__)("This poll is no longer accepting votes.","yop-poll")).replace(/%END-DATE%/g,m(ct,L))}):null;return(0,l.jsxs)("div",{ref:Ce,className:"yop-poll","data-template":S.template_base,style:lt,children:["top"===Ve&&(yt||mt||ut||ht),Fe.elements.map(e=>function(e){const t=e.meta_data||{},o=e.etype;if(["question-text"].includes(o)){const n=`yop-poll-${w}-${e.id}-label`;return(0,l.jsxs)("div",{className:"yop-poll-element","data-element-type":o,children:[e.etext&&(0,l.jsx)("div",{id:n,className:"yop-poll-question",dangerouslySetInnerHTML:{__html:e.etext}}),ze(e,t,e.etext?n:null)]},e.id)}if("standard-single-line-text"===o){const n=`yop-poll-${w}-${e.id}-label`,s=e.etext?e.etext.replace(/<[^>]+>/g,"").trim():"";return(0,l.jsxs)("div",{className:"yop-poll-element","data-element-type":o,children:[e.etext&&(0,l.jsx)("div",{id:n,className:"yop-poll-question",dangerouslySetInnerHTML:{__html:e.etext}}),(0,l.jsx)("input",{type:"text",className:`yop-poll-text-input yop-poll-text-input--${t.size||"small"} yop-poll-text-input--${t.align||"left"}`,maxLength:parseInt(t.maxCharsAllowed,10)>0?parseInt(t.maxCharsAllowed,10):void 0,value:P[e.id]||"",onChange:t=>Te(e.id,t.target.value),"aria-labelledby":e.etext?n:void 0,"aria-label":!e.etext&&s?s:void 0})]},e.id)}return null}(e)),De&&(()=>{const e=d(S);if("yes"!==(e.options?.poll?.enableGdpr||"no"))return null;const t=e.options?.poll?.gdprSolution||"ask_consent";if("ask_consent"!==t&&"consent"!==t)return null;const o=(e.options?.poll?.gdprConsentText||"").replace(/^\s*<p[^>]*>/i,"").replace(/<\/p>\s*$/i,""),n="material"===S.template_base,r="bootstrap"===S.template_base;if(n)return(0,l.jsx)("div",{className:"yop-poll-element yop-poll-gdpr",children:(0,l.jsxs)("label",{className:"yop-poll-gdpr__label",children:[(0,l.jsx)("input",{type:"checkbox",className:"yop-poll-checkbox-input",checked:H,onChange:e=>q(e.target.checked)}),(0,l.jsx)("span",{className:"yop-poll-checkbox-outer",children:(0,l.jsx)("svg",{className:"yop-poll-checkbox-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:"#fff",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:o}})]})},"poll-gdpr");if(r){const e=d(S).style?.answers?.colorScheme||"#0d6efd";return(0,l.jsx)("div",{className:"yop-poll-element yop-poll-gdpr",children:(0,l.jsxs)("label",{className:"yop-poll-gdpr__label",children:[(0,l.jsx)("input",{type:"checkbox",className:"yop-poll-bootstrap-input",checked:H,onChange:e=>q(e.target.checked)}),(0,l.jsx)("span",{className:"yop-poll-bootstrap-outer",children:(0,l.jsx)("svg",{className:"yop-poll-bootstrap-check",viewBox:"0 0 12 12",fill:"none",children:(0,l.jsx)("polyline",{points:"1.5,6 5,9.5 10.5,2.5",stroke:s(e),strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:o}})]})},"poll-gdpr")}return(0,l.jsxs)("div",{className:"yop-poll-element yop-poll-gdpr",children:[(0,l.jsx)("input",{type:"checkbox",id:`yop-gdpr-${w}`,checked:H,onChange:e=>q(e.target.checked),style:{margin:0,flexShrink:0}}),(0,l.jsx)("label",{htmlFor:`yop-gdpr-${w}`,dangerouslySetInnerHTML:{__html:o},style:{cursor:"pointer"}})]},"poll-gdpr")})(),De&&(()=>{const e=d(S),o=e.options?.poll?.useCaptcha||"no";return"no"===o?null:"built_in"!==o?g(o)?"recaptcha_v3"===o?null:(0,l.jsx)("div",{className:"yop-poll-element yop-poll-captcha",children:(0,l.jsx)("div",{ref:e=>{te.current=e,e&&!X&&Q(!0)},className:"yop-poll-captcha__external-container"})},"poll-captcha"):(0,l.jsx)("div",{className:"yop-poll-element",children:(0,l.jsx)("div",{className:"yop-poll-captcha__not-configured",children:(0,t.__)("Captcha not configured.","yop-poll")})},"poll-captcha"):z?(0,l.jsxs)("div",{className:"yop-poll-element yop-poll-captcha",children:[(0,l.jsx)("div",{className:"yop-poll-captcha__question",dangerouslySetInnerHTML:{__html:z.question}}),(0,l.jsxs)("div",{className:"yop-poll-captcha__images",children:[z.images.map(e=>(0,l.jsx)("button",{type:"button",className:"yop-poll-captcha__image-btn"+(U===e.value?" is-selected":""),onClick:()=>V(e.value),children:(0,l.jsx)("img",{src:e.src,alt:""})},e.value)),(0,l.jsx)("button",{type:"button",className:"yop-poll-captcha__refresh",onClick:Me,children:"↻"})]})]},"poll-captcha"):null})(),De&&(()=>{const e=d(S),t=e.options?.poll||{},o="yes"===t.showTotalVotes,n="yes"===t.showTotalAnswers;if(!o&&!n)return null;const s=parseInt(S.total_submits,10)||0,r=parseInt(S.total_submited_answers,10)||0,a=1===s?u(C,"results","single-vote","vote"):u(C,"results","multiple-votes","votes"),i=1===r?u(C,"results","single-answer","answer"):u(C,"results","multiple-answers","answers"),p=[];return o&&p.push(`${s} ${a}`),n&&p.push(`${r} ${i}`),(0,l.jsx)("div",{className:"yop-poll-element yop-poll-total-votes",style:{fontSize:"13px",color:"#555",textAlign:"center"},children:p.join(" · ")},"poll-total-votes")})(),"top"!==Ve&&(yt||mt||ut||ht),De?(0,l.jsxs)("div",{className:`yop-poll-footer yop-poll-footer--${Ue}`,children:[Ee&&(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button yop-poll-btn-prev",style:{padding:`${Oe.prev_btn_paddingTop??6}px ${Oe.prev_btn_paddingRight??16}px ${Oe.prev_btn_paddingBottom??6}px ${Oe.prev_btn_paddingLeft??16}px`},onClick:()=>B(e=>e-1),children:Oe.prev_label||(0,t.__)("Previous","yop-poll")}),(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button",onClick:qe,disabled:fe||it||dt,children:fe?u(C,"buttons","submitting",(0,t.__)("Submitting…","yop-poll")):Ke||u(C,"buttons","anonymous","Vote Now")}
1),"yes"===We?.options?.poll?.showResultsLink&&re&&(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button",onClick:()=>pe(!0),children:We?.options?.poll?.resultsLabelText||(0,t.__)("Results","yop-poll")})]}):(0,l.jsx)(x,{breakEl:Fe.breakEl,currentPage:E,onNext:function(){const e=Be(Fe.elements);e?he(e):(he(""),B(e=>e+1))},onPrev:()=>B(e=>e-1)}),je&&(0,l.jsx)("div",{className:"yop-poll-perm-overlay",onClick:e=>{e.target===e.currentTarget&&Se(!1)},children:(0,l.jsx)("div",{className:"yop-poll-perm-overlay__inner",children:Ge.map(e=>(0,l.jsx)("button",{type:"button",className:"yop-poll-vote-button",onClick:async()=>{if("guest"===e)Se(!1),qe({skipOverlay:!0,selectedPerm:"guest"});else if("wordpress"===e)if(Ne)Se(!1),qe({skipOverlay:!0,selectedPerm:"wordpress"});else{if(Ae.current)return;Ae.current=!0;const e=window.yopPollFront?.wpLoginUrl||"",o=`${window.yopPollFront?.adminAjaxUrl||""}?action=yop_poll_wp_login_redirect&poll_id=${w}`;try{const{nonce:t,authNonce:n}=await c(e,o,w);ke(n),$e(!0),we(t),Se(!1),qe({skipOverlay:!0,nonceOverride:t,authNonceOverride:n,selectedPerm:"wordpress"})}catch(e){he(e.message||(0,t.__)("WordPress login failed.","yop-poll"))}finally{Ae.current=!1}}},disabled:fe,children:u(C,"buttons",Xe[e],Qe[e]||"Vote Now")},e))})})]})}class v extends e.Component{constructor(e){super(e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error("YOP Poll: failed to render poll.",e)}render(){return this.state.failed?(0,l.jsx)("div",{className:"yop-poll-error",children:(0,t.__)("Failed to load poll.","yop-poll")}):this.props.children}}function k(t=document){t.querySelectorAll("[data-yop-poll-id]").forEach(t=>{if("true"===t.dataset.yopPollMounted)return;const o=parseInt(t.dataset.yopPollId,10);if(!o)return;t.dataset.yopPollMounted="true";let n=null;const s=t.querySelector("[data-yop-poll-init]");if(s)try{n=JSON.parse(s.textContent)}catch(e){}const r=window.localStorage.getItem(`yop_poll_h_${o}`);r&&(t.style.minHeight=r+"px"),(0,e.createRoot)(t).render((0,l.jsx)(v,{children:(0,l.jsx)(w,{pollId:o,initialData:n})}))})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>k()):k();let j=!1;const S=()=>{!j&&window.elementorFrontend?.hooks&&(j=!0,window.elementorFrontend.hooks.addAction("frontend/element_ready/yop_poll.default",e=>k(e[0])))};S(),window.addEventListener("elementor/frontend/init",S)})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.