(()=>{"use strict";const t=t=>"string"==typeof t&&t.startsWith("||")&&t.endsWith("||")?t.split("||").map(t=>t.trim()).filter(t=>""!==t):t,e={default:(t,e)=>t.value===e.value,list__in:(e,i)=>{let r=i.value;if("string"==typeof r&&(r=i.value.split(",").map(t=>t.trim())),!Array.isArray(r))return!1;const n=t(e.value);return Array.isArray(n)?n.some(t=>r.some(e=>e==t)):!(!n||!r.some(t=>t==n))},list__not_in:(e,i)=>{let r=i.value;if("string"==typeof r&&(r=i.value.split(",").map(t=>t.trim())),!Array.isArray(r))return!0;const n=t(e.value);return Array.isArray(n)?!n.some(t=>r.some(e=>e==t)):!n||!r.some(t=>t==n)},range:(t,e)=>{if(isNaN(t.value))return!1;const{min:i,max:r}=e.value,n=t=>null!=t&&""!==t;return!(n(i)&&t.valuer)}};window.newspackPopupsCriteria=window.newspackPopupsCriteria||{criteria:{}},window.newspackPopupsCriteria.criteria=window.newspackPopupsCriteria.criteria||{};const i={};function r(t,r={}){if(!t)throw new Error("Criteria must have an ID.");const n={id:t,matchingFunction:"default",...r,...i[t]};return n.getValue=t=>{if("function"==typeof n.matchingAttribute)return n.matchingAttribute(t);if("string"==typeof n.matchingAttribute){if("function"==typeof t?.store?.get)return t.store.get(n.matchingAttribute);console.warn(`Reader data library not loaded. Unable to fetch value for '${n.id}'`)}return n.value},n._matched={},n.matches=t=>{const i=JSON.stringify(t);if(void 0!==n._matched[i])return n._matched[i];const r=window.newspackReaderActivation;return r||console.warn("Reader activation script not loaded."),(t=>{n._configured||(n._configured=!0,n.matchingAttribute||(n.matchingAttribute=n.id),"string"==typeof n.matchingFunction&&e[n.matchingFunction]&&(n.matchingFunction=e[n.matchingFunction].bind(null,n)),"function"==typeof n.matchingFunction?("function"==typeof t?.on&&t.on("data",()=>{n._matched={}}),n.value=n.getValue(t)):console.warn(`Unable to configure matching function for criteria ${n.id}.`))})(r),n._matched[i]=n.matchingFunction(t,r,n),n._matched[i]},window.newspackPopupsCriteria.criteria||(window.newspackPopupsCriteria.criteria={}),window.newspackPopupsCriteria.criteria[t]=n,n}function n(t){return t?window.newspackPopupsCriteria.criteria[t]:window.newspackPopupsCriteria.criteria}function a(t,e){let r=n(t);r||(i[t]=i[t]||{},r=i[t]),r._matched={},r.matchingAttribute=e}function s(t,e){let r=n(t);r||(i[t]=i[t]||{},r=i[t]),r._matched={},r.matchingFunction=e}function o({param:t,sessionKey:e,isPositive:i}){const r=new URLSearchParams(window.location.search).get(t);if(null!==r&&i(r)){try{window.sessionStorage.setItem(e,"1")}catch(t){}return!0}try{return"1"===window.sessionStorage.getItem(e)}catch(t){return!1}}function c(){return o({param:"np_seg_donor",sessionKey:"newspack-popups-donor-from-email",isPositive:t=>!(t=>/^\*\|[^|]+\|\*$/.test(t)||/^\[\[[^\]]+\]\]$/.test(t)||/^%[^%]+%$/.test(t)||/^\[[^\][]+\]$/.test(t))(t)&&(t=>!["no","none","false","0",""].includes(String(t).toLowerCase()))(t)})}if(a("articles_read",t=>t.getUniqueActivitiesBy("article_view","post_id").filter(t=>t.timestamp>Date.now()-2592e6).length),a("articles_read_in_session",t=>{const e=t.getUniqueActivitiesBy("article_view","post_id");if(!e.length)return 0;if(e.sort((t,e)=>e.timestamp-t.timestamp),e[0].timestamp{const r=Array.isArray(t.value)?t.value:[];if(0===r.length)return!1;const n=window.innerWidth;return r.some(t=>{const e=i[t];return!isNaN(e?.min_width)&&!isNaN(e?.max_width)&&n>=e.min_width&&n"email"===t.toLowerCase()});switch(t.value){case"subscribers":return i;case"non-subscribers":return!i}}),s("user_account",(t,{store:e})=>{switch(t.value){case"with-account":return newspackPopupsCriteria.is_non_preview_user||e.get("reader")?.email;case"without-account":return!newspackPopupsCriteria.is_non_preview_user&&!e.get("reader")?.email}}),newspackPopupsCriteria.criteria={},newspackPopupsCriteria?.config)for(const t in newspackPopupsCriteria.config)r(t,newspackPopupsCriteria.config[t])})();