@metoceanapi/wxtiles-leaflet 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +10 -32
- package/dist/es/controls/WxAPIControl.d.ts +4 -2
- package/dist/es/controls/WxStyleEditorControl.d.ts +5 -0
- package/dist/es/controls/WxTimeControl .d.ts +1 -1
- package/dist/es/customlayer/customlayer.d.ts +2 -0
- package/dist/es/index.d.ts +14 -17
- package/dist/es/index.js +2 -2
- package/dist/es/utils/RawCLUT.d.ts +9 -8
- package/dist/es/utils/qtree.d.ts +6 -4
- package/dist/es/utils/tests_wxtools.d.ts +1 -0
- package/dist/es/utils/wxtools.d.ts +32 -5
- package/dist/es/wxAPI/WxAPI.d.ts +63 -0
- package/dist/es/wxAPI/WxAPItypes.d.ts +152 -0
- package/dist/es/wxAPI/WxDataSetManager.d.ts +67 -90
- package/dist/es/wxlayer/WxImplementation.d.ts +36 -16
- package/dist/es/wxlayer/loader.d.ts +3 -5
- package/dist/es/wxlayer/loadertools.d.ts +1 -1
- package/dist/es/wxlayer/painter.d.ts +1 -1
- package/dist/es/wxlayer/wxlayer.d.ts +51 -26
- package/dist/es/wxsource/wxsource.d.ts +3 -1
- package/dist/es/wxsource/wxsourcetypes.d.ts +2 -1
- package/dist/web/index.js +2 -2
- package/docs/docs/assets/highlight.css +4 -4
- package/docs/docs/assets/main.js +56 -52
- package/docs/docs/assets/search.js +1 -1
- package/docs/docs/assets/style.css +27 -5
- package/docs/docs/{interfaces/WxDataSetsMetasJSON.html → classes/CustomWxTilesLayer.html} +16 -23
- package/docs/docs/classes/DataIntegral.html +13 -13
- package/docs/docs/classes/Loader.html +17 -24
- package/docs/docs/classes/Painter.html +11 -11
- package/docs/docs/classes/QTree.html +63 -34
- package/docs/docs/classes/RawCLUT.html +8 -8
- package/docs/docs/classes/TilesCache.html +108 -0
- package/docs/docs/classes/WxAPI.html +33 -106
- package/docs/docs/classes/WxDataSetManager.html +115 -181
- package/docs/docs/classes/WxLayer.html +95 -58
- package/docs/docs/classes/WxLayerBaseImplementation.html +52 -43
- package/docs/docs/classes/WxTileSource.html +63 -47
- package/docs/docs/enums/TileType.html +4 -4
- package/docs/docs/functions/WXLOG.html +11 -8
- package/docs/docs/functions/WxCreateLegend.html +13 -10
- package/docs/docs/functions/WxGetColorSchemes.html +11 -8
- package/docs/docs/functions/WxGetColorStyles.html +11 -8
- package/docs/docs/functions/WxTilesLogging.html +11 -8
- package/docs/docs/index.html +23 -21
- package/docs/docs/interfaces/CachedUriLoaderPromiseFunc.html +106 -0
- package/docs/docs/interfaces/ColorStylesIncomplete.html +11 -8
- package/docs/docs/interfaces/Converter.html +5 -3
- package/docs/docs/interfaces/DataPicture.html +5 -5
- package/docs/docs/interfaces/FrameworkOptions.html +5 -4
- package/docs/docs/interfaces/IntegralPare.html +3 -3
- package/docs/docs/interfaces/SLinePoint.html +3 -3
- package/docs/docs/interfaces/Tree.html +2 -2
- package/docs/docs/interfaces/WxAPIOptions.html +15 -15
- package/docs/docs/interfaces/WxAllBoundariesMeta.html +4 -4
- package/docs/docs/interfaces/WxAllDatasetsShortMetas.html +120 -0
- package/docs/docs/interfaces/WxBoundaryMeta.html +5 -5
- package/docs/docs/interfaces/WxColorSchemes.html +11 -8
- package/docs/docs/interfaces/WxColorStyleStrict.html +47 -25
- package/docs/docs/interfaces/WxColorStyleWeak.html +48 -25
- package/docs/docs/interfaces/WxColorStylesStrict.html +2 -2
- package/docs/docs/interfaces/WxColorStylesWeakMixed.html +11 -8
- package/docs/docs/interfaces/WxData.html +3 -3
- package/docs/docs/interfaces/WxDataSetManagerOptions.html +12 -12
- package/docs/docs/interfaces/WxDatasetMeta.html +18 -9
- package/docs/docs/interfaces/WxDatasetShortMeta.html +5 -5
- package/docs/docs/interfaces/WxLayerAPI.html +92 -26
- package/docs/docs/interfaces/WxLayerBaseAPI.html +21 -21
- package/docs/docs/interfaces/WxLayerOptions.html +9 -10
- package/docs/docs/interfaces/WxLegend.html +7 -7
- package/docs/docs/interfaces/WxLngLat.html +3 -3
- package/docs/docs/interfaces/WxRasterData.html +6 -6
- package/docs/docs/interfaces/WxRequestInit.html +2 -2
- package/docs/docs/interfaces/WxSourceLayerOptions.html +8 -5
- package/docs/docs/interfaces/WxTick.html +5 -5
- package/docs/docs/interfaces/WxTileInfo.html +9 -9
- package/docs/docs/interfaces/WxUnits.html +11 -8
- package/docs/docs/interfaces/WxVariableMeta.html +6 -6
- package/docs/docs/interfaces/WxVariablesMetas.html +11 -8
- package/docs/docs/interfaces/XYZ.html +4 -4
- package/docs/docs/modules.html +20 -14
- package/docs/docs/types/DataIntegrals.html +11 -8
- package/docs/docs/types/DataPictures.html +11 -8
- package/docs/docs/types/ListenerMethod.html +129 -0
- package/docs/docs/types/SLine.html +11 -8
- package/docs/docs/types/SubTrees.html +11 -8
- package/docs/docs/types/SubTreesN.html +11 -8
- package/docs/docs/types/TreeN.html +11 -8
- package/docs/docs/types/WxDate.html +19 -9
- package/docs/docs/types/{UriLoaderPromiseFunc.html → WxEventType.html} +17 -31
- package/docs/docs/types/{WxVars.html → WxInstances.html} +15 -14
- package/docs/docs/types/WxLayerVarsNames.html +113 -0
- package/docs/docs/types/WxURIs.html +11 -8
- package/docs/docs/types/WxUnitTuple.html +11 -8
- package/docs/examples/interactive.html +84 -0
- package/docs/examples/seaMaskAndAnimatedBlur.html +30 -22
- package/docs/examples/simpleDemo.html +32 -21
- package/docs/script/script.js +13 -9
- package/package.json +6 -7
- package/src_example/frwrkdeps.ts +6 -3
- package/src_example/index.ts +31 -54
- package/src_example/start.ts +39 -18
- package/watch-public.mjs +93 -0
- package/dist/es/wxAPI/wxAPI.d.ts +0 -192
- package/docs/docs/classes/FrameworkParentClass.html +0 -98
- package/docs/docs/interfaces/WxTilesLibOptions.html +0 -92
|
@@ -79,7 +79,9 @@ export declare class WxTileSource extends WxLayerBaseImplementation implements W
|
|
|
79
79
|
protected createTile(coords: L.Coords, done: L.DoneCallback): HTMLElement;
|
|
80
80
|
/**
|
|
81
81
|
* @internal
|
|
82
|
-
* @description
|
|
82
|
+
* @description Called when the layer is removed from a map.
|
|
83
|
+
* @param {L.Map} map - The map instance.
|
|
84
|
+
* @returns {this} - The WxTileSource instance.
|
|
83
85
|
*/
|
|
84
86
|
onRemove(map: L.Map): this;
|
|
85
87
|
}
|
|
@@ -10,7 +10,8 @@ export declare class FrameworkParentClass extends L.GridLayer {
|
|
|
10
10
|
constructor(options: FrameworkOptions);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Framework
|
|
13
|
+
* Framework dependent options for constructing a layer.
|
|
14
|
+
* Inherits from *L.GridLayerOptions*.
|
|
14
15
|
* @example
|
|
15
16
|
* ```ts
|
|
16
17
|
* const leafletOptions: FrameworkOptions = { opacity: 1, attribution: 'WxTiles' };
|
package/dist/web/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var wxtilesleaflet=(()=>{var Xe=Object.create;var Z=Object.defineProperty,Oe=Object.defineProperties,Fe=Object.getOwnPropertyDescriptor,Ze=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertyNames,ue=Object.getOwnPropertySymbols,Ye=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var de=(a,e,t)=>e in a?Z(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,C=(a,e)=>{for(var t in e||(e={}))fe.call(e,t)&&de(a,t,e[t]);if(ue)for(var t of ue(e))qe.call(e,t)&&de(a,t,e[t]);return a},xe=(a,e)=>Oe(a,Ze(e));var je=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ge=(a,e)=>{for(var t in e)Z(a,t,{get:e[t],enumerable:!0})},ge=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ee(e))!fe.call(a,n)&&n!==t&&Z(a,n,{get:()=>e[n],enumerable:!(r=Fe(e,n))||r.enumerable});return a};var ze=(a,e,t)=>(t=a!=null?Xe(Ye(a)):{},ge(e||!a||!a.__esModule?Z(t,"default",{value:a,enumerable:!0}):t,a)),Ke=a=>ge(Z({},"__esModule",{value:!0}),a);var p=(a,e,t)=>new Promise((r,n)=>{var s=l=>{try{o(t.next(l))}catch(m){n(m)}},i=l=>{try{o(t.throw(l))}catch(m){n(m)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,i);o((t=t.apply(a,e)).next())});var Be=je((Jt,Ve)=>{Ve.exports=window.L});var ht={};Ge(ht,{FrameworkParentClass:()=>X,Loader:()=>V,Painter:()=>B,QTree:()=>U,RawCLUT:()=>$,WXLOG:()=>c,WxAPI:()=>ee,WxCreateLegend:()=>oe,WxDataSetManager:()=>F,WxGetColorSchemes:()=>q,WxGetColorStyles:()=>R,WxLayer:()=>N,WxTileSource:()=>O,WxTilesLogging:()=>De});var he={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var pe={none:["#00000000","#00000000"],divergingbluered:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbowzerro:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow2:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebirdzerro:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bw:["#000000ff","#ffffffff"],wb:["#ffffffff","#000000ff"],redish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]};var Y={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"divergingbluered",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var be,ye,We;function we({colorStyles:a={},units:e={},colorSchemes:t={}}={}){c("WxTile lib setup: start"),be=Object.assign({},he,e),ye=Object.assign({},t,pe);let r=Object.assign({},a,Y);We=He(r),c("WxTile lib setup: styles unrolled");try{p(this,null,function*(){yield document.fonts.load("32px barbs"),yield document.fonts.load("32px arrows")})}catch(n){c("WxTile lib setup: fonts not loaded")}c("WxTile lib setup is done.")}function R(){return We}function q(){return ye}function j(a,e,t){c("makeConverter: From=",a," To=",e);let r=d=>d;if(r.trivial=!0,a===e)return c("Trivial converter"),r;let n=Object.assign({},be,t),s=n[a],i=n[e];if(!s||!i)return c("Inconvertible units. Trivial converter"),r;let[o,l,m]=s,[u,f,x]=i;if(o!==u||!l||!f)return c("Inconvertible units. Trivial converter"),r;let b=l/f,g=((m||0)-(x||0))/f;return g?d=>b*d+g:d=>b*d}function He(a){let e=Object.assign({},Y);for(let s in a){let i=a[s];if(Array.isArray(i))for(let o=0;o<i.length;++o)e[s+"["+o+"]"]=Object.assign({},i[o]);else e[s]=Object.assign({},i)}let t=Object.assign({},Y.base),r=(s,i)=>{if(i==="base")return t;let o=s[i];if(!o)return t;(!o.parent||!(o.parent in s))&&(o.parent="base");let l=r(s,o.parent);return Object.assign(o,Object.assign({},l,o,{parent:"base"}))},n={base:t};for(let s in e)n[s]=r(e,s);return n}function E(a){let e=new Map;return(t,...r)=>{let n=e.get(t);if(n)return n;let s=a(t,...r);return e.set(t,s),s.catch(i=>i.name==="AbortError"&&e.delete(t)),s}}function Je(a,e){return p(this,null,function*(){return createImageBitmap(yield(yield fetch(a,e)).blob())})}var re=class{constructor(e,t,r,n){this.raw=e;this.dmin=t;this.dmax=r;this.dmul=n;this.radius=0}get integral(){return this.integral_||(this.integral_=tt(this.raw))}};function _(a,e,t=!0){let r=Object.assign(document.createElement("canvas"),{width:a,height:e,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:t});if(!r)throw new Error("Cannot get canvas context");return r}function Qe(a){let{width:e,height:t}=a,r=_(e,t);return r.drawImage(a,0,0),r.getImageData(0,0,e,t)}function ae(a,e){return p(this,null,function*(){return Qe(yield Je(a,e))})}function et(a){a.data[34]<1&&c("Warning: image is in too old format. Check the version of the Splitter.");let e=new Uint16Array(a.data.buffer),t=new Uint16Array(e.length/2);for(let l=0;l<t.length;l++)t[l]=e[l*2];let r=new Uint8Array(8);for(let l=0;l<8;++l)r[l]=a.data[l*4+2];let n=new DataView(r.buffer),s=n.getFloat32(0,!0),i=n.getFloat32(4,!0),o=(i-s)/65535;return new re(t,s,i,o)}function ne(a,e){return p(this,null,function*(){return et(yield ae(a,e))})}function tt(a){let e=new Uint32Array(66564),t=new Uint32Array(258*258);e[0]=a[0],t[0]=a[0]===0?0:1;for(let r=1;r<258;++r)e[r]=a[r]+e[r-1],e[258*r]=a[258*r]+e[258*r-258],t[r]=(a[r]===0?0:1)+t[r-1],t[258*r]=(a[258*r]===0?0:1)+t[258*r-258];for(let r=1,n=259;r<258;++r,++n)for(let s=1;s<258;++s,++n)e[n]=a[n]+e[n-258]+e[n-1]-e[n-258-1],t[n]=(a[n]===0?0:1)+t[n-258]+t[n-1]-t[n-258-1];return{integral:e,integralNZ:t}}function Se(a,e){if(e<0||e===a.radius)return a;a.radius=e;let t=258,{integral:r,integralNZ:n}=a.integral;for(let s=1;s<t;s++)for(let i=1;i<t;i++){if(!a.raw[t*s+i])continue;let o=Math.min(e,i-1,t-1-i),l=Math.min(e,s-1,t-1-s),m=t*(s-l-1)+i,u=t*(s+l)+i,f;if(n){let y=n[m-o-1],W=n[m+o],w=n[u-o-1],M=n[u+o];f=y+M-W-w}else f=(2*o+1)*(2*l+1);let x=r[m-o-1],b=r[m+o],g=r[u-o-1],d=r[u+o],h=x+d-b-g;a.raw[s*t+i]=h/f}return a}function T(a){let e=a>>0&255,t=a>>8&255,r=a>>16&255,n=e.toString(16),s=t.toString(16),i=r.toString(16);return n=n.length===2?n:"0"+n,s=s.length===2?s:"0"+s,i=i.length===2?i:"0"+i,"#"+n+s+i}function L(a){if(a[0]==="#"){if(a.length===4)return+("0xff"+a[3]+a[3]+a[2]+a[2]+a[1]+a[1]);if(a.length===7)return+("0xff"+a[5]+a[6]+a[3]+a[4]+a[1]+a[2]);if(a.length===9)return+("0x"+a[7]+a[8]+a[5]+a[6]+a[3]+a[4]+a[1]+a[2])}return c("wrong color format",a),0}function A(a,e){return p(this,null,function*(){let t=yield fetch(a,e);if(!t.ok)throw new Error("error:"+a+" - "+t.statusText);return t.json()})}function se(a,e,t){let r=a>>0&255,n=a>>8&255,s=a>>16&255,i=a>>>24,o=e>>0&255,l=e>>8&255,m=e>>16&255,u=e>>>24,f=r+t*(o-r),x=n+t*(l-n),b=s+t*(m-s),g=i+t*(u-i);return f|x<<8|b<<16|g<<24}function Me(a,e,t){let r=[];for(let n=0;n<t;++n)r.push(n*(e-a)/(t-1)+a);return r}var te=!1,c=(...a)=>{};function De(a){te=!!a,console.log("WXLOGing",te),c=typeof a=="function"?a:te?console.log:()=>{}}function ie(a){return a[0]==="#"&&a.length===4?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:a}function G(a,{x:e,y:t,z:r}){return a.replace("{x}",`${e}`).replace("{y}",`${t}`).replace("{z}",`${r}`)}function z({x:a,y:e,z:t}){return`${t}-${a}-${e}`}var rt="A".charCodeAt(0);var U=class{constructor(){this.qtree={nodes:null};this.qtreedepth=0;c("QTree.constructor")}load(e,t){return p(this,null,function*(){try{let r=yield A(e,t);this.qtree=Te(r,{pos:0})}catch(r){throw new Error(`Failed to load QTree: ${r.message}`)}this.qtreedepth=Ce(this.qtree),c(`QTree.load: qtreedepth=${this.qtreedepth}`)})}check(e){let t=e.z-this.qtreedepth,r=t>=0,n=r?{x:e.x>>t,y:e.y>>t,z:this.qtreedepth}:C({},e);return Ie(this.qtree,n,r)}};function Te(a,e){let t=a.charCodeAt(e.pos)-rt;e.pos++;let r=[1,2,4,8].map(n=>t&n?Te(a,e):null);return{nodes:r.some(n=>n)?r:null}}function Ce(a){return a!=null&&a.nodes?1+Math.max(...a.nodes.map(Ce)):0}function Ie(a,e,t){return a===null?"land":t&&!e.z?"mixed":a.nodes===null?"sea":e.z?(e.z--,Ie(a.nodes[(e.y>>e.z&1)<<1|e.x>>e.z&1],e,t)):"mixed"}function at(a,e,t){return a>t?t:a<e?e:a}var $=class{constructor(e,t,[r,n],s){c("RawCLUT.constructor");let i=n-r;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let o=[];this.DataToStyle=j(t,e.units,e.extraUnits),this.DataToStyle.trivial&&(e.units=t),s&&(this.DataToKnots=j(t,"knot"));let l=j(e.units,t,e.extraUnits),m=d=>~~(65535*at((l(d)-r)/(n-r),0,1));if(Array.isArray(e.colorMap)){e.colorMap.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);for(let[d]of e.colorMap)o.push(m(d))}else{if(e.levels||(e.levels=Me(this.DataToStyle(r),this.DataToStyle(n),10)),e.levels.sort((d,h)=>d<h?-1:d>h?1:0),!e.colors){let d=q();e.colorScheme&&e.colorScheme in d?e.colors=d[e.colorScheme]:e.colors=d.wb}for(let d of e.levels)o.push(m(d))}let u=65536,f=oe(u,e);this.ticks=f.ticks;let x=f.ticks[0].data,g=f.ticks[f.ticks.length-1].data-x;for(let d=0;d<65536;++d){let h=i*d/65535+r,y=this.DataToStyle(h),W=Math.round((u-1)*(y-x)/g);W<=0?this.colorsI[d]=e.showBelowMin?f.colors[0]:0:W>=u?this.colorsI[d]=e.showAboveMax?f.colors[u-1]:0:this.colorsI[d]=f.colors[W]}this.colorsI[0]=0;for(let d=0;d<o[0];++d)this.levelIndex[d]=0;for(let d=0;d<o.length-1;d++)for(let h=o[d];h<o[d+1]+1;++h)this.levelIndex[h]=d;for(let d=o[o.length-1];d<65536;++d)this.levelIndex[d]=o.length-1}};function Le(a){var t;if(a!==0&&-.1<a&&a<.1)return a.toExponential(2);let e=a.toString();return((t=e.split(".")[1])==null?void 0:t.length)>2?a.toFixed(2):e}function oe(a,e){let t={size:a,showBelowMin:e.showBelowMin,showAboveMax:e.showAboveMax,units:e.units,colors:new Uint32Array(a),ticks:[]},{colorMap:r,levels:n,colors:s}=e,i=e.fill!=="solid";if(r){let x=r[0][0],b=r[r.length-1][0]-x;for(let[g,d]of r){let h=~~((g-x)/b*(a-1)),y={data:g,dataString:Le(g),color:d,pos:h};t.ticks.push(y)}for(let g=0;g<r.length-1;g++){let d=t.ticks[g].pos,h=t.ticks[g+1].pos,y=L(r[g][1]),W=i?L(r[g+1][1]):0;for(let w=d;w<h;++w)t.colors[w]=i?se(y,W,(w-d)/(h-d)):y}return t.colors[a-1]=L(r[r.length-1][1]),t}if(!s||!n)return t;let o=0,l=0,m=-1;for(let x=0;x<a;++x){let b=x*(s.length-1)/a;m!==~~b&&(m=~~b,o=L(s[m]),l=s.length>m+1?L(s[m+1]):o),t.colors[x]=i?se(o,l,b-m):o}t.colors[a-1]=L(s[s.length-1]);let u=n[0],f=(a-1)/(n[n.length-1]-u);for(let x of n){let b=~~((x-u)*f),g={data:x,dataString:Le(x),color:T(t.colors[b]),pos:b};t.ticks.push(g)}return t}var nt=2*Math.PI*6378137/256,K=2*Math.PI*6378137/2;function st(a,e){let t=a/K*180,r=e/K*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),[r,t]}function it(a,e,t){let r=ot(t),n=a*r-K,s=e*r-K;return[n,s]}function ot(a){return nt/Math.pow(2,a)}function le(a,e,t){let[r,n]=st(...it(a,e,t));return[n,-r]}function ve(a,e){return[a*256,e*256]}function ce(a,e,t){let r=((e-a)%360+540)%360-180;return(a+r*t+360)%360}function lt(a,e,t,r,n,s,i,o){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 0:return 0;case 1:return a;case 2:return e;case 3:t=a,r=e;break;case 4:return t;case 5:e=a,r=t;break;case 6:r=e+t>>1,a=r;break;case 7:r=e+t>>1;break;case 8:return r;case 9:e=a+r>>1,t=e;break;case 10:a=e,t=r;break;case 11:t=a+r>>1;break;case 12:a=t,e=r;break;case 13:e=a+r>>1;break;case 14:a=e+t>>1;break}a=i+o*a,e=i+o*e,t=i+o*t,r=i+o*r;let m=ce(a,e,n),u=ce(t,r,n);return(ce(m,u,s)-i)/o||1}function Pe(a,e,t,r,n,s,i,o){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 7:return n+s<1?n*(e-a)+s*(t-a)+a:0;case 14:return n+s<1?0:n*(r-t)+s*(r-e)+e+t-r;case 11:return s<n?(1-n)*(a-e)+s*(r-e)+e:0;case 13:return s<n?0:(1-n)*(t-r)+s*(t-a)+a+r-t;case 15:return n+s<1?n*(e-a)+s*(t-a)+a:n*(r-t)+s*(r-e)+e+t-r;default:return 0}}function ke(a,e,t){let r=1/Math.pow(2,t.z),n=t.x*256*r-.5,s=t.y*256*r-.5,{raw:i,dmin:o,dmax:l,dmul:m}=e,u={raw:new Uint16Array(258*258),dmin:o,dmax:l,dmul:m},{raw:f}=u;for(let x=-1,b=0,g=s-r+1;x<=256;x++,g+=r){let d=Math.floor(g),h=g-d,y=d*258;for(let W=-1,w=n-r+1;W<=256;W++,b++,w+=r){let M=Math.floor(w),D=w-M,S=M+y,I=i[S],v=i[S+1],P=i[S+258],k=i[S+258+1];f[b]=a(I,v,P,k,D,h,o,m)}}return u}function Ae(a,e,t){if(!e)return a;let r=u=>u<0?0:u>254?254:u,n=1/Math.pow(2,e.z),s=e.x*256*n-.5,i=e.y*256*n-.5,{data:o}=a,l=new ImageData(256,256),{data:m}=l;for(let u=0,f=t,x=i;u<256;u++,x+=n){let b=~~r(x),g=x-b,d=b*256;for(let h=0,y=s;h<256;h++,f+=4,y+=n){let W=~~r(y),w=y-W,M=(W+d)*4+t,D=o[M],S=o[M+4],I=o[M+4*256],v=o[M+4*256+4],P=Pe(D,S,I,v,w,g,0,0);m[f]=P>127?255:0}}return l}function Re(a,e){return e?ke(Pe,a,e):a}function _e(a,e){return e?ke(lt,a,e):a}function Ue(a,{data:e},t,r){let n=r==="sea",{raw:s}=a;for(let i=t,o=259,l=0;l<256;o+=2,l++)for(let m=0;m<256;m++,o++,i+=4)n===!e[i]&&(s[o]=0);return a}function $e(a){let[e,t]=ve(a.x,a.y),[r,n]=le(e,t,a.z),[s,i]=le(e+256,t+256,a.z);return{west:r,north:n,east:s,south:i}}function me(a,e){let t=a.z-e;if(t<=0)return{upCoords:a};let r={x:a.x>>>t,y:a.y>>>t,z:e},n={x:a.x&(1<<t)-1,y:a.y&(1<<t)-1,z:t};return{upCoords:r,subCoords:n}}var V=class{constructor(e){this.loadDataFunc=E(ne);this.layer=e,this.wxAPI=e.wxdatasetManager.wxAPI}load(e,t){return p(this,null,function*(){let r=yield this.cacheLoad(e,this.layer.tilesURIs,t);if(!r)return null;let{rawdata:n,subCoords:s,tileType:i}=r,{units:o}=this.layer.currentVariableMeta,l=o==="degree"?_e:Re,m=f=>l(Se(f,this.layer.style.blurRadius),s),u=n.map(m);return this._vectorMagnitudesPrepare(u),yield this._applyMask(u,e,i,!s&&n.length===1),{data:u,slines:this._createStreamLines(u)}})}cacheLoad(e,t,r){return p(this,null,function*(){if(!this._checkInsideBoundaries(e))return null;let n=this._checkTypeAndMask(e);if(!n)return null;let{upCoords:s,subCoords:i}=me(e,this.layer.getMaxZoom()),o=t.map(u=>G(u,s)),l=Object.assign({},this.wxAPI.requestInit,{signal:r==null?void 0:r.signal});return{rawdata:yield Promise.all(o.map(u=>this.loadDataFunc(u,l))),subCoords:i,tileType:n}})}clearCache(){this.loadDataFunc=E(ne)}_applyMask(e,t,r,n){return p(this,null,function*(){let{style:s}=this.layer;if((s.mask==="land"||s.mask==="sea")&&r==="mixed"){if(n){let{raw:o,dmin:l,dmax:m,dmul:u}=e[0];e[0]={raw:new Uint16Array(o),dmin:l,dmax:m,dmul:u}}let i;try{let{upCoords:o,subCoords:l}=me(t,this.wxAPI.maskDepth);i=yield this.wxAPI.loadMaskFunc(o),i=Ae(i,l,this.wxAPI.maskChannel)}catch(o){s.mask=void 0,c("Can't load Mask. Masking is disabled");return}Ue(e[0],i,this.wxAPI.maskChannel,s.mask)}})}_vectorMagnitudesPrepare(e){if(e.length===1)return;e.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,r,n]=e;t.dmax=1.42*Math.max(-r.dmin,r.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let s=0;s<258*258;++s){if(!r.raw[s]||!n.raw[s])continue;let i=r.dmin+r.dmul*r.raw[s],o=n.dmin+n.dmul*n.raw[s];t.raw[s]=Math.sqrt(o*o+i*i)/t.dmul}}_checkTypeAndMask(e){let{mask:t}=this.layer.style;if(t==="land"||t==="sea"){let r=this.wxAPI.qtree.check(e);return t===r?void 0:r}return"mixed"}_checkInsideBoundaries(e){let t=this.layer.getBoundaries();if(t!=null&&t.boundaries180){let r=$e(e),n=s=>!(r.west>s.east||s.west>r.east||r.south>s.north||s.south>r.north);if(!t.boundaries180.some(n))return!1}return!0}_createStreamLines(e){if(e.length!==3)return[];let{style:t}=this.layer;if(t.streamLineColor==="none")return[];let r=[],[n,s,i]=e,o=(t.streamLineSpeedFactor||1)/n.dmax,l=t.addDegrees?.017453292519943*t.addDegrees:0,m=t.streamLineGridStep||64,u=t.streamLineSteps||300;for(let f=0;f<=256;f+=m)for(let x=0;x<=256;x+=m){if(!n.raw[1+x+(1+f)*258])continue;let b=[],g=x,d=f,h=-1,y=0,W=0;for(let D=0;D<=u&&g>=0&&g<=256&&d>=0&&d<=256;D++){D%(u/10)||b.push({x:~~g,y:~~d});let S=~~g+1+(~~d+1)*258;if(S!==h){if(!n.raw[S])break;h=S;let I=n.dmin+n.raw[S]*n.dmul,v=s.dmin+s.raw[S]*s.dmul,P=i.dmin+i.raw[S]*i.dmul,k=Math.atan2(v,P)+l;y=o*I*Math.sin(k),W=o*I*Math.cos(k)}g+=y,d-=W}let w=x,M=f;h=-1;for(let D=1;D<=u&&w>=0&&w<=256&&M>=0&&M<=256;D++){D%(u/10)||b.unshift({x:~~w,y:~~M});let S=~~w+1+(~~M+1)*258;if(S!==h){if(!n.raw[S])break;h=S;let I=n.dmin+n.raw[S]*n.dmul,v=s.dmin+s.raw[S]*s.dmul,P=i.dmin+i.raw[S]*i.dmul,k=Math.atan2(v,P)+l;y=o*I*Math.sin(k),W=o*I*Math.cos(k)}w-=y,M+=W}b.length>2&&r.push(b)}return r}};var B=class{constructor(e){this.layer=e}paint({data:e,ctxFill:t,ctxText:r,ctxStreamLines:n}){let{layer:s}=this,{units:i}=s.currentVariableMeta,o=new ImageData(256,256),l=new Uint32Array(o.data.buffer);t.clearRect(0,0,256,256),r.clearRect(0,0,256,256),n.clearRect(0,0,256,256),ct(e.data[0],l,s);let m=mt(l,e.data[0],s);t.putImageData(o,0,0),ut(m,r,s),dt(e.data,r,s),ft(e.data[0],r,i,s),xt(e,r,s)}getPaintedCanvas(e,t,r){return t?(this.imprintVectorAnimationLinesStep(e,r),e.ctxStreamLines.canvas):e.ctxFill.canvas}imprintVectorAnimationLinesStep({data:e,ctxFill:t,ctxStreamLines:r},n){let{layer:s}=this;r.clearRect(0,0,256,256),r.drawImage(t.canvas,0,0),!(e.slines.length===0||s.style.streamLineStatic||s.style.streamLineColor==="none")&>(e,r,s,n)}};function ct(a,e,{CLUT:t,style:r}){let{raw:n}=a,{colorsI:s}=t;if(r.fill!=="none")for(let i=0,o=0,l=259;i<256;++i,l+=2)for(let m=0;m<256;++m,++o,++l)e[o]=s[n[l]];else e.fill(0)}function mt(a,e,{CLUT:t,style:r}){let{raw:n}=e,{levelIndex:s,colorsI:i}=t,o=[];if(r.isolineColor!=="none"){let l=r.isolineColor[0]==="#"?L(r.isolineColor):0;for(let m=0,u=0;m<256;m+=1)for(let f=0;f<256;f+=1){let x=(m+1)*258+(f+1),b=n[x],g=n[x+1],d=n[x+258];if(!b||!g||!d)continue;let h=s[b],y=s[g],W=s[d];if(h!==y||h!==W){let w=Math.max(h,y,W),M=Math.max(b,g,d),D=m*256+f;switch(r.isolineColor){case"inverted":a[D]=~i[M]|4278190080;break;case"fill":a[D]=i[M]|4278190080;break;default:a[D]=l;break}r.isolineText&&!(++u%255)&&f>20&&f<235&&m>20&&m<235&&o.push({x:f,y:m,d:b,dr:g,db:d,mli:w})}}}return o}function ut(a,e,{CLUT:t}){if(a.length){e.font="1.1em Sans-serif",e.lineWidth=2,e.strokeStyle="white",e.fillStyle="black",e.textAlign="center",e.textBaseline="middle";for(let{x:r,y:n,d:s,dr:i,db:o,mli:l}of a){let m=t.ticks[l].dataString,u=Math.atan2(s-i,o-s);e.save(),e.translate(r,n),e.rotate(u<-1.57||u>1.57?u+3.14:u),e.strokeText(m,0,0),e.fillText(m,0,0),e.restore()}}}function dt(a,e,{CLUT:t,style:r}){if(!t.DataToKnots||r.vectorColor==="none"||r.vectorType==="none")return;if(a.length!==3)throw new Error("data.length !== 3");let[n,s,i]=a;switch(r.vectorType){case"barbs":e.font="40px barbs";break;case"arrows":e.font="50px arrows";break;default:e.font=r.vectorType}e.textAlign="center",e.textBaseline="middle",e.fillStyle=r.vectorColor;let o=r.addDegrees?.017453292519943*r.addDegrees:0,l=32;for(let m=l/2;m<256;m+=l)for(let u=l/2;u<256;u+=l){let f=u+1+(m+1)*258;if(!n.raw[f])continue;let x=Math.atan2(s.dmin+s.raw[f]*s.dmul,i.dmin+i.raw[f]*i.dmul),b=n.dmin+n.raw[f]*n.dmul,g=r.vectorType!=="barbs"?r.vectorFactor*.5:.2,d=Math.min(~~(t.DataToKnots(b)*g),25)+65,h=String.fromCharCode(d);switch(r.vectorColor){case"inverted":e.fillStyle=T(~t.colorsI[n.raw[f]]);break;case"fill":e.fillStyle=T(t.colorsI[n.raw[f]]);break}e.save(),e.translate(u,m),e.rotate(x+o),e.fillText(h,0,0),e.restore()}}function ft(a,e,t,{CLUT:r,style:n}){if(t!=="degree")return;let s=.017453292519943*n.addDegrees;e.font="50px arrows",e.textAlign="center",e.textBaseline="middle",e.fillStyle=n.vectorColor;let i="L",o=32;for(let l=o/2;l<256;l+=o)for(let m=o/2;m<256;m+=o){let u=m+1+(l+1)*258;if(!a.raw[u])continue;let x=(a.dmin+a.raw[u]*a.dmul+180)*.01745329251;switch(n.vectorColor){case"inverted":e.fillStyle=T(~r.colorsI[a.raw[u]]);break;case"fill":e.fillStyle=T(r.colorsI[a.raw[u]]);break}e.save(),e.translate(m,l),e.rotate(x+s),e.fillText(i,0,0),e.restore()}}function xt(a,e,{CLUT:t,style:r}){let{data:n,slines:s}=a;if(!s.length||!r.streamLineStatic||r.streamLineColor==="none")return;let i=n[0];e.lineWidth=1,r.streamLineColor[0]==="#"&&(e.strokeStyle=ie(r.streamLineColor));for(let o=s.length;o--;){let l=s[o];for(let m=0;m<l.length-1;++m){let u=l[m],f=l[m+1],x=u.x+1+(u.y+1)*258;switch(r.streamLineColor){case"inverted":e.strokeStyle=T(~t.colorsI[i.raw[x]]);break;case"fill":e.strokeStyle=T(t.colorsI[i.raw[x]]);break}e.beginPath(),e.moveTo(u.x,u.y),e.lineTo(f.x,f.y),e.stroke()}}}function gt(a,e,{CLUT:t,style:r},n){let{data:s,slines:i}=a,o=s[0],l=r.streamLineColor[0]==="#"?ie(r.streamLineColor).substring(0,7):"#000000";n=n>>5;for(let m=0;m<i.length;++m){let u=i[m],f=u.length-1,x=(n+(1+u[0].x)*(1+u[0].y))%30;for(let b=0;b<f;++b){let g=u[b],d=u[b+1],h=1-(x-b)/f;(h<0||h>1)&&(h=0);let y=(~~(h*255)).toString(16).padStart(2,"0"),W=1+~~((1.2-h)*5);e.lineWidth=W;let w=g.x+1+(g.y+1)*258;switch(r.streamLineColor){case"inverted":l=T(~t.colorsI[o.raw[w]]);break;case"fill":l=T(t.colorsI[o.raw[w]]);break}e.strokeStyle=l+y,e.beginPath(),e.moveTo(g.x,g.y),e.lineTo(d.x,d.y),e.stroke()}}}var H=class extends Map{clear(){c("TilesCache.clear()"),this.forEach(e=>{!e.rd||(e.rd.gl.deleteTexture(e.rd.vectorTextureU),e.rd.gl.deleteTexture(e.rd.vectorTextureV))}),super.clear()}},N=class{constructor(e){this.tilesCache=new H;this.painter=new B(this);var s;if(c(`WxLayer.constructor:
|
|
1
|
+
var wxtilesleaflet=(()=>{var Ne=Object.create;var X=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Fe=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Xe=(a,e)=>{for(var t in e)X(a,t,{get:e[t],enumerable:!0})},ue=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ze(e))!Ve.call(a,n)&&n!==t&&X(a,n,{get:()=>e[n],enumerable:!(r=$e(e,n))||r.enumerable});return a};var qe=(a,e,t)=>(t=a!=null?Ne(Be(a)):{},ue(e||!a||!a.__esModule?X(t,"default",{value:a,enumerable:!0}):t,a)),Oe=a=>ue(X({},"__esModule",{value:!0}),a);var Re=Fe((qt,ke)=>{ke.exports=window.L});var mt={};Xe(mt,{CustomWxTilesLayer:()=>te,DataIntegral:()=>F,Loader:()=>R,Painter:()=>U,QTree:()=>k,TilesCache:()=>N,WXLOG:()=>m,WxAPI:()=>ee,WxCreateLegend:()=>ce,WxDataSetManager:()=>V,WxGetColorSchemes:()=>O,WxGetColorStyles:()=>P,WxLayer:()=>$,WxLayerBaseImplementation:()=>Z,WxTileSource:()=>B,WxTilesLogging:()=>We});var me={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var de={none:["#00000000","#00000000"],divergingbluered:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbowzerro:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow2:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebirdzerro:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bw:["#000000ff","#ffffffff"],wb:["#ffffffff","#000000ff"],redish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]};var q={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"none",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"none",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"divergingbluered",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none",gl:{animationSpeed:1,noiseTexturePow:5,vectorFieldFactor:1,animationIntensity:5,wavesCount:4}},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var fe,xe,pe;function he({colorStyles:a={},units:e={},colorSchemes:t={}}={}){m("WxTile lib setup: start"),fe=Object.assign({},me,e),xe=Object.assign({},t,de);let r=Object.assign({},a,q);pe=Ee(r),m("WxTile lib setup: styles unrolled"),(async()=>{try{await document.fonts.load("32px barbs"),await document.fonts.load("32px arrows")}catch{m("WxTile lib setup: fonts not loaded")}})(),m("WxTile lib setup is done.")}function P(){return pe}function O(){return xe}function E(a,e,t){m("makeConverter: From=",a," To=",e);let r=g=>g;if(r.trivial=!0,a===e)return m("Trivial converter"),r;let n=Object.assign({},fe,t),s=n[a],o=n[e];if(!s||!o)return m("Inconvertible units. Trivial converter"),r;let[i,u,c]=s,[l,d,x]=o;if(i!==l||!u||!d)return m("Inconvertible units. Trivial converter"),r;let p=u/d,h=((c||0)-(x||0))/d;return h?g=>p*g+h:g=>p*g}function Ee(a){let e=Object.assign({},q);for(let s in a){let o=a[s];if(Array.isArray(o))for(let i=0;i<o.length;++i)e[s+"["+i+"]"]=Object.assign({},o[i]);else e[s]=Object.assign({},o)}let t=Object.assign({},q.base),r=(s,o)=>{if(o==="base")return t;let i=s[o];if(!i)return t;(!i.parent||!(i.parent in s))&&(i.parent="base");let u=r(s,i.parent);return Object.assign(i,Object.assign({},u,i,{parent:"base"}))},n={base:t};for(let s in e)n[s]=r(e,s);return n}function Y(a){let e=new Map,t=(r,...n)=>{let s=e.get(r);if(s)return s;let o=a(r,...n);return e.set(r,o),o.catch(i=>i.name==="AbortError"&&e.delete(r)),o};return t.clearCache=()=>e.clear(),t}async function Ye(a,e){let t=await fetch(a,e);if(t.status!==200&&t.status!==304)throw{name:"Tile loading failed",reason:t.headers.get("x-reason"),status:t.status};return await createImageBitmap(await t.blob(),{premultiplyAlpha:"none"})}var F=class{constructor(e,t,r,n){this.raw=e;this.dmin=t;this.dmax=r;this.dmul=n;this.radius=0}get integral(){return this.integral_||(this.integral_=ze(this.raw))}};function A(a,e,t=!0){let r=Object.assign(document.createElement("canvas"),{width:a,height:e,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:t});if(!r)throw new Error("Cannot get canvas context");return r}function je(a){let{width:e,height:t}=a,r=A(e,t);return r.drawImage(a,0,0),r.getImageData(0,0,e,t)}async function ae(a,e){return je(await Ye(a,e))}function Ge(a){a.data[34]<1&&m("Warning: image is in too old format. Check the version of the Splitter.");let e=new Uint16Array(a.data.buffer),t=new Uint16Array(e.length/2);for(let u=0;u<t.length;u++)t[u]=e[u*2];let r=new Uint8Array(8);for(let u=0;u<8;++u)r[u]=a.data[u*4+2];let n=new DataView(r.buffer),s=n.getFloat32(0,!0),o=n.getFloat32(4,!0),i=(o-s)/65535;return new F(t,s,o,i)}async function ge(a,e){return Ge(await ae(a,e))}function ze(a){let e=new Uint32Array(66564),t=new Uint32Array(258*258);e[0]=a[0],t[0]=a[0]?1:0;for(let r=1;r<258;++r){e[r]=a[r]+e[r-1],t[r]=(a[r]?1:0)+t[r-1];let n=258*r;e[n]=a[n]+e[n-258],t[n]=(a[n]?1:0)+t[n-258]}for(let r=1;r<258;++r)for(let n=1;n<258;++n){let s=258*r+n;e[s]=a[s]+e[s-258]+e[s-1]-e[s-259],t[s]=(a[s]?1:0)+t[s-258]+t[s-1]-t[s-259]}return{integral:e,integralNZ:t[66563]===66564?null:t}}function He(a){let{integral:e}=a.integral;a.raw[0]=e[0];for(let t=1;t<258;t++){a.raw[t]=e[t]-e[t-1],a.raw[258*t]=e[258*t]-e[258*(t-1)];for(let r=1;r<258;r++){let n=258*t+r;a.raw[n]=e[n-259]+e[n]-e[n-258]-e[n-1]}}return a}function ye(a,e){if(e<0&&(e=0),e===a.radius)return a;if(a.radius=e,!e)return He(a);let{integral:t,integralNZ:r}=a.integral;for(let n=2;n<256;n++)for(let s=2;s<256;s++){let o=258*n+s;if(!a.raw[o])continue;let i=Math.min(e,s-1,256-s),u=Math.min(e,n-1,256-n),c=258*(n-u-1)+s,l=258*(n+u)+s,d;if(r){let y=r[c-i-1],b=r[c+i],W=r[l-i-1],S=r[l+i];d=y+S-b-W}else d=(2*i+1)*(2*u+1);let x=t[c-i-1],p=t[c+i],h=t[l-i-1],g=t[l+i],f=x+g-p-h;a.raw[o]=f/d}for(let n=2;n<256;n++){let s=258+n;if(a.raw[s]){let c=n,l=Math.min(e,c-1,256-c),d=258+c,x;if(r){let M=r[d-l-1];x=0+r[d+l]-0-M}else x=(2*l+1)*2;let p=0,h=0,g=t[d-l-1],f=t[d+l],b=(p+f-h-g)/x;a.raw[s-258]=b,a.raw[s]=b}let o=258*256+n;if(a.raw[o]){let c=n,l=Math.min(e,c-1,256-c),d=258*255+c,x=258*257+c,p=t[d-l-1],h=t[d+l],g=t[x-l-1],f=t[x+l],y=p+f-h-g,b;if(r){let S=r[d-l-1],M=r[d+l],w=r[x-l-1],D=r[x+l];b=S+D-M-w}else b=(2*l+1)*2;let W=y/b;a.raw[o]=W,a.raw[o+258]=W}let i=258*n+1;if(a.raw[i]){let c=n,l=Math.min(e,c-1,256-c),d=258*(c-l-1)+1,x=258*(c+l)+1,p;if(r){let M=r[d],w=0;p=0+r[x]-M-w}else p=(2*l+1)*2;let h=0,g=t[d],f=0,y=t[x],W=(h+y-g-f)/p;a.raw[i-1]=W,a.raw[i]=W}let u=258*n+256;if(a.raw[u]){let c=n,l=Math.min(e,c-1,256-c),d=258*(c-l-1)+256,x=258*(c+l)+256,p;if(r){let S=r[d-1],M=r[d+1],w=r[x-1],D=r[x+1];p=S+D-M-w}else p=2*(2*l+1);let h=t[d-1],g=t[d+1],f=t[x-1],y=t[x+1],W=(h+y-g-f)/p;a.raw[u]=W,a.raw[u+1]=W}}return a}function T(a){let e=a>>0&255,t=a>>8&255,r=a>>16&255,n=e.toString(16),s=t.toString(16),o=r.toString(16);return n=n.length===2?n:"0"+n,s=s.length===2?s:"0"+s,o=o.length===2?o:"0"+o,"#"+n+s+o}function C(a){if(a[0]==="#"){if(a.length===4)return+("0xff"+a[3]+a[3]+a[2]+a[2]+a[1]+a[1]);if(a.length===7)return+("0xff"+a[5]+a[6]+a[3]+a[4]+a[1]+a[2]);if(a.length===9)return+("0x"+a[7]+a[8]+a[5]+a[6]+a[3]+a[4]+a[1]+a[2])}return m("wrong color format",a),0}async function v(a,e){let t=await fetch(a,e);if(!t.ok)throw new Error("error:"+a+" - "+t.statusText);return t.json()}function ne(a,e,t){let r=a>>0&255,n=a>>8&255,s=a>>16&255,o=a>>>24,i=e>>0&255,u=e>>8&255,c=e>>16&255,l=e>>>24,d=r+t*(i-r),x=n+t*(u-n),p=s+t*(c-s),h=o+t*(l-o);return d|x<<8|p<<16|h<<24}function be(a,e,t){let r=[];for(let n=0;n<t;++n)r.push(n*(e-a)/(t-1)+a);return r}var re=!1,m=(...a)=>{};function We(a){re=!!a,console.log("WXLOGing",re),m=typeof a=="function"?a:re?console.log:()=>{}}function se(a){return a[0]==="#"&&a.length===4?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:a}function j(a,{x:e,y:t,z:r}){return a.replace("{x}",`${e}`).replace("{y}",`${t}`).replace("{z}",`${r}`)}function G({x:a,y:e,z:t}){return`${t}-${a}-${e}`}var Ke="A".charCodeAt(0);var k=class{constructor(e,t){this._qtree={nodes:null};this._qtreedepth=0;m("QTree.constructor"),this._ready=this._load(e,t)}get ready(){return this._ready}async _load(e,t){if(e!="none"){try{let r=await v(e,t);this._qtree=we(r,{pos:0})}catch(r){throw new Error(`Failed to load QTree: ${r.message}`)}this._qtreedepth=Se(this._qtree),m(`QTree.load: qtreedepth=${this._qtreedepth}`)}}check(e){let t=e.z-this._qtreedepth,r=t>=0,n=r?{x:e.x>>t,y:e.y>>t,z:this._qtreedepth}:{...e};return Me(this._qtree,n,r)}};function we(a,e){let t=a.charCodeAt(e.pos)-Ke;e.pos++;let r=[1,2,4,8].map(n=>t&n?we(a,e):null);return{nodes:r.some(n=>n)?r:null}}function Se(a){return a?.nodes?1+Math.max(...a.nodes.map(Se)):0}function Me(a,e,t){return a===null?"land":t&&!e.z?"mixed":a.nodes===null?"sea":e.z?(e.z--,Me(a.nodes[(e.y>>e.z&1)<<1|e.x>>e.z&1],e,t)):"mixed"}var Je=2*Math.PI*6378137/256,z=2*Math.PI*6378137/2;function Qe(a,e){let t=a/z*180,r=e/z*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),[r,t]}function et(a,e,t){let r=tt(t),n=a*r-z,s=e*r-z;return[n,s]}function tt(a){return Je/2**a}function oe(a,e,t){let[r,n]=Qe(...et(a,e,t));return[n,-r]}function De(a,e){return[a*256,e*256]}function ie(a,e,t){let r=((e-a)%360+540)%360-180;return(a+r*t+360)%360}function rt(a,e,t,r,n,s,o,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 0:return 0;case 1:return a;case 2:return e;case 3:t=a,r=e;break;case 4:return t;case 5:e=a,r=t;break;case 6:r=e+t>>1,a=r;break;case 7:r=e+t>>1;break;case 8:return r;case 9:e=a+r>>1,t=e;break;case 10:a=e,t=r;break;case 11:t=a+r>>1;break;case 12:a=t,e=r;break;case 13:e=a+r>>1;break;case 14:a=e+t>>1;break}a=o+i*a,e=o+i*e,t=o+i*t,r=o+i*r;let c=ie(a,e,n),l=ie(t,r,n),d=(ie(c,l,s)-o)/i;return d<1?1:d}function Te(a,e,t,r,n,s,o,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 7:return n+s<1?n*(e-a)+s*(t-a)+a:0;case 14:return n+s<1?0:n*(r-t)+s*(r-e)+e+t-r;case 11:return s<n?(1-n)*(a-e)+s*(r-e)+e:0;case 13:return s<n?0:(1-n)*(t-r)+s*(t-a)+a+r-t;case 15:return n+s<1?n*(e-a)+s*(t-a)+a:n*(r-t)+s*(r-e)+e+t-r;default:return 0}}function Ce(a,e,t){let r=1/2**t.z,n=t.x*256*r-.5,s=t.y*256*r-.5,{raw:o,dmin:i,dmax:u,dmul:c}=e,l={raw:new Uint16Array(258*258),dmin:i,dmax:u,dmul:c},{raw:d}=l;for(let x=-1,p=0,h=s-r+1;x<=256;x++,h+=r){let g=Math.floor(h),f=h-g,y=g*258;for(let b=-1,W=n-r+1;b<=256;b++,p++,W+=r){let S=Math.floor(W),M=W-S,w=S+y,D=o[w],I=o[w+1],_=o[w+258],L=o[w+258+1];d[p]=a(D,I,_,L,M,f,i,c)}}return l}function Ie(a,e,t){if(!e)return a;let r=l=>l<0?0:l>254?254:l,n=1/2**e.z,s=e.x*256*n-.5,o=e.y*256*n-.5,{data:i}=a,u=new ImageData(256,256),{data:c}=u;for(let l=0,d=t,x=o;l<256;l++,x+=n){let p=~~r(x),h=x-p,g=p*256;for(let f=0,y=s;f<256;f++,d+=4,y+=n){let b=~~r(y),W=y-b,S=(b+g)*4+t,M=i[S],w=i[S+4],D=i[S+4*256],I=i[S+4*256+4],_=Te(M,w,D,I,W,h,0,0);c[d]=_>127?255:0}}return u}function _e(a,e){return e?Ce(Te,a,e):a}function Le(a,e){return e?Ce(rt,a,e):a}function ve(a,{data:e},t,r){let n=r==="sea",{raw:s}=a;for(let o=t,i=259,u=0;u<256;i+=2,u++)for(let c=0;c<256;c++,i++,o+=4)n===!e[o]&&(s[i]=0);return a}function Pe(a){let[e,t]=De(a.x,a.y),[r,n]=oe(e,t,a.z),[s,o]=oe(e+256,t+256,a.z);return{west:r,north:n,east:s,south:o}}function le(a,e){let t=a.z-e;if(t<=0)return{upCoords:a};let r={x:a.x>>>t,y:a.y>>>t,z:e},n={x:a.x&(1<<t)-1,y:a.y&(1<<t)-1,z:t};return{upCoords:r,subCoords:n}}var R=class{constructor(e){this._loadDataFunc=Y(ge);this._layer=e}async load(e,t){let r=await this.cacheLoad(e,this._layer.tilesURIs,t);if(!r)return null;let{rawdata:n,subCoords:s,tileType:o}=r,{units:i}=this._layer.currentVariableMeta,u=i==="degree"?Le:_e,c=d=>u(ye(d,this._layer.style.blurRadius),s),l=n.map(c);return this._vectorMagnitudesPrepare(l),await this._applyMask(l,e,o,!s&&n.length===1),{data:l,slines:this._createStreamLines(l)}}async cacheLoad(e,t,r){if(!this._checkInsideBoundaries(e))return null;let n=this._checkTypeAndMask(e);if(!n)return null;let{upCoords:s,subCoords:o}=le(e,this._layer.getCoarseMaxZoom()),i=t.map(l=>j(l,s)),u=Object.assign({},this._layer.wxdatasetManager.wxAPI.requestInit,{signal:r?.signal});return{rawdata:await Promise.all(i.map(l=>this._loadDataFunc(l,u))),subCoords:o,tileType:n}}clearCache(){this._loadDataFunc.clearCache()}async _applyMask(e,t,r,n){let{style:s}=this._layer;if((s.mask==="land"||s.mask==="sea")&&r==="mixed"){if(n){let{raw:u,dmin:c,dmax:l,dmul:d}=e[0];e[0]={raw:new Uint16Array(u),dmin:c,dmax:l,dmul:d}}let o,{wxAPI:i}=this._layer.wxdatasetManager;try{let{upCoords:u,subCoords:c}=le(t,i.maskDepth);o=await i.loadMaskFunc(u),o=Ie(o,c,i.maskChannel)}catch{s.mask=void 0,m("Can't load Mask. Masking is disabled");return}ve(e[0],o,i.maskChannel,s.mask)}}_vectorMagnitudesPrepare(e){if(e.length===1)return;e.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,r,n]=e;t.dmax=1.42*Math.max(-r.dmin,r.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let s=0;s<258*258;++s){if(!r.raw[s]||!n.raw[s])continue;let o=r.dmin+r.dmul*r.raw[s],i=n.dmin+n.dmul*n.raw[s];t.raw[s]=Math.sqrt(i*i+o*o)/t.dmul}}_checkTypeAndMask(e){let{mask:t}=this._layer.style;if(t==="land"||t==="sea"){let r=this._layer.wxdatasetManager.wxAPI.qtree.check(e);return t===r?void 0:r}return"mixed"}_checkInsideBoundaries(e){let t=this._layer.getBoundaries();if(t?.boundaries180){let r=Pe(e),n=s=>!(r.west>s.east||s.west>r.east||r.south>s.north||s.south>r.north);if(!t.boundaries180.some(n))return!1}return!0}_createStreamLines(e){if(e.length!==3)return[];let{style:t}=this._layer;if(t.streamLineColor==="none")return[];let r=[],[n,s,o]=e,i=(t.streamLineSpeedFactor||1)/n.dmax,u=t.addDegrees?.017453292519943*t.addDegrees:0,c=t.streamLineGridStep||64,l=t.streamLineSteps||300;for(let d=0;d<=256;d+=c)for(let x=0;x<=256;x+=c){if(!n.raw[1+x+(1+d)*258])continue;let p=[],h=x,g=d,f=-1,y=0,b=0;for(let M=0;M<=l&&h>=0&&h<=256&&g>=0&&g<=256;M++){M%(l/10)||p.push({x:~~h,y:~~g});let w=~~h+1+(~~g+1)*258;if(w!==f){if(!n.raw[w])break;f=w;let D=n.dmin+n.raw[w]*n.dmul,I=s.dmin+s.raw[w]*s.dmul,_=o.dmin+o.raw[w]*o.dmul,L=Math.atan2(I,_)+u;y=i*D*Math.sin(L),b=i*D*Math.cos(L)}h+=y,g-=b}let W=x,S=d;f=-1;for(let M=1;M<=l&&W>=0&&W<=256&&S>=0&&S<=256;M++){M%(l/10)||p.unshift({x:~~W,y:~~S});let w=~~W+1+(~~S+1)*258;if(w!==f){if(!n.raw[w])break;f=w;let D=n.dmin+n.raw[w]*n.dmul,I=s.dmin+s.raw[w]*s.dmul,_=o.dmin+o.raw[w]*o.dmul,L=Math.atan2(I,_)+u;y=i*D*Math.sin(L),b=i*D*Math.cos(L)}W-=y,S+=b}p.length>2&&r.push(p)}return r}};var U=class{constructor(e){this._layer=e}paint({data:e,ctxFill:t,ctxText:r,ctxStreamLines:n}){let{_layer:s}=this,{units:o}=s.currentVariableMeta,i=new ImageData(256,256),u=new Uint32Array(i.data.buffer);t.clearRect(0,0,256,256),r.clearRect(0,0,256,256),n.clearRect(0,0,256,256),at(e.data[0],u,s);let c=nt(u,e.data[0],s);t.putImageData(i,0,0),st(c,r,s),ot(e.data,r,s),it(e.data[0],r,o,s),lt(e,r,s)}getPaintedCanvas(e,t,r){return t?(this.imprintVectorAnimationLinesStep(e,r),e.ctxStreamLines.canvas):e.ctxFill.canvas}imprintVectorAnimationLinesStep({data:e,ctxFill:t,ctxStreamLines:r},n){let{_layer:s}=this;r.clearRect(0,0,256,256),r.drawImage(t.canvas,0,0),!(e.slines.length===0||s.style.streamLineStatic||s.style.streamLineColor==="none")&&ct(e,r,s,n)}};function at(a,e,{CLUT:t,style:r}){let{raw:n}=a,{colorsI:s}=t;if(r.fill!=="none")for(let o=0,i=0,u=259;o<256;++o,u+=2)for(let c=0;c<256;++c,++i,++u)e[i]=s[n[u]];else e.fill(0)}function nt(a,e,{CLUT:t,style:r}){let{raw:n}=e,{levelIndex:s,colorsI:o}=t,i=[];if(r.isolineColor!=="none"){let u=r.isolineColor[0]==="#"?C(r.isolineColor):0;for(let c=0,l=0;c<256;c+=1)for(let d=0;d<256;d+=1){let x=(c+1)*258+(d+1),p=n[x],h=n[x+1],g=n[x+258];if(!p||!h||!g)continue;let f=s[p],y=s[h],b=s[g];if(f!==y||f!==b){let W=Math.max(f,y,b),S=Math.max(p,h,g),M=c*256+d;switch(r.isolineColor){case"inverted":a[M]=~o[S]|4278190080;break;case"fill":a[M]=o[S]|4278190080;break;default:a[M]=u;break}r.isolineText&&!(++l%255)&&d>20&&d<235&&c>20&&c<235&&i.push({x:d,y:c,d:p,dr:h,db:g,mli:W})}}}return i}function st(a,e,{CLUT:t}){if(a.length){e.font="1.1em Sans-serif",e.lineWidth=2,e.strokeStyle="white",e.fillStyle="black",e.textAlign="center",e.textBaseline="middle";for(let{x:r,y:n,d:s,dr:o,db:i,mli:u}of a){let c=t.ticks[u].dataString,l=Math.atan2(s-o,i-s);e.save(),e.translate(r,n),e.rotate(l<-1.57||l>1.57?l+3.14:l),e.strokeText(c,0,0),e.fillText(c,0,0),e.restore()}}}function ot(a,e,{CLUT:t,style:r}){if(!t.DataToKnots||r.vectorColor==="none"||r.vectorType==="none")return;if(a.length!==3)throw new Error("data.length !== 3");let[n,s,o]=a;switch(r.vectorType){case"barbs":e.font="40px barbs";break;case"arrows":e.font="50px arrows";break;default:e.font=r.vectorType}e.textAlign="center",e.textBaseline="middle",e.fillStyle=r.vectorColor;let i=r.addDegrees?.017453292519943*r.addDegrees:0,u=32;for(let c=u/2;c<256;c+=u)for(let l=u/2;l<256;l+=u){let d=l+1+(c+1)*258;if(!n.raw[d])continue;let x=Math.atan2(s.dmin+s.raw[d]*s.dmul,o.dmin+o.raw[d]*o.dmul),p=n.dmin+n.raw[d]*n.dmul,h=r.vectorType!=="barbs"?r.vectorFactor*.5:.2,g=Math.min(~~(t.DataToKnots(p)*h),25)+65,f=String.fromCharCode(g);switch(r.vectorColor){case"inverted":e.fillStyle=T(~t.colorsI[n.raw[d]]);break;case"fill":e.fillStyle=T(t.colorsI[n.raw[d]]);break}e.save(),e.translate(l,c),e.rotate(x+i),e.fillText(f,0,0),e.restore()}}function it(a,e,t,{CLUT:r,style:n}){if(t!=="degree")return;let s=.017453292519943*n.addDegrees;e.font="50px arrows",e.textAlign="center",e.textBaseline="middle",e.fillStyle=n.vectorColor;let o="L",i=32;for(let u=i/2;u<256;u+=i)for(let c=i/2;c<256;c+=i){let l=c+1+(u+1)*258;if(!a.raw[l])continue;let x=(a.dmin+a.raw[l]*a.dmul+180)*.01745329251;switch(n.vectorColor){case"inverted":e.fillStyle=T(~r.colorsI[a.raw[l]]);break;case"fill":e.fillStyle=T(r.colorsI[a.raw[l]]);break}e.save(),e.translate(c,u),e.rotate(x+s),e.fillText(o,0,0),e.restore()}}function lt(a,e,{CLUT:t,style:r}){let{data:n,slines:s}=a;if(!s.length||!r.streamLineStatic||r.streamLineColor==="none")return;let o=n[0];e.lineWidth=1,r.streamLineColor[0]==="#"&&(e.strokeStyle=se(r.streamLineColor));for(let i=s.length;i--;){let u=s[i];for(let c=0;c<u.length-1;++c){let l=u[c],d=u[c+1],x=l.x+1+(l.y+1)*258;switch(r.streamLineColor){case"inverted":e.strokeStyle=T(~t.colorsI[o.raw[x]]);break;case"fill":e.strokeStyle=T(t.colorsI[o.raw[x]]);break}e.beginPath(),e.moveTo(l.x,l.y),e.lineTo(d.x,d.y),e.stroke()}}}function ct(a,e,{CLUT:t,style:r},n){let{data:s,slines:o}=a,i=s[0],u=r.streamLineColor[0]==="#"?se(r.streamLineColor).substring(0,7):"#000000";n=n>>5;for(let c=0;c<o.length;++c){let l=o[c],d=l.length-1,x=(n+(1+l[0].x)*(1+l[0].y))%30;for(let p=0;p<d;++p){let h=l[p],g=l[p+1],f=1-(x-p)/d;(f<0||f>1)&&(f=0);let y=(~~(f*255)).toString(16).padStart(2,"0"),b=1+~~((1.2-f)*5);e.lineWidth=b;let W=h.x+1+(h.y+1)*258;switch(r.streamLineColor){case"inverted":u=T(~t.colorsI[i.raw[W]]);break;case"fill":u=T(t.colorsI[i.raw[W]]);break}e.strokeStyle=u+y,e.beginPath(),e.moveTo(h.x,h.y),e.lineTo(g.x,g.y),e.stroke()}}}function ut(a,e,t){return a>t?t:a<e?e:a}var H=class{constructor(e,t,[r,n],s){m("RawCLUT.constructor"),this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let o;this.DataToStyle=E(t,e.units,e.extraUnits),this.DataToStyle.trivial&&(e.units=t),s&&(this.DataToKnots=E(t,"knot"));let i=E(e.units,t,e.extraUnits),u=f=>~~(65535*ut((i(f)-r)/(n-r),0,1));if(e.colorMap?.length)o=e.colorMap.sort((f,y)=>f[0]-y[0]).map(([f])=>u(f));else{e.levels||(e.levels=be(this.DataToStyle(r),this.DataToStyle(n),10)),e.levels.sort((y,b)=>y-b);let f=O();e.colors||(e.colors=f[e.colorScheme&&e.colorScheme in f&&e.colorScheme||"wb"]),o=e.levels.map(u)}let c=n-r,l=ce(65536,e);this.ticks=l.ticks;let d=l.ticks[0].data,p=l.ticks[l.ticks.length-1].data-d,h=e.showBelowMin?l.colors[0]:0,g=e.showAboveMax?l.colors[65535]:0;this.colorsI[0]=0;for(let f=1;f<65536;++f){let y=this.DataToStyle(c*f/65535+r),b=Math.round(65535*(y-d)/p);this.colorsI[f]=b<=0?h:b>65535?g:l.colors[b]}for(let f=0;f<o[0];++f)this.levelIndex[f]=0;for(let f=0;f<o.length-1;f++)for(let y=o[f];y<o[f+1]+1;++y)this.levelIndex[y]=f;for(let f=o[o.length-1];f<65536;++f)this.levelIndex[f]=o.length-1}};function Ae(a){if(a!==0&&-.1<a&&a<.1)return a.toExponential(2);let e=a.toString();return e.split(".")[1]?.length>2?a.toFixed(2):e}function ce(a,e){let t={size:a,showBelowMin:e.showBelowMin,showAboveMax:e.showAboveMax,units:e.units,colors:new Uint32Array(a),ticks:[]},{colorMap:r,levels:n,colors:s}=e,o=e.fill!=="solid";if(r){let x=r[0][0],p=(a-1)/(r[r.length-1][0]-x);t.ticks=r.map(([h,g])=>({data:h,dataString:Ae(h),color:g,pos:~~((h-x)*p)}));for(let h=0;h<r.length-1;h++){let g=t.ticks[h].pos,f=t.ticks[h+1].pos,y=C(r[h][1]),b=o?C(r[h+1][1]):0;for(let W=g;W<f;++W)t.colors[W]=o?ne(y,b,(W-g)/(f-g)):y}return t.colors[a-1]=C(r[r.length-1][1]),t}if(!s||!n)return t;let i=0,u=0,c=-1;for(let x=0;x<a;++x){let p=x*(s.length-1)/a;c!==~~p&&(c=~~p,i=C(s[c]),u=s.length>c+1?C(s[c+1]):i),t.colors[x]=o?ne(i,u,p-c):i}t.colors[a-1]=C(s[s.length-1]);let l=n[0],d=(a-1)/(n[n.length-1]-l);return t.ticks=n.map(x=>{let p=~~((x-l)*d);return{data:x,dataString:Ae(x),pos:p,color:T(t.colors[p])}}),t}var N=class extends Map{clear(){m("TilesCache.clear()"),this.forEach(e=>{e.rd&&(e.rd.gl.deleteTexture(e.rd.vectorTextureU),e.rd.gl.deleteTexture(e.rd.vectorTextureV))}),super.clear()}},$=class{constructor(e){this.tilesRasterCache=new N;this.coarseLevel=0;this._painter=new U(this);this._loader=new R(this);if(m(`WxLayer.constructor:
|
|
2
2
|
datasetName: ${e.wxdatasetManager.datasetName},
|
|
3
3
|
variables: ${e.variables.join(", ")},
|
|
4
4
|
wxstyleName: ${e.wxstyleName},
|
|
5
5
|
wxstyle: ${JSON.stringify(e.wxstyle)},
|
|
6
|
-
time: ${e.time}`),!((s=e.variables)!=null&&s.length)||e.variables.length>2)throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: only 1 or 2 variables are supported but ${e.variables} was given`);e.variables.forEach(i=>{if(!e.wxdatasetManager.checkVariableValid(i))throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: variable ${i} is not valid`)}),this.variables=e.variables,this.wxdatasetManager=e.wxdatasetManager,this.loader=new V(this),[this.tilesURIs,this.time]=this._createURLsAndTime(e.time);let t=R(),r=t.base,n=e.wxstyleName&&t[e.wxstyleName];this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT(C(C(C({},r),n),e.wxstyle))}get nonanimatable(){return c("WxLayer.nonanimatabl()"),this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getMaxZoom(){return c("WxLayer.getMaxZoom"),this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).maxZoom:this.wxdatasetManager.getMaxZoom()}getBoundaries(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).boundaries:this.wxdatasetManager.getBoundaries()}getTime(){return c("WxLayer.getTime"),this.time}clearCache(){c("WxLayer.clearCache"),this.tilesCache.clear(),this.loader.clearCache()}getCurrentStyleObjectCopy(){return c("WxLayer.getCurrentStyleObjectCopy"),Object.assign({},this.style)}updateCurrentStyleObject(e){c(`WxLayer.updateCurrentStyleObject ${JSON.stringify(e)}`),[this.style,this.CLUT]=this._createStyleAndCLUT(e)}getTileData(e,t){let r=this.tilesCache.get(z(e));if(!r)return;let n=this._getPixelInfo(t,r.data.data);if(!n)return;let{raw:s,data:i}=n,o=s.map(u=>this.CLUT.colorsI[u]),l=o.map(T),m=i.map(u=>this.CLUT.DataToStyle(u));return{data:i,raw:s,rgba:o,hexColor:l,inStyleUnits:m,tilePoint:t,styleUnits:this.style.units,dataUnits:this.currentVariableMeta.units}}setURLsAndTime(e){c(`WxLayer.setURLsAndTime time=${e}`),[this.tilesURIs,this.time]=this._createURLsAndTime(e),this.wxdatasetManager.isInstanced()&&(this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT())}loadTile(e,t){return p(this,null,function*(){return this._loadCacheDrawTile(e,this.tilesCache,t).catch(r=>{if(r.name==="AbortError")throw r;return null})})}preloadTime(e,t,r){return p(this,null,function*(){c(`WxLayer.preloadTime time=${e}`);let[n]=this._createURLsAndTime(e);yield Promise.allSettled(t.map(s=>this.loader.cacheLoad(s,n,r)))})}reloadTiles(e,t){return p(this,null,function*(){var n;c("WxLayer.reloadTiles");let r=new H;yield Promise.allSettled(e.map(s=>this._loadCacheDrawTile(s,r,t))),(n=t==null?void 0:t.signal)!=null&&n.aborted?r.clear():(this.tilesCache.clear(),this.tilesCache=r)})}_loadCacheDrawTile(e,t,r){return p(this,null,function*(){let n=t.get(z(e));if(n)return n;let s=yield this.loader.load(e,r);if(!s)return null;let i=_(256,256),o=i,l=this.variables.length===2?_(256,256):i,m={ctxFill:i,ctxText:o,ctxStreamLines:l,data:s};return this.painter.paint(m),t.set(z(e),m),m})}_getCurrentVariableMeta(){let e=this.variables.map(i=>{let o=this.wxdatasetManager.getInstanceVariableMeta(i,this.time);if(!o)throw new Error(`WxLayer ${this.wxdatasetManager.datasetName}: variable ${i} is not valid`);return o}),{min:t,max:r,units:n,vector:s}=e[0];return this.variables.length>1&&(t=0,r=1.42*Math.max(-e[0].min,e[0].max,-e[1].min,e[1].max)),{min:t,max:r,units:n,vector:s}}_getPixelInfo({x:e,y:t},r){var s,i;c(`WxLayer._getPixelInfo x=${e} y=${t}`);let n=(t+1)*258+(e+1);if(!!((i=(s=r==null?void 0:r[0])==null?void 0:s.raw)!=null&&i[n]))return{raw:r.map(o=>o.raw[n]),data:r.map(o=>o.raw[n]*o.dmul+o.dmin)}}_createStyleAndCLUT(e){let t=Object.assign({},this.style,e),r=this._prepareCLUT(t);return[t,r]}_prepareCLUT(e){let{min:t,max:r,units:n}=this.currentVariableMeta;return new $(e,n,[t,r],this.variables.length===2)}_createURLsAndTime(e){let t=this.wxdatasetManager.getValidTime(e);return[this.variables.map(n=>this.wxdatasetManager.createURI(n,t)),t]}};var Ne=ze(Be()),X=class extends Ne.default.GridLayer{constructor(t){super(t);this.id=t.id}};var J=class extends X{constructor(t,r){c(`WxLayerBaseImplementation.constructor (${r.id})`);super(r);this.animation=!1;this.animationSeed=0;this.layer=new N(t),this.oldMaxZoom=this.layer.getMaxZoom()}get wxdatasetManager(){return c(`WxLayerBaseImplementation.wxdatasetManager (${this.id})`),this.layer.wxdatasetManager}getCurrentVariableMeta(){return c(`WxLayerBaseImplementation.getCurrentVariableMeta (${this.id})`),C({},this.layer.currentVariableMeta)}getDatasetMeta(){return this.layer.wxdatasetManager.getInstanceMeta(this.getTime())}getMetadata(){return c(`WxLayerBaseImplementation.getMetadata (${this.id})`),C({},this.layer.currentVariableMeta)}getVariables(){return c(`WxLayerBaseImplementation.getVariables (${this.id})`),[...this.layer.variables]}clearCache(){c(`WxLayerBaseImplementation.clearCache (${this.id})`),this.layer.clearCache()}getCache(){return this.layer.tilesCache}getCurrentStyleObjectCopy(){return c(`WxLayerBaseImplementation.getCurrentStyleObjectCopy (${this.id})`),this.layer.getCurrentStyleObjectCopy()}getTime(){return c(`WxLayerBaseImplementation.getTime (${this.id})`),this.layer.getTime()}getTimes(){return c(`WxLayerBaseImplementation.getTimes (${this.id})`),this.layer.wxdatasetManager.getTimes()}setTime(t,r){return p(this,null,function*(){var s;c(`WxLayerBaseImplementation.setTime (${this.id}) time=${t}`);let n=this.getTime();return this.layer.setURLsAndTime(t),yield this._reloadVisible(r),(s=r==null?void 0:r.signal)!=null&&s.aborted&&this.layer.setURLsAndTime(n),this.getTime()})}preloadTime(t,r){return p(this,null,function*(){return c(`WxLayerBaseImplementation.preloadTime (${this.id}) time=${t}`),this.layer.preloadTime(t,this.coveringTiles(),r)})}startAnimation(){if(this.animation){c(`WxLayerBaseImplementation.startAnimation (${this.id}) already started`);return}if(this.layer.nonanimatable){c(`WxLayerBaseImplementation.startAnimation (${this.id}) nonanimatable`);return}c(`WxLayerBaseImplementation.startAnimation (${this.id})`),this.animation=!0;let t=r=>p(this,null,function*(){if(c(`WxLayerBaseImplementation.startAnimation (${this.id}) animationStep`),!this.animation||this.layer.nonanimatable){this.animation=!1;return}this.animationSeed=r,yield this._redrawTiles(),requestAnimationFrame(t)});requestAnimationFrame(t)}stopAnimation(){return p(this,null,function*(){return c(`WxLayerBaseImplementation.stopAnimation (${this.id})`),this.animation=!1,this._redrawTiles()})}setCoarseLevel(t=2){return p(this,null,function*(){})}unsetCoarseLevel(){return p(this,null,function*(){})}setStyleByName(t,r=!0){return p(this,null,function*(){return c(`WxLayerBaseImplementation.setStyleByName (${this.id}) wxstyleName=${t} reload=${r}`),this.updateCurrentStyleObject(R()[t],r)})}updateCurrentStyleObject(t,r=!0,n){return p(this,null,function*(){if(c(`WxLayerBaseImplementation.updateCurrentStyleObject (${this.id}) style=${t} reload=${r}`),this.layer.updateCurrentStyleObject(t),this.startAnimation(),r)return this._reloadVisible(n)})}_redrawTiles(){return this.redrawRequested?this.redrawRequested:(this.redrawRequested=new Promise(t=>{requestAnimationFrame(()=>{c(`WxTileSource _redrawTiles (${this.id})`),this.update(),t(),this.redrawRequested=void 0})}),this.redrawRequested)}_reloadVisible(t){return p(this,null,function*(){})}coveringTiles(){return[]}update(){}};var Q=class{constructor(e,t,r){this.coords=e;this.ctx=t;this.raster_data=r;this.draw(r==null?void 0:r.ctxFill.canvas)}draw(e){this.ctx.clearRect(0,0,256,256),e&&this.ctx.drawImage(e,0,0)}},O=class extends J{constructor(e,t){super(e,t),c("WxTileSource constructor: ",e)}getLayerInfoAtLatLon(e,t){if(c(`WxTileSource getLayerInfoAtLatLon (${this.layer.wxdatasetManager.datasetName})`,e),!this._map)return;let r=this._map.getZoom(),n=this._map.project(e,r),s=n.divideBy(256).floor(),i=n.subtract(s.multiplyBy(256)).floor();return this.layer.getTileData({x:s.x,y:s.y,z:r},i)}_reloadVisible(e){return p(this,null,function*(){var t;if(c(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName})`),yield this.layer.reloadTiles(this.coveringTiles(),e),(t=e==null?void 0:e.signal)!=null&&t.aborted){c(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName}) aborted`);return}return yield Promise.allSettled(this._ForEachWxTile(r=>p(this,null,function*(){r.raster_data=yield this.layer.loadTile(r.coords)}),"_reloadVisible")),this._redrawTiles()})}coveringTiles(){var t;c(`WxTileSource coveringTiles (${this.layer.wxdatasetManager.datasetName})`);let e=[];for(let r in this._tiles){let n=(t=this._tiles[r].el)==null?void 0:t.wxtile;n&&e.push(n.coords)}return e}update(){c(`WxTileSource update (${this.layer.wxdatasetManager.datasetName})`),this._ForEachWxTile(e=>{e.draw(e.raster_data&&this.layer.painter.getPaintedCanvas(e.raster_data,this.animation,this.animationSeed))},"_redrawTiles")}_ForEachWxTile(e,t){var n;c(`WxTileSource _ForEachWxTile (${this.layer.wxdatasetManager.datasetName}) func=${t}`);let r=[];for(let s in this._tiles){let i=(n=this._tiles[s].el)==null?void 0:n.wxtile;i&&r.push(e(i))}return r}createTile(e,t){let r=_(256,256),n=r.canvas;return this.layer.loadTile(e).then(s=>{n.wxtile=new Q(e,r,s)}).catch(()=>{n.wxtile=new Q(e,r,null)}).finally(t),n}onRemove(e){return super.onRemove(e),c(`WxTileSource onRemove (${this.layer.wxdatasetManager.datasetName})`),this.animation=!1,this}};var F=class{constructor({datasetName:e,datasetCurrentInstance:t,instanced:r,datasetCurrentMeta:n,metas:s,wxAPI:i}){if(!i.datasetsMetas.allDatasetsList.includes(e))throw new Error(`Dataset ${e} not found`);this.datasetName=e,this.instanced=r,this.datasetCurrentInstance=t,this.datasetCurrentMeta=n,this.metas=s,this.wxAPI=i,c(`WxDataSetManager.constructor: ${this.datasetName}`)}isInstanced(){return!!this.instanced}getValidTime(e=Date()){c(`WxDataSetManager.getValidTime: ${this.datasetName}, ${e}`);let t=this.getTimes();if(e==="")return t[t.length-1];if(typeof e=="string"){let s=t.indexOf(e);if(s!==-1)return t[s]}if(typeof e=="number"){if(e<=0)return t[0];if(e<t.length)return t[e]}let r=new Date(e).getTime();return isNaN(r)?t[t.length-1]:t.find(s=>new Date(s).getTime()>=r)||t[t.length-1]}getTimes(){return c(`WxDataSetManager.getTimes: ${this.datasetName}`),this.instanced||this.datasetCurrentMeta.times}getVariables(){return c(`WxDataSetManager.getVariables: ${this.datasetName}`),this.datasetCurrentMeta.variables}getVariableMeta(e){return c(`WxDataSetManager.getVariableMeta: ${this.datasetName}, ${e}`),this.datasetCurrentMeta.variablesMeta[e]}getInstanceVariableMeta(e,t){return c(`WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${e}, ${t}`),this.getInstanceMeta(t).variablesMeta[e]}getMaxZoom(){return c(`WxDataSetManager.getMaxZoom: ${this.datasetName}`),this.datasetCurrentMeta.maxZoom}getBoundaries(){return c(`WxDataSetManager.getBoundaries: ${this.datasetName}`),this.datasetCurrentMeta.boundaries}getInstanceMeta(e){return c(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${e}`),this.instanced&&this.metas.get(e)||this.datasetCurrentMeta}createURI(e,t,r="png"){if(c(`WxDataSetManager.createURI: ${this.datasetName}, ${e}, ${t}`),!this.checkVariableValid(e))throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);let n=this.instanced?t:this.datasetCurrentInstance;return`${this.wxAPI.dataServerURL+this.datasetName}/${n}/${e}/${t}/{z}/{x}/{y}.${r}`}checkVariableValid(e){return c(`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${e}`),this.getVariableMeta(e)!==void 0}checkCombineVariableIfVector(e){c(`WxDataSetManager.checkCombineVariableIfVector: ${this.datasetName}, ${e}`);let t=this.getVariableMeta(e);if(!t)throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);return t.vector||[e]}createSourceLayer(e,t){c(`WxDataSetManager.createSourceLayer: ${this.datasetName}`);let r=xe(C({},e),{variables:this.checkCombineVariableIfVector(e.variable),wxdatasetManager:this});return new O(r,t)}checkDatasetOutdated(){return p(this,null,function*(){return c(`WxDataSetManager.checkDatasetOutdated: ${this.datasetName}`),yield this.wxAPI.initDone,(yield this.getDatasetInstance())===this.datasetCurrentInstance})}getDatasetInstance(){return p(this,null,function*(){c(`WxDataSetManager.getDatasetInstance: ${this.datasetName}`);let e=yield this.getDatasetInstances();return e[e.length-1]})}getDatasetInstances(){return p(this,null,function*(){c(`WxDataSetManager.getDatasetInstances: ${this.datasetName}`);try{let e=yield A(this.wxAPI.dataServerURL+this.datasetName+"/instances.json",this.wxAPI.requestInit);if(e.length===0)throw new Error(`No instances found for dataset ${this.datasetName}`);return e}catch(e){throw new Error(`getting dataset instances failure message: ${e.message} datasetName: ${this.datasetName} (they are likely removed from API)`)}})}};var ee=class{constructor({dataServerURL:e,maskURL:t="none",maskChannel:r="R",maskDepth:n=11,qtreeURL:s="none",requestInit:i,colorStyles:o,units:l,colorSchemes:m}){this.maskURL="auto";this.datasetsMetas={allDatasetsList:[]};this.qtree=new U;this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));if(c("WxAPI.constructor",e),we({colorStyles:o,units:l,colorSchemes:m}),this.dataServerURL=e,this.requestInit=i,s=s==="auto"?e+"masks/11+1.seamask.qtree":s,t!=="none"){let u=E(ae);this.maskURL=t=t==="auto"?e+"masks/{z}/{x}/{y}.png":t,this.loadMaskFunc=f=>u(G(t,f),i)}this.maskChannel=r==="R"?0:r==="G"?1:r==="B"?2:r==="A"?3:0,this.maskDepth=n,this.initDone=Promise.all([A(e+"datasetsmeta.json",i),s!=="none"?this.qtree.load(s,i):Promise.resolve()]).then(([u,f])=>{u.allDatasetsList||(u.allDatasetsList=Object.keys(u)),this.datasetsMetas=u,c("WxAPI.constructor initDone")})}getDatasetShortMeta(e){if(c("WxAPI.getDatasetShortMeta",e),e!=="allDatasetsList")return this.datasetsMetas[e]}getDatasetInatance(e){var t;return c("WxAPI.getDatasetInatance",e),(t=this.getDatasetShortMeta(e))==null?void 0:t.instance}getDatasetVariables(e){return p(this,null,function*(){var t;return yield this.initDone,c("WxAPI.getDatasetVariables",e),(t=this.datasetsMetas[e])==null?void 0:t.variables})}createDatasetManager(e){return p(this,null,function*(){yield this.initDone,c("WxAPI.createDatasetManager",e);let t=this.getDatasetShortMeta(e),r=t==null?void 0:t.instance;if(!r)throw new Error("Dataset/instance not found:"+e);let n=t.instanced,s=m=>A(this.dataServerURL+e+"/"+m+"/meta.json",this.requestInit),i=m=>p(this,null,function*(){return[m,yield s(m)]}),o=yield s(r),l=new Map(n?yield Promise.all(n.map(i)):[[r,o]]);return new F({datasetName:e,datasetCurrentInstance:r,datasetCurrentMeta:o,instanced:n,metas:l,wxAPI:this})})}createAllDatasetsManagers(){return p(this,null,function*(){return yield this.initDone,c("WxAPI.createAllDatasetsManagers"),Promise.allSettled(this.datasetsMetas.allDatasetsList.map(t=>this.createDatasetManager(t)))})}filterDatasetsByVariableName(e){return p(this,null,function*(){return yield this.initDone,c("WxAPI.filterDatasetsByVariableName",e),this.datasetsMetas.allDatasetsList.filter(t=>{var r,n,s;return(s=(n=(r=this.datasetsMetas[t])==null?void 0:r.variables)==null?void 0:n.includes)==null?void 0:s.call(n,e)})})}getAllDatasetsNames(){return p(this,null,function*(){return yield this.initDone,c("WxAPI.getAllDatasetsNames"),this.datasetsMetas.allDatasetsList})}};return Ke(ht);})();
|
|
6
|
+
time: ${e.time}`),!e.variables?.length||e.variables.length>2)throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: only 1 or 2 variables are supported but ${e.variables} was given`);e.variables.forEach(s=>{if(!e.wxdatasetManager.isVariableValid(s))throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: variable ${s} is not valid`)}),this.variables=e.variables,this.wxdatasetManager=e.wxdatasetManager,[this.tilesURIs,this._time]=this._createURLsAndTime(e.time);let t=P(),r=t.base,n=e.wxstyleName&&t[e.wxstyleName];this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT({...r,...n,...e.wxstyle})}get nonanimatable(){return m("WxLayer.nonanimatabl()"),this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getMaxZoom(){return m("WxLayer.getMaxZoom"),this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).maxZoom:this.wxdatasetManager.getMaxZoom()}getCoarseMaxZoom(){return m("WxLayer.getCoarseMaxZoom"),this.getMaxZoom()-this.coarseLevel}getBoundaries(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).boundaries:this.wxdatasetManager.getBoundaries()}getTime(){return m("WxLayer.getTime"),this._time}clearCache(){m("WxLayer.clearCache"),this.tilesRasterCache.clear(),this._loader.clearCache()}getCurrentStyleObjectCopy(){return m("WxLayer.getCurrentStyleObjectCopy"),Object.assign({},this.style)}updateCurrentStyleObject(e){m(`WxLayer.updateCurrentStyleObject ${JSON.stringify(e)}`),[this.style,this.CLUT]=this._createStyleAndCLUT(e)}getTileData(e,t){let r=this.tilesRasterCache.get(G(e));if(!r)return;let n=this._getPixelInfo(t,r.data.data);if(!n)return;let{raw:s,data:o}=n,i=s.map(l=>this.CLUT.colorsI[l]),u=i.map(T),c=o.map(l=>this.CLUT.DataToStyle(l));return{data:o,raw:s,rgba:i,hexColor:u,inStyleUnits:c,tilePoint:t,styleUnits:this.style.units,dataUnits:this.currentVariableMeta.units}}setURLsAndTime(e){m(`WxLayer.setURLsAndTime time=${e}`),[this.tilesURIs,this._time]=this._createURLsAndTime(e),this.wxdatasetManager.isInstanced()&&(this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT())}getPaintedCanvas(e,t,r){return this._painter.getPaintedCanvas(e,t,r)}async loadTile(e,t){return this._loadCacheDrawTile(e,this.tilesRasterCache,t)}async preloadTime(e,t,r){m(`WxLayer.preloadTime time=${e}`);let[n]=this._createURLsAndTime(e);await Promise.allSettled(t.map(s=>this._loader.cacheLoad(s,n,r)))}async reloadTiles(e,t){m("WxLayer.reloadTiles");let r=new N;await Promise.allSettled(e.map(n=>this._loadCacheDrawTile(n,r,t))),t?.signal?.aborted?r.clear():(this.tilesRasterCache.clear(),this.tilesRasterCache=r)}async _loadCacheDrawTile(e,t,r){let n=t.get(G(e));if(n)return n;let s=await this._loader.load(e,r);if(!s)return null;let o=A(256,256),i=o,u=this.variables.length===2?A(256,256):o,c={ctxFill:o,ctxText:i,ctxStreamLines:u,data:s};return this._painter.paint(c),t.set(G(e),c),c}_getCurrentVariableMeta(){let e=this.variables.map(o=>{let i=this.wxdatasetManager.getInstanceVariableMeta(o,this._time);if(!i)throw new Error(`datasetName ${this.wxdatasetManager.datasetName}: variable ${o} is not valid`);return i}),{min:t,max:r,units:n,vector:s}=e[0];return this.variables.length>1&&(t=0,r=1.42*Math.max(-e[0].min,e[0].max,-e[1].min,e[1].max)),{min:t,max:r,units:n,vector:s}}_getPixelInfo({x:e,y:t},r){m(`WxLayer._getPixelInfo x=${e} y=${t}`);let n=(t+1)*258+(e+1);if(r?.[0]?.raw?.[n])return{raw:r.map(s=>s.raw[n]),data:r.map(s=>s.raw[n]*s.dmul+s.dmin)}}_createStyleAndCLUT(e){let t=Object.assign({},this.style,e),r=this._prepareCLUT(t);return[t,r]}_prepareCLUT(e){let{min:t,max:r,units:n}=this.currentVariableMeta;return new H(e,n,[t,r],this.variables.length===2)}_createURLsAndTime(e){let t=this.wxdatasetManager.getNearestValidTime(e);return[this.variables.map(n=>this.wxdatasetManager.createURI(n,t)),t]}};var Ue=qe(Re()),K=class extends Ue.default.GridLayer{constructor(t){super(t);this.id=t.id}};var Z=class extends K{constructor(t,r){m(`WxLayerBaseImplementation.constructor (${r.id})`);super(r);this._animation=!1;this._animationSeed=0;this._needUpdateDSManager=!1;this._layer=new $(t)}get wxdatasetManager(){return m(`WxLayerBaseImplementation.wxdatasetManager (${this.id})`),this._layer.wxdatasetManager}getCurrentVariableMeta(){return m(`WxLayerBaseImplementation.getCurrentVariableMeta (${this.id})`),{...this._layer.currentVariableMeta}}getDatasetMeta(){return this._layer.wxdatasetManager.getInstanceMeta(this.getTime())}getMetadata(){return m(`WxLayerBaseImplementation.getMetadata (${this.id})`),{...this._layer.currentVariableMeta}}getVariablesNames(){return m(`WxLayerBaseImplementation.getVariables (${this.id})`),[...this._layer.variables]}clearCache(){m(`WxLayerBaseImplementation.clearCache (${this.id})`),this._layer.clearCache()}getCache(){return this._layer.tilesRasterCache}getCurrentStyleObjectCopy(){return m(`WxLayerBaseImplementation.getCurrentStyleObjectCopy (${this.id})`),this._layer.getCurrentStyleObjectCopy()}getTime(){return m(`WxLayerBaseImplementation.getTime (${this.id})`),this._layer.getTime()}getAllTimes(){return m(`WxLayerBaseImplementation.getTimes (${this.id})`),this._layer.wxdatasetManager.getAllTimes()}async setTime(t,r){m(`WxLayerBaseImplementation.setTime (${this.id}) time=${t}`);let n=this.getTime();return this._layer.setURLsAndTime(t),await this._reloadVisible(r),r?.signal?.aborted&&this._layer.setURLsAndTime(n),this.getTime()}async preloadTime(t,r){return m(`WxLayerBaseImplementation.preloadTime (${this.id}) time=${t}`),this._layer.preloadTime(t,this.coveringTiles(),r)}startAnimation(){if(this._animation){m(`WxLayerBaseImplementation.startAnimation (${this.id}) already started`);return}if(this._layer.nonanimatable){m(`WxLayerBaseImplementation.startAnimation (${this.id}) nonanimatable`);return}m(`WxLayerBaseImplementation.startAnimation (${this.id})`),this._animation=!0;let t=async r=>{if(m(`WxLayerBaseImplementation.startAnimation (${this.id}) animationStep`),!this._animation||this._layer.nonanimatable){this._animation=!1;return}this._animationSeed=r,await this._redrawTiles(),requestAnimationFrame(t)};requestAnimationFrame(t)}async stopAnimation(){return m(`WxLayerBaseImplementation.stopAnimation (${this.id})`),this._animation=!1,this._redrawTiles()}async setCoarseLevel(t=2){this._layer.coarseLevel=Math.max(0,Math.min(t,this.wxdatasetManager.getMaxZoom()))}async unsetCoarseLevel(){return this._layer.coarseLevel=0,this._reloadVisible()}async setStyleByName(t,r=!0){return m(`WxLayerBaseImplementation.setStyleByName (${this.id}) wxstyleName=${t} reload=${r}`),this.updateCurrentStyleObject(P()[t],r)}async updateCurrentStyleObject(t,r=!0,n){if(m(`WxLayerBaseImplementation.updateCurrentStyleObject (${this.id}) style=${t} reload=${r}`),this._layer.updateCurrentStyleObject(t),this.startAnimation(),r)return this._reloadVisible(n)}_redrawTiles(){return this._redrawRequested?this._redrawRequested:(this._redrawRequested=new Promise(t=>{requestAnimationFrame(()=>{m(`WxTileSource _redrawTiles (${this.id})`),this.update(),t(),this._redrawRequested=void 0})}),this._redrawRequested)}async _reloadVisible(t){}coveringTiles(){return[]}update(){}async _loadTileHelper(t,r){let n=null;if(!this._needUpdateDSManager)try{n=await this._layer.loadTile(t,r)}catch(s){if(s.name==="AbortError")throw s;s.reason==="instance-not-found"&&!this._needUpdateDSManager&&(this._needUpdateDSManager=!0,m(`WxTileSource.loadTile (${this.id}) instance-not-found. Trying to update wxdatasetManager and load again.`),this.wxdatasetManager.update().then(()=>{this._needUpdateDSManager=!1,this.setTime(this.getTime()).then(()=>this.fire("changed",this))}).catch(o=>{m(`WxTileSource.loadTile (${this.id}) instance-not-found. wxdatasetManager update failed.`,o)}))}return n}};var J=class{constructor(e,t,r){this.coords=e;this.ctx=t;this.raster_data=r;this.draw(r?.ctxFill.canvas)}draw(e){this.ctx.clearRect(0,0,256,256),e&&this.ctx.drawImage(e,0,0)}},B=class extends Z{constructor(e,t){super(e,t),m("WxTileSource constructor: ",e)}getLayerInfoAtLatLon(e,t){if(m(`WxTileSource getLayerInfoAtLatLon (${this._layer.wxdatasetManager.datasetName})`,e),!this._map)return;let r=this._map.getZoom(),n=this._map.project(e,r),s=n.divideBy(256).floor(),o=n.subtract(s.multiplyBy(256)).floor();return this._layer.getTileData({x:s.x,y:s.y,z:r},o)}async _reloadVisible(e){if(m(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName})`),await this._layer.reloadTiles(this.coveringTiles(),e),e?.signal?.aborted){m(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName}) aborted`);return}return await Promise.allSettled(this._ForEachWxTile(async t=>{t.raster_data=null,t.raster_data=await this._layer.loadTile(t.coords)},"_reloadVisible")),this._redrawTiles()}coveringTiles(){m(`WxTileSource coveringTiles (${this._layer.wxdatasetManager.datasetName})`);let e=[];for(let t in this._tiles){let r=this._tiles[t].el?.wxtile;r&&e.push(r.coords)}return e}update(){m(`WxTileSource update (${this._layer.wxdatasetManager.datasetName})`),this._ForEachWxTile(e=>{e.draw(e.raster_data&&this._layer.getPaintedCanvas(e.raster_data,this._animation,this._animationSeed))},"_redrawTiles")}_ForEachWxTile(e,t){m(`WxTileSource _ForEachWxTile (${this._layer.wxdatasetManager.datasetName}) func=${t}`);let r=[];for(let n in this._tiles){let s=this._tiles[n].el?.wxtile;s&&r.push(e(s))}return r}createTile(e,t){let r=A(256,256),n=r.canvas;return this._loadTileHelper(e).then(s=>{n.wxtile=new J(e,r,s)}).catch(()=>{n.wxtile=new J(e,r,null)}).finally(t),n}onRemove(e){return super.onRemove(e),m(`WxTileSource onRemove (${this._layer.wxdatasetManager.datasetName})`),this._animation=!1,this}};var V=class{constructor({datasetName:e,datasetCurrentInstance:t,instanced:r,datasetCurrentMeta:n,metas:s,wxAPI:o}){this.datasetName=e,this._instanced=r,this._datasetCurrentInstance=t,this._datasetCurrentMeta=n,this._metas=s,this.wxAPI=o,m(`WxDataSetManager.constructor: ${this.datasetName}`)}createSourceLayer(e,t){m(`WxDataSetManager.createSourceLayer: ${this.datasetName}`);let r={...e,variables:this._checkCombineVariableIfVector(e.variable),wxdatasetManager:this};return new B(r,t)}getNearestValidTime(e=Date()){m(`WxDataSetManager.getValidTime: ${this.datasetName}, ${e}`);let t=this.getAllTimes();if(e==="")return t[t.length-1];if(typeof e=="string"){let s=t.indexOf(e);if(s!==-1)return t[s]}if(typeof e=="number"){if(e<=0)return t[0];if(e<t.length)return t[e]}let r=new Date(e).getTime();return isNaN(r)?t[t.length-1]:t.find(s=>new Date(s).getTime()>=r)||t[t.length-1]}getAllTimes(){return m(`WxDataSetManager.getTimes: ${this.datasetName}`),this._instanced||this._datasetCurrentMeta.times}getAllVariables(){return m(`WxDataSetManager.getVariables: ${this.datasetName}`),this._datasetCurrentMeta.variables}getVariableCurrentMeta(e){return m(`WxDataSetManager.getVariableCurrentMeta: ${this.datasetName}, ${e}`),this._datasetCurrentMeta.variablesMeta[e]}getInstanceVariableMeta(e,t){return m(`WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${e}, ${t}`),this.getInstanceMeta(t).variablesMeta[e]}getMaxZoom(){return m(`WxDataSetManager.getMaxZoom: ${this.datasetName}`),this._datasetCurrentMeta.maxZoom}getBoundaries(){return m(`WxDataSetManager.getBoundaries: ${this.datasetName}`),this._datasetCurrentMeta.boundaries}getInstanceMeta(e){return m(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${e}`),e&&this._metas?.get(e)||this._datasetCurrentMeta}createURI(e,t,r="png"){if(m(`WxDataSetManager.createURI: ${this.datasetName}, ${e}, ${t}`),!this.isVariableValid(e))throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);let n=this._instanced?t:this._datasetCurrentInstance;return`${this.wxAPI.dataServerURL+this.datasetName}/${n}/${e}/${t}/{z}/{x}/{y}.${r}`}isVariableValid(e){return m(`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${e}`),this._datasetCurrentMeta.variablesMeta[e]!==void 0}async update(){let e=await this.wxAPI.createDatasetManager(this.datasetName);this._datasetCurrentInstance=e._datasetCurrentInstance,this._instanced=e._instanced,this._datasetCurrentMeta=e._datasetCurrentMeta,this._metas=e._metas}isInstanced(){return this._instanced!==void 0}_checkCombineVariableIfVector(e){m(`WxDataSetManager.checkCombineVariableIfVector: ${this.datasetName}, ${e}`);let t=this._datasetCurrentMeta.variablesMeta[e];if(!t)throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);return t.vector||[e]}},Q=class{constructor(e){this.wxAPI=e;this.allDatasetsShortMetas={};this.ready=this.updateAll()}updateAll(){return this.ready=v(this.wxAPI.dataServerURL+"meta.json",this.wxAPI.requestInit),this.ready.then(e=>this.allDatasetsShortMetas=e),this.ready}async updateOne(e){try{let t=this.wxAPI.dataServerURL+e+"/meta.json",r=await v(t,this.wxAPI.requestInit);return Object.assign(this.allDatasetsShortMetas,r)}catch{return this.updateAll()}}};var ee=class{constructor({dataServerURL:e,maskURL:t="none",maskChannel:r="R",maskDepth:n=11,qtreeURL:s="none",requestInit:o,colorStyles:i,units:u,colorSchemes:c}){if(m("WxAPI.constructor",e),he({colorStyles:i,units:u,colorSchemes:c}),s==="auto"&&(s=e+"masks/11+1.seamask.qtree"),t==="auto"&&(t=e+"masks/{z}/{x}/{y}.png"),this.dataServerURL=e,this.requestInit=o,this.maskURL=t,this.maskChannel=r==="R"?0:r==="G"?1:r==="B"?2:r==="A"?3:0,this.maskDepth=n,this.maskURL!=="none"){let l=Y(ae);this.loadMaskFunc=d=>l(j(this.maskURL,d),o)}else this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));this._allDatasetsManager=new Q(this),this.qtree=new k(s,o),this.initDone=Promise.all([this._allDatasetsManager.ready,this.qtree.ready]).then(()=>m("WxAPI.constructor initDone"))}async createDatasetManager(e){await this.initDone,await this._allDatasetsManager.updateOne(e),m("WxAPI.createDatasetManager",e);let t=this._allDatasetsManager.allDatasetsShortMetas[e],r=t?.instance;if(!r)throw new Error("Dataset/instance not found:"+e);let n=t.instanced,s=await v(this.dataServerURL+e+"/metafull.json"),o=s[0],i=n&&new Map(s.map(u=>[u.instance,u]));return new V({datasetName:e,datasetCurrentInstance:r,datasetCurrentMeta:o,instanced:n,metas:i,wxAPI:this})}async getDatasetAllVariables(e){return await this.initDone,m("WxAPI.getDatasetVariables",e),this._allDatasetsManager.allDatasetsShortMetas[e]?.variables}async filterDatasetsByVariableName(e){await this.initDone,m("WxAPI.filterDatasetsByVariableName:",e);let{allDatasetsShortMetas:t}=this._allDatasetsManager;return Object.keys(t).filter(r=>t[r].variables.includes(e))}async getAllDatasetsNames(){return await this.initDone,m("WxAPI.getAllDatasetsNames"),Object.keys(this._allDatasetsManager.allDatasetsShortMetas)}};var te=class{};return Oe(mt);})();
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
--dark-hl-6: #569CD6;
|
|
16
16
|
--light-hl-7: #0070C1;
|
|
17
17
|
--dark-hl-7: #4FC1FF;
|
|
18
|
-
--light-hl-8: #
|
|
19
|
-
--dark-hl-8: #
|
|
20
|
-
--light-hl-9: #
|
|
21
|
-
--dark-hl-9: #
|
|
18
|
+
--light-hl-8: #267F99;
|
|
19
|
+
--dark-hl-8: #4EC9B0;
|
|
20
|
+
--light-hl-9: #098658;
|
|
21
|
+
--dark-hl-9: #B5CEA8;
|
|
22
22
|
--light-code-background: #FFFFFF;
|
|
23
23
|
--dark-code-background: #1E1E1E;
|
|
24
24
|
}
|
package/docs/docs/assets/main.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use strict";(()=>{var Qe=Object.create;var ae=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Me=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ce(e))!Re.call(t,i)&&i!==n&&ae(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Qe(Oe(t)):{},Me(e||!t||!t.__esModule?ae(n,"default",{value:t,enumerable:!0}):n,t));var de=_e((ce,he)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var s=r[i],o=e[s];if(Array.isArray(o)){n[s]=o.slice();continue}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){n[s]=o;continue}throw new TypeError("clone is not deep and does not support nested objects")}return n},t.FieldRef=function(e,n,r){this.docRef=e,this.fieldName=n,this._stringValue=r},t.FieldRef.joiner="/",t.FieldRef.fromString=function(e){var n=e.indexOf(t.FieldRef.joiner);if(n===-1)throw"malformed field ref string";var r=e.slice(0,n),i=e.slice(n+1);return new t.FieldRef(i,r,e)},t.FieldRef.prototype.toString=function(){return this._stringValue==null&&(this._stringValue=this.fieldName+t.FieldRef.joiner+this.docRef),this._stringValue};t.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var n=0;n<this.length;n++)this.elements[e[n]]=!0}else this.length=0},t.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},t.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},t.Set.prototype.contains=function(e){return!!this.elements[e]},t.Set.prototype.intersect=function(e){var n,r,i,s=[];if(e===t.Set.complete)return this;if(e===t.Set.empty)return e;this.length<e.length?(n=this,r=e):(n=e,r=this),i=Object.keys(n.elements);for(var o=0;o<i.length;o++){var a=i[o];a in r.elements&&s.push(a)}return new t.Set(s)},t.Set.prototype.union=function(e){return e===t.Set.complete?t.Set.complete:e===t.Set.empty?this:new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},t.idf=function(e,n){var r=0;for(var i in e)i!="_index"&&(r+=Object.keys(e[i]).length);var s=(n-r+.5)/(r+.5);return Math.log(1+Math.abs(s))},t.Token=function(e,n){this.str=e||"",this.metadata=n||{}},t.Token.prototype.toString=function(){return this.str},t.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},t.Token.prototype.clone=function(e){return e=e||function(n){return n},new t.Token(e(this.str,this.metadata),this.metadata)};t.tokenizer=function(e,n){if(e==null||e==null)return[];if(Array.isArray(e))return e.map(function(m){return new t.Token(t.utils.asString(m).toLowerCase(),t.utils.clone(n))});for(var r=e.toString().toLowerCase(),i=r.length,s=[],o=0,a=0;o<=i;o++){var u=r.charAt(o),l=o-a;if(u.match(t.tokenizer.separator)||o==i){if(l>0){var h=t.utils.clone(n)||{};h.position=[a,l],h.index=s.length,s.push(new t.Token(r.slice(a,o),h))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
|
|
3
|
-
`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r<n;r++){for(var i=this._stack[r],s=[],o=0;o<e.length;o++){var a=i(e[o],o,e);if(!(a==null||a===""))if(Array.isArray(a))for(var u=0;u<a.length;u++)s.push(a[u]);else s.push(a)}e=s}return e},t.Pipeline.prototype.runString=function(e,n){var r=new t.Token(e,n);return this.run([r]).map(function(i){return i.toString()})},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})};t.Vector=function(e){this._magnitude=0,this.elements=e||[]},t.Vector.prototype.positionForIndex=function(e){if(this.elements.length==0)return 0;for(var n=0,r=this.elements.length/2,i=r-n,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<e&&(n=s),o>e&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(o<e)return(s+1)*2},t.Vector.prototype.insert=function(e,n){this.upsert(e,n,function(){throw"duplicate index"})},t.Vector.prototype.upsert=function(e,n,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],n):this.elements.splice(i,0,e,n)},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,n=this.elements.length,r=1;r<n;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},t.Vector.prototype.dot=function(e){for(var n=0,r=this.elements,i=e.elements,s=r.length,o=i.length,a=0,u=0,l=0,h=0;l<s&&h<o;)a=r[l],u=i[h],a<u?l+=2:a>u?h+=2:a==u&&(n+=r[l+1]*i[h+1],l+=2,h+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n<this.elements.length;n+=2,r++)e[r]=this.elements[n];return e},t.Vector.prototype.toJSON=function(){return this.elements};t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},n={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",s=r+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,u="^("+s+")?"+o+s+"("+o+")?$",l="^("+s+")?"+o+s+o+s,h="^("+s+")?"+i,m=new RegExp(a),v=new RegExp(l),b=new RegExp(u),y=new RegExp(h),E=/^(.+?)(ss|i)es$/,f=/^(.+?)([^s])s$/,p=/^(.+?)eed$/,w=/^(.+?)(ed|ing)$/,S=/.$/,I=/(at|bl|iz)$/,_=new RegExp("([^aeiouylsz])\\1$"),z=new RegExp("^"+s+i+"[^aeiouwxy]$"),A=/^(.+?[^aeiou])y$/,q=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,$=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,V=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,W=/^(.+?)(s|t)(ion)$/,P=/^(.+?)e$/,U=/ll$/,G=new RegExp("^"+s+i+"[^aeiouwxy]$"),N=function(c){var g,C,T,d,x,O,D;if(c.length<3)return c;if(T=c.substr(0,1),T=="y"&&(c=T.toUpperCase()+c.substr(1)),d=E,x=f,d.test(c)?c=c.replace(d,"$1$2"):x.test(c)&&(c=c.replace(x,"$1$2")),d=p,x=w,d.test(c)){var L=d.exec(c);d=m,d.test(L[1])&&(d=S,c=c.replace(d,""))}else if(x.test(c)){var L=x.exec(c);g=L[1],x=y,x.test(g)&&(c=g,x=I,O=_,D=z,x.test(c)?c=c+"e":O.test(c)?(d=S,c=c.replace(d,"")):D.test(c)&&(c=c+"e"))}if(d=A,d.test(c)){var L=d.exec(c);g=L[1],c=g+"i"}if(d=q,d.test(c)){var L=d.exec(c);g=L[1],C=L[2],d=m,d.test(g)&&(c=g+e[C])}if(d=$,d.test(c)){var L=d.exec(c);g=L[1],C=L[2],d=m,d.test(g)&&(c=g+n[C])}if(d=V,x=W,d.test(c)){var L=d.exec(c);g=L[1],d=v,d.test(g)&&(c=g)}else if(x.test(c)){var L=x.exec(c);g=L[1]+L[2],x=v,x.test(g)&&(c=g)}if(d=P,d.test(c)){var L=d.exec(c);g=L[1],d=v,x=b,O=G,(d.test(g)||x.test(g)&&!O.test(g))&&(c=g)}return d=U,x=v,d.test(c)&&x.test(c)&&(d=S,c=c.replace(d,"")),T=="y"&&(c=T.toLowerCase()+c.substr(1)),c};return function(M){return M.update(N)}}(),t.Pipeline.registerFunction(t.stemmer,"stemmer");t.generateStopWordFilter=function(e){var n=e.reduce(function(r,i){return r[i]=i,r},{});return function(r){if(r&&n[r.toString()]!==r.toString())return r}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter");t.trimmer=function(e){return e.update(function(n){return n.replace(/^\W+/,"").replace(/\W+$/,"")})},t.Pipeline.registerFunction(t.trimmer,"trimmer");t.TokenSet=function(){this.final=!1,this.edges={},this.id=t.TokenSet._nextId,t.TokenSet._nextId+=1},t.TokenSet._nextId=1,t.TokenSet.fromArray=function(e){for(var n=new t.TokenSet.Builder,r=0,i=e.length;r<i;r++)n.insert(e[r]);return n.finish(),n.root},t.TokenSet.fromClause=function(e){return"editDistance"in e?t.TokenSet.fromFuzzyString(e.term,e.editDistance):t.TokenSet.fromString(e.term)},t.TokenSet.fromFuzzyString=function(e,n){for(var r=new t.TokenSet,i=[{node:r,editsRemaining:n,str:e}];i.length;){var s=i.pop();if(s.str.length>0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}if(s.str.length==0&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var h=s.str.charAt(0),m=s.str.charAt(1),v;m in s.node.edges?v=s.node.edges[m]:(v=new t.TokenSet,s.node.edges[m]=v),s.str.length==1&&(v.final=!0),i.push({node:v,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i<s;i++){var o=e[i],a=i==s-1;if(o=="*")n.edges[o]=n,n.final=a;else{var u=new t.TokenSet;u.final=a,n.edges[o]=u,n=u}}return r},t.TokenSet.prototype.toArray=function(){for(var e=[],n=[{prefix:"",node:this}];n.length;){var r=n.pop(),i=Object.keys(r.node.edges),s=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var o=0;o<s;o++){var a=i[o];n.push({prefix:r.prefix.concat(a),node:r.node.edges[a]})}}return e},t.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",n=Object.keys(this.edges).sort(),r=n.length,i=0;i<r;i++){var s=n[i],o=this.edges[s];e=e+s+o.id}return e},t.TokenSet.prototype.intersect=function(e){for(var n=new t.TokenSet,r=void 0,i=[{qNode:e,output:n,node:this}];i.length;){r=i.pop();for(var s=Object.keys(r.qNode.edges),o=s.length,a=Object.keys(r.node.edges),u=a.length,l=0;l<o;l++)for(var h=s[l],m=0;m<u;m++){var v=a[m];if(v==h||h=="*"){var b=r.node.edges[v],y=r.qNode.edges[h],E=b.final&&y.final,f=void 0;v in r.output.edges?(f=r.output.edges[v],f.final=f.final||E):(f=new t.TokenSet,f.final=E,r.output.edges[v]=f),i.push({qNode:y,output:f,node:b})}}}return n},t.TokenSet.Builder=function(){this.previousWord="",this.root=new t.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},t.TokenSet.Builder.prototype.insert=function(e){var n,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;this.minimize(r),this.uncheckedNodes.length==0?n=this.root:n=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=r;i<e.length;i++){var s=new t.TokenSet,o=e[i];n.edges[o]=s,this.uncheckedNodes.push({parent:n,char:o,child:s}),n=s}n.final=!0,this.previousWord=e},t.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},t.TokenSet.Builder.prototype.minimize=function(e){for(var n=this.uncheckedNodes.length-1;n>=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u<this.fields.length;u++)i[this.fields[u]]=new t.Vector;e.call(n,n);for(var u=0;u<n.clauses.length;u++){var l=n.clauses[u],h=null,m=t.Set.empty;l.usePipeline?h=this.pipeline.runString(l.term,{fields:l.fields}):h=[l.term];for(var v=0;v<h.length;v++){var b=h[v];l.term=b;var y=t.TokenSet.fromClause(l),E=this.tokenSet.intersect(y).toArray();if(E.length===0&&l.presence===t.Query.presence.REQUIRED){for(var f=0;f<l.fields.length;f++){var p=l.fields[f];o[p]=t.Set.empty}break}for(var w=0;w<E.length;w++)for(var S=E[w],I=this.invertedIndex[S],_=I._index,f=0;f<l.fields.length;f++){var p=l.fields[f],z=I[p],A=Object.keys(z),q=S+"/"+p,$=new t.Set(A);if(l.presence==t.Query.presence.REQUIRED&&(m=m.union($),o[p]===void 0&&(o[p]=t.Set.complete)),l.presence==t.Query.presence.PROHIBITED){a[p]===void 0&&(a[p]=t.Set.empty),a[p]=a[p].union($);continue}if(i[p].upsert(_,l.boost,function(ke,Ie){return ke+Ie}),!s[q]){for(var V=0;V<A.length;V++){var W=A[V],P=new t.FieldRef(W,p),U=z[W],G;(G=r[P])===void 0?r[P]=new t.MatchData(S,p,U):G.add(S,p,U)}s[q]=!0}}}if(l.presence===t.Query.presence.REQUIRED)for(var f=0;f<l.fields.length;f++){var p=l.fields[f];o[p]=o[p].intersect(m)}}for(var N=t.Set.complete,M=t.Set.empty,u=0;u<this.fields.length;u++){var p=this.fields[u];o[p]&&(N=N.intersect(o[p])),a[p]&&(M=M.union(a[p]))}var c=Object.keys(r),g=[],C=Object.create(null);if(n.isNegated()){c=Object.keys(this.fieldVectors);for(var u=0;u<c.length;u++){var P=c[u],T=t.FieldRef.fromString(P);r[P]=new t.MatchData}}for(var u=0;u<c.length;u++){var T=t.FieldRef.fromString(c[u]),d=T.docRef;if(!!N.contains(d)&&!M.contains(d)){var x=this.fieldVectors[T],O=i[T.fieldName].similarity(x),D;if((D=C[d])!==void 0)D.score+=O,D.matchData.combine(r[T]);else{var L={ref:d,score:O,matchData:r[T]};C[d]=L,g.push(L)}}}return g.sort(function(we,Te){return Te.score-we.score})},t.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map(function(r){return[r,this.invertedIndex[r]]},this),n=Object.keys(this.fieldVectors).map(function(r){return[r,this.fieldVectors[r].toJSON()]},this);return{version:t.version,fields:this.fields,fieldVectors:n,invertedIndex:e,pipeline:this.pipeline.toJSON()}},t.Index.load=function(e){var n={},r={},i=e.fieldVectors,s=Object.create(null),o=e.invertedIndex,a=new t.TokenSet.Builder,u=t.Pipeline.load(e.pipeline);e.version!=t.version&&t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+t.version+"' does not match serialized index '"+e.version+"'");for(var l=0;l<i.length;l++){var h=i[l],m=h[0],v=h[1];r[m]=new t.Vector(v)}for(var l=0;l<o.length;l++){var h=o[l],b=h[0],y=h[1];a.insert(b),s[b]=y}return a.finish(),n.fields=e.fields,n.fieldVectors=r,n.invertedIndex=s,n.tokenSet=a.root,n.pipeline=u,new t.Index(n)};t.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=t.tokenizer,this.pipeline=new t.Pipeline,this.searchPipeline=new t.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},t.Builder.prototype.ref=function(e){this._ref=e},t.Builder.prototype.field=function(e,n){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=n||{}},t.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,u=a?a(e):e[o],l=this.tokenizer(u,{fields:[o]}),h=this.pipeline.run(l),m=new t.FieldRef(r,o),v=Object.create(null);this.fieldTermFrequencies[m]=v,this.fieldLengths[m]=0,this.fieldLengths[m]+=h.length;for(var b=0;b<h.length;b++){var y=h[b];if(v[y]==null&&(v[y]=0),v[y]+=1,this.invertedIndex[y]==null){var E=Object.create(null);E._index=this.termIndex,this.termIndex+=1;for(var f=0;f<i.length;f++)E[i[f]]=Object.create(null);this.invertedIndex[y]=E}this.invertedIndex[y][o][r]==null&&(this.invertedIndex[y][o][r]=Object.create(null));for(var p=0;p<this.metadataWhitelist.length;p++){var w=this.metadataWhitelist[p],S=y.metadata[w];this.invertedIndex[y][o][r][w]==null&&(this.invertedIndex[y][o][r][w]=[]),this.invertedIndex[y][o][r][w].push(S)}}}},t.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),n=e.length,r={},i={},s=0;s<n;s++){var o=t.FieldRef.fromString(e[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,r[a]||(r[a]=0),r[a]+=this.fieldLengths[o]}for(var u=Object.keys(this._fields),s=0;s<u.length;s++){var l=u[s];r[l]=r[l]/i[l]}this.averageFieldLength=r},t.Builder.prototype.createFieldVectors=function(){for(var e={},n=Object.keys(this.fieldTermFrequencies),r=n.length,i=Object.create(null),s=0;s<r;s++){for(var o=t.FieldRef.fromString(n[s]),a=o.fieldName,u=this.fieldLengths[o],l=new t.Vector,h=this.fieldTermFrequencies[o],m=Object.keys(h),v=m.length,b=this._fields[a].boost||1,y=this._documents[o.docRef].boost||1,E=0;E<v;E++){var f=m[E],p=h[f],w=this.invertedIndex[f]._index,S,I,_;i[f]===void 0?(S=t.idf(this.invertedIndex[f],this.documentCount),i[f]=S):S=i[f],I=S*((this._k1+1)*p)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+p),I*=b,I*=y,_=Math.round(I*1e3)/1e3,l.insert(w,_)}e[o]=l}this.fieldVectors=e},t.Builder.prototype.createTokenSet=function(){this.tokenSet=t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},t.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new t.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},t.Builder.prototype.use=function(e){var n=Array.prototype.slice.call(arguments,1);n.unshift(this),e.apply(this,n)},t.MatchData=function(e,n,r){for(var i=Object.create(null),s=Object.keys(r||{}),o=0;o<s.length;o++){var a=s[o];i[a]=r[a].slice()}this.metadata=Object.create(null),e!==void 0&&(this.metadata[e]=Object.create(null),this.metadata[e][n]=i)},t.MatchData.prototype.combine=function(e){for(var n=Object.keys(e.metadata),r=0;r<n.length;r++){var i=n[r],s=Object.keys(e.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],u=Object.keys(e.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var l=0;l<u.length;l++){var h=u[l];this.metadata[i][a][h]==null?this.metadata[i][a][h]=e.metadata[i][a][h]:this.metadata[i][a][h]=this.metadata[i][a][h].concat(e.metadata[i][a][h])}}}},t.MatchData.prototype.add=function(e,n,r){if(!(e in this.metadata)){this.metadata[e]=Object.create(null),this.metadata[e][n]=r;return}if(!(n in this.metadata[e])){this.metadata[e][n]=r;return}for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];o in this.metadata[e][n]?this.metadata[e][n][o]=this.metadata[e][n][o].concat(r[o]):this.metadata[e][n][o]=r[o]}},t.Query=function(e){this.clauses=[],this.allFields=e},t.Query.wildcard=new String("*"),t.Query.wildcard.NONE=0,t.Query.wildcard.LEADING=1,t.Query.wildcard.TRAILING=2,t.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},t.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=t.Query.wildcard.NONE),e.wildcard&t.Query.wildcard.LEADING&&e.term.charAt(0)!=t.Query.wildcard&&(e.term="*"+e.term),e.wildcard&t.Query.wildcard.TRAILING&&e.term.slice(-1)!=t.Query.wildcard&&(e.term=""+e.term+"*"),"presence"in e||(e.presence=t.Query.presence.OPTIONAL),this.clauses.push(e),this},t.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=t.Query.presence.PROHIBITED)return!1;return!0},t.Query.prototype.term=function(e,n){if(Array.isArray(e))return e.forEach(function(i){this.term(i,t.utils.clone(n))},this),this;var r=n||{};return r.term=e.toString(),this.clause(r),this},t.QueryParseError=function(e,n,r){this.name="QueryParseError",this.message=e,this.start=n,this.end=r},t.QueryParseError.prototype=new Error,t.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},t.QueryLexer.prototype.run=function(){for(var e=t.QueryLexer.lexText;e;)e=e(this)},t.QueryLexer.prototype.sliceString=function(){for(var e=[],n=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(n,r)),n=r+1;return e.push(this.str.slice(n,this.pos)),this.escapeCharPositions.length=0,e.join("")},t.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},t.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},t.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos<this.length},t.QueryLexer.EOS="EOS",t.QueryLexer.FIELD="FIELD",t.QueryLexer.TERM="TERM",t.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",t.QueryLexer.BOOST="BOOST",t.QueryLexer.PRESENCE="PRESENCE",t.QueryLexer.lexField=function(e){return e.backup(),e.emit(t.QueryLexer.FIELD),e.ignore(),t.QueryLexer.lexText},t.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof ce=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});var le=[];function j(t,e){le.push({selector:e,constructor:t})}var Y=class{constructor(){this.createComponents(document.body)}createComponents(e){le.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r}),r.dataset.hasInstance=String(!0))})})}};var k=class{constructor(e){this.el=e.el}};var J=class{constructor(){this.listeners={}}addEventListener(e,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(n)}removeEventListener(e,n){if(!(e in this.listeners))return;let r=this.listeners[e];for(let i=0,s=r.length;i<s;i++)if(r[i]===n){r.splice(i,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return!0;let n=this.listeners[e.type].slice();for(let r=0,i=n.length;r<i;r++)n[r].call(this,e);return!e.defaultPrevented}};var ne=(t,e=100)=>{let n=Date.now();return(...r)=>{n+e-Date.now()<0&&(t(...r),n=Date.now())}};var re=class extends J{constructor(){super();this.scrollTop=0;this.lastY=0;this.width=0;this.height=0;this.showToolbar=!0;this.toolbar=document.querySelector(".tsd-page-toolbar"),this.navigation=document.querySelector(".col-menu"),window.addEventListener("scroll",ne(()=>this.onScroll(),10)),window.addEventListener("resize",ne(()=>this.onResize(),10)),this.searchInput=document.querySelector("#tsd-search input"),this.searchInput&&this.searchInput.addEventListener("focus",()=>{this.hideShowToolbar()}),this.onResize(),this.onScroll()}triggerResize(){let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onResize(){this.width=window.innerWidth||0,this.height=window.innerHeight||0;let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onScroll(){this.scrollTop=window.scrollY||0;let n=new CustomEvent("scroll",{detail:{scrollTop:this.scrollTop}});this.dispatchEvent(n),this.hideShowToolbar()}hideShowToolbar(){let n=this.showToolbar;this.showToolbar=this.lastY>=this.scrollTop||this.scrollTop<=0||!!this.searchInput&&this.searchInput===document.activeElement,n!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.navigation?.classList.toggle("col-menu--hide")),this.lastY=this.scrollTop}},R=re;R.instance=new re;var X=class extends k{constructor(n){super(n);this.anchors=[];this.index=-1;R.instance.addEventListener("resize",()=>this.onResize()),R.instance.addEventListener("scroll",r=>this.onScroll(r)),this.createAnchors()}createAnchors(){let n=window.location.href;n.indexOf("#")!=-1&&(n=n.substring(0,n.indexOf("#"))),this.el.querySelectorAll("a").forEach(r=>{let i=r.href;if(i.indexOf("#")==-1||i.substring(0,n.length)!=n)return;let s=i.substring(i.indexOf("#")+1),o=document.querySelector("a.tsd-anchor[name="+s+"]"),a=r.parentNode;!o||!a||this.anchors.push({link:a,anchor:o,position:0})}),this.onResize()}onResize(){let n;for(let i=0,s=this.anchors.length;i<s;i++){n=this.anchors[i];let o=n.anchor.getBoundingClientRect();n.position=o.top+document.body.scrollTop}this.anchors.sort((i,s)=>i.position-s.position);let r=new CustomEvent("scroll",{detail:{scrollTop:R.instance.scrollTop}});this.onScroll(r)}onScroll(n){let r=n.detail.scrollTop+5,i=this.anchors,s=i.length-1,o=this.index;for(;o>-1&&i[o].position>r;)o-=1;for(;o<s&&i[o+1].position<r;)o+=1;this.index!=o&&(this.index>-1&&this.anchors[this.index].link.classList.remove("focus"),this.index=o,this.index>-1&&this.anchors[this.index].link.classList.add("focus"))}};var ue=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var me=De(de());function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let n=document.querySelector("#tsd-search input"),r=document.querySelector("#tsd-search .results");if(!n||!r)throw new Error("The input field or the result list wrapper was not found");let i=!1;r.addEventListener("mousedown",()=>i=!0),r.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),n.addEventListener("focus",()=>t.classList.add("has-focus")),n.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Fe(t,r,n,s)}function Fe(t,e,n,r){n.addEventListener("input",ue(()=>{Ae(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?fe(e,-1):s.key==="ArrowDown"?fe(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function He(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=me.Index.load(window.searchData.index))}function Ae(t,e,n,r){if(He(r,t),!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;o<s.length;o++){let a=s[o],u=r.data.rows[Number(a.ref)],l=1;u.name.toLowerCase().startsWith(i.toLowerCase())&&(l*=1+1/(1+Math.abs(u.name.length-i.length))),a.score*=l}s.sort((o,a)=>a.score-o.score);for(let o=0,a=Math.min(10,s.length);o<a;o++){let u=r.data.rows[Number(s[o].ref)],l=pe(u.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(l+=` (score: ${s[o].score.toFixed(2)})`),u.parent&&(l=`<span class="parent">${pe(u.parent,i)}.</span>${l}`);let h=document.createElement("li");h.classList.value=u.classes??"";let m=document.createElement("a");m.href=r.base+u.url,m.innerHTML=l,h.append(m),e.appendChild(h)}}function fe(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function pe(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ie(t.substring(s,o)),`<b>${ie(t.substring(o,o+r.length))}</b>`),s=o+r.length,o=n.indexOf(r,s);return i.push(ie(t.substring(s))),i.join("")}var Ne={"&":"&","<":"<",">":">","'":"'",'"':"""};function ie(t){return t.replace(/[&<>"'"]/g,e=>Ne[e])}var F="mousedown",ye="mousemove",B="mouseup",Z={x:0,y:0},ge=!1,se=!1,je=!1,H=!1,xe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(xe?"is-mobile":"not-mobile");xe&&"ontouchstart"in document.documentElement&&(je=!0,F="touchstart",ye="touchmove",B="touchend");document.addEventListener(F,t=>{se=!0,H=!1;let e=F=="touchstart"?t.targetTouches[0]:t;Z.y=e.pageY||0,Z.x=e.pageX||0});document.addEventListener(ye,t=>{if(!!se&&!H){let e=F=="touchstart"?t.targetTouches[0]:t,n=Z.x-(e.pageX||0),r=Z.y-(e.pageY||0);H=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{se=!1});document.addEventListener("click",t=>{ge&&(t.preventDefault(),t.stopImmediatePropagation(),ge=!1)});var K=class extends k{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){H||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-menu, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!H&&this.active&&n.target.closest(".col-menu")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var oe;try{oe=localStorage}catch{oe={getItem(){return null},setItem(){}}}var Q=oe;var Le=document.head.appendChild(document.createElement("style"));Le.dataset.for="filters";var ee=class extends k{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),Le.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
|
|
4
|
-
`}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var te=class extends
|
|
5
|
-
/*!
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
3
|
+
`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r<n;r++){for(var i=this._stack[r],s=[],o=0;o<e.length;o++){var a=i(e[o],o,e);if(!(a==null||a===""))if(Array.isArray(a))for(var u=0;u<a.length;u++)s.push(a[u]);else s.push(a)}e=s}return e},t.Pipeline.prototype.runString=function(e,n){var r=new t.Token(e,n);return this.run([r]).map(function(i){return i.toString()})},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})};t.Vector=function(e){this._magnitude=0,this.elements=e||[]},t.Vector.prototype.positionForIndex=function(e){if(this.elements.length==0)return 0;for(var n=0,r=this.elements.length/2,i=r-n,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<e&&(n=s),o>e&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(o<e)return(s+1)*2},t.Vector.prototype.insert=function(e,n){this.upsert(e,n,function(){throw"duplicate index"})},t.Vector.prototype.upsert=function(e,n,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],n):this.elements.splice(i,0,e,n)},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,n=this.elements.length,r=1;r<n;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},t.Vector.prototype.dot=function(e){for(var n=0,r=this.elements,i=e.elements,s=r.length,o=i.length,a=0,u=0,l=0,h=0;l<s&&h<o;)a=r[l],u=i[h],a<u?l+=2:a>u?h+=2:a==u&&(n+=r[l+1]*i[h+1],l+=2,h+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n<this.elements.length;n+=2,r++)e[r]=this.elements[n];return e},t.Vector.prototype.toJSON=function(){return this.elements};t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},n={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",s=r+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,u="^("+s+")?"+o+s+"("+o+")?$",l="^("+s+")?"+o+s+o+s,h="^("+s+")?"+i,m=new RegExp(a),v=new RegExp(l),b=new RegExp(u),y=new RegExp(h),E=/^(.+?)(ss|i)es$/,p=/^(.+?)([^s])s$/,f=/^(.+?)eed$/,S=/^(.+?)(ed|ing)$/,w=/.$/,k=/(at|bl|iz)$/,_=new RegExp("([^aeiouylsz])\\1$"),z=new RegExp("^"+s+i+"[^aeiouwxy]$"),H=/^(.+?[^aeiou])y$/,q=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,$=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,V=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,W=/^(.+?)(s|t)(ion)$/,P=/^(.+?)e$/,U=/ll$/,G=new RegExp("^"+s+i+"[^aeiouwxy]$"),N=function(c){var g,C,T,d,x,O,D;if(c.length<3)return c;if(T=c.substr(0,1),T=="y"&&(c=T.toUpperCase()+c.substr(1)),d=E,x=p,d.test(c)?c=c.replace(d,"$1$2"):x.test(c)&&(c=c.replace(x,"$1$2")),d=f,x=S,d.test(c)){var L=d.exec(c);d=m,d.test(L[1])&&(d=w,c=c.replace(d,""))}else if(x.test(c)){var L=x.exec(c);g=L[1],x=y,x.test(g)&&(c=g,x=k,O=_,D=z,x.test(c)?c=c+"e":O.test(c)?(d=w,c=c.replace(d,"")):D.test(c)&&(c=c+"e"))}if(d=H,d.test(c)){var L=d.exec(c);g=L[1],c=g+"i"}if(d=q,d.test(c)){var L=d.exec(c);g=L[1],C=L[2],d=m,d.test(g)&&(c=g+e[C])}if(d=$,d.test(c)){var L=d.exec(c);g=L[1],C=L[2],d=m,d.test(g)&&(c=g+n[C])}if(d=V,x=W,d.test(c)){var L=d.exec(c);g=L[1],d=v,d.test(g)&&(c=g)}else if(x.test(c)){var L=x.exec(c);g=L[1]+L[2],x=v,x.test(g)&&(c=g)}if(d=P,d.test(c)){var L=d.exec(c);g=L[1],d=v,x=b,O=G,(d.test(g)||x.test(g)&&!O.test(g))&&(c=g)}return d=U,x=v,d.test(c)&&x.test(c)&&(d=w,c=c.replace(d,"")),T=="y"&&(c=T.toLowerCase()+c.substr(1)),c};return function(M){return M.update(N)}}(),t.Pipeline.registerFunction(t.stemmer,"stemmer");t.generateStopWordFilter=function(e){var n=e.reduce(function(r,i){return r[i]=i,r},{});return function(r){if(r&&n[r.toString()]!==r.toString())return r}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter");t.trimmer=function(e){return e.update(function(n){return n.replace(/^\W+/,"").replace(/\W+$/,"")})},t.Pipeline.registerFunction(t.trimmer,"trimmer");t.TokenSet=function(){this.final=!1,this.edges={},this.id=t.TokenSet._nextId,t.TokenSet._nextId+=1},t.TokenSet._nextId=1,t.TokenSet.fromArray=function(e){for(var n=new t.TokenSet.Builder,r=0,i=e.length;r<i;r++)n.insert(e[r]);return n.finish(),n.root},t.TokenSet.fromClause=function(e){return"editDistance"in e?t.TokenSet.fromFuzzyString(e.term,e.editDistance):t.TokenSet.fromString(e.term)},t.TokenSet.fromFuzzyString=function(e,n){for(var r=new t.TokenSet,i=[{node:r,editsRemaining:n,str:e}];i.length;){var s=i.pop();if(s.str.length>0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}if(s.str.length==0&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var h=s.str.charAt(0),m=s.str.charAt(1),v;m in s.node.edges?v=s.node.edges[m]:(v=new t.TokenSet,s.node.edges[m]=v),s.str.length==1&&(v.final=!0),i.push({node:v,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i<s;i++){var o=e[i],a=i==s-1;if(o=="*")n.edges[o]=n,n.final=a;else{var u=new t.TokenSet;u.final=a,n.edges[o]=u,n=u}}return r},t.TokenSet.prototype.toArray=function(){for(var e=[],n=[{prefix:"",node:this}];n.length;){var r=n.pop(),i=Object.keys(r.node.edges),s=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var o=0;o<s;o++){var a=i[o];n.push({prefix:r.prefix.concat(a),node:r.node.edges[a]})}}return e},t.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",n=Object.keys(this.edges).sort(),r=n.length,i=0;i<r;i++){var s=n[i],o=this.edges[s];e=e+s+o.id}return e},t.TokenSet.prototype.intersect=function(e){for(var n=new t.TokenSet,r=void 0,i=[{qNode:e,output:n,node:this}];i.length;){r=i.pop();for(var s=Object.keys(r.qNode.edges),o=s.length,a=Object.keys(r.node.edges),u=a.length,l=0;l<o;l++)for(var h=s[l],m=0;m<u;m++){var v=a[m];if(v==h||h=="*"){var b=r.node.edges[v],y=r.qNode.edges[h],E=b.final&&y.final,p=void 0;v in r.output.edges?(p=r.output.edges[v],p.final=p.final||E):(p=new t.TokenSet,p.final=E,r.output.edges[v]=p),i.push({qNode:y,output:p,node:b})}}}return n},t.TokenSet.Builder=function(){this.previousWord="",this.root=new t.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},t.TokenSet.Builder.prototype.insert=function(e){var n,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;this.minimize(r),this.uncheckedNodes.length==0?n=this.root:n=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=r;i<e.length;i++){var s=new t.TokenSet,o=e[i];n.edges[o]=s,this.uncheckedNodes.push({parent:n,char:o,child:s}),n=s}n.final=!0,this.previousWord=e},t.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},t.TokenSet.Builder.prototype.minimize=function(e){for(var n=this.uncheckedNodes.length-1;n>=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u<this.fields.length;u++)i[this.fields[u]]=new t.Vector;e.call(n,n);for(var u=0;u<n.clauses.length;u++){var l=n.clauses[u],h=null,m=t.Set.empty;l.usePipeline?h=this.pipeline.runString(l.term,{fields:l.fields}):h=[l.term];for(var v=0;v<h.length;v++){var b=h[v];l.term=b;var y=t.TokenSet.fromClause(l),E=this.tokenSet.intersect(y).toArray();if(E.length===0&&l.presence===t.Query.presence.REQUIRED){for(var p=0;p<l.fields.length;p++){var f=l.fields[p];o[f]=t.Set.empty}break}for(var S=0;S<E.length;S++)for(var w=E[S],k=this.invertedIndex[w],_=k._index,p=0;p<l.fields.length;p++){var f=l.fields[p],z=k[f],H=Object.keys(z),q=w+"/"+f,$=new t.Set(H);if(l.presence==t.Query.presence.REQUIRED&&(m=m.union($),o[f]===void 0&&(o[f]=t.Set.complete)),l.presence==t.Query.presence.PROHIBITED){a[f]===void 0&&(a[f]=t.Set.empty),a[f]=a[f].union($);continue}if(i[f].upsert(_,l.boost,function(Ie,ke){return Ie+ke}),!s[q]){for(var V=0;V<H.length;V++){var W=H[V],P=new t.FieldRef(W,f),U=z[W],G;(G=r[P])===void 0?r[P]=new t.MatchData(w,f,U):G.add(w,f,U)}s[q]=!0}}}if(l.presence===t.Query.presence.REQUIRED)for(var p=0;p<l.fields.length;p++){var f=l.fields[p];o[f]=o[f].intersect(m)}}for(var N=t.Set.complete,M=t.Set.empty,u=0;u<this.fields.length;u++){var f=this.fields[u];o[f]&&(N=N.intersect(o[f])),a[f]&&(M=M.union(a[f]))}var c=Object.keys(r),g=[],C=Object.create(null);if(n.isNegated()){c=Object.keys(this.fieldVectors);for(var u=0;u<c.length;u++){var P=c[u],T=t.FieldRef.fromString(P);r[P]=new t.MatchData}}for(var u=0;u<c.length;u++){var T=t.FieldRef.fromString(c[u]),d=T.docRef;if(N.contains(d)&&!M.contains(d)){var x=this.fieldVectors[T],O=i[T.fieldName].similarity(x),D;if((D=C[d])!==void 0)D.score+=O,D.matchData.combine(r[T]);else{var L={ref:d,score:O,matchData:r[T]};C[d]=L,g.push(L)}}}return g.sort(function(Se,Te){return Te.score-Se.score})},t.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map(function(r){return[r,this.invertedIndex[r]]},this),n=Object.keys(this.fieldVectors).map(function(r){return[r,this.fieldVectors[r].toJSON()]},this);return{version:t.version,fields:this.fields,fieldVectors:n,invertedIndex:e,pipeline:this.pipeline.toJSON()}},t.Index.load=function(e){var n={},r={},i=e.fieldVectors,s=Object.create(null),o=e.invertedIndex,a=new t.TokenSet.Builder,u=t.Pipeline.load(e.pipeline);e.version!=t.version&&t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+t.version+"' does not match serialized index '"+e.version+"'");for(var l=0;l<i.length;l++){var h=i[l],m=h[0],v=h[1];r[m]=new t.Vector(v)}for(var l=0;l<o.length;l++){var h=o[l],b=h[0],y=h[1];a.insert(b),s[b]=y}return a.finish(),n.fields=e.fields,n.fieldVectors=r,n.invertedIndex=s,n.tokenSet=a.root,n.pipeline=u,new t.Index(n)};t.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=t.tokenizer,this.pipeline=new t.Pipeline,this.searchPipeline=new t.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},t.Builder.prototype.ref=function(e){this._ref=e},t.Builder.prototype.field=function(e,n){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=n||{}},t.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,u=a?a(e):e[o],l=this.tokenizer(u,{fields:[o]}),h=this.pipeline.run(l),m=new t.FieldRef(r,o),v=Object.create(null);this.fieldTermFrequencies[m]=v,this.fieldLengths[m]=0,this.fieldLengths[m]+=h.length;for(var b=0;b<h.length;b++){var y=h[b];if(v[y]==null&&(v[y]=0),v[y]+=1,this.invertedIndex[y]==null){var E=Object.create(null);E._index=this.termIndex,this.termIndex+=1;for(var p=0;p<i.length;p++)E[i[p]]=Object.create(null);this.invertedIndex[y]=E}this.invertedIndex[y][o][r]==null&&(this.invertedIndex[y][o][r]=Object.create(null));for(var f=0;f<this.metadataWhitelist.length;f++){var S=this.metadataWhitelist[f],w=y.metadata[S];this.invertedIndex[y][o][r][S]==null&&(this.invertedIndex[y][o][r][S]=[]),this.invertedIndex[y][o][r][S].push(w)}}}},t.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),n=e.length,r={},i={},s=0;s<n;s++){var o=t.FieldRef.fromString(e[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,r[a]||(r[a]=0),r[a]+=this.fieldLengths[o]}for(var u=Object.keys(this._fields),s=0;s<u.length;s++){var l=u[s];r[l]=r[l]/i[l]}this.averageFieldLength=r},t.Builder.prototype.createFieldVectors=function(){for(var e={},n=Object.keys(this.fieldTermFrequencies),r=n.length,i=Object.create(null),s=0;s<r;s++){for(var o=t.FieldRef.fromString(n[s]),a=o.fieldName,u=this.fieldLengths[o],l=new t.Vector,h=this.fieldTermFrequencies[o],m=Object.keys(h),v=m.length,b=this._fields[a].boost||1,y=this._documents[o.docRef].boost||1,E=0;E<v;E++){var p=m[E],f=h[p],S=this.invertedIndex[p]._index,w,k,_;i[p]===void 0?(w=t.idf(this.invertedIndex[p],this.documentCount),i[p]=w):w=i[p],k=w*((this._k1+1)*f)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+f),k*=b,k*=y,_=Math.round(k*1e3)/1e3,l.insert(S,_)}e[o]=l}this.fieldVectors=e},t.Builder.prototype.createTokenSet=function(){this.tokenSet=t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},t.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new t.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},t.Builder.prototype.use=function(e){var n=Array.prototype.slice.call(arguments,1);n.unshift(this),e.apply(this,n)},t.MatchData=function(e,n,r){for(var i=Object.create(null),s=Object.keys(r||{}),o=0;o<s.length;o++){var a=s[o];i[a]=r[a].slice()}this.metadata=Object.create(null),e!==void 0&&(this.metadata[e]=Object.create(null),this.metadata[e][n]=i)},t.MatchData.prototype.combine=function(e){for(var n=Object.keys(e.metadata),r=0;r<n.length;r++){var i=n[r],s=Object.keys(e.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],u=Object.keys(e.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var l=0;l<u.length;l++){var h=u[l];this.metadata[i][a][h]==null?this.metadata[i][a][h]=e.metadata[i][a][h]:this.metadata[i][a][h]=this.metadata[i][a][h].concat(e.metadata[i][a][h])}}}},t.MatchData.prototype.add=function(e,n,r){if(!(e in this.metadata)){this.metadata[e]=Object.create(null),this.metadata[e][n]=r;return}if(!(n in this.metadata[e])){this.metadata[e][n]=r;return}for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];o in this.metadata[e][n]?this.metadata[e][n][o]=this.metadata[e][n][o].concat(r[o]):this.metadata[e][n][o]=r[o]}},t.Query=function(e){this.clauses=[],this.allFields=e},t.Query.wildcard=new String("*"),t.Query.wildcard.NONE=0,t.Query.wildcard.LEADING=1,t.Query.wildcard.TRAILING=2,t.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},t.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=t.Query.wildcard.NONE),e.wildcard&t.Query.wildcard.LEADING&&e.term.charAt(0)!=t.Query.wildcard&&(e.term="*"+e.term),e.wildcard&t.Query.wildcard.TRAILING&&e.term.slice(-1)!=t.Query.wildcard&&(e.term=""+e.term+"*"),"presence"in e||(e.presence=t.Query.presence.OPTIONAL),this.clauses.push(e),this},t.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=t.Query.presence.PROHIBITED)return!1;return!0},t.Query.prototype.term=function(e,n){if(Array.isArray(e))return e.forEach(function(i){this.term(i,t.utils.clone(n))},this),this;var r=n||{};return r.term=e.toString(),this.clause(r),this},t.QueryParseError=function(e,n,r){this.name="QueryParseError",this.message=e,this.start=n,this.end=r},t.QueryParseError.prototype=new Error,t.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},t.QueryLexer.prototype.run=function(){for(var e=t.QueryLexer.lexText;e;)e=e(this)},t.QueryLexer.prototype.sliceString=function(){for(var e=[],n=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(n,r)),n=r+1;return e.push(this.str.slice(n,this.pos)),this.escapeCharPositions.length=0,e.join("")},t.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},t.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},t.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos<this.length},t.QueryLexer.EOS="EOS",t.QueryLexer.FIELD="FIELD",t.QueryLexer.TERM="TERM",t.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",t.QueryLexer.BOOST="BOOST",t.QueryLexer.PRESENCE="PRESENCE",t.QueryLexer.lexField=function(e){return e.backup(),e.emit(t.QueryLexer.FIELD),e.ignore(),t.QueryLexer.lexText},t.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof ce=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});var le=[];function B(t,e){le.push({selector:e,constructor:t})}var Y=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){le.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureFocusedElementVisible(){this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null);let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}};var I=class{constructor(e){this.el=e.el,this.app=e.app}};var J=class{constructor(){this.listeners={}}addEventListener(e,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(n)}removeEventListener(e,n){if(!(e in this.listeners))return;let r=this.listeners[e];for(let i=0,s=r.length;i<s;i++)if(r[i]===n){r.splice(i,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return!0;let n=this.listeners[e.type].slice();for(let r=0,i=n.length;r<i;r++)n[r].call(this,e);return!e.defaultPrevented}};var ne=(t,e=100)=>{let n=Date.now();return(...r)=>{n+e-Date.now()<0&&(t(...r),n=Date.now())}};var re=class extends J{constructor(){super();this.scrollTop=0;this.lastY=0;this.width=0;this.height=0;this.showToolbar=!0;this.toolbar=document.querySelector(".tsd-page-toolbar"),this.navigation=document.querySelector(".col-menu"),window.addEventListener("scroll",ne(()=>this.onScroll(),10)),window.addEventListener("resize",ne(()=>this.onResize(),10)),this.searchInput=document.querySelector("#tsd-search input"),this.searchInput&&this.searchInput.addEventListener("focus",()=>{this.hideShowToolbar()}),this.onResize(),this.onScroll()}triggerResize(){let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onResize(){this.width=window.innerWidth||0,this.height=window.innerHeight||0;let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onScroll(){this.scrollTop=window.scrollY||0;let n=new CustomEvent("scroll",{detail:{scrollTop:this.scrollTop}});this.dispatchEvent(n),this.hideShowToolbar()}hideShowToolbar(){let n=this.showToolbar;this.showToolbar=this.lastY>=this.scrollTop||this.scrollTop<=0||!!this.searchInput&&this.searchInput===document.activeElement,n!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.navigation?.classList.toggle("col-menu--hide")),this.lastY=this.scrollTop}},R=re;R.instance=new re;var X=class extends I{constructor(n){super(n);this.anchors=[];this.index=-1;R.instance.addEventListener("resize",()=>this.onResize()),R.instance.addEventListener("scroll",r=>this.onScroll(r)),this.createAnchors()}createAnchors(){let n=window.location.href;n.indexOf("#")!=-1&&(n=n.substring(0,n.indexOf("#"))),this.el.querySelectorAll("a").forEach(r=>{let i=r.href;if(i.indexOf("#")==-1||i.substring(0,n.length)!=n)return;let s=i.substring(i.indexOf("#")+1),o=document.querySelector("a.tsd-anchor[name="+s+"]"),a=r.parentNode;!o||!a||this.anchors.push({link:a,anchor:o,position:0})}),this.onResize()}onResize(){let n;for(let i=0,s=this.anchors.length;i<s;i++){n=this.anchors[i];let o=n.anchor.getBoundingClientRect();n.position=o.top+document.body.scrollTop}this.anchors.sort((i,s)=>i.position-s.position);let r=new CustomEvent("scroll",{detail:{scrollTop:R.instance.scrollTop}});this.onScroll(r)}onScroll(n){let r=n.detail.scrollTop+5,i=this.anchors,s=i.length-1,o=this.index;for(;o>-1&&i[o].position>r;)o-=1;for(;o<s&&i[o+1].position<r;)o+=1;this.index!=o&&(this.index>-1&&this.anchors[this.index].link.classList.remove("focus"),this.index=o,this.index>-1&&this.anchors[this.index].link.classList.add("focus"))}};var ue=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var me=De(de());function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let n=document.querySelector("#tsd-search input"),r=document.querySelector("#tsd-search .results");if(!n||!r)throw new Error("The input field or the result list wrapper was not found");let i=!1;r.addEventListener("mousedown",()=>i=!0),r.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),n.addEventListener("focus",()=>t.classList.add("has-focus")),n.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Fe(t,r,n,s)}function Fe(t,e,n,r){n.addEventListener("input",ue(()=>{He(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?pe(e,-1):s.key==="ArrowDown"?pe(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ae(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=me.Index.load(window.searchData.index))}function He(t,e,n,r){if(Ae(r,t),!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;o<s.length;o++){let a=s[o],u=r.data.rows[Number(a.ref)],l=1;u.name.toLowerCase().startsWith(i.toLowerCase())&&(l*=1+1/(1+Math.abs(u.name.length-i.length))),a.score*=l}s.sort((o,a)=>a.score-o.score);for(let o=0,a=Math.min(10,s.length);o<a;o++){let u=r.data.rows[Number(s[o].ref)],l=fe(u.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(l+=` (score: ${s[o].score.toFixed(2)})`),u.parent&&(l=`<span class="parent">${fe(u.parent,i)}.</span>${l}`);let h=document.createElement("li");h.classList.value=u.classes??"";let m=document.createElement("a");m.href=r.base+u.url,m.innerHTML=l,h.append(m),e.appendChild(h)}}function pe(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function fe(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ie(t.substring(s,o)),`<b>${ie(t.substring(o,o+r.length))}</b>`),s=o+r.length,o=n.indexOf(r,s);return i.push(ie(t.substring(s))),i.join("")}var Ne={"&":"&","<":"<",">":">","'":"'",'"':"""};function ie(t){return t.replace(/[&<>"'"]/g,e=>Ne[e])}var F="mousedown",ye="mousemove",j="mouseup",Z={x:0,y:0},ge=!1,se=!1,Be=!1,A=!1,xe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(xe?"is-mobile":"not-mobile");xe&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",ye="touchmove",j="touchend");document.addEventListener(F,t=>{se=!0,A=!1;let e=F=="touchstart"?t.targetTouches[0]:t;Z.y=e.pageY||0,Z.x=e.pageX||0});document.addEventListener(ye,t=>{if(se&&!A){let e=F=="touchstart"?t.targetTouches[0]:t,n=Z.x-(e.pageX||0),r=Z.y-(e.pageY||0);A=Math.sqrt(n*n+r*r)>10}});document.addEventListener(j,()=>{se=!1});document.addEventListener("click",t=>{ge&&(t.preventDefault(),t.stopImmediatePropagation(),ge=!1)});var K=class extends I{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(j,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(j,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){A||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-menu, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!A&&this.active&&n.target.closest(".col-menu")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var oe;try{oe=localStorage}catch{oe={getItem(){return null},setItem(){}}}var Q=oe;var Le=document.head.appendChild(document.createElement("style"));Le.dataset.for="filters";var ee=class extends I{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),Le.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
|
|
4
|
+
`}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var te=class extends I{constructor(n){super(n);this.calculateHeights(),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.textContent.replace(/\s+/g,"-").toLowerCase()}`,this.setLocalStorage(this.fromLocalStorage(),!0),this.summary.addEventListener("click",r=>this.toggleVisibility(r)),this.icon.style.transform=this.getIconRotation()}getIconRotation(n=this.el.open){return`rotate(${n?0:-90}deg)`}calculateHeights(){let n=this.el.open,{position:r,left:i}=this.el.style;this.el.style.position="fixed",this.el.style.left="-9999px",this.el.open=!0,this.expandedHeight=this.el.offsetHeight+"px",this.el.open=!1,this.collapsedHeight=this.el.offsetHeight+"px",this.el.open=n,this.el.style.height=n?this.expandedHeight:this.collapsedHeight,this.el.style.position=r,this.el.style.left=i}toggleVisibility(n){n.preventDefault(),this.el.style.overflow="hidden",this.el.open?this.collapse():this.expand()}expand(n=!0){this.el.open=!0,this.animate(this.collapsedHeight,this.expandedHeight,{opening:!0,duration:n?300:0})}collapse(n=!0){this.animate(this.expandedHeight,this.collapsedHeight,{opening:!1,duration:n?300:0})}animate(n,r,{opening:i,duration:s=300}){if(this.animation)return;let o={duration:s,easing:"ease"};this.animation=this.el.animate({height:[n,r]},o),this.icon.animate({transform:[this.icon.style.transform||this.getIconRotation(!i),this.getIconRotation(i)]},o).addEventListener("finish",()=>{this.icon.style.transform=this.getIconRotation(i)}),this.animation.addEventListener("finish",()=>this.animationEnd(i))}animationEnd(n){this.el.open=n,this.animation=void 0,this.el.style.height="auto",this.el.style.overflow="visible",this.setLocalStorage(n)}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.open}setLocalStorage(n,r=!1){this.fromLocalStorage()===n&&!r||(Q.setItem(this.key,n.toString()),this.el.open=n,this.handleValueChange(r))}handleValueChange(n=!1){this.fromLocalStorage()===this.el.open&&!n||(this.fromLocalStorage()?this.expand(!1):this.collapse(!1))}};function be(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,Ee(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),Ee(t.value)})}function Ee(t){document.documentElement.dataset.theme=t}ve();B(X,".menu-highlight");B(K,"a[data-toggle]");B(te,".tsd-index-accordion");B(ee,".tsd-filter-item input[type=checkbox]");var we=document.getElementById("theme");we&&be(we);var je=new Y;Object.defineProperty(window,"app",{value:je});})();
|
|
5
|
+
/*! Bundled license information:
|
|
6
|
+
|
|
7
|
+
lunr/lunr.js:
|
|
8
|
+
(**
|
|
9
|
+
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
|
|
10
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
11
|
+
* @license MIT
|
|
12
|
+
*)
|
|
13
|
+
(*!
|
|
14
|
+
* lunr.utils
|
|
15
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
16
|
+
*)
|
|
17
|
+
(*!
|
|
18
|
+
* lunr.Set
|
|
19
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
20
|
+
*)
|
|
21
|
+
(*!
|
|
22
|
+
* lunr.tokenizer
|
|
23
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
24
|
+
*)
|
|
25
|
+
(*!
|
|
26
|
+
* lunr.Pipeline
|
|
27
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
28
|
+
*)
|
|
29
|
+
(*!
|
|
30
|
+
* lunr.Vector
|
|
31
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
32
|
+
*)
|
|
33
|
+
(*!
|
|
34
|
+
* lunr.stemmer
|
|
35
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
36
|
+
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
|
37
|
+
*)
|
|
38
|
+
(*!
|
|
39
|
+
* lunr.stopWordFilter
|
|
40
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
41
|
+
*)
|
|
42
|
+
(*!
|
|
43
|
+
* lunr.trimmer
|
|
44
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
45
|
+
*)
|
|
46
|
+
(*!
|
|
47
|
+
* lunr.TokenSet
|
|
48
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
49
|
+
*)
|
|
50
|
+
(*!
|
|
51
|
+
* lunr.Index
|
|
52
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
53
|
+
*)
|
|
54
|
+
(*!
|
|
55
|
+
* lunr.Builder
|
|
56
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
57
|
+
*)
|
|
58
|
+
*/
|