PageSourceSearch

https://www.sspnet.org/wp-content/themes/gowp-skeleton/build/block…/view.js?ver=ea85ddbd6e49c08475b8

js sspnet.org collected 2026-10-02 02:19:58 UTC 11,930 bytes, 1 lines download raw bytes

1import{getContext as t,store as e}from"@wordpress/interactivity";const r="date",s="desc",a=["date","title","menu_order","rand","modified"],i=["asc","desc"];class n{static DEFAULT_ORDER_BY=r;static DEFAULT_ORDER_DIR=s;static ORDER_BY_VALUES=a;static ORDER_DIR_VALUES=i;static TERM_PARAM_PREFIX="tax_";static REMOVED_TERM_PARAM_PREFIX="removed_tax_";static SEARCH_PARAM="s";static DATE_FROM_PARAM="date_from";static DATE_TO_PARAM="date_to";static DATE_UNIT_PARAMS={month:"date_month",year:"date_year"};static DATE_UNITS=["month","year"];static DATE_UNIT_PARAM="date_unit";static DATE_UNIT_VALUES_PARAM="date_unit_values";static DATE_SOURCE_PARAM="date_source";static DATE_SOURCE_VALUES=["post_date","event_start"];static DEFAULT_DATE_SOURCE="post_date";static sanitizeDateSource(t){return this.DATE_SOURCE_VALUES.includes(t)?t:this.DEFAULT_DATE_SOURCE}static get(t,e){return t?.[e]}static args(t,e){return t?.[e]?.args||{}}static filterParameters(t,e){return t?.[e]?.filterParameters||{}}static orderBy(t,e){return this.args(t,e).orderBy??r}static orderDir(t,e){return this.args(t,e).orderDir??s}static setSort(t,e,r,s){const a=t?.[e];a&&(a.args={...a.args,orderBy:r,orderDir:s},a.filterParameters={...a.filterParameters,page:1})}static sortMatches(t,e,r,s){return this.orderBy(t,e)===r&&this.orderDir(t,e)===s}static page(t,e){return this.filterParameters(t,e).page??1}static totalPages(t,e){return t?.[e]?.totalPages||1}static isFirstPage(t,e){return this.page(t,e)<=1}static isLastPage(t,e){return this.page(t,e)>=this.totalPages(t,e)}static setPage(t,e,r){const s=t?.[e];s&&(s.filterParameters={...s.filterParameters,page:Math.max(1,r)})}static setPageClamped(t,e,r){const s=Math.min(Math.max(1,Number.isNaN(r)?1:r),this.totalPages(t,e));return this.setPage(t,e,s),s}static stepPage(t,e,r){this.setPageClamped(t,e,this.page(t,e)+r)}static setTotalPages(t,e,r){const s=t?.[e];s&&(s.totalPages=r)}static total(t,e){return t?.[e]?.total||0}static shownCount(t,e){return t?.[e]?.shownCount||0}static nextPage(t,e){return t?.[e]?.nextPage||2}static isFullyLoaded(t,e){return this.shownCount(t,e)>=this.total(t,e)}static addShown(t,e,r){const s=t?.[e];if(!s)return;const a=this.shownCount(t,e),i=a>0?a+r:r,n=this.nextPage(t,e)+1;s.shownCount=i,s.nextPage=n,t[e]={...s,shownCount:i,nextPage:n}}static setShown(t,e,r){const s=t?.[e];s&&(s.shownCount=r,t[e]={...s,shownCount:r})}static resetShown(t,e,r){const s=t?.[e];s&&(s.shownCount=r,s.nextPage=2,t[e]={...s,shownCount:r,nextPage:2})}static setTotal(t,e,r){const s=t?.[e];s&&(s.total=r,t[e]={...s,total:r})}static countLabel(t,e,r){const s=this.total(t,e);if(s<1||!r?.trim())return"";const a=Math.max(1,t?.[e]?.args?.perPage??6),i=(Math.max(1,this.page(t,e))-1)*a+1;if(i>s)return"";const n=Math.min(i+Math.max(1,this.shownCount(t,e))-1,s),o=Math.max(1,this.shownCount(t,e)||n-i+1);return r.replace(/{from}/g,String(i)).replace(/{to}/g,String(n)).replace(/{total}/g,String(s)).replace(/{shown}/g,String(o))}static terms(t,e){return this.filterParameters(t,e).terms||{}}static toggleTerm(t,e,r,s,a){const i=t?.[e];if(!i)return;const n={...i.filterParameters?.terms||{}},o=n[r]||[],c=String(s);n[r]=a?[...o.filter(t=>t!==c),c]:o.filter(t=>t!==c),i.filterParameters={...i.filterParameters,terms:n,page:1}}static clearTerms(t,e){const r=t?.[e];r&&(r.filterParameters={...r.filterParameters,terms:{},page:1})}static mainQueryTerms(t,e){return t?.[e]?.mainQueryTerms||{}}static isMainQueryTerm(t,e,r,s){return(this.mainQueryTerms(t,e)[r]||[]).includes(String(s))}static isTermChecked(t,e,r,s){return(this.terms(t,e)[r]||[]).includes(String(s))}static termCount(t,e,r){return(this.terms(t,e)[r]||[]).length}static activeTerms(t,e){const r=this.canonicalTerms(this.terms(t,e)),s=[];return Object.keys(r).forEach(t=>{r[t].forEach(e=>{s.push({taxonomy:t,termId:String(e)})})}),s}static search(t,e){return this.filterParameters(t,e).search??""}static setSearch(t,e,r){const s=t?.[e];s&&(s.filterParameters={...s.filterParameters,search:String(r??"").trim(),page:1})}static dateFilter(t,e){const r=this.filterParameters(t,e).dateFilter;return{from:r?.from??"",to:r?.to??"",units:this.canonicalDateUnits(r?.units),source:this.sanitizeDateSource(r?.source)}}static canonicalDateUnits(t){const e={};
1return this.DATE_UNITS.forEach(r=>{e[r]=(t?.[r]??[]).map(String)}),e}static emptyDateUnits(){return this.canonicalDateUnits({})}static restParamForDateUnit(t){return"date"+t.charAt(0).toUpperCase()+t.slice(1)}static signedDateUnits(t){const e=this.canonicalDateUnits(t),r={};return this.DATE_UNITS.forEach(t=>{r[t]=[...e[t]].sort((t,e)=>Number(t)-Number(e))}),r}static setDateRange(t,e,r,s,a){const i=t?.[e];i&&(i.filterParameters={...i.filterParameters,dateFilter:{from:r||"",to:s||"",units:this.emptyDateUnits(),source:this.sanitizeDateSource(a)},page:1})}static setDateUnitValue(t,e,r,s,a){const i=t?.[e];if(!i||!this.DATE_UNITS.includes(r))return;const n=""===s||null==s?"":String(s),o=this.dateFilter(t,e).units;o[r]=n?[n]:[],i.filterParameters={...i.filterParameters,dateFilter:{from:"",to:"",units:o,source:this.sanitizeDateSource(a)},page:1}}static clearDateFilter(t,e){const r=t?.[e];r&&(r.filterParameters={...r.filterParameters,dateFilter:{from:"",to:"",units:this.emptyDateUnits(),source:this.dateFilter(t,e).source},page:1})}static hasDateFilter(t,e){const r=this.dateFilter(t,e);return!!(r.from||r.to||this.DATE_UNITS.some(t=>r.units[t].length))}static isDateUnitValueChecked(t,e,r,s){return(this.dateFilter(t,e).units[r]??[]).includes(String(s))}static dateUnitValue(t,e,r){return(this.dateFilter(t,e).units[r]??[])[0]??""}static loadingCount(t,e){return t?.[e]?.loadingCount||0}static isFetching(t,e){return this.loadingCount(t,e)>0}static beginLoading(t,e){const r=t?.[e];r&&(r.loadingCount=(r.loadingCount||0)+1)}static endLoading(t,e){const r=t?.[e];r&&(r.loadingCount=Math.max(0,(r.loadingCount||0)-1))}static canonicalTerms(t){const e={};return Object.keys(t||{}).sort().forEach(r=>{const s=[...new Set((t[r]||[]).map(String))].sort((t,e)=>{const r=Number(t),s=Number(e);return isNaN(r)||isNaN(s)?String(t).localeCompare(String(e)):r-s});s.length&&(e[r]=s)}),e}static toRestArgs(t){const e=t?.args||{},a=t?.filterParameters||{},i=e.taxQuery||{},n=e.taxQueryExclude||{},o={objectType:t?.objectType??"post",objectSlug:t?.objectSlug??"post",currentTerms:e.currentTerms?1:0,excludeCurrentPost:e.excludeCurrentPost?1:0,listingTemplateRef:t?.listingTemplateRef??"",includeIds:(e.includeIds||[]).join(","),excludeIds:(e.excludeIds||[]).join(","),taxQueryTaxonomy:i.taxonomy||"",taxQueryTerms:(i.terms||[]).join(","),taxQueryUseCurrentTag:i.useCurrentTag?1:0,taxQueryExcludeTaxonomy:n.taxonomy||"",taxQueryExcludeTerms:(n.terms||[]).join(","),orderBy:e.orderBy??r,orderDir:e.orderDir??s,perPage:e.perPage??6,page:a.page??1,search:a.search??"",s:a.search??"",noResultsText:t?.noResultsText??"",showNoResults:!1===t?.showNoResults?0:1,dateFrom:a.dateFilter?.from??"",dateTo:a.dateFilter?.to??"",dateSource:this.sanitizeDateSource(a.dateFilter?.source)},c=this.canonicalDateUnits(a.dateFilter?.units);this.DATE_UNITS.forEach(t=>{o[this.restParamForDateUnit(t)]=c[t].join(",")});const u=this.canonicalTerms(a.terms);return Object.keys(u).forEach(t=>{o[this.TERM_PARAM_PREFIX+t]=u[t].join(",")}),t?.queryId&&(o.queryId=t.queryId),t?.endpointKey&&(o.endpointKey=t.endpointKey),t?.apiEndpoint&&(o.apiEndpoint=t.apiEndpoint),e.product_type&&(o.product_type=e.product_type),e.topLevelFilter&&(
1o.topLevelFilter=e.topLevelFilter),e.topLevelValue&&(o.topLevelValue=e.topLevelValue),e.subspecialty&&(o.subspecialty=e.subspecialty),e.accreditation&&(o.accreditation=e.accreditation),e.audience&&(o.audience=e.audience),o}static urlTerms(t){const e=t?.mainQueryTerms||{},r=this.canonicalTerms(t?.filterParameters?.terms),s={};return Object.keys(r).forEach(t=>{const a=r[t].filter(r=>!(e[t]||[]).includes(String(r)));a.length&&(s[t]=a)}),s}static removedUrlTerms(t){const e=t?.mainQueryTerms||{},r=this.canonicalTerms(t?.filterParameters?.terms),s={};return Object.keys(e).forEach(t=>{const a=(e[t]||[]).map(String).filter(e=>!(r[t]||[]).includes(e));a.length&&(s[t]=a)}),s}static normalizeSignature(t){if(!t||"string"!=typeof t)return"";let e;try{e=JSON.parse(t)}catch(t){return""}const r=e?.dateFilter??{},s=r.units??(r.unit?{[r.unit]:r.unitValues??[]}:{});return this.signature({args:{orderBy:e?.orderBy,orderDir:e?.orderDir},filterParameters:{page:e?.page,search:e?.search,terms:e?.terms,dateFilter:{from:r.from,to:r.to,units:s,source:r.source}}})}static signature(t){const e=t?.args||{},a=t?.filterParameters||{};return JSON.stringify({page:a.page??1,orderBy:e.orderBy??r,orderDir:e.orderDir??s,search:a.search??"",terms:this.canonicalTerms(a.terms),dateFilter:{from:a.dateFilter?.from??"",to:a.dateFilter?.to??"",units:this.signedDateUnits(a.dateFilter?.units),source:this.sanitizeDateSource(a.dateFilter?.source)}})}static writeUrl(t,e){"undefined"!=typeof window&&window.gowpIsNavigating||window.history.replaceState({},"",this.buildUrl(t,e))}static buildUrl(t,e){const a=e?.args||{},i=e?.filterParameters||{},n=Number(i.page??1),o=a.orderBy??r,c=a.orderDir??s,u=String(i.search??"").trim(),h=this.urlTerms(e),l=this.removedUrlTerms(e),m=i.dateFilter||{},d=new URL(window.location.href),g=d.searchParams.has("s")||"undefined"!=typeof window&&new URLSearchParams(window.location.search).has("s");d.searchParams.delete("queryId"),d.searchParams.delete("page"),d.searchParams.delete("sort_by"),d.searchParams.delete("sort_dir"),d.searchParams.delete(this.SEARCH_PARAM),d.searchParams.delete("search"),d.searchParams.delete("s"),d.searchParams.delete(this.DATE_FROM_PARAM),d.searchParams.delete(this.DATE_TO_PARAM),d.searchParams.delete(this.DATE_UNIT_PARAM),d.searchParams.delete(this.DATE_UNIT_VALUES_PARAM),this.DATE_UNITS.forEach(t=>d.searchParams.delete(this.DATE_UNIT_PARAMS[t])),d.searchParams.delete(this.DATE_SOURCE_PARAM),[...d.searchParams.keys()].forEach(e=>{if(e.startsWith(this.TERM_PARAM_PREFIX)||e.startsWith(this.REMOVED_TERM_PARAM_PREFIX)||t&&(e.startsWith(`${t}_${this.TERM_PARAM_PREFIX}`)||e.startsWith(`${t}_${this.REMOVED_TERM_PARAM_PREFIX}`))){const r=e.replace(new RegExp(`^(?:${t}_)?(?:removed_)?tax_`),"");d.searchParams.delete(e),r&&(d.searchParams.delete(r),t&&d.searchParams.delete(`${t}_${r}`))}});const P=Object.keys(h).length>0||Object.keys(l).length>0,_=this.signedDateUnits(m.units),A=!!(m.from||m.to||this.DATE_UNITS.some(t=>_[t].length)),E=o===r&&c===s;if(!(n<=1&&E)||P||A||""!==u||g){const e=P||A||n>1||!E;(new URLSearchParams(window.location.search).has("queryId")&&e||t&&"1"!==String(t)&&e)&&d.searchParams.set("queryId",String(t)),n>1&&d.searchParams.set("page",String(n)),E||(d.searchParams.set("sort_by",o),d.searchParams.set("sort_dir",c)),""!==u?d.searchParams.set(this.SEARCH_PARAM,u):g&&d.searchParams.set(this.SEARCH_PARAM,""),m.from&&d.searchParams.set(this.DATE_FROM_PARAM,m.from),m.to&&d.searchParams.set(this.DATE_TO_PARAM,m.to),this.DATE_UNITS.forEach(t=>{_[t].length&&d.searchParams.set(this.DATE_UNIT_PARAMS[t],_[t].join(","))}),A&&this.sanitizeDateSource(m.source)!==this.DEFAULT_DATE_SOURCE&&d.searchParams.set(this.DATE_SOURCE_PARAM,this.sanitizeDateSource(m.source)),Object.keys(h).forEach(t=>d.searchParams.set(this.TERM_PARAM_PREFIX+t,h[t].join(","))),Object.keys(l).forEach(t=>d.searchParams.set(this.REMOVED_TERM_PARAM_PREFIX+t,l[t].join(",")))}return d.search=d.searchParams.toString().replace(/%2C/g,","),d.toString()}}const{state:o}=e("gowp/listing",{actions:{prevPage(){n.stepPage(o.queries,t().queryId,-1)},nextPage(){n.stepPage(o.queries,t().queryId,1)},setPage(e){const{queryId:r}=t(),s=n.setPageClamped(o.queries,r,parseInt(e.target.value,10));e.target.value=String(s)}},callbacks:{currentPage:()=>n.page(o.queries,t().queryId),totalPages:()=>n.totalPages(o.queries,t().queryId),isFirst:()=>n.isFirstPage(o.queries,t().queryId),isLast:()=>
1n.isLastPage(o.queries,t().queryId),isFetching:()=>n.isFetching(o.queries,t().queryId)}});

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.