PageSourceSearch

https://seagrassspotter.org/chunk-C534OVUK.js

js seagrassspotter.org collected 2026-10-02 17:07:18 UTC 8,819 bytes, 1 lines download raw bytes

1import{a as b}from"./chunk-C7IADD4R.js";import{a as v}from"./chunk-A3HR2LEN.js";import{a as x}from"./chunk-7P27RJDN.js";import{a as y}from"./chunk-26GFPNAE.js";import{c as m}from"./chunk-FDSZTAV7.js";import{Z as F,ba as o}from"./chunk-6XLY2MTM.js";import{j as g}from"./chunk-SZAW6ZBW.js";var f=class a{year;month;day;static from(t){return t instanceof a?t:t?new a(t.year,t.month,t.day):null}constructor(t,e,s){this.year=d(t)?t:null,this.month=d(e)?e:null,this.day=d(s)?s:null}equals(t){return t!=null&&this.year===t.year&&this.month===t.month&&this.day===t.day}before(t){return t?this.year===t.year?this.month===t.month?this.day===t.day?!1:this.day<t.day:this.month<t.month:this.year<t.year:!1}after(t){return t?this.year===t.year?this.month===t.month?this.day===t.day?!1:this.day>t.day:this.month>t.month:this.year>t.year:!1}};function d(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}var n=class{filters=[];activeCount=0;isActive=!1;constructor(t){this.filters=t,this.countActive()}countActive(){let t=0;this.filters.forEach(e=>{e.checked&&t++}),this.activeCount=t,this.isActive=this.activeCount<this.filters.length}asString(){if(!this.isActive)return"all";let t="";return this.filters.forEach(e=>{e.checked&&(e.id==null?t+=e.text:t+=e.id,t+=",")}),t}},_=class a{constructor(t,e,s,i,r){this.explore=t;this.events=e;this.http=s;this.lang=i;this.questions=r;this.events.sightingDeleted.subscribe(()=>{this.filter()}),this.events.sightingChanged.subscribe(()=>{this.filter()}),this.events.sightingCreated.subscribe(()=>{this.filter()})}filteredSightings;totalNumber=0;activeFilterCount=0;totalFilterCount=0;customTextCount=0;countries;species;research_grade;algae;boats;depth;extensive;fishing;flowers;intertidal;shootLength;percentage_cover;moorings;observe;sediment;indexableFilters=[];dateUploadedFrom=null;dateUploadedTo=null;dateSpottedFrom=null;dateSpottedTo=null;firstUploadYear=2e3;firstSpottedYear=2e3;damages;water_temperature_measurement;recreational_activity;additionalSpecies;fishingGear;fishingCaught;flowering_density;fruiting_density;number_of_seeds;seed_length;water_temperature;textFilters=[];initialise(){return g(this,null,function*(){this.loadFilterOptions(),this.calculateDateRanges(),this.filter()})}calculateDateRanges(){let t=new Date,e=new Date;this.explore.sightings.forEach(s=>{let i=new Date(s.created_at);i<t&&(t=i);let r=new Date(s.date_spotted);r<e&&(e=r)}),this.firstUploadYear=t.getUTCFullYear(),this.firstSpottedYear=e.getUTCFullYear()}filter(){this.totalNumber=this.explore.sightings.length,this.filteredSightings=this.explore.sightings.filter(t=>{let e=!1;if(this.countries.filters.forEach(u=>{t.country==u.text&&u.checked&&(e=!0)}),this.countries.countActive(),!e)return!1;let s=!1;if(this.species.filters.forEach(u=>{t.species.forEach(c=>{c.display_name==u.text&&u.checked&&(s=!0)})}),this.species.countActive(),!s)return!1;for(var i=0;i<this.indexableFilters.length;i++)if(!this.checkForIndex(t,this.indexableFilters[i].filter,this.indexableFilters[i].key))return!1;for(var i=0;i<this.textFilters.length;i++){let c=t;if(this.textFilters[i].filter.countActive(),!this.textFilters[i].filter.filters[0].checked&&!c[this.textFilters[i].key]||!this.textFilters[i].filter.filters[1].checked&&c[this.textFilters[i].key])return!1}let r=new Date(t.created_at),l=new f(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate()),h=new Date(t.date_spotted),p=new f(h.getUTCFullYear(),h.getUTCMonth()+1,h.getUTCDate());return!(this.dateUploadedFrom!=null&&l.before(this.dateUploadedFrom)||this.dateUploadedTo!=null&&l.after(this.dateUploadedTo)||this.dateSpottedFrom!=null&&p.before(this.dateSpottedFrom)||this.dateSpottedTo!=null&&p.after(this.dateSpottedTo))}),this.activeFilterCount=0,this.indexableFilters.forEach(t=>{t.filter.isActive&&this.activeFilterCount++}),this.textFilters.forEach(t=>{t.filter.isActive&&this.activeFilterCount++}),this.countries.isActive&&this.activeFilterCount++,this.species.isActive&&this.activeFilterCount++,this.totalFilterCount=this.indexableFilters.length,this.totalFilterCount+=this.textFilters.length,this.totalFilterCount+=2,this.events.filterChanged.emit()}checkForIndex(t,e,s){let i=t,r=!1;
1return e.filters.forEach(l=>{l.id==i[s]&&l.checked&&(r=!0)}),e.countActive(),r}loadFilterOptions(){this.countries=new n(this.loadStringOptionsFromArray(this.explore.sightings,"country")),this.species=new n(this.loadSpeciesFromArray(this.explore.sightings)),this.algae=this.createFilterWithOptions("algae",this.questions.sightingQuestions.algae),this.depth=this.createFilterWithOptions("depth",this.questions.sightingQuestions.depth),this.boats=this.createFilterWithOptions("boats",this.questions.sightingQuestions.boats),this.extensive=this.createFilterWithOptions("extensive",this.questions.sightingQuestions.extensive),this.fishing=this.createFilterWithOptions("fishing",this.questions.sightingQuestions.fishing),this.flowers=this.createFilterWithOptions("flowers",this.questions.sightingQuestions.flowers),this.intertidal=this.createFilterWithOptions("intertidal",this.questions.sightingQuestions.intertidal),this.shootLength=this.createFilterWithOptions("length",this.questions.sightingQuestions.length),this.percentage_cover=this.createFilterWithOptions("percentage_cover",this.questions.sightingQuestions.percentage_cover),this.moorings=this.createFilterWithOptions("moorings",this.questions.sightingQuestions.moorings),this.observe=this.createFilterWithOptions("observe",this.questions.sightingQuestions.observe),this.sediment=this.createFilterWithOptions("sediment",this.questions.sightingQuestions.sediment),this.damages=new n(this.loadUserTextFilters()),this.fishingCaught=new n(this.loadUserTextFilters()),this.fishingGear=new n(this.loadUserTextFilters()),this.additionalSpecies=new n(this.loadUserTextFilters()),this.recreational_activity=new n(this.loadUserTextFilters()),this.water_temperature_measurement=new n(this.loadUserTextFilters()),this.textFilters.push({filter:this.damages,key:"damages"}),this.textFilters.push({filter:this.fishingCaught,key:"fishing_caught"}),this.textFilters.push({filter:this.fishingGear,key:"fishing_gear"}),this.textFilters.push({filter:this.additionalSpecies,key:"additional_species"}),this.flowering_density=new n(this.loadUserTextFilters()),this.fruiting_density=new n(this.loadUserTextFilters()),this.number_of_seeds=new n(this.loadUserTextFilters()),this.seed_length=new n(this.loadUserTextFilters()),this.water_temperature=new n(this.loadUserTextFilters()),this.textFilters.push({filter:this.flowering_density,key:"flowering_density"}),this.textFilters.push({filter:this.fruiting_density,key:"fruiting_density"}),this.textFilters.push({filter:this.number_of_seeds,key:"number_of_seeds"}),this.textFilters.push({filter:this.seed_length,key:"seed_length"}),this.textFilters.push({filter:this.water_temperature,key:"water_temperature"}),this.textFilters.push({filter:this.water_temperature_measurement,key:"water_temperature_measurement"}),this.textFilters.push({filter:this.recreational_activity,key:"recreational_activity"});let t=new Array;t.push({text:"research_grade",checked:!0,id:0}),t.push({text:"research_grade",checked:!0,id:1}),t.push({text:"research_grade",checked:!0,id:2}),t.push({text:"research_grade",checked:!0,id:3});let e=new n(t);this.indexableFilters.push({filter:e,key:"research_grade"}),this.research_grade=e}createFilterWithOptions(t,e){let s=new Array;s.push({text:"filters.no_data",checked:!0,id:0});for(let r in e.a)s.push({text:e.a[r],checked:!0,id:+r});let i=new n(s);return this.indexableFilters.push({filter:i,key:t}),i}loadUserTextFilters(){let t=new Array;return t.push({text:"filters.no_data",checked:!0,id:0}),t.push({text:"filters.user_data",checked:!0,id:1}),t}loadStringOptionsFromArray(t,e,s=!0){let i=new Set;for(let l=0;l<t.length;l++){let h=t[l];h.hasOwnProperty(e)?i.add(h[e]):console.warn("Unable to get child name "+e)}let r=new Array;return i.forEach(l=>{r.push({text:l,checked:!0})}),s&&r.sort(function(l,h){return l.text<h.text?-1:l.text>h.text?1:0}),r}loadSpeciesFromArray(t){let e=new Set;for(let i=0;i<t.length;i++){let r=t[i];t[i].species.forEach(l=>{e.add(l.display_name)})}let s=new Array;return e.forEach(i=>{s.push({text:i,checked:!0})}),s.sort(function(i,r){return i.text<r.text?-1:i.text>r.text?1:0}),s}
1selectNone(t){t.forEach(e=>{e.checked=!1}),this.filter()}selectAll(t){t.forEach(e=>{e.checked=!0}),this.filter()}setFilterVisibility(t){this.events.showFilter.emit(t)}reset(){this.indexableFilters.forEach(t=>{this.selectAll(t.filter.filters)}),this.textFilters.forEach(t=>{this.selectAll(t.filter.filters)}),this.selectAll(this.countries.filters),this.selectAll(this.species.filters)}static \u0275fac=function(e){return new(e||a)(o(v),o(y),o(m),o(x),o(b))};static \u0275prov=F({token:a,factory:a.\u0275fac,providedIn:"root"})};export{_ as a};

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.