UNPKG

@here/harp-examples

Version:
1 lines 71.2 kB
(()=>{"use strict";var e={4417:(e,t,o)=>{var i,r,n,s=o(3737),a=s.Reader,l=s.util,u=s.roots.default||(s.roots.default={});u.com=((n={}).mapbox=((r={}).pb=((i={}).Tile=function(){function e(e){if(this.layers=[],e)for(var t=Object.keys(e),o=0;o<t.length;++o)null!=e[t[o]]&&(this[t[o]]=e[t[o]])}var t,o;return e.prototype.layers=l.emptyArray,e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var o=void 0===t?e.len:e.pos+t,i=new u.com.mapbox.pb.Tile;e.pos<o;){var r=e.uint32();switch(r>>>3){case 3:i.layers&&i.layers.length||(i.layers=[]),i.layers.push(u.com.mapbox.pb.Tile.Layer.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.fromObject=function(e){if(e instanceof u.com.mapbox.pb.Tile)return e;var t=new u.com.mapbox.pb.Tile;if(e.layers){if(!Array.isArray(e.layers))throw TypeError(".com.mapbox.pb.Tile.layers: array expected");t.layers=[];for(var o=0;o<e.layers.length;++o){if("object"!=typeof e.layers[o])throw TypeError(".com.mapbox.pb.Tile.layers: object expected");t.layers[o]=u.com.mapbox.pb.Tile.Layer.fromObject(e.layers[o])}}return t},e.toObject=function(e,t){t||(t={});var o={};if((t.arrays||t.defaults)&&(o.layers=[]),e.layers&&e.layers.length){o.layers=[];for(var i=0;i<e.layers.length;++i)o.layers[i]=u.com.mapbox.pb.Tile.Layer.toObject(e.layers[i],t)}return o},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e.GeomType=(t={},(o=Object.create(t))[t[0]="UNKNOWN"]=0,o[t[1]="POINT"]=1,o[t[2]="LINESTRING"]=2,o[t[3]="POLYGON"]=3,o),e.Value=function(){function e(e){if(e)for(var t=Object.keys(e),o=0;o<t.length;++o)null!=e[t[o]]&&(this[t[o]]=e[t[o]])}return e.prototype.stringValue="",e.prototype.floatValue=0,e.prototype.doubleValue=0,e.prototype.intValue=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.uintValue=l.Long?l.Long.fromBits(0,0,!0):0,e.prototype.sintValue=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.boolValue=!1,e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var o=void 0===t?e.len:e.pos+t,i=new u.com.mapbox.pb.Tile.Value;e.pos<o;){var r=e.uint32();switch(r>>>3){case 1:i.stringValue=e.string();break;case 2:i.floatValue=e.float();break;case 3:i.doubleValue=e.double();break;case 4:i.intValue=e.int64();break;case 5:i.uintValue=e.uint64();break;case 6:i.sintValue=e.sint64();break;case 7:i.boolValue=e.bool();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.fromObject=function(e){if(e instanceof u.com.mapbox.pb.Tile.Value)return e;var t=new u.com.mapbox.pb.Tile.Value;return null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.floatValue&&(t.floatValue=Number(e.floatValue)),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.intValue&&(l.Long?(t.intValue=l.Long.fromValue(e.intValue)).unsigned=!1:"string"==typeof e.intValue?t.intValue=parseInt(e.intValue,10):"number"==typeof e.intValue?t.intValue=e.intValue:"object"==typeof e.intValue&&(t.intValue=new l.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber())),null!=e.uintValue&&(l.Long?(t.uintValue=l.Long.fromValue(e.uintValue)).unsigned=!0:"string"==typeof e.uintValue?t.uintValue=parseInt(e.uintValue,10):"number"==typeof e.uintValue?t.uintValue=e.uintValue:"object"==typeof e.uintValue&&(t.uintValue=new l.LongBits(e.uintValue.low>>>0,e.uintValue.high>>>0).toNumber(!0))),null!=e.sintValue&&(l.Long?(t.sintValue=l.Long.fromValue(e.sintValue)).unsigned=!1:"string"==typeof e.sintValue?t.sintValue=parseInt(e.sintValue,10):"number"==typeof e.sintValue?t.sintValue=e.sintValue:"object"==typeof e.sintValue&&(t.sintValue=new l.LongBits(e.sintValue.low>>>0,e.sintValue.high>>>0).toNumber())),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),t},e.toObject=function(e,t){t||(t={});var o={};if(t.defaults){if(o.stringValue="",o.floatValue=0,o.doubleValue=0,l.Long){var i=new l.Long(0,0,!1);o.intValue=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else o.intValue=t.longs===String?"0":0;l.Long?(i=new l.Long(0,0,!0),o.uintValue=t.longs===String?i.toString():t.longs===Number?i.toNumber():i):o.uintValue=t.longs===String?"0":0,l.Long?(i=new l.Long(0,0,!1),o.sintValue=t.longs===String?i.toString():t.longs===Number?i.toNumber():i):o.sintValue=t.longs===String?"0":0,o.boolValue=!1}return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(o.stringValue=e.stringValue),null!=e.floatValue&&e.hasOwnProperty("floatValue")&&(o.floatValue=t.json&&!isFinite(e.floatValue)?String(e.floatValue):e.floatValue),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(o.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue),null!=e.intValue&&e.hasOwnProperty("intValue")&&("number"==typeof e.intValue?o.intValue=t.longs===String?String(e.intValue):e.intValue:o.intValue=t.longs===String?l.Long.prototype.toString.call(e.intValue):t.longs===Number?new l.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber():e.intValue),null!=e.uintValue&&e.hasOwnProperty("uintValue")&&("number"==typeof e.uintValue?o.uintValue=t.longs===String?String(e.uintValue):e.uintValue:o.uintValue=t.longs===String?l.Long.prototype.toString.call(e.uintValue):t.longs===Number?new l.LongBits(e.uintValue.low>>>0,e.uintValue.high>>>0).toNumber(!0):e.uintValue),null!=e.sintValue&&e.hasOwnProperty("sintValue")&&("number"==typeof e.sintValue?o.sintValue=t.longs===String?String(e.sintValue):e.sintValue:o.sintValue=t.longs===String?l.Long.prototype.toString.call(e.sintValue):t.longs===Number?new l.LongBits(e.sintValue.low>>>0,e.sintValue.high>>>0).toNumber():e.sintValue),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(o.boolValue=e.boolValue),o},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e.Feature=function(){function e(e){if(this.tags=[],this.geometry=[],e)for(var t=Object.keys(e),o=0;o<t.length;++o)null!=e[t[o]]&&(this[t[o]]=e[t[o]])}return e.prototype.id=l.Long?l.Long.fromBits(0,0,!0):0,e.prototype.tags=l.emptyArray,e.prototype.type=0,e.prototype.geometry=l.emptyArray,e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var o=void 0===t?e.len:e.pos+t,i=new u.com.mapbox.pb.Tile.Feature;e.pos<o;){var r=e.uint32();switch(r>>>3){case 1:i.id=e.uint64();break;case 2:if(i.tags&&i.tags.length||(i.tags=[]),2==(7&r))for(var n=e.uint32()+e.pos;e.pos<n;)i.tags.push(e.uint32());else i.tags.push(e.uint32());break;case 3:i.type=e.int32();break;case 4:if(i.geometry&&i.geometry.length||(i.geometry=[]),2==(7&r))for(n=e.uint32()+e.pos;e.pos<n;)i.geometry.push(e.uint32());else i.geometry.push(e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.fromObject=function(e){if(e instanceof u.com.mapbox.pb.Tile.Feature)return e;var t=new u.com.mapbox.pb.Tile.Feature;if(null!=e.id&&(l.Long?(t.id=l.Long.fromValue(e.id)).unsigned=!0:"string"==typeof e.id?t.id=parseInt(e.id,10):"number"==typeof e.id?t.id=e.id:"object"==typeof e.id&&(t.id=new l.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber(!0))),e.tags){if(!Array.isArray(e.tags))throw TypeError(".com.mapbox.pb.Tile.Feature.tags: array expected");t.tags=[];for(var o=0;o<e.tags.length;++o)t.tags[o]=e.tags[o]>>>0}switch(e.type){case"UNKNOWN":case 0:t.type=0;break;case"POINT":case 1:t.type=1;break;case"LINESTRING":case 2:t.type=2;break;case"POLYGON":case 3:t.type=3}if(e.geometry){if(!Array.isArray(e.geometry))throw TypeError(".com.mapbox.pb.Tile.Feature.geometry: array expected");for(t.geometry=[],o=0;o<e.geometry.length;++o)t.geometry[o]=e.geometry[o]>>>0}return t},e.toObject=function(e,t){t||(t={});var o={};if((t.arrays||t.defaults)&&(o.tags=[],o.geometry=[]),t.defaults){if(l.Long){var i=new l.Long(0,0,!0);o.id=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else o.id=t.longs===String?"0":0;o.type=t.enums===String?"UNKNOWN":0}if(null!=e.id&&e.hasOwnProperty("id")&&("number"==typeof e.id?o.id=t.longs===String?String(e.id):e.id:o.id=t.longs===String?l.Long.prototype.toString.call(e.id):t.longs===Number?new l.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber(!0):e.id),e.tags&&e.tags.length){o.tags=[];for(var r=0;r<e.tags.length;++r)o.tags[r]=e.tags[r]}if(null!=e.type&&e.hasOwnProperty("type")&&(o.type=t.enums===String?u.com.mapbox.pb.Tile.GeomType[e.type]:e.type),e.geometry&&e.geometry.length)for(o.geometry=[],r=0;r<e.geometry.length;++r)o.geometry[r]=e.geometry[r];return o},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e.Layer=function(){function e(e){if(this.features=[],this.keys=[],this.values=[],e)for(var t=Object.keys(e),o=0;o<t.length;++o)null!=e[t[o]]&&(this[t[o]]=e[t[o]])}return e.prototype.version=1,e.prototype.name="",e.prototype.features=l.emptyArray,e.prototype.keys=l.emptyArray,e.prototype.values=l.emptyArray,e.prototype.extent=4096,e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var o=void 0===t?e.len:e.pos+t,i=new u.com.mapbox.pb.Tile.Layer;e.pos<o;){var r=e.uint32();switch(r>>>3){case 15:i.version=e.uint32();break;case 1:i.name=e.string();break;case 2:i.features&&i.features.length||(i.features=[]),i.features.push(u.com.mapbox.pb.Tile.Feature.decode(e,e.uint32()));break;case 3:i.keys&&i.keys.length||(i.keys=[]),i.keys.push(e.string());break;case 4:i.values&&i.values.length||(i.values=[]),i.values.push(u.com.mapbox.pb.Tile.Value.decode(e,e.uint32()));break;case 5:i.extent=e.uint32();break;default:e.skipType(7&r)}}if(!i.hasOwnProperty("version"))throw l.ProtocolError("missing required 'version'",{instance:i});if(!i.hasOwnProperty("name"))throw l.ProtocolError("missing required 'name'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.fromObject=function(e){if(e instanceof u.com.mapbox.pb.Tile.Layer)return e;var t=new u.com.mapbox.pb.Tile.Layer;if(null!=e.version&&(t.version=e.version>>>0),null!=e.name&&(t.name=String(e.name)),e.features){if(!Array.isArray(e.features))throw TypeError(".com.mapbox.pb.Tile.Layer.features: array expected");t.features=[];for(var o=0;o<e.features.length;++o){if("object"!=typeof e.features[o])throw TypeError(".com.mapbox.pb.Tile.Layer.features: object expected");t.features[o]=u.com.mapbox.pb.Tile.Feature.fromObject(e.features[o])}}if(e.keys){if(!Array.isArray(e.keys))throw TypeError(".com.mapbox.pb.Tile.Layer.keys: array expected");for(t.keys=[],o=0;o<e.keys.length;++o)t.keys[o]=String(e.keys[o])}if(e.values){if(!Array.isArray(e.values))throw TypeError(".com.mapbox.pb.Tile.Layer.values: array expected");for(t.values=[],o=0;o<e.values.length;++o){if("object"!=typeof e.values[o])throw TypeError(".com.mapbox.pb.Tile.Layer.values: object expected");t.values[o]=u.com.mapbox.pb.Tile.Value.fromObject(e.values[o])}}return null!=e.extent&&(t.extent=e.extent>>>0),t},e.toObject=function(e,t){t||(t={});var o={};if((t.arrays||t.defaults)&&(o.features=[],o.keys=[],o.values=[]),t.defaults&&(o.name="",o.extent=4096,o.version=1),null!=e.name&&e.hasOwnProperty("name")&&(o.name=e.name),e.features&&e.features.length){o.features=[];for(var i=0;i<e.features.length;++i)o.features[i]=u.com.mapbox.pb.Tile.Feature.toObject(e.features[i],t)}if(e.keys&&e.keys.length)for(o.keys=[],i=0;i<e.keys.length;++i)o.keys[i]=e.keys[i];if(e.values&&e.values.length)for(o.values=[],i=0;i<e.values.length;++i)o.values[i]=u.com.mapbox.pb.Tile.Value.toObject(e.values[i],t);return null!=e.extent&&e.hasOwnProperty("extent")&&(o.extent=e.extent),null!=e.version&&e.hasOwnProperty("version")&&(o.version=e.version),o},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e}(),i),r),n),e.exports=u},2450:(e,t,o)=>{t.l=void 0;const i=o(5636),r=o(3074),n=o(9164),s=o(2998),a=o(4607),l=o(3829),u=o(4565);t.l||(t.l={}),async function(e){const t=document.getElementById("mapCanvas"),o=[-74.01,40.707],c=new r.MapView({canvas:t,theme:"resources/berlin_tilezen_base.json",target:o,zoomLevel:15.1});r.CopyrightElementHandler.install("copyrightNotice",c);const h=new i.MapControls(c);h.maxTiltAngle=50;const d=new i.MapControlsUI(h,{zoomLevel:"input"});t.parentElement.appendChild(d.domElement),c.resize(window.innerWidth,window.innerHeight),window.addEventListener("resize",(()=>{c.resize(window.innerWidth,window.innerHeight)}));const p=new s.VectorTileDataSource({baseUrl:"https://vector.hereapi.com/v2/vectortiles/base/mc",authenticationCode:u.apikey});c.addDataSource(p),p.dataSourceOrder=0;const f=l.circle(o,1e3,{units:"meters"}),m=l.randomPoint(100,{bbox:l.bbox(f)});m.features=m.features.filter((e=>l.distance(o,e.geometry.coordinates,{units:"meters"})<1e3));const g=new s.GeoJsonDataProvider("geojson",l.featureCollection([f,...m.features]),{tiler:new n.GeoJsonTiler}),y=new s.VectorTileDataSource({decoder:new a.VectorTileDecoder,styleSetName:"geojson",dataProvider:g,addGroundPlane:!1});return y.dataSourceOrder=1,await c.addDataSource(y),await y.setTheme({styles:[{styleSet:"geojson",when:["==",["geometry-type"],"Polygon"],technique:"fill",color:"rgba(200,94,202,0.5)",minZoomLevel:15,maxZoomLevel:17},{styleSet:"geojson",when:["==",["geometry-type"],"Point"],technique:"circles",color:"rgba(94,0,202,1)",size:30,minZoomLevel:15,maxZoomLevel:17}]}),g.onDidInvalidate((()=>{c.update()})),setInterval((()=>{l.transformRotate(m,5,{pivot:o,mutate:!0}),g.updateInput(l.featureCollection([f,...m.features]))}),100),c}().catch(console.error)},6290:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wrapLineString=t.clipLineString=void 0;const i=o(8957),r=o(1845),n=o(4428);class s{constructor(e,t,o,i,r){this.isInside=r,this.p0=new n.Vector2(e,t),this.p1=new n.Vector2(o,i)}inside(e){return this.isInside(e)}computeIntersection(e,t){const o=new n.Vector2;return r.Math2D.intersectLines(e.x,e.y,t.x,t.y,this.p0.x,this.p0.y,this.p1.x,this.p1.y,o),o}clipLine(e){const t=e,o=[];e=[],o.push(e);const i=t=>{0!==e.length&&e[e.length-1].equals(t)||e.push(t)};for(let r=0;r<t.length;++r){const n=t[r],s=r>0?t[r-1]:void 0;this.inside(n)?(void 0===s||this.inside(s)||(e.length>0&&(e=[],o.push(e)),i(this.computeIntersection(s,n))),i(n)):void 0!==s&&this.inside(s)&&i(this.computeIntersection(s,n))}return 0===o[o.length-1].length&&(o.length=o.length-1),o}clipLines(e){const t=[];return e.forEach((e=>{this.clipLine(e).forEach((e=>{t.push(e)}))})),t}}function a(e,t,o){for(const o of t)e=o.clipLines(e);const r=new n.Vector3,s=[];return e.forEach((e=>{if(0===e.length)return;const t=e.map((({x:e,y:t})=>{r.set(e,t,0);const n=i.webMercatorProjection.unprojectPoint(r);return n.longitude+=o,n}));s.push(t)})),s.length>0?s:void 0}t.clipLineString=function(e,t,o,i,r){const n=new s(t,o,t,r,(e=>e.x>t)),a=new s(t,r,i,r,(e=>e.y<r)),l=new s(i,r,i,o,(e=>e.x<i)),u=new s(i,o,t,o,(e=>e.y>o));let c=n.clipLine(e);return c=a.clipLines(c),c=l.clipLines(c),c=u.clipLines(c),c},t.wrapLineString=function(e){const t=new n.Vector3,o=[e.map((e=>{const{x:o,y:r}=i.webMercatorProjection.projectPoint(e,t);return new n.Vector2(o,r)}))];return{left:a(o,c,360),middle:a(o,u,0),right:a(o,h,-360)}};const l=i.EarthConstants.EQUATORIAL_CIRCUMFERENCE,u=[new s(0,l,0,0,(e=>e.x>0)),new s(l+0,0,l+0,l,(e=>e.x<l+0))],c=[new s(-l-0,l,-l-0,0,(e=>e.x>-l-0)),new s(0,0,0,l,(e=>e.x<0))],h=[new s(l-0,l,l-0,0,(e=>e.x>l-0)),new s(2*l+0,0,2*l+0,l,(e=>e.x<2*l+0))]},2635:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clipPolygon=t.ClippingEdge=void 0;const i=o(4428);class r{clipPolygon(e,t){const o=e;e=[];const i=t=>{0!==e.length&&e[e.length-1].equals(t)||e.push(t)};for(let e=0;e<o.length;++e){const r=o[e],n=o[(e+o.length-1)%o.length];this.inside(r,t)?(this.inside(n,t)||i(this.computeIntersection(n,r,t)),i(r)):this.inside(n,t)&&i(this.computeIntersection(n,r,t))}return e}}t.ClippingEdge=r;const n=[new class extends r{inside(e){return e.y>0}computeIntersection(e,t){const{x:o,y:r}=e,{x:n,y:s}=t;return new i.Vector2((o*s-r*n)/-(r-s),0).round()}},new class extends r{inside(e,t){return e.x<t}computeIntersection(e,t,o){const{x:r,y:n}=e,{x:s,y:a}=t;return new i.Vector2(o,(r*a-n*s-(n-a)*-o)/(r-s)).round()}},new class extends r{inside(e,t){return e.y<t}computeIntersection(e,t,o){const{x:r,y:n}=e,{x:s,y:a}=t;return new i.Vector2((r*a-n*s-(r-s)*o)/-(n-a),o).round()}},new class extends r{inside(e){return e.x>0}computeIntersection(e,t){const{x:o,y:r}=e,{x:n,y:s}=t;return new i.Vector2(0,(o*s-r*n)/(o-n)).round()}}];t.clipPolygon=function(e,t){if(0===e.length)return e;e[0].equals(e[e.length-1])||(e=[...e,e[0]]);for(const o of n)e=o.clipPolygon(e,t);return e}},2851:function(e,t,o){var i=this&&this.__createBinding||(Object.create?function(e,t,o,i){void 0===i&&(i=o),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,i){void 0===i&&(i=o),e[i]=t[o]}),r=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||i(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(o(9363),t),r(o(2396),t),r(o(9609),t),r(o(253),t),r(o(9482),t),r(o(9164),t)},9164:(e,t,o)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.GeoJsonTiler=void 0;const r=o(8832),n=null!==(i=r.default)&&void 0!==i?i:r,s=-(-2&-Math.ceil(204.8));t.GeoJsonTiler=class{constructor(){this.indexes=new Map}dispose(){}async connect(){return await Promise.resolve()}async registerIndex(e,t){if(!this.indexes.has(e))return await this.updateIndex(e,t)}async updateIndex(e,t){if(t instanceof URL){const e=await fetch(t.href);if(!e.ok)throw new Error(`GeoJsonTiler: Unable to fetch ${t.href}: ${e.statusText}`);t=await e.json()}else t=t;const o=n(t,{maxZoom:20,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:s,lineMetrics:!1,promoteId:null,generateId:!0,debug:0});o.geojson=t,this.indexes.set(e,o)}async getTile(e,t){const o=this.indexes.get(e);if(void 0===o)throw new Error("Tile not found");const i=o.getTile(t.level,t.column,t.row);if(null!==i){i.layer=e;for(const e of i.features)e.originalGeometry=this.getOriginalGeometry(e,o.geojson)}return i||{}}getOriginalGeometry(e,t){switch(t.type){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":case"GeometryCollection":return t;case"Feature":return t.geometry;case"FeatureCollection":return t.features[e.id].geometry}}}},9363:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThemedTileDecoder=void 0;const i=o(5263),r=o(1845).LoggerManager.instance.create("ThemedTileDecoder");t.ThemedTileDecoder=class{constructor(){this.m_storageLevelOffset=0}dispose(){}decodeTile(e,t,o){return void 0===this.m_styleSetEvaluator?(r.info("cannot decode tile, as there is not style available"),Promise.resolve(void 0)):this.decodeThemedTile(e,t,this.m_styleSetEvaluator,o)}getTileInfo(e,t,o){return Promise.resolve(void 0)}configure(e,t){void 0!==(null==e?void 0:e.styleSet)&&(this.m_styleSetEvaluator=new i.StyleSetEvaluator(e)),void 0!==(null==e?void 0:e.languages)&&(this.languages=e.languages),void 0!==t&&void 0!==t.storageLevelOffset&&(this.m_storageLevelOffset=t.storageLevelOffset)}}},2396:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TileDecoderService=void 0;const i=o(2636),r=o(8957),n=o(1845),s=o(253),a=n.LoggerManager.instance.create("TileDecoderService");class l extends s.WorkerService{constructor(e,t){super(e),this.serviceId=e,this.m_decoder=t,this.m_decoder.connect()}static start(e,t){return new l(e,t)}handleRequest(e){return i.WorkerDecoderProtocol.isDecodeTileRequest(e)?this.handleDecodeTileRequest(e):i.WorkerDecoderProtocol.isTileInfoRequest(e)?this.handleTileInfoRequest(e):super.handleRequest(e)}handleMessage(e){i.WorkerDecoderProtocol.isConfigurationMessage(e)?this.handleConfigurationMessage(e):a.error(`[${this.serviceId}]: invalid message ${e.type}`)}async handleDecodeTileRequest(e){const t=r.TileKey.fromMortonCode(e.tileKey),o=i.getProjection(e.projection),n=await this.m_decoder.decodeTile(e.data,t,o),s=[],a=e=>{void 0!==e&&e.buffer.byteLength>0&&!s.includes(e.buffer)&&s.push(e.buffer)};return null==n||n.geometries.forEach((e=>{var t,o,i;if(null===(t=e.vertexAttributes)||void 0===t||t.forEach((e=>a(e))),null===(o=e.interleavedVertexAttributes)||void 0===o||o.forEach((e=>a(e))),a(e.index),a(e.edgeIndex),Array.isArray(e.objInfos)&&1===e.objInfos.length&&"object"==typeof e.objInfos[0]&&(null===(i=e.objInfos[0])||void 0===i?void 0:i.hasOwnProperty("displacementMap"))){const t=e.objInfos[0];a(t.displacementMap)}Array.isArray(e.attachments)&&e.attachments.forEach((e=>{a(e.index),a(e.edgeIndex)}))})),null==n||n.techniques.forEach((e=>{i.addBuffersToTransferList(e,s)})),{response:n,transferList:s}}handleTileInfoRequest(e){const t=r.TileKey.fromMortonCode(e.tileKey),o=i.getProjection(e.projection);return this.m_decoder.getTileInfo(e.data,t,o).then((e=>({response:e,transferList:void 0!==e&&void 0!==e.transferList?e.transferList:[]})))}handleConfigurationMessage(e){this.m_decoder.configure(e,e.options)}}t.TileDecoderService=l},9609:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilerService=void 0;const i=o(2636),r=o(8957),n=o(9164),s=o(253);class a extends s.WorkerService{constructor(e){super(e),this.serviceId=e,this.tiler=new n.GeoJsonTiler}static start(e){return new a(e)}handleRequest(e){return i.WorkerTilerProtocol.isRegisterIndexRequest(e)?this.handleRegisterIndexRequest(e):i.WorkerTilerProtocol.isUpdateIndexRequest(e)?this.handleUpdateIndexRequest(e):i.WorkerTilerProtocol.isTileRequest(e)?this.handleTileRequest(e):super.handleRequest(e)}async handleTileRequest(e){const t=r.TileKey.fromMortonCode(e.tileKey);return{response:await this.tiler.getTile(e.index,t)||{}}}async handleRegisterIndexRequest(e){const t="string"==typeof e.input?new URL(e.input):e.input;return await this.tiler.registerIndex(e.id,t),{response:{}}}async handleUpdateIndexRequest(e){const t="string"==typeof e.input?new URL(e.input):e.input;return this.tiler.updateIndex(e.id,t),{response:{}}}}t.TilerService=a},253:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerService=void 0;const i=o(2636),r=o(1845).LoggerManager.instance.create("WorkerService",{enabled:!0});t.WorkerService=class{constructor(e){this.serviceId=e,this.m_pendingRequests=new Map,this.onMessage=e=>{if("string"==typeof e.data.service&&e.data.service===this.serviceId)try{if(i.WorkerServiceProtocol.isRequestMessage(e.data)){const t=e.data,o={service:t.service,messageId:t.messageId,responseSent:!1};this.m_pendingRequests.set(t.messageId,o),this.tryHandleRequest(t.request).then((e=>{this.doSendResponse(o,{service:this.serviceId,type:i.WorkerServiceProtocol.ServiceMessageName.Response,messageId:t.messageId,response:e.response},e.transferList)})).catch((e=>{this.doSendResponse(o,{service:this.serviceId,type:i.WorkerServiceProtocol.ServiceMessageName.Response,messageId:t.messageId,errorMessage:e.toString(),errorStack:e.stack})}))}else this.tryHandleMessage(e.data)}catch(t){r.error(`[${this.serviceId}]: Unhandled exception when handling ${e.type}`)}},self.addEventListener("message",this.onMessage);const t={service:e,type:i.WorkerServiceProtocol.ServiceMessageName.Initialized};self.postMessage(t)}destroy(){this.cancelAllPendingRequests(),self.removeEventListener("message",this.onMessage)}handleMessage(e){r.error(`[${this.serviceId}]: Invalid message ${e.type}`)}handleRequest(e){throw new Error(`ServiceAdapter[${this.serviceId}]: Invalid request '${e.type}'`)}tryHandleMessage(e){try{this.handleMessage(e)}catch(t){r.error(`[${this.serviceId}]: Failed, handling message ${e.type}`)}}tryHandleRequest(e){try{return this.handleRequest(e)}catch(e){return r.error(`[${this.serviceId}]: Failure`,e),Promise.reject(e)}}doSendResponse(e,t,o){e.responseSent||(void 0!==o?self.postMessage(t,o):self.postMessage(t),e.responseSent=!0,this.m_pendingRequests.delete(e.messageId))}cancelAllPendingRequests(){this.m_pendingRequests.forEach((e=>{this.doSendResponse(e,{service:this.serviceId,type:i.WorkerServiceProtocol.ServiceMessageName.Response,messageId:e.messageId,errorMessage:"cancelled"})}))}}},9482:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerServiceManager=void 0;const i=o(2636),r=o(253);class n extends r.WorkerService{constructor(e=i.WorkerServiceProtocol.WORKER_SERVICE_MANAGER_SERVICE_ID){super(e),this.m_factories=new Map,this.m_services=new Map}static getInstance(){return void 0===this.m_service&&(this.m_service=new n(i.WorkerServiceProtocol.WORKER_SERVICE_MANAGER_SERVICE_ID)),this.m_service}register(e){this.m_factories.set(e.serviceType,e.factory)}handleRequest(e){if(e.type===i.WorkerServiceProtocol.Requests.CreateService){if(void 0!==this.m_services.get(e.targetServiceId))throw Error(`error - service with targetServiceId='${e.targetServiceId}' already running, ignoring CreateService request`);const t=this.m_factories.get(e.targetServiceType);if(void 0===t)throw Error(`unknown targetServiceType requested: '${e.targetServiceType}'`);const o=t(e.targetServiceId);this.m_services.set(e.targetServiceId,o)}if(e.type===i.WorkerServiceProtocol.Requests.DestroyService){const t=this.m_services.get(e.targetServiceId);if(void 0===t)throw Error(`unknown targetServiceId '${e.targetServiceId}'`);t.destroy(),this.m_services.delete(e.targetServiceId)}return Promise.resolve({response:{}})}}t.WorkerServiceManager=n},4607:function(e,t,o){var i=this&&this.__createBinding||(Object.create?function(e,t,o,i){void 0===i&&(i=o),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,i){void 0===i&&(i=o),e[i]=t[o]}),r=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||i(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(o(976),t),r(o(4050),t),r(o(1173),t)},7707:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecodeInfo=void 0;const i=o(8957),r=o(4428);t.DecodeInfo=class{constructor(e,t,o,n=0){this.adapterId=e,this.targetProjection=t,this.tileKey=o,this.storageLevelOffset=n,this.projectedBoundingBox=new i.OrientedBox3,this.tileBounds=new r.Box3,this.tileSize=new r.Vector3,this.center=new r.Vector3,this.geoBox=this.tilingScheme.getGeoBox(o),this.targetProjection.projectBox(this.geoBox,this.projectedBoundingBox),this.projectedBoundingBox.getCenter(this.center),this.tilingScheme.getWorldBox(o,this.tileBounds),this.tileBounds.getSize(this.tileSize),this.tileSizeOnScreen=256*Math.pow(2,-this.storageLevelOffset),this.columnCount=i.webMercatorTilingScheme.subdivisionScheme.getLevelDimensionX(this.tileKey.level),this.rowCount=i.webMercatorTilingScheme.subdivisionScheme.getLevelDimensionY(this.tileKey.level)}get tilingScheme(){return i.webMercatorTilingScheme}get sourceProjection(){return this.tilingScheme.projection}}},4050:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GeoJsonTilerService=void 0;const i=o(2851),r=o(1173);t.GeoJsonTilerService=class{static start(){i.WorkerServiceManager.getInstance().register({serviceType:r.GEOJSON_TILER_SERVICE_TYPE,factory:e=>i.TilerService.start(e)})}}},1834:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OmvPoliticalViewFeatureModifier=void 0;const i=o(1845).LoggerManager.instance.create("OmvPoliticalViewFeatureModifier");t.OmvPoliticalViewFeatureModifier=class{constructor(e){this.m_countryCode=e}doProcessPointFeature(e,t,o){return!0}doProcessLineFeature(e,t,o){return this.rewriteEnvironment(e,t),!0}doProcessPolygonFeature(e,t,o){return!0}rewriteEnvironment(e,t){this.isPoliticalViewLayer(e)&&this.updateEnvironment(t,this.m_countryCode,"kind")}updateEnvironment(e,t,o){const i=this.getAlternativePov(e,t,o);void 0!==i&&(e.entries[o]=i)}getAlternativePov(e,t,o){i.log("Get alternate POV: ",JSON.stringify(e));const r=t,n=e.lookup(`${o}:${r}`);return i.log("Lookup POV: ",`${o}:${r}`,n),"string"==typeof n&&n.length>0?(i.log("Found POV: ",`${o}:${r}`,n),n):void 0}isPoliticalViewLayer(e){return"boundaries"===e}}},8544:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.webMercatorTile2TargetTile=t.webMercatorTile2TargetWorld=t.world2tile=t.tile2world=t.createWorldTileTransformationCookie=t.tile2lat=t.lat2tile=t.isArrayBufferLike=void 0;const i=o(8957);function r(e,t){return Math.round((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*Math.pow(2,t))}function n(e,t){const{north:o,west:i}=t.geoBox,n=Math.log2(e),s=Math.pow(2,t.tileKey.level+n);return{extents:e,scale:s,top:r(o,t.tileKey.level+n),left:Math.round((i+180)/360*s)}}function s(e,t,o,r=!1,s){void 0!==t.worldTileProjectionCookie&&t.worldTileProjectionCookie.extents===e||(t.worldTileProjectionCookie=n(e,t));const{top:a,left:l,scale:u}=t.worldTileProjectionCookie,c=i.EarthConstants.EQUATORIAL_CIRCUMFERENCE;return s.x=(l+o.x)/u*c,s.y=(a+(r?-o.y:o.y))/u*c,s.z=i.isVector3Like(o)?o.z:0,s}function a(e,t,o,r,n=!1){s(e,t,o,n,r),t.targetProjection.reprojectPoint(i.webMercatorProjection,r,r)}t.isArrayBufferLike=function(e){return"undefined"!=typeof SharedArrayBuffer?e instanceof ArrayBuffer||e instanceof SharedArrayBuffer:e instanceof ArrayBuffer},t.lat2tile=r,t.tile2lat=function(e,t){const o=Math.PI-2*Math.PI*e/Math.pow(2,t);return 180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)))},t.createWorldTileTransformationCookie=n,t.tile2world=s,t.world2tile=function(e,t,o,r=!1,s){void 0!==t.worldTileProjectionCookie&&t.worldTileProjectionCookie.extents===e||(t.worldTileProjectionCookie=n(e,t));const{top:a,left:l,scale:u}=t.worldTileProjectionCookie,c=i.EarthConstants.EQUATORIAL_CIRCUMFERENCE;return s.x=o.x/c*u-l,s.y=(r?-1:1)*(o.y/c*u-a),i.isVector3Like(s)&&(s.z=o.z),s},t.webMercatorTile2TargetWorld=a,t.webMercatorTile2TargetTile=function(e,t,o,i,r=!1){a(e,t,o,i,r),i.sub(t.center)}},1892:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Ring=void 0;const i=o(4428);t.Ring=class{constructor(e,t,o=4096,r){if(this.points=e,this.textureCoords=t,this.extents=o,this.clippedPointIndices=r,void 0!==t&&t.length!==e.length)throw new Error("the array of texture coordinates must have the same number of elements of the array of points");this.vertexStride=2,void 0!==t&&(this.vertexStride=this.vertexStride+2),this.area=i.ShapeUtils.area(this.points),this.winding=this.area<0}static computeClippedPointIndices(e,t){return new Set(e.map(((e,o)=>(e=>void 0===t.find((t=>t.equals(e))))(e)?o:-1)).filter((e=>-1!==e)))}toArray(e=[],t=0){var o;return this.points.forEach(((o,i)=>o.toArray(e,t+this.vertexStride*i))),null===(o=this.textureCoords)||void 0===o||o.forEach(((o,i)=>o.toArray(e,t+this.vertexStride*i+2))),e}isProperEdge(e){const t=this.extents,o=(e+1)%this.points.length,i=this.points[e],r=this.points[o];if(void 0!==this.clippedPointIndices){if(i.x!==r.x&&i.y!==r.y)return!0;if(i.x%this.extents!=0&&i.y%this.extents!=0)return!0;if(r.x%this.extents!=0&&r.y%this.extents!=0)return!0;const t=this.clippedPointIndices.has(e),n=this.clippedPointIndices.has(o);return!t&&!n}return!(i.x<=0&&r.x<=0||i.x>=t&&r.x>=t||i.y<=0&&r.y<=0||i.y>=t&&r.y>=t)}}},4312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSetDataFilter=void 0,t.StyleSetDataFilter=class{constructor(e){this.styleSetEvaluator=e,this.hasKindFilter=!1}wantsLayer(e,t){return this.styleSetEvaluator.wantsLayer(e)}wantsPointFeature(e){return this.styleSetEvaluator.wantsFeature(e,"point")}wantsLineFeature(e){return this.styleSetEvaluator.wantsFeature(e,"line")}wantsPolygonFeature(e){return this.styleSetEvaluator.wantsFeature(e,"polygon")}wantsKind(){return!0}}},8640:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VectorTileDataEmitter=void 0;const i=o(2636),r=o(3024),n=o(2635),s=o(7771),a=o(7478),l=o(8957),u=o(6155),c=o(8655),h=o(8136),d=o(1845),p=o(9502),f=o(4428),m=o(8544),g=o(1892),y=d.LoggerManager.instance.create("OmvDecodedTileEmitter"),v=new f.Vector3,b=new f.Vector3,T=new f.Vector3,x=new f.Vector3,w=new f.Vector3,_=new f.Vector2,P=new f.Vector2,S=new f.Vector3,L=new f.Vector3,V=new f.Vector3,I=new f.Vector2,M=new f.Vector2,E=new f.Vector2,O=new f.Vector3,C=new f.Vector3,F=new f.Vector3,j=new f.Vector3,A=new f.Vector3,k=new f.Line3,q=Math.PI/8;function G(e,t,o="index"){const i=t>65535?"uint32":"uint16";return{itemCount:1,name:o,buffer:("uint32"===i?new Uint32Array(e):new Uint16Array(e)).buffer,type:i}}class N{constructor(e){this.type=e,this.positions=[],this.normals=[],this.textureCoordinates=[],this.colors=[],this.extrusionAxis=[],this.indices=[],this.edgeIndices=[],this.groups=[],this.texts=[],this.pathLengths=[],this.stringCatalog=[],this.imageTextures=[],this.featureStarts=[],this.edgeFeatureStarts=[],this.objInfos=[],this.offsetDirections=[]}addText(e){let t=this.stringCatalog.indexOf(e);return t<0&&(t=this.stringCatalog.length,this.stringCatalog.push(e)),t}}var R;!function(e){e[e.Simple=0]="Simple",e[e.Complex=1]="Complex"}(R||(R={}));const D=new f.Color;t.VectorTileDataEmitter=class{constructor(e,t,o,i,r,n){this.m_decodeInfo=e,this.m_styleSetEvaluator=t,this.m_gatherFeatureAttributes=o,this.m_skipShortLabels=i,this.m_enableElevationOverlay=r,this.m_languages=n,this.m_meshBuffers=new Map,this.m_geometries=[],this.m_textGeometries=[],this.m_textPathGeometries=[],this.m_pathGeometries=[],this.m_poiGeometries=[],this.m_simpleLines=[],this.m_solidLines=[],this.m_sources=[],this.m_maxGeometryHeight=0,this.m_minGeometryHeight=0}get projection(){return this.m_decodeInfo.targetProjection}get center(){return this.m_decodeInfo.center}processPointFeature(e,t,o,n,s){var a;const l=n.env;this.processFeatureCommon(l);const{tileKey:u,columnCount:c,rowCount:h}=this.m_decodeInfo,d=u.column+1<c?t-1:t,p=u.row+1<h?t-1:t,f=o.filter((e=>e.x>=0&&e.x<=d&&e.y>=0&&e.y<=p));if(0!==f.length)for(const e of s){if(void 0===e)continue;const o=e._index,s=this.findOrCreateMeshBuffers(o,i.GeometryType.Point);if(void 0===s)continue;const{positions:u,texts:c,imageTextures:h,objInfos:d,offsetDirections:p}=s,g=i.isTextTechnique(e)||i.isPoiTechnique(e);let y;const v=i.isPoiTechnique(e);if(v){const t=e;if(y=r.evaluateTechniqueAttr(n,t.imageTexture),void 0!==t.poiName)y=r.evaluateTechniqueAttr(n,t.poiName);else if("string"==typeof t.poiNameField)y=l.lookup(t.poiNameField);else if("string"==typeof t.imageTextureField){const e=l.lookup(t.imageTextureField);y=i.composeTechniqueTextureName(e,t)}}const b=i.getFeatureId(l.entries);for(const o of f){if(g){const t=e,o=i.getFeatureText(n,t,this.m_languages);void 0!==o&&o.length>0?c.push(s.addText(o)):c.push(-1)}g?m.webMercatorTile2TargetWorld(t,this.m_decodeInfo,o,S):m.webMercatorTile2TargetTile(t,this.m_decodeInfo,o,S),u.push(S.x,S.y,S.z),d.push(this.m_gatherFeatureAttributes?l.entries:b),p.push(null!==(a=l.lookup("offset_direction"))&&void 0!==a?a:0),v&&(void 0===y?h.push(-1):h.push(s.addText(y)))}}}processLineFeature(e,t,o,n,s,a){const l=n.env;this.processFeatureCommon(l);const u=[],h=[],p=[],g=[],v=this.m_decodeInfo.projectedBoundingBox;let b;const T=2*v.extents.x,x=2*v.extents.y,w=Math.max(T,x);let _,P;const I=void 0!==o[0].untiledPositions;let M=!1,E=!1;for(const e of s)if(void 0!==e){if(_){const t=this.getTextureCoordinateType(e);d.assert(void 0===t||P===t)}else _=this.getComputeTexCoordsFunc(e),P=this.getTextureCoordinateType(e);M=M||i.isSpecialDashesLineTechnique(e),E=E||!M}for(const e of o){const o=[];let i=0;if(I&&(this.m_decodeInfo.targetProjection.projectPoint(e.untiledPositions[0],L),e.untiledPositions.forEach((e=>{this.m_decodeInfo.targetProjection.projectPoint(e,S),i+=S.distanceTo(L),L.copy(S),this.m_decodeInfo.targetProjection.projectPoint(e.normalized(),S),o.push(S.x,S.y,S.z,i)}))),M){b=[];let r=0;const n=e.positions.length;if(n>1){let s=0;for(let a=0;a<n-1;a++){const n=[],l=[],u=[],c=[],d=e.positions[a],f=e.positions[a+1];if(m.webMercatorTile2TargetWorld(t,this.m_decodeInfo,d,S),l.push(S.x,S.y,S.z),m.webMercatorTile2TargetWorld(t,this.m_decodeInfo,f,V),l.push(V.x,V.y,V.z),_&&(_(d,t).toArray(u,u.length),_(f,t).toArray(u,u.length)),I){let e=this.findRelativePositionInLine(S,o)/i;c.push(e),e=this.findRelativePositionInLine(V,o)/i,c.push(e)}else{c.push(s);const e=S.distanceTo(V);r+=e,s+=e,c.push(s)}S.sub(this.m_decodeInfo.center),n.push(S.x,S.y,S.z),V.sub(this.m_decodeInfo.center),n.push(V.x,V.y,V.z),b.push(n),h.push(l),p.push(u),g.push(c)}}if(!I&&r>0)for(const e of g)e.forEach(((t,o)=>{e[o]=t/r}))}if(E){const r=[],n=[],s=[],a=[];e.positions.forEach((e=>{if(m.webMercatorTile2TargetWorld(t,this.m_decodeInfo,e,S),n.push(S.x,S.y,S.z),_&&_(e,t).toArray(s,s.length),I){const e=this.findRelativePositionInLine(S,o)/i;a.push(e)}S.sub(this.m_decodeInfo.center),r.push(S.x,S.y,S.z)})),u.push(r),h.push(n),p.push(s),g.push(a)}}const O=this.m_decodeInfo.tileKey.level>=11;for(const e of s){if(void 0===e)continue;const t=e._index,o=e.name;if(i.isLineTechnique(e)||i.isSolidLineTechnique(e)){const o=i.isLineTechnique(e)?this.m_simpleLines:this.m_solidLines,r=i.isLineTechnique(e)?R.Simple:R.Complex;M&&(d.assert(void 0!==b,"OmvDecodedTileEmitter#processLineFeature: Internal error - No localLineSegments"),this.applyLineTechnique(o,e,t,r,l.entries,b,n,this.getTextureCoordinateType(e)?p:void 0,g)),u.length>0&&this.applyLineTechnique(o,e,t,r,l.entries,u,n,this.getTextureCoordinateType(e)?p:void 0,I?g:void 0)}else if(i.isTextTechnique(e)||i.isPoiTechnique(e)||i.isLineMarkerTechnique(e)){const o=e,s=i.getFeatureText(n,o,this.m_languages);if(void 0===s||0===s.length)continue;let a=[];if(this.m_skipShortLabels){const e=w/this.m_decodeInfo.tileSizeOnScreen,t=5*s.length*e*.5,o=t*t;a=this.splitJaggyLines(h,o,q)}else a=h;if(0===a.length)continue;if(i.isTextTechnique(e)){if(void 0===s)continue;for(const e of a){const o=d.Math2D.computeSquaredLineLength(e);this.m_textPathGeometries.push({technique:t,path:e,pathLengthSqr:o,text:String(s),objInfos:this.m_gatherFeatureAttributes?l.entries:i.getFeatureId(l.entries)})}}else{const o=e;let u=r.evaluateTechniqueAttr(n,o.imageTexture);"string"==typeof o.imageTextureField&&(u=l.lookup(o.imageTextureField),"string"==typeof o.imageTexturePrefix&&(u=o.imageTexturePrefix+u),"string"==typeof o.imageTexturePostfix&&(u+=o.imageTexturePostfix));for(const e of a)this.m_poiGeometries.push({technique:t,positions:{name:"position",type:"float",buffer:new Float32Array(e).buffer,itemCount:3},texts:[0],stringCatalog:[s,u],imageTextures:[1],objInfos:this.m_gatherFeatureAttributes?[l.entries]:[i.getFeatureId(l.entries)]})}}else if(i.isLabelRejectionLineTechnique(e))for(const e of h){const t=[];for(let o=0;o<e.length;o+=3)t.push((new f.Vector3).fromArray(e,o));this.m_pathGeometries.push({path:t})}else if(i.isExtrudedLineTechnique(e)){const o=this.findOrCreateMeshBuffers(t,i.GeometryType.ExtrudedLine);if(void 0===o)continue;const{positions:s,indices:a,groups:h,featureStarts:d,objInfos:p}=o,f=a.length,m=r.evaluateTechniqueAttr(n,e.lineWidth);if(void 0===m)continue;const g=r.evaluateTechniqueAttr(n,e.caps,"Circle"),y=O&&"Circle"===g;u.forEach((e=>{c.triangulateLine(e,m,s,a,y),d.push(f),p.push(this.m_gatherFeatureAttributes?l.entries:i.getFeatureId(l.entries))}));const v=a.length-f;h.push({start:f,count:v,technique:t})}else y.warn(`OmvDecodedTileEmitter#processLineFeature: Invalid line technique\n ${o} for layer: ${l.entries.$layer} `)}}processPolygonFeature(e,t,o,r,s,a){const u=r.env;this.processFeatureCommon(u),s.forEach((e=>{if(void 0===e)return;const s=e._index;if(void 0===s)throw new Error("OmvDecodedTileEmitter#processPolygonFeature: Internal error - No technique index");let c;const h=u.lookup("bbox");if(Array.isArray(h)){const[e,t,o,i]=h,r=new l.GeoBox(new l.GeoCoordinates(t,e),new l.GeoCoordinates(i,o));c=new f.Box3,l.webMercatorProjection.projectBox(r,c)}const d=[],p=i.isExtrudedPolygonTechnique(e),y=i.isFillTechnique(e),v=i.isStandardTechnique(e),b=p||y||v||i.isShaderTechnique(e)&&"mesh"===e.primitive,T=this.getComputeTexCoordsFunc(e,c);for(const e of o){const o=[];for(const i of e.rings){let e,r,s=i;b&&!p&&(s.some((e=>e.x<0||e.x>t||e.y<0||e.y>t))?(s=n.clipPolygon(s,t),e=g.Ring.computeClippedPointIndices(s,i)):e=new Set),0!==s.length&&(void 0!==T&&(r=s.map((e=>T(e,t)))),o.push(new g.Ring(s,r,t,e)))}0!==o.length&&d.push(o)}const x=i.isSolidLineTechnique(e)||i.isLineTechnique(e);if(b)this.applyPolygonTechnique(d,e,s,a,r,t);else if(x){const o="line"===e.name?this.m_simpleLines:this.m_solidLines,n="line"===e.name?R.Simple:R.Complex,a=i.isSpecialDashesLineTechnique(e);d.forEach((i=>{const l=[],c=a?[]:void 0;i.forEach((e=>{const o=e.points.length;let i=[],r=0,n=0,s=a?[]:void 0;for(let u=0;u<o;++u){a&&i.length>0&&(i=[],s=[]);const h=(u+1)%o,d=e.points[u],p=e.points[h],f=e.isProperEdge(u);if(f||0===i.length){if(f&&0===i.length&&(m.webMercatorTile2TargetTile(t,this.m_decodeInfo,_.copy(d),S),i.push(S.x,S.y,S.z),a)){m.webMercatorTile2TargetTile(t,this.m_decodeInfo,_.copy(p),V),i.push(V.x,V.y,V.z),s.push(n);const e=S.distanceTo(V);r+=e,n+=e,s.push(n)}}else l.push(i),i=[];f&&!a&&(m.webMercatorTile2TargetTile(t,this.m_decodeInfo,_.copy(p),S),i.push(S.x,S.y,S.z)),a&&i.length>0&&r>0&&(s.forEach(((e,t)=>{s[t]=e/r})),l.push(i),c.push(s))}!a&&i.length>0&&l.push(i)})),0!==l.length&&this.applyLineTechnique(o,e,s,n,u.entries,l,r,void 0,c)}))}}))}getDecodedTile(){this.createGeometries(),this.processSimpleLines(this.m_simpleLines),this.processLines(this.m_solidLines);const e={techniques:this.m_styleSetEvaluator.decodedTechniques,geometries:this.m_geometries,decodeTime:void 0};return this.m_textGeometries.length>0&&(e.textGeometries=this.m_textGeometries),this.m_poiGeometries.length>0&&(e.poiGeometries=this.m_poiGeometries),this.m_textPathGeometries.length>0&&(e.textPathGeometries=this.m_textPathGeometries),this.m_pathGeometries.length>0&&(e.pathGeometries=this.m_pathGeometries),0!==this.m_sources.length&&(e.copyrightHolderIds=this.m_sources),e.maxGeometryHeight=this.m_maxGeometryHeight,e.minGeometryHeight=this.m_minGeometryHeight,e}splitJaggyLines(e,t,o){const i=[],r=(e,t,o)=>{let i=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;for(let a=t;a<o;a+=3){const t=e[a],o=e[a+1];t<i&&(i=t),t>r&&(r=t),o<n&&(n=o),o>s&&(s=o)}return(r-i)*(r-i)+(s-n)*(s-n)},n=e.slice();for(;n.length>0;){const e=n.pop();if(void 0===e||e.length<6)continue;let s=-1;for(let t=0;t<e.length-3;t+=3){I.set(e[t],e[t+1]),M.set(e[t+3],e[t+4]);const i=M.sub(I).normalize();if(t>0){const e=Math.atan2(E.x*i.y-i.x*E.y,i.dot(E));if(Math.abs(e)>o){s=t;break}}E.set(i.x,i.y)}if(s>0){const o=r(e,0,s+3),a=r(e,s,e.length);o>t&&i.push(e.slice(0,s+3)),a>t&&n.push(e.slice(s))}else r(e,0,e.length)>t&&i.push(e)}return i}getTextureCoordinateType(e){return(i.isFillTechnique(e)||i.isSolidLineTechnique(e)||i.isExtrudedPolygonTechnique(e))&&this.m_enableElevationOverlay?i.TextureCoordinateType.TileSpace:i.textureCoordinateType(e)}getComputeTexCoordsFunc(e,t){switch(this.getTextureCoordinateType(e)){case i.TextureCoordinateType.TileSpace:return(e,t)=>{const o=e.clone().divideScalar(t);return o.y=1-o.y,o};case i.TextureCoordinateType.EquirectangularSpace:return(e,t)=>{const o=m.tile2world(t,this.m_decodeInfo,e,!1,L),i=l.normalizedEquirectangularProjection.reprojectPoint(l.webMercatorProjection,o);return new f.Vector2(i.x,i.y)};case i.TextureCoordinateType.FeatureSpace:if(!t)return;return(e,o)=>{const i=m.tile2world(o,this.m_decodeInfo,e,!1,L),r=new f.Vector2(i.x,i.y);return t&&(r.x-=t.min.x,r.y-=t.min.y,r.x/=t.max.x-t.min.x,r.y/=t.max.y-t.min.y),r.y=1-r.y,r};default:return}}applyLineTechnique(e,t,o,r=R.Complex,n,s,a,l,c){let h;const d=e.find((e=>e.technique===o)),p=void 0!==l;if(void 0===d){h=new u.LineGroup(p,void 0,r===R.Simple);const t={type:r===R.Complex?i.GeometryType.SolidLine:i.GeometryType.Line,technique:o,lines:h};this.m_gatherFeatureAttributes&&(t.objInfos=[n],t.featureStarts=[0]),e.push(t)}else h=d.lines,this.m_gatherFeatureAttributes&&d.objInfos&&d.featureStarts&&(d.objInfos.push(n),d.featureStarts.push(h.indices.length));let f=0;s.forEach((e=>{h.add(this.m_decodeInfo.center,e,this.projection,c?c[f]:void 0,l?l[f]:void 0),f++}))}applyPolygonTechnique(e,t,o,n,u,c){var g,V;if(0===e.length)return;const I=i.isExtrudedPolygonTechnique(t),M=I?i.GeometryType.ExtrudedPolygon:i.GeometryType.Polygon,E=this.findOrCreateMeshBuffers(o,M);if(void 0===E)return;const O=t,C=t,F=!0===O.boundaryWalls,j=i.isFillTechnique(t),A=this.getTextureCoordinateType(t);let k=r.evaluateTechniqueAttr(u,O.height),q=r.evaluateTechniqueAttr(u,O.floorHeight);if(void 0===k){const e=u.env.lookup("height"),t=r.evaluateTechniqueAttr(u,O.defaultHeight);k=void 0!==e?e:void 0!==t?t:0}if(void 0===q){const e=u.env.lookup("min_height");q=void 0===e||j?0:e}k=Math.max(q+h.ExtrusionFeatureDefs.MIN_BUILDING_HEIGHT,k);const N=this.m_decodeInfo.tileKey.level,R=r.evaluateTechniqueAttr(u,O.constantHeight,N<12);this.m_decodeInfo.tileBounds.getCenter(v);const{positions:B,normals:W,textureCoordinates:K,colors:U,extrusionAxis:z,indices:$,edgeIndices:J,groups:H}=E,Y=this.m_decodeInfo.targetProjection.type===l.ProjectionType.Spherical,Z=I?null!==(g=O.lineWidth)&&void 0!==g?g:0:j&&null!==(V=C.lineWidth)&&void 0!==V?V:0,X="number"!=typeof Z||Z>0;let Q;if(i.isExtrudedPolygonTechnique(t)&&d.getOptionValue(t.vertexColors,!1)){let e=r.evaluateTechniqueAttr(u,t.color);if(void 0===e){const t=u.env.lookup("color");this.isColorStringValid(t)&&(e=String(t))}void 0===e&&(e=r.evaluateTechniqueAttr(u,t.defaultColor,0)),void 0===e&&(e=0),D.set(e),Q=D}for(const t of e){const e=$.length,i=J.length;for(let e=0;e<t.length;){const o=[],i=B.length/3,r=t[e++],n=r.vertexStride,u=n+2,h=r.winding;for(let e=0;e<r.points.length;++e){const t=r.points[e];o.push(t.x,-t.y),void 0!==r.textureCoords&&o.push(r.textureCoords[e].x,r.textureCoords[e].y);const i=(e+1)%r.points.length,n=r.isProperEdge(e);o.push(n?i:-1,F||n?i:-1)}const d=[];for(;e<t.length&&t[e].winding!==h;){const i=o.length/u;d.push(i);const r=t[e++];for(let e=0;e<r.points.length;++e){const t=(e+1)%r.points.length,n=r.points[e];o.push(n.x,-n.y),void 0!==r.textureCoords&&o.push(r.textureCoords[e].x,r.textureCoords[e].y);const s=r.isProperEdge(e);o.push(s?i+t:-1,F||s?i+t:-1)}}try{const e=p.default(o,d,u),t=o.length/u;if(Y){const t=new f.BufferGeometry,i=[],r=[],h=[],d=[];for(let e=0;e<o.length;e+=u){const t=m.tile2world(c,this.m_decodeInfo,_.set(o[e],o[e+1]),!0,L);i.push(t.x,t.y,0),void 0!==A&&r.push(o[e+2],o[e+3]),h.push(o[e+n]),d.push(o[e+n+1])}const p=new f.BufferAttribute(new Float32Array(i),3);let g;t.setAttribute("position",p),void 0!==A&&(g=new f.BufferAttribute(new Float32Array(r),2),t.setAttribute("uv",g));const y=new f.BufferAttribute(new Float32Array(h),1);t.setAttribute("edge",y);const v=new f.BufferAttribute(new Float32Array(d),1);t.setAttribute("wall",y);const b=G(e,p.count-1),T="uint32"===b.type?new f.Uint32BufferAttribute(b.buffer,1):new f.Uint16BufferAttribute(b.buffer,1);t.setIndex(T);const x=this.m_decodeInfo.tileKey.level;if(x>=3&&x<9){const e=Math.pow(2,9-x),{geoBox:o}=this.m_decodeInfo;new s.EdgeLengthGeometrySubdivisionModifier(e,o,s.SubdivisionMode.NoDiagonals,l.webMercatorProjection).modify(t)}new a.SphericalGeometrySubdivisionModifier(f.MathUtils.degToRad(10),l.webMercatorProjection).modify(t),o.length=0,e.length=0;for(let e=0;e<p.array.length;e+=3){const t=m.world2tile(c,this.m_decodeInfo,S.set(p.array[e],p.array[e+1],0),!0,P);o.push(t.x,t.y),void 0!==A&&(o.push(g.array[e/3*2]),o.push(g.array[e/3*2+1])),o.push(y.array[e/3]),o.push(v.array[e/3])}const w=t.getIndex();null!==w&&e.push(...w.array)}T.set(0,0,1);for(let e=0;e<o.length;e+=u){m.webMercatorTile2TargetTile(c,this.m_decodeInfo,_.set(o[e],o[e+1]),S,!0);let t=1;I&&!0!==R&&(b.set(v.x+S.x,v.y+S.y,v.z+S.z),t=this.m_decodeInfo.targetProjection.getScaleFactor(b)),this.m_maxGeometryHeight=Math.max(this.m_maxGeometryHeight,t*k),this.m_minGeometryHeight=Math.min(this.m_minGeometryHeight,t*k),Y&&T.set(S.x,S.y,S.z).add(this.center).normalize(),x.copy(T).multiplyScalar(q*t),B.push(S.x+x.x,S.y+x.y,S.z+x.z),void 0!==A&&K.push(o[e+2],o[e+3]),this.m_enableElevationOverlay&&W.push(...T.toArray()),I&&(w.copy(T).multiplyScalar(k*t),B.push(S.x+w.x,S.y+w.y,S.z+w.z),z.push(0,0,0,0,w.x-x.x,w.y-x.y,w.z-x.z,1),void 0!==A&&K.push(o[e+2],o[e+3]),this.m_enableElevationOverlay&&W.push(...T.toArray()),void 0!==Q&&U.push(Q.r,Q.g,Q.b,Q.r,Q.g,Q.b))}for(let t=0;t<e.length;t+=3)if(I){const o=i+2*e[t+0]+1,r=i+2*e[t+1]+1,n=i+2*e[t+2]+1;$.push(o,r,n)}else{const o=i+e[t+0],r=i+e[t+1],n=i+e[t+2];$.push(o,r,n)}X&&this.addEdges(i,t,u,n,B,o,J,I,O.footprint,O.maxSlope),I&&this.addWalls(i,t,u,n,o,$)}catch(e){y.error("cannot triangulate geometry",e)}}this.m_gatherFeatureAttributes&&(E.objInfos.push(u.env.entries),E.featureStarts.push(e),E.edgeFeatureStarts.push(i));const r=$.length-e;r>0&&H.push({start:e,count:r,technique:o})}}createGeometries(){this.m_meshBuffers.forEach(((e,t)=>{if(0===e.positions.length)return;if(!this.m_styleSetEvaluator.techniques||this.m_styleSetEvaluator.techniques.length<=t)throw new Error("Invalid technique index");const o=this.m_styleSetEvaluator.techniques[t];if(void 0===o)return;const r=new Float32Array(e.positions);if(e.texts.length>0&&i.isTextTechnique(o))return void this.m_textGeometries.push({positions:{name:"position",type:"float",buffer:r.buffer,itemCount:3},texts:e.texts,technique:t,stringCatalog:e.stringCatalog,objInfos:e.objInfos});if(e.texts.length>0&&i.isPoiTechnique(o))return void this.m_poiGeometries.push({positions:{name:"position",type:"float",buffer:r.buffer,itemCount:3},texts:e.texts,technique:t,stringCatalog:e.stringCatalog,imageTextures:e.imageTextures,objInfos:e.objInfos,offsetDirections:e.offsetDirections});0===e.groups.length&&e.groups.push({start:0,count:r.length/3,technique:t});const n=[{name:"position",buffer:r.buffer,itemCount:3,type:"float"}],s={type:e.type,vertexAttributes:n,groups:e.groups};if(e.normals.length>0){const t=new Float32Array(e.normals);d.assert(t.length===r.length,"length of normals buffer is different than the length of the position buffer"),n.push({name:"normal",buffer:t.buffer,itemCount:3,type:"float"})}if(e.colors.length>0){const t=new Float32Array(e.colors);d.assert(t.length===r.length,"length of colors buffer is different than the length of the position buffe