// dispose of the item that was fetched


// fetches the associated data if it doesn't exist and increments the lock counter


// decrements the lock counter for the item and deletes the item if it has reached zero


// dispose all items


// releases an item with an optional force flag


// prioritize user-set bounds over projection bounds if present


// draw the given texture at the given span with the provided projection


// clear the set target


// the [ - 1, 1 ] NDC ranges to draw the texture at


// access the map being drawn


// iterates over all present tiles in the given tile set at the given level in the given range


// initialize the texture and resize it if needed


// dispose the fade texture. Super cannot be used here due to proxy


// initializes the batched mesh if it needs to be, dispose if it it's no longer needed


// helper for iterating over the batch ids for a given tile


// delete the object from the fade, reset the material data


// Returns whether a new state had to be added


// Force the fade to complete in the direction it is already trending


// Fade the object in


// Fade the object out


// Tick the fade timer for each actively fading object


// initialize materials in the object


// initialize the material


// callback( geometry, i0, i1, i2, barycoord );


// Removes all split operations


// clips an object hierarchy


// elements to include when clipping.


// Takes the set of resultant data and constructs a mesh


// Splits the given triangle


// Copy the indices from a target triangle


// Set the indices for the given


// Lerp the given vertex along to the provided edge of the provided triangle


// Copy a vertex from the provided triangle


// Read a vertex from the given attribute interpolated between the indices


// Hash the provided numbers


// increases the width of the target render target to support more data


// read data from the rendered texture asynchronously


// read data from the rendered texture


// takes the texture, pixel to read from, and pixel to render in to


// checks the structural metadata type


// check if the class property type is a float component type value


// check if the class property type is a vector type


// check if the class property type is a matrix type


// returns a value from the given buffer of the given type


// returns false if the given value is not of "type"


// resolve a full default value for the given property including arrays


// gets the default value of the given type


// replace the value with a default if no data is encountered


// checks if the given value is equal to the no data value


// the provided target value is normalized, scaled, and then offset if numeric


// provided then it will be used to specify the array length.


// Shape the "target" object based on the provided set of properties


// Returns the number of components required for the given type


// takes the buffer to read from and the value index to read


// dispose all of the texture data used


// reads an individual element


// enums are set to their integer value


// enums are set to a default string


// converts any instances of no data to the default value


// converts enums integers in the given target to strings


// geometry into a new one with only the relevant triangles.


// this CRS84 crs is the same as EPSG:4326 except the order of lat / lon are swapped


// parse a series of space-separated numbers


// expects lon, lat order


// parse layer <ResourceURL> tag


// parse layer <Dimension> tag


// parse <ows:WGS84BoundingBox> and <BoundingBox> tags


// parse tile matrix set <TileMatrix> tag


// Returns whether the passed color is white or not


// Adjusts the given material to take an ArrayTexture for a map


// Finds a free id that can fit the geometry with the requested ranges. Returns -1 if it could not be found.


// Overrides addGeometry to find an option geometry slot, expand, or optimized if needed


// add an instance and automatically expand the number of instances if necessary


// delete an instance, keeping note that the geometry id is now unused


// add a function for raycasting per tile


// init the batched mesh if it's not ready


// render the given into the given layer


// check if the array texture target needs to be expanded


// Override raycasting per tile to defer to the batched mesh


/**
 * Generates a JavScript file that adds an 'icons' variable to the window that contains a list of all icons.
 * Import the JavaScript file in our example for displaying icons.
 */


/**
	 * Multi-WCS astrometric projection.
	 * @param {leaflet.LatLng} latlng - Input world coordinates.
	 * @returns {leaflet.Point} Projected (merged) pixel coordinates.
	 */


/**
	 * Multi-WCS version of the astrometric de-projection.
	 * @param {leaflet.Point} pnt - Input (merged) pixel coordinates.
	 * @returns {leaflet.LatLng} De-projected world coordinates.
	 */


/**
	 * Return index of chip closest to the given pixel coordinates in a
	   multi-WCS setting.
	 * @param {leaflet.Point} pnt - Input (merged) pixel coordinates.
	 * @returns {number} Index of the closest chip (extension).
	 */


/**
	 * Compute the pixel coordinates of the geometric image center.
	 * @private
	 * @param {Projection} proj
	   Projection for pixel coordinates.
	 * @returns {leaflet.Point}
	   Pixel coordinates of the image center.
	 */


// 3. This notice may not be removed or altered from any source distribution.


// Level 2 QA_PIXEL band (CFMask) to mask unwanted pixels.


// QA_PIXEL band (CFMask) to mask unwanted pixels.


// Calendar -- A calendar instance


// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);


