var padLeft=function(a,b,c){for(;a.length<c;)a=b+a;return a},getDateString=function(a){return a.getFullYear()+"-"+padLeft(String(a.getUTCMonth()+1),"0",2)+"-"+padLeft(String(a.getUTCDate()),"0",2)},getISODateString=function(a){return getDateString(a)+"T"},getISODateTimeString=function(a){return getISODateString(a)+padLeft(String(a.getUTCHours()),"0",2)+":"+padLeft(String(a.getUTCMinutes()),"0",2)+":"+padLeft(String(a.getUTCSeconds()),"0",2)+"Z"},htmlTemplate=function(a,b){var c=$(a).html();return _.template(c,b)},utc=function(a,b,c,d,e,f,g){var h=new Date(Date.UTC.apply(null,arguments));return h};strHash=function(a){var b,c=0,d=a.length;for(b=0;d>b;++b)c=(c<<5)-c+a.charCodeAt(b),c&=2147483647;for(c=Number(c).toString(16);c.length<8;)c="0"+c;return c};var getCoverageXML=function(a,b){if(!a)throw new Error("Parameters 'coverageid' is mandatory.");b=b||{},subsetCRS=b.subsetCRS||"http://www.opengis.net/def/crs/EPSG/0/4326";var c=['<wcs:GetCoverage service="WCS" version="2.0.0" xmlns:wcs="http://www.opengis.net/wcs/2.0" xmlns:wcscrs="http://www.opengis.net/wcs/crs/1.0" xmlns:wcsmask="http://www.opengis.net/wcs/mask/1.0" xmlns:int="http://www.opengis.net/wcs/interpolation/1.0" xmlns:crs="http://www.opengis.net/wcs/crs/1.0">',"<wcs:CoverageId>"+a+"</wcs:CoverageId>"],d=[];return b.format&&c.push("<wcs:format>"+b.format+"</wcs:format>"),!b.bbox||b.subsetX||b.subsetY||(b.subsetX=[b.bbox[0],b.bbox[2]],b.subsetY=[b.bbox[1],b.bbox[3]]),b.subsetX&&c.push("<wcs:DimensionTrim><wcs:Dimension>x</wcs:Dimension><wcs:TrimLow>"+b.subsetX[0]+"</wcs:TrimLow><wcs:TrimHigh>"+b.subsetX[1]+"</wcs:TrimHigh></wcs:DimensionTrim>"),b.subsetY&&c.push("<wcs:DimensionTrim><wcs:Dimension>y</wcs:Dimension><wcs:TrimLow>"+b.subsetY[0]+"</wcs:TrimLow><wcs:TrimHigh>"+b.subsetY[1]+"</wcs:TrimHigh></wcs:DimensionTrim>"),b.mask&&d.push("<wcsmask:polygonMask>"+b.mask+"</wcsmask:polygonMask>"),b.multipart&&c.push("<wcs:mediaType>multipart/related</wcs:mediaType>"),c.push("<wcs:Extension>"),subsetCRS&&c.push("<crs:subsettingCrs>"+subsetCRS+"</crs:subsettingCrs>"),b.outputCRS&&c.push("<crs:outputCrs>"+b.outputCRS+"</crs:outputCrs>"),c.push("</wcs:Extension>"),c.push("</wcs:GetCoverage>"),c.join("")};