PageSourceSearch

https://gg.givingcompass.org/_nuxt/CyrvrKgH.js

js givingcompass.org collected 2026-09-24 09:17:42 UTC 7,490 bytes, 1 lines download raw bytes

1import{d as e}from"./CzuCJjyz.js";import{C as t,i as r,a4 as s,u as i,s as o,ad as n,ae as a,v as l,R as c}from"#entry";var g=(e=>(e.RelatedContent="RelatedContent",e.RelatedNonprofits="RelatedNonprofits",e))(g||{});const f=["gc_vetted","foundation","deductible_donations","gc_original","map","video","impact_url","has_social_media"],h=["sdgs","ntee_codes","subsection_codes","social_media"],u=["min_revenue","max_revenue","min_assets","max_assets","min_expenses","max_expenses","min_employees","max_employees","location_range","page","size"],d=e("filter",{state:()=>({contentType:t.NONPROFIT,filters:{},previousFilters:{}}),getters:{hasActiveFilters(){return Object.keys(this.filters).length>0},getFilterValue:e=>t=>e.filters[t],currentPage(){return this.filters.page||1},currentPageSize(){return this.filters.size||9},cleanFilters(){return s(this.filters)},getChangedFilterProperties(){return e=>{const t=this.cleanFilters,r=new Set([...Object.keys(t),...Object.keys(s(e))]),i=[];for(const s of r){const r=s,o=t[r],n=e[r];JSON.stringify(o)!==JSON.stringify(n)&&i.push(r)}return i}},getShowMap(){return!!this.filters.map}},actions:{setContentType(e){this.contentType=e,this.resetFilters()},setFilter(e,t){this.filters[e]=t},setPage(e){1===e?delete this.filters.page:this.filters.page=e},setPageSize(e){9===e?delete this.filters.size:this.filters.size=e,this.setPage(1)},resetPage(){delete this.filters.page},resetFilters(){this.filters={}},applyFiltersFromQuery(e){Object.entries(e).forEach((([e,t])=>{if(e.startsWith("filter-")){const s=e.replace("filter-","");if("page"===s){const e=Number(t);1!==e&&(this.filters.page=e)}else if("size"===s){const e=Number(t);9!==e&&(this.filters.size=e)}else if(u.includes(s)){const e=Number(t);isNaN(e)||this.setFilter(s,e)}else if(f.includes(s))this.setFilter(s,"true"===t.toLowerCase());else if("filter-sdgs"===e){const e=t.split(",").map(Number).filter((e=>!isNaN(e)&&e>=1&&e<=17));this.setFilter("sdgs",e.slice(0,3))}else if(h.includes(s)){const e=t.split(",").filter((e=>!r(e)&&""!==e?.trim()));this.setFilter(s,e)}else this.setFilter(s,t)}}))}}}),p={async searchArticles(e,t){try{const r="/articles/advanced",o={...s(e),...t},{data:n,error:a}=await i(r,{params:o});if(a.value)throw console.error("Error searching articles:",a.value),a.value;return n.value}catch(r){throw console.error("Error searching articles:",r),r}},async getLearningCenterContent(){try{const e="/learning-center/",{data:t,error:r}=await i(e);return r.value?(console.error("Error getting learning center:",r.value),null):t.value}catch(e){return console.error("Error getting learning center:",e),null}},async getArticleById(e){try{const t=`/articles/details/${e}`,{data:r,error:s}=await i(t);return s.value?void console.error("Error getting article by ID:",s.value):r.value}catch(t){return void console.error("Error getting article by ID:",t)}},async getArticleByName(e){try{const t=`/articles/name/${e}`,{data:r,error:s}=await i(t);return s.value?void console.error("Error getting article by name:",s.value):r.value}catch(t){return void console.error("Error getting article by name:",t)}},async getPartnerArticleByName(e){try{const t=`/articles/partner/name/${e}`,{data:r,error:s}=await i(t);return s.value?void console.error("Error getting partner article by name:",s.value):r.value}catch(t){return void console.error("Error getting partner article by name:",t)}},async getRelatedArticlesById(e){try{const t=`/articles/details/${e}/related`,{data:r,error:s}=await i(t);return s.value?void console.error("Error getting related articles:",s.value):r.value}catch(t){return void console.error("Error getting related articles:",t)}},async getSuggestions(e){try{const t=`/articles/details/${e}/suggestions`,{data:r,error:s}=await i(t);return s.value?(console.error("Error getting suggestions:",s.value),[]):r.value}catch(t){return console.error("Error getting suggestions:",t),[]}}};function y(){return p}const m=e("content",{state:()=>({nonprofits:{},articles:{},logos:{},gcArticle:null,loading:!1,relatedArticles:null}),getters:{nonprofitByEIN:e=>t=>e.nonprofits[t],articleById:e=>t=>e.articles[t],nonprofitPromise:e=>(t,r)=>{const s=e.nonprofits[t];return s?.$promises?.[r]},logoByEIN:e=>t=>e.logos[t]},actions:{async navigateToNonprofit(e){l({name:c.Nonprofit,params:{ein:e}})},async navigateToArticleById(e){l({name:c.Article,params:{nameOrId:e+""}})},async navigateToArticleByUrl(e){if(a(e)){const t=e.split("/"),r=t.pop(),s=t.pop();l({name:c.PartnerPost,params:{nameOrId:r,partner:s}})}else l({name:c.Article,params:{nameOrId:e.split("/").pop()}})},async fetchArticleOrPartnerArticleByPath(e){const t=e.split("/").pop();a(e)?this.fetchPartnerArticleByName(t):this.fetchArticleByName(t)},storeNonprofitPromise(e,t,r){const s=this.nonprofits[e];s&&(s.$promises||(s.$promises={}),s.$promises[t]=r)},clearNonprofitPromiseIfLatest(e,t,r){const s=this.nonprofits[e];s&&s.$promises?.[t]===r&&(s.$promises[t]=void 0)},async fetchNonprofitByEIN(e){try{const t=o().getDetails(e),r=await t;return r&&(this.nonprofits[e]=r),r}catch(t){console.error("Error fetching nonprofit by EIN:",t)}},async loadNonprofitRelatedContent(e){const t=this.nonprofits[e],r=g.RelatedContent;if(!t||t.relatedContent||this.nonprofitPromise(e,r))return;const s=o(),i=d().filters,n=s.getRelatedContent(e,i);this.storeNonprofitPromise(e,r,n),t.relatedContent=await n,await this.ensureLogosForNonprofits(t.relatedContent?.nonprofits||[]),this.clearNonprofitPromiseIfLatest(e,r,n)},async loadRelatedNonprofits(e){const t=this.nonprofits[e];if(!t)return void console.error("Nonprofit not found:",e);const r=o(),s=d().filters,i=g.RelatedNonprofits;let a;try{a=r.getRelatedNonprofits(e,s),this.storeNonprofitPromise(e,i,a);const o=await a;t.relatedContent?t.relatedContent.nonprofits=o:t.relatedContent={ein:e,nonprofits:o,articles:[]},await this.ensureLogosForNonprofits(o)}catch(l){n.isCancel(l)||console.error("Error loading related nonprofits:",l)}this.clearNonprofitPromiseIfLatest(e,i,a)},async ensureLogosForNonprofits(e){if(!e?.length)return;const t=e.map((e=>e.ein));await this.fetchLogos(t)},async fetchLogos(e){const t=e.filter((e=>!this.logos[e]));let r={};if(t.length>0)try{const e=o();r=await e.getLogos(t);for(const[t,s]of Object.entries(r))this.logos[t]=s}catch(i){console.error("Error fetching logos:",i)}const s={};for(const o of e)this.logos[o]&&(s[o]=this.logos[o]);return s},async fetchArticleById(e){try{if(this.gcArticle?.id==e)return this.gcArticle;this.gcArticle=null,this.loading=!0;const t=y().getArticleById(e),r=await t;return r&&(this.gcArticle=r,this.navigateToArticleByUrl(r.url)),r}catch(t){console.error("Error fetching article by id.",t)}finally{this.loading=!1}},async fetchArticleByName(e){try{if(!e)return;if(this.gcArticle&&this.gcArticle.url.includes(e))return this.gcArticle;this.gcArticle=null,this.loading=!0;const t=y().getArticleByName(e),r=await t;return r&&(this.gcArticle=r),r}catch(t){console.error("Error fetching article by name.",t)}finally{this.loading=!1}},async fetchPartnerArticleByName(e){try{if(!e)return;this.gcArticle=null,this.loading=!0;const t=y().getPartnerArticleByName(e),r=await t;return r&&(this.gcArticle=r),r}catch(t){console.error("Error fetching article by name.",t)}finally{this.loading=!1}},async fetchRelatedArticlesById(e){try{this.relatedArticles=null;const t=y().getRelatedArticlesById(e),r=await t;r&&(this.relatedArticles=r)}catch(t){console.error("Error fetching related articles by id.",t)}}}});
1export{g as N,y as a,d as b,m as u};

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.