/*! * * PRC Parent Theme * * @author Seth Rubenstein * @version 0.1.0 * @link https://github.com/wpcomvip/pewresearch-org * @license GPL * * Copyright (c) 2023 Seth Rubenstein * * This software is released under the UNLICENSED License * https://opensource.org/licenses/UNLICENSED * * Compiled with the help of https://wpack.io * A zero setup Webpack Bundler Script for WordPress */ (window.wpackioprcParentthemeJsonp=window.wpackioprcParentthemeJsonp||[]).push([[7],{160:function(e,t,n){n(27),e.exports=n(161)},161:function(e,t,n){"use strict";n.r(t);var o=n(35),r=n(17),c=n.n(r),i=n(50),a=n.n(i);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t(document.querySelectorAll(".wp-block-social-link.wp-social-link-facebook, .share-tools .social-link.facebook").forEach((t=>{const{url:e}=a(t);let o=null;o=t.parentElement.classList.contains("share-tools")?t:t.querySelector("a"),o&&o.addEventListener("click",(t=>{t.preventDefault();const o=(0,r.addQueryArgs)("https://www.facebook.com/sharer/sharer.php",{u:e});i(o,"fbShareWindow",`height=450, width=550, top=${l/2-275}, left=${n/2-225}, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0`),t.stopPropagation()}))})),document.querySelectorAll(".wp-block-social-link.wp-social-link-linkedin, .share-tools .social-link.linkedin").forEach((t=>{const{url:e,title:o,description:c}=a(t);let s=null;s=t.parentElement.classList.contains("share-tools")?t:t.querySelector("a"),s&&s.addEventListener("click",(t=>{t.preventDefault();const a=(0,r.addQueryArgs)("https://www.linkedin.com/shareArticle",{summary:c,url:e,title:o,source:"PewResearch"});i(a,"linkedinShareWindow",`height=450, width=550, top=${l/2-275}, left=${n/2-225}, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0`),t.stopPropagation()}))})),void document.querySelectorAll(".wp-block-social-link.wp-social-link-twitter, .share-tools .social-link.twitter").forEach((t=>{const{url:e,description:o}=a(t);let c=null;c=t.parentElement.classList.contains("share-tools")?t:t.querySelector("a"),c&&c.addEventListener("click",(t=>{t.preventDefault();const a=(0,r.addQueryArgs)("https://twitter.com/intent/tweet",{text:o,url:e});i(a,"twtrShareWindow",`height=450, width=550, top=${l/2-275}, left=${n/2-225}, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0`),t.stopPropagation()}))})))))}();; (()=>{var t,e={506:(t,e,n)=>{"use strict";const i=window.enquire;var o=n.n(i);n(682),n(356);const r=window.wp.domReady;var s=n.n(r);window.hasOwnProperty("prcBlocks")||(window.prcBlocks={}),window.prcBlocks.tableOfContents={breakpoints:[],elms:{},useIcons:!1,chapters:[]};const a=t=>{const e=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const n=t.querySelector(".toc-title");if(n){if(!n.getAttribute("original-classes")){const t=Array.from(n.classList).filter((t=>t.startsWith("has-")));n.setAttribute("original-classes",t.join(" "))}if(e){const t=n.getAttribute("original-classes");n.classList.remove(...t.split(" "))}else{const t=n.getAttribute("original-classes");n.classList.add(...t.split(" "))}}},n=function(t){t&&(t.classList.toggle("is-style-card-alt"),window.prcBlocks.tableOfContents.useIcons?(t=>{if(t.classList.toggle("mobile-toc-icons")){const e=t.querySelectorAll("a.item[data-icon-src]");Array.from(t.querySelectorAll("a.item")).filter((t=>!t.getAttribute("data-icon-src"))).forEach((t=>{t.classList.add("hidden")})),console.log("isMobileToc",e,t.querySelectorAll("a.item")),e.forEach((t=>{const e=t.getAttribute("data-icon-src");t.innerHTML=`${t.innerHTML}`}))}else t.querySelectorAll("a.item[data-icon-src]").forEach((t=>{const e=t.querySelector("span.icon"),n=t.querySelector("span.hidden-text");e&&t.removeChild(e),t.innerHTML=n.innerHTML}))})(t):t.classList.toggle("mobile-toc"))},i=t.getAttribute("data-mobile-threshold");i&&o().register(`screen and (max-width: ${i}px)`,{match:()=>{var i;i=t,setTimeout((()=>{const t=i.parentElement;n(t),e(t,!0)}),100)},unmatch:()=>{var i;i=t,setTimeout((()=>{const t=i.parentElement;n(t),e(t,!1)}),100)}})};s()((()=>{const t=document.querySelectorAll(".wp-block-prc-block-table-of-contents");t.length&&t.forEach((t=>{t.querySelector("a.item[data-icon-src]")&&(window.prcBlocks.tableOfContents.useIcons=!0),t.getAttribute("data-show-current-chapter")&&(t=>{const e=document.querySelectorAll("[data-is-chapter]");e.length&&e.forEach((e=>{const n=e.getAttribute("id");window.prcBlocks.tableOfContents.chapters.push(n),new Waypoint.Inview({element:e,enter(e){const n=t.querySelector("a.item.active");n&&n.classList.remove("active")},entered(e){const i=t.querySelector(`a.item[href="#${n}"]`);i&&i.classList.add("active")}})}))})(t),(t=>{const e=t.parentElement;t.querySelectorAll("a.item").forEach((t=>{t.addEventListener("click",(n=>{const i=t.getAttribute("href");if(0===i.indexOf("#")){n.preventDefault();const t=document.getElementById(i.replace("#",""));t&&(t.scrollIntoView({behavior:"smooth"},!0),window.history.pushState(null,null,i),e.classList.contains("mobile-toc")&&e.classList.contains("is-open")&&e.classList.remove("is-open"))}}))}))})(t),(t=>{const e=t.parentElement;e.querySelector(".toc-title").addEventListener("click",(()=>{e.classList.contains("mobile-toc")&&e.classList.toggle("is-open")}))})(t),a(t)}))}))},682:()=>{!function(){"use strict";var t=0,e={};function n(i){if(!i)throw new Error("No options passed to Waypoint constructor");if(!i.element)throw new Error("No element option passed to Waypoint constructor");if(!i.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+t,this.options=n.Adapter.extend({},n.defaults,i),this.element=this.options.element,this.adapter=new n.Adapter(this.element),this.callback=i.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=n.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=n.Context.findOrCreateByElement(this.options.context),n.offsetAliases[this.options.offset]&&(this.options.offset=n.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),e[this.key]=this,t+=1}n.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},n.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},n.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete e[this.key]},n.prototype.disable=function(){return this.enabled=!1,this},n.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},n.prototype.next=function(){return this.group.next(this)},n.prototype.previous=function(){return this.group.previous(this)},n.invokeAll=function(t){var n=[];for(var i in e)n.push(e[i]);for(var o=0,r=n.length;oi.oldScroll?i.forward:i.backward;for(var r in this.waypoints[n]){var s=this.waypoints[n][r];if(null!==s.triggerPoint){var a=i.oldScroll=s.triggerPoint;(a&&l||!a&&!l)&&(s.queueTrigger(o),t[s.group.id]=s.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},r.prototype.innerHeight=function(){return this.element==this.element.window?i.viewportHeight():this.adapter.innerHeight()},r.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},r.prototype.innerWidth=function(){return this.element==this.element.window?i.viewportWidth():this.adapter.innerWidth()},r.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var n in this.waypoints[e])t.push(this.waypoints[e][n]);for(var i=0,o=t.length;i-1&&(d=Math.ceil(s.contextDimension*d/100))),l=s.contextScroll-s.contextOffset,u.triggerPoint=Math.floor(w+l-d),c=f=s.oldScroll,p=!c&&!h,!y&&c&&h?(u.queueTrigger(s.backward),o[u.group.id]=u.group):(!y&&p||y&&s.oldScroll>=u.triggerPoint)&&(u.queueTrigger(s.forward),o[u.group.id]=u.group)}}return i.requestAnimationFrame((function(){for(var t in o)o[t].flushTriggers()})),this},r.findOrCreateByElement=function(t){return r.findByElement(t)||new r(t)},r.refreshAll=function(){for(var t in n)n[t].refresh()},r.findByElement=function(t){return n[t.waypointContextKey]},window.onload=function(){o&&o(),r.refreshAll()},i.requestAnimationFrame=function(e){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t).call(window,e)},i.Context=r}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}var n={vertical:{},horizontal:{}},i=window.Waypoint;function o(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),n[this.axis][this.name]=this}o.prototype.add=function(t){this.waypoints.push(t)},o.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},o.prototype.flushTriggers=function(){for(var n in this.triggerQueues){var i=this.triggerQueues[n],o="up"===n||"left"===n;i.sort(o?e:t);for(var r=0,s=i.length;r-1&&this.waypoints.splice(e,1)},o.prototype.first=function(){return this.waypoints[0]},o.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},o.findOrCreate=function(t){return n[t.axis][t.name]||new o(t)},i.Group=o}(),function(){"use strict";var t=window.Waypoint;function e(t){return t===t.window}function n(t){return e(t)?t:t.defaultView}function i(t){this.element=t,this.handlers={}}i.prototype.innerHeight=function(){return e(this.element)?this.element.innerHeight:this.element.clientHeight},i.prototype.innerWidth=function(){return e(this.element)?this.element.innerWidth:this.element.clientWidth},i.prototype.off=function(t,e){function n(t,e,n){for(var i=0,o=e.length-1;i{!function(){"use strict";function t(){}var e=window.Waypoint;function n(t){this.options=e.Adapter.extend({},n.defaults,t),this.axis=this.options.horizontal?"horizontal":"vertical",this.waypoints=[],this.element=this.options.element,this.createWaypoints()}n.prototype.createWaypoints=function(){for(var t={vertical:[{down:"enter",up:"exited",offset:"100%"},{down:"entered",up:"exit",offset:"bottom-in-view"},{down:"exit",up:"entered",offset:0},{down:"exited",up:"enter",offset:function(){return-this.adapter.outerHeight()}}],horizontal:[{right:"enter",left:"exited",offset:"100%"},{right:"entered",left:"exit",offset:"right-in-view"},{right:"exit",left:"entered",offset:0},{right:"exited",left:"enter",offset:function(){return-this.adapter.outerWidth()}}]},e=0,n=t[this.axis].length;e{if(!n){var s=1/0;for(h=0;h=r)&&Object.keys(i.O).every((t=>i.O[t](n[l])))?n.splice(l--,1):(a=!1,r0&&t[h-1][2]>r;h--)t[h]=t[h-1];t[h]=[n,o,r]},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={692:0,431:0};i.O.j=e=>0===t[e];var e=(e,n)=>{var o,r,s=n[0],a=n[1],l=n[2],c=0;if(s.some((e=>0!==t[e]))){for(o in a)i.o(a,o)&&(i.m[o]=a[o]);if(l)var h=l(i)}for(e&&e(n);ci(506)));o=i.O(o)})(); //# sourceMappingURL=view.js.map; !function(){"use strict";var e={n:function(o){var t=o&&o.__esModule?function(){return o.default}:function(){return o};return e.d(t,{a:t}),t},d:function(o,t){for(var l in t)e.o(t,l)&&!e.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:t[l]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)}},o=window.wp.domReady,t=e.n(o),l=window.wp.url;t()((()=>{const e=(0,l.getQueryArg)(window.location.href,"collapsibleId");console.log("collapsibleId: "+e);const o=document.querySelectorAll(".wp-block-prc-block-collapsible");1<=o.length&&o.forEach((o=>{e===o.id&&setTimeout((()=>{o.scrollIntoView({behavior:"smooth"}),setTimeout((()=>{o.classList.add("is-open")}),200)}),400),o.querySelector(".wp-block-prc-block-collapsible__title").addEventListener("click",(e=>{e.preventDefault(),o.classList.toggle("is-open")}))}))}))}(); //# sourceMappingURL=view.js.map; !function(){var e={472:function(e,t){var a;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t{let e=document.querySelector('iframe[title="Main content of the hCaptcha challenge"]');if(e=e.parentElement.parentElement,e){const t=e.querySelector("div:last-of-type");null!==t&&(t.style={...t.style,display:"none"})}else g()};function C(t){let{className:a,input:n={style:"",className:"",type:"email",placeholder:""},button:r={wrapperClassName:"",wrapperStyle:"",style:"",className:"",text:""},form:i={segmentId:!1}}=t;const[s,o]=(0,e.useState)(!1),[c,p]=(0,e.useState)(!1),[l,h]=(0,e.useState)(!1),[u,m]=(0,e.useState)(!1),[C,R]=(0,e.useState)(null),[E,S]=(0,e.useState)(r.text),[w,x]=(0,e.useState)(!1),O=(0,e.useRef)(null),A=f()(r.className,{"is-processing":s,"is-disabled":c,"has-error":l,"has-success":u});return(0,e.useEffect)((()=>{p(!C)}),[C]),(0,e.createElement)("form",{className:a},!w&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("input",{type:n.type,placeholder:n.placeholder,style:n.style,className:n.className,onChange:e=>R(e.target.value),value:C}),(0,e.createElement)("button",{type:"submit",className:r.wrapperClassName,disabled:s||c,style:{opacity:s?.5:1,...r.wrapperStyle},onClick:e=>{e.preventDefault(),!1===c&&x(!w)}},(0,e.createElement)("span",{style:r.style,className:A},E))),w&&(0,e.createElement)(d,{sitekey:b,theme:"light",ref:O,onVerify:e=>{!1!==e&&!0!==s&&(e=>{let{onStart:t,onSuccess:a,onError:n,emailAddress:r,captchaToken:i=!1,closeCaptcha:s,interest:o=!1}=e;if(!b)return n("Invalid captcha key");if(!i)return n("We couldn't verify you're not a robot. Please try again.");t(),s();const c=r,p=document.URL;if(!(0,v.isURL)(p))return n("Invalid URL");const l=(0,v.buildQueryString)({email:c,captcha_token:i,interests:o,api_key:"mailchimp-form",origin_url:p});y()({path:`/prc-api/v2/mailchimp/subscribe/?${l}`,method:"POST"}).then((()=>a())).catch((e=>n(e)))})({onStart:()=>{o(!0),S("Processing...")},onSuccess:()=>(S("Success"),m(!0),o(!1),R(""),h(!1),!0),onError:e=>(h(!0),S("Error"),o(!1),console.log("Error!",e),!1),closeCaptcha:()=>x(!1),emailAddress:C,captchaToken:e,interest:i.segmentId})},onOpen:()=>{g()}}))}function R(e){return e?e.split(";").filter((e=>e)).reduce(((e,t)=>{const[a,n]=t.split(":");return e[a.split("-").map(((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1))).join("")]=n,e}),{}):{}}n()((()=>{document.querySelectorAll(".wp-block-prc-block-mailchimp-form").forEach((t=>{const a=t.getAttribute("class"),n=t.getAttribute("data-segment-id"),r=t.querySelector(".wp-block-prc-block-form-input-text"),i=r.getAttribute("style")||"",s=r.getAttribute("class")||"",o=t.querySelector(".wp-block-button"),c=t.querySelector(".wp-block-button__link"),p=o.getAttribute("class")||"",l=o.getAttribute("style")||"",h=c.getAttribute("style")||"",d=c.getAttribute("class")||"",u=document.createElement("div");t.parentNode.insertBefore(u,t),(0,e.render)((0,e.createElement)(C,{className:a,input:{style:R(i),className:s,type:r.getAttribute("type"),placeholder:r.getAttribute("placeholder")},button:{wrapperClassName:p,wrapperStyle:R(l),style:R(h),className:d,text:c.innerText},form:{segmentId:n}}),u),t.parentNode.removeChild(t)}))}))}()}(); //# sourceMappingURL=view.js.map;