//applies functions for gathering, cloud masking, and cloud shadow masking Landsat imagery


/*function to calculate maximum value composite based on NDVI percentile
parameters: landsat image collection, studyarea, percentile value*/


///-------------------Landsat 8 OLI CLOUDMASK----------------


//Function to mask clouds using the Sentinel-2 QA band


//function to calculate EVI


//---------------Composite of Sentinel and Landsat Functions--------------///


/*
 Rover.js simulates a small spacecraft generating telemetry.
*/


/**
 * Basic historical telemetry plugin.
 */


/**
 * Basic Realtime telemetry plugin using websockets.
 */


/*
 Spacecraft.js simulates a small spacecraft generating telemetry.
*/


// Function to update the clip plane state


// Function to update controls after preset is selected


// worldToModel: Matrix4 taking world frame to model frame, or omit to infer as inverse of modelToWorld


// Add a layer to render and composite


// Removes a layer


// Composite all the render layers into a final target


/**
 * Decompress a TypedArray (in browser) or Buffer (in node)
 * containing LZF compressed data.
 * @param {(ArrayBuffer|TypedArray|Buffer)} data - the data to be decompressed
 * @returns {(ArrayBuffer|Buffer)} - decompressed data
 */


/**
 * Compress a buffer containing some data
 * @param {(ArrayBuffer|TypedArray|Buffer)} data - the data to be compressed
 * @returns {(ArrayBuffer|Buffer)} - compressed data
 */


//and we don't care about most of the others


// schedules (debounced) hierarchy refresh and emits (debounced) hierarchy-updated event


// forces a hierarchy refresh and emits (debounced) hierarchy-updated event


// if a hierarchy refresh is pending then force it to execute now and emit (debounced) hierarchy-updated event


// force a hierarchy refresh and emit (debounced) hierarchy-updated event


// every node's bounds need to be updated


//the returned ids are always integers, not strings


//unless includeDescendantsOfInternalNodesWithGeometry = true


// Adds cached values onto the hierarchy and initializes


// visibility of a node with its parents, etc


//neither paused nor stopped


/* Event Handler Helpers */


// from the protospace repo


//if cb never returns true then all triangles are enumerated and this function returns false


//length of triangles will be a multiple of 3


//the optional passed THREE.Vector3 position and normal and/or THREE.Color color avoid allocation


//returns { cut_mesh, tris }


//callback cb takes an array THREE.Vector3[3] of the vertices of an emitted triangle


//returns an interpolated vector in the same coordinate frame as the vectors in q


//array of random bytes and our index into it


// should have the same ordinal relationship to thresh as the passed value n


//   .catch(err => { console.log(err.message); })


//deal with fields that can be e.g. 0 or false


/**
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round#Decimal_rounding
 * Decimal adjustment of a number.
 *
 * @param {String}  type  The type of adjustment.
 * @param {Number}  value The number.
 * @param {Integer} exp   The exponent (the 10 logarithm of the adjustment base).
 * @returns {Number} The adjusted value.
 */


//     (and even if we define a canonical output range, we can't restrict the input range of xyzToQuat())


/*
 * Flattens a tree like this:
 *
 * {
 *     root: {
 *         val: 'a',
 *         children: [
 *             {
 *                 id: 1, val: 'b', children: [
 *                     { id: 2, val: 'c', children: [] },
 *                 ],
 *             },
 *             { id: 3, val: 'd', children: [] },
 *         ],
 *     },
 * }
 *
 * Into this:
 *
 * {
 *     "1": { id: 1, val: "b", children: [2] },
 *     "2": { id: 2, val: "c", children: [] },
 *     "3": { id: 3, val: "d", children: [] },
 *     "root": { id: "root", val: "a", children: [1, 3 ] }
 * }
 */


//return if user has exactly one node selected


/**
	 * Create a highlight material with clipping plane support
	 * @param {Object} color - Color object with r, g, b properties (0-1 range)
	 * @param {number} opacity - Opacity value (0-1 range)
	 * @returns {THREE.ShaderMaterial} Highlight material with clipping plane support
	 */


// Add a job


// run the jobs


/* A class handling everything associated with the search panel.

   Parameters:
   name - The name of the global variable that will be
          storing this instance.  Is needed to be able to set timeouts.
   resultPath - path to use for external files
*/


/* @class LatLng
 * @aka L.LatLng
 *
 * Represents a geographical point with a certain latitude and longitude.
 *
 * @example
 *
 * ```
 * var latlng = L.latLng(50.5, 30.5);
 * ```
 *
 * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
 *
 * ```
 * map.panTo([50, 30]);
 * map.panTo({lon: 30, lat: 50});
 * map.panTo({lat: 50, lng: 30});
 * map.panTo(L.latLng(50, 30));
 * ```
 *
 * Note that `LatLng` does not inherit from Leafet's `Class` object,
 * which means new classes can't inherit from it, and new methods
 * can't be added to it with the `include` function.
 */


/**
 * Query a CMR Search endpoint with optional parameters
 * @param {string} cmrUrl CMR search URL
 * @param {string} path CMR path to append to search URL (e.g., granules.json, collections.json)
 * @param {object} params Set of CMR parameters
 */


/**
 * Query a CMR Search endpoint with optional parameters using POST
 * @param {string} path CMR path to append to search URL (e.g., granules.json, collections.json)
 * @param {object} params Set of CMR parameters
 */


/**
 * Search CMR for granules matching CMR query parameters
 * @param {object} params Object of CMR Search parameters
 */


/**
 * Convert a STAC Collection ID to set of CMR query parameters
 * @param {string} providerId The CMR Provider ID
 * @param {string} collectionId The STAC Collection ID
 */


/**
 * Converts STAC parameter to equivalent CMR parameter
 * @param {string} providerId CMR Provider ID
 * @param {string} key The STAC field name
 * @param {string} value The STAC value
 */


/**
 * Converts STAC parameters to CMR parameters
 * @param {string} providerId CMR Provider ID
 * @param {object} params STAC parameters
 */


/**
 * Extensions with `prepare` functions modify the request parameters
 * @param params
 * @returns {{[p: string]: *}|{sort_key}}
 */


/**
 * Extensions with `format` functions modify the api response
 * @param result
 * @param options
 * @returns {{context: {limit: number, matched: number, returned: *}}}
 */


// Convert a GeoJSON Polygon to coordinates used in CMR queries


// Class for converting GeoJSON to CMR query parameters


// +Z axis passes through the north pole


// Normalized cross product


/**
 * Split a string on the first delimiter found. Returns the list of splits.
 * @param str
 * @param delimiters
 * @returns {*[]}
 */


/**
 * Handle single date case. End on the same day even if given a time.
 */


/**
 * Handle a given range, only convert to valid CMR query string.
 */


/**
 * Convert a datetime to a temporal range value.
 * If a single datetime is given, duplicate it to be the end of the range.
 * @param dateTimes
 * @returns {*}
 */


/**
 * Convert a date to a temporal range value.
 * If a single date is given, duplicate it to be the end of the range.
 * @param dates Array of dates, only the first 2 are used
 * @returns {string}
 */


/**
 * Converts a datetime string to a CMR temporal range.
 * If the value is a time, identity.
 * If the value is a datetime => CMR range
 * @param dateTime
 * @returns {string}
 */


/**
 * Circular min
 * @param lng0 - the first longitude
 * @param lng1  - the second longitude
 * @returns min - the left most longitude of the shortest arc joining the given longitudes
 */


/**
 * Finds simple bounding box with inflection to account for geodesic mapping
 * @param latlngs - an array of [lat, lng] coordinate pairs
 * @returns a bounding box in the form [S, W, N, E]
 */


/**
   * @returns Coordinate object
   */


/**
 *
 * @param bbox - An array of float coordinates in the format `[W, S, E, N]`
 * @param points - An array of of arrays of two float coordinates in the format [lon, lat]
 * @returns number[] - A single array of float coordinates in the format `[W, S, E, N]`
 */


/**
 * Join two bounding boxes to create a single box that is the minimal bounding box
 * encompassing the two.
 *
 * @param box1 - A bounding-box array of floats in the `[W, S, E, N]` format
 * @param box2 - A bounding-box array of floats in the `[W, S, E, N]` format
 * @returns number[] - A single combined bounding-box in the `[W, S, E, N]` format
 */


/**
 * Convert a CMR bounding box to GeoJSON
 *
 * @param cmrBox - Bounding box in CMR order [S, W, N, E]
 * @returns - Bounding box in GeoJSON order [W, S, E, N]
 */


/**
 * Fetch a list of cloud holding collections from CMR for the provider
 */


/**
 * Extract parameters from requst object
 * @param {Object} request - Request object
 */


/**
 * Returns a router.
 * @param cfg map of options.
 */


/**
 *
 * @param {string, array} value
 */


/**
 * Extract desired type from an href
 * @param href
 * @returns {string}
 */


/**
 * Function to take an object and a function name and replace with a
 * jest mock function.
 * @param obj object with property to mock
 * @param name string name of the property from the obj
 * @param returnVal The return value for the mock function
 * @returns {object} obj
 */


/**
 * Function to revert a mock to its original form.
 * @param obj object that has a mocked function
 * @param name string name of the property that was mocked.
 * @returns {object} obj
 */