@teritorio/openstreetmap-logical-history-component 0.4.0 → 0.4.2
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/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +439 -391
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`maplibre-gl`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`maplibre-gl`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.OSMLoChaComponent={},e.Vue,e.maplibregl))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n);var f=6371008.8,p={centimeters:f*100,centimetres:f*100,degrees:360/(2*Math.PI),feet:f*3.28084,inches:f*39.37,kilometers:f/1e3,kilometres:f/1e3,meters:f,metres:f,miles:f/1609.344,millimeters:f*1e3,millimetres:f*1e3,nauticalmiles:f/1852,radians:1,yards:f*1.0936};function m(e,t,n={}){let r={type:`Feature`};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function h(e,t,n={}){if(!e)throw Error(`coordinates is required`);if(!Array.isArray(e))throw Error(`coordinates must be an Array`);if(e.length<2)throw Error(`coordinates must be at least 2 numbers long`);if(!w(e[0])||!w(e[1]))throw Error(`coordinates must contain numbers`);return m({type:`Point`,coordinates:e},t,n)}function g(e,t,n={}){for(let t of e){if(t.length<4)throw Error(`Each LinearRing of a Polygon must have 4 or more Positions.`);if(t[t.length-1].length!==t[0].length)throw Error(`First and last Position are not equivalent.`);for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error(`First and last Position are not equivalent.`)}return m({type:`Polygon`,coordinates:e},t,n)}function _(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return m({type:`LineString`,coordinates:e},t,n)}function v(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function y(e,t,n={}){return m({type:`MultiLineString`,coordinates:e},t,n)}function b(e,t,n={}){return m({type:`MultiPolygon`,coordinates:e},t,n)}function x(e,t=`kilometers`){let n=p[t];if(!n)throw Error(t+` units is invalid`);return e*n}function S(e){return e%(2*Math.PI)*180/Math.PI}function C(e){return e%360*Math.PI/180}function w(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function T(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function E(e,t,n){if(e!==null)for(var r,i,a,o,s,c,l,u=0,d=0,f,p=e.type,m=p===`FeatureCollection`,h=p===`Feature`,g=m?e.features.length:1,_=0;_<g;_++){l=m?e.features[_].geometry:h?e.geometry:e,f=l?l.type===`GeometryCollection`:!1,s=f?l.geometries.length:1;for(var v=0;v<s;v++){var y=0,b=0;if(o=f?l.geometries[v]:l,o!==null){c=o.coordinates;var x=o.type;switch(u=n&&(x===`Polygon`||x===`MultiPolygon`)?1:0,x){case null:break;case`Point`:if(t(c,d,_,y,b)===!1)return!1;d++,y++;break;case`LineString`:case`MultiPoint`:for(r=0;r<c.length;r++){if(t(c[r],d,_,y,b)===!1)return!1;d++,x===`MultiPoint`&&y++}x===`LineString`&&y++;break;case`Polygon`:case`MultiLineString`:for(r=0;r<c.length;r++){for(i=0;i<c[r].length-u;i++){if(t(c[r][i],d,_,y,b)===!1)return!1;d++}x===`MultiLineString`&&y++,x===`Polygon`&&b++}x===`Polygon`&&y++;break;case`MultiPolygon`:for(r=0;r<c.length;r++){for(b=0,i=0;i<c[r].length;i++){for(a=0;a<c[r][i].length-u;a++){if(t(c[r][i][a],d,_,y,b)===!1)return!1;d++}b++}y++}break;case`GeometryCollection`:for(r=0;r<o.geometries.length;r++)if(E(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function D(e,t){if(e.type===`Feature`)t(e,0);else if(e.type===`FeatureCollection`)for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function O(e,t,n){var r=n;return D(e,function(e,i){r=i===0&&n===void 0?e:t(r,e,i)}),r}function k(e,t){var n,r,i,a,o,s,c,l,u,d,f=0,p=e.type===`FeatureCollection`,m=e.type===`Feature`,h=p?e.features.length:1;for(n=0;n<h;n++){for(s=p?e.features[n].geometry:m?e.geometry:e,l=p?e.features[n].properties:m?e.properties:{},u=p?e.features[n].bbox:m?e.bbox:void 0,d=p?e.features[n].id:m?e.id:void 0,c=s?s.type===`GeometryCollection`:!1,o=c?s.geometries.length:1,i=0;i<o;i++){if(a=c?s.geometries[i]:s,a===null){if(t(null,f,l,u,d)===!1)return!1;continue}switch(a.type){case`Point`:case`LineString`:case`MultiPoint`:case`Polygon`:case`MultiLineString`:case`MultiPolygon`:if(t(a,f,l,u,d)===!1)return!1;break;case`GeometryCollection`:for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],f,l,u,d)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}f++}}function A(e,t,n){var r=n;return k(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function ee(e,t){k(e,function(e,n,r,i,a){var o=e===null?null:e.type;switch(o){case null:case`Point`:case`LineString`:case`Polygon`:return t(m(e,r,{bbox:i,id:a}),n,0)===!1?!1:void 0}var s;switch(o){case`MultiPoint`:s=`Point`;break;case`MultiLineString`:s=`LineString`;break;case`MultiPolygon`:s=`Polygon`;break}for(var c=0;c<e.coordinates.length;c++){var l=e.coordinates[c];if(t(m({type:s,coordinates:l},r),n,c)===!1)return!1}})}function te(e){return A(e,(e,t)=>e+ne(t),0)}function ne(e){let t=0,n;switch(e.type){case`Polygon`:return re(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=re(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function re(e){let t=0;if(e&&e.length>0){t+=Math.abs(oe(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(oe(e[n]))}return t}var ie=f*f/2,ae=Math.PI/180;function oe(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*ae,c=a[1]*ae,l=o[0]*ae;n+=(l-s)*Math.sin(c),r++}return n*ie}var se=Object.defineProperty,j=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=class{constructor(e){this.direction=!1,this.compareProperties=!0,this.precision=10**-(e?.precision??17),this.direction=e?.direction??!1,this.compareProperties=e?.compareProperties??!0}compare(e,t){if(e.type!==t.type||!M(e,t))return!1;switch(e.type){case`Point`:return this.compareCoord(e.coordinates,t.coordinates);case`LineString`:return this.compareLine(e.coordinates,t.coordinates);case`Polygon`:return this.comparePolygon(e,t);case`GeometryCollection`:return this.compareGeometryCollection(e,t);case`Feature`:return this.compareFeature(e,t);case`FeatureCollection`:return this.compareFeatureCollection(e,t);default:if(e.type.startsWith(`Multi`)){let n=ue(e),r=ue(t);return n.every(e=>r.some(t=>this.compare(e,t)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<this.precision)}compareLine(e,t,n=0,r=!1){if(!M(e,t))return!1;let i=e,a=t;if(r&&!this.compareCoord(i[0],a[0])){let e=this.fixStartIndex(a,i);if(e)a=e;else return!1}let o=this.compareCoord(i[n],a[n]);return this.direction||o?this.comparePath(i,a):this.compareCoord(i[n],a[a.length-(1+n)])?this.comparePath(i.slice().reverse(),a):!1}fixStartIndex(e,t){let n,r=-1;for(let n=0;n<e.length;n++)if(this.compareCoord(e[n],t[0])){r=n;break}return r>=0&&(n=[].concat(e.slice(r,e.length),e.slice(1,r+1))),n}comparePath(e,t){return e.every((e,n)=>this.compareCoord(e,t[n]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){let n=e.coordinates.slice(1,e.coordinates.length),r=t.coordinates.slice(1,t.coordinates.length);return n.every(e=>r.some(t=>this.compareLine(e,t,1,!0)))}return!1}compareGeometryCollection(e,t){return M(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((e,n)=>this.compare(e,t.geometries[n]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?fe(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return M(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((e,n)=>this.compare(e,t.features[n]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};j(ce,`GeojsonEquality`);var le=ce;function M(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}j(M,`sameLength`);function ue(e){return e.coordinates.map(t=>({type:e.type.replace(`Multi`,``),coordinates:t}))}j(ue,`explode`);function de(e,t,n){return new le(n).compare(e,t)}j(de,`geojsonEquality`);function fe(e,t){if(e===null&&t===null)return!0;if(e===null||t===null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i of n){let n=e[i],r=t[i],a=pe(n)&&pe(r);if(a&&!fe(n,r)||!a&&n!==r)return!1}return!0}j(fe,`equal`);var pe=j(e=>typeof e==`object`&&!!e,`isObject`);function N(e){if(!e)throw Error(`coord is required`);if(!Array.isArray(e)){if(e.type===`Feature`&&e.geometry!==null&&e.geometry.type===`Point`)return[...e.geometry.coordinates];if(e.type===`Point`)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error(`coord must be GeoJSON Point or an Array of numbers`)}function P(e){if(Array.isArray(e))return e;if(e.type===`Feature`){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw Error(`coords must be GeoJSON Feature, Geometry Object or an Array`)}function F(e){return e.type===`Feature`?e.geometry:e}function me(e,t){return e.type===`FeatureCollection`?`FeatureCollection`:e.type===`GeometryCollection`?`GeometryCollection`:e.type===`Feature`&&e.geometry!==null?e.geometry.type:e.type}function I(e,t,n={}){let r=N(e),i=P(t);for(let e=0;e<i.length-1;e++){let t=!1;if(n.ignoreEndVertices&&(e===0&&(t=`start`),e===i.length-2&&(t=`end`),e===0&&e+1===i.length-1&&(t=`both`)),he(i[e],i[e+1],r,t,n.epsilon===void 0?null:n.epsilon))return!0}return!1}function he(e,t,n,r,i){let a=n[0],o=n[1],s=e[0],c=e[1],l=t[0],u=t[1],d=n[0]-s,f=n[1]-c,p=l-s,m=u-c,h=d*m-f*p;if(i!==null){if(Math.abs(h)>i)return!1}else if(h!==0)return!1;return Math.abs(p)===Math.abs(m)&&Math.abs(p)===0?r?!1:n[0]===e[0]&&n[1]===e[1]:r?r===`start`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<=l:l<=a&&a<s:m>0?c<o&&o<=u:u<=o&&o<c:r===`end`?Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<l:l<a&&a<=s:m>0?c<=o&&o<u:u<o&&o<=c:r===`both`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<l:l<a&&a<s:m>0?c<o&&o<u:u<o&&o<c:!1:Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<=l:l<=a&&a<=s:m>0?c<=o&&o<=u:u<=o&&o<=c}function ge(e,t={}){var n=typeof t==`object`?t.mutate:t;if(!e)throw Error(`geojson is required`);var r=me(e),i=[];switch(r){case`LineString`:i=_e(e,r);break;case`MultiLineString`:case`Polygon`:P(e).forEach(function(e){i.push(_e(e,r))});break;case`MultiPolygon`:P(e).forEach(function(e){var t=[];e.forEach(function(e){t.push(_e(e,r))}),i.push(t)});break;case`Point`:return e;case`MultiPoint`:var a={};P(e).forEach(function(e){var t=e.join(`-`);Object.prototype.hasOwnProperty.call(a,t)||(i.push(e),a[t]=!0)});break;default:throw Error(r+` geometry not supported`)}return e.coordinates?n===!0?(e.coordinates=i,e):{type:r,coordinates:i}:n===!0?(e.geometry.coordinates=i,e):m({type:r,coordinates:i},e.properties,{bbox:e.bbox,id:e.id})}function _e(e,t){let n=P(e);if(n.length===2&&!ve(n[0],n[1]))return n;let r=[],i=0,a=1,o=2;for(r.push(n[i]);o<n.length;)I(n[a],_([n[i],n[o]]))?a=o:(r.push(n[a]),i=a,a++,o=a),o++;if(r.push(n[a]),t===`Polygon`||t===`MultiPolygon`){if(I(r[0],_([r[1],r[r.length-2]]))&&(r.shift(),r.pop(),r.push(r[0])),r.length<4)throw Error(`invalid polygon, fewer than 4 points`);if(!ve(r[0],r[r.length-1]))throw Error(`invalid polygon, first and last points not equal`)}return r}function ve(e,t){return e[0]===t[0]&&e[1]===t[1]}function ye(e,t,n={}){let r=n.precision;if(r=r==null||isNaN(r)?6:r,typeof r!=`number`||!(r>=0))throw Error(`precision must be a positive number`);return F(e).type===F(t).type?de(ge(e),ge(t),{precision:r}):!1}var be=ye;function xe(e){return e.features.map(t=>{if(t.id==null){console.warn(`Skipping feature with null id`);return}let n=e.metadata.links[t.properties.links];if(!n){console.warn(`Feature ${t.id} has no group, skipping.`);return}let r=n.find(e=>e.before===t.id||e.after===t.id);if(!r){console.warn(`Feature ${t.id} has no link, skipping.`);return}let i=e.features.find(e=>e.properties.links===t.properties.links&&e.id!==t.id);return i?.geometry&&t.geometry&&(t.properties.geom=!be(t.geometry,i.geometry)),t.id===r.before?{...t,properties:{...t.properties,is_before:!0}}:t.id===r.after&&!n.filter(e=>`before`in e).length?{...t,properties:{...t.properties,is_new:!0}}:t.id===r.after||r.before===void 0&&r.after!==void 0?{...t,properties:{...t.properties,is_after:!0}}:t}).filter(e=>e!==void 0).sort((e,t)=>{let n=e.geometry,r=t.geometry;return!n&&!r?0:n?r?te(t)-te(e):-1:1})}var L={new:`#52c41a`,delete:`#FF0000`,updateBefore:`#FFA479`,updateAfter:`#F2BE00`},R=Object.fromEntries([`new`,`delete`,`updateAfter`,`updateBefore`].map(e=>[e,e]));function Se(){let e=(0,t.ref)(),n=(0,t.ref)([]),r=(0,t.computed)(()=>e.value?.features.length);function i(e){return e.reduce((e,t)=>{let n=t.properties.links;return e[n]||(e[n]=[]),e[n].push(t),e},[])}function a(t){l();let r={...t,features:xe(t)};e.value=r,n.value=i(r.features)}function o(e){return e.filter(e=>e.properties.is_before)}function s(e){return e.filter(e=>e.properties.is_after||e.properties.is_new)}function c(e){return e.properties.is_new?R.new:e.properties.deleted?R.delete:e.properties.is_before?R.updateBefore:R.updateAfter}function l(){e.value=void 0,n.value=[]}return{featureCount:r,loCha:e,groups:n,setLoCha:a,getStatus:c,getBeforeFeatures:o,getAfterFeatures:s}}var Ce=Symbol(`reasonCollapsed`),we=Symbol(`loCha`),Te=Symbol(`loChaInstanceId`),Ee=Symbol(`mapStyleUrl`),De={n:`node`,w:`way`,r:`relation`};function Oe(e,t){return`https://www.openstreetmap.org/${De[e]}/${t}/history`}function ke(e){return`https://www.openstreetmap.org/user/${encodeURIComponent(e)}`}function Ae(e,t){return`http://127.0.0.1:8111/load_object?objects=${e}${t}`}function je(e,t){return`https://osmlab.github.io/osm-deep-history/#/${De[e]}/${t}`}function Me(e,t){return`https://pewu.github.io/osm-history/#/${De[e]}/${t}`}var Ne={class:`locha-object`},Pe={class:`wrap`},Fe=[`href`],Ie={class:`fab`},Le={class:`fab-menu`},Re=[`href`],ze=[`href`,`target`],Be=[`href`],Ve=[`href`],He={class:`date`},Ue=[`href`,`title`],We=(0,t.defineComponent)({__name:`LoChaObject`,props:{feature:{},josmTarget:{}},setup(e){(0,t.useCssVars)(e=>({v26dc6b0d:o.value,v817d1e34:(0,t.unref)(L).delete,v0b8a0045:(0,t.unref)(L).new}));let n=e,{getStatus:r}=(0,t.inject)(we),i=(0,t.computed)(()=>r(n.feature)),a=(0,t.computed)(()=>{switch(i.value){case`new`:return`new`;case`delete`:return`deleted`;default:return``}}),o=(0,t.computed)(()=>L[i.value]);return(r,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`article`,Ne,[(0,t.createElementVNode)(`header`,null,[(0,t.createElementVNode)(`div`,Pe,[(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Oe)(e.feature.properties.objtype,e.feature.properties.id),title:`OSM History`,target:`_blank`,onClick:o[0]||=(0,t.withModifiers)(()=>{},[`stop`])},(0,t.toDisplayString)(`${e.feature.properties.objtype}${e.feature.properties.id}-v${e.feature.properties.version}`),9,Fe),i.value===`new`||i.value===`delete`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`status-content`,{"object-new":i.value===`new`,"object-deleted":i.value===`delete`}])},(0,t.toDisplayString)(a.value),3)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Ie,[o[6]||=(0,t.createElementVNode)(`button`,{class:`fab-toggle`,type:`button`,title:`Tools`},` 🔧 Tools `,-1),(0,t.createElementVNode)(`div`,Le,[(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Oe)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`Edit in OSM iD`,target:`_blank`,onClick:o[1]||=(0,t.withModifiers)(()=>{},[`stop`])},` OSM iD `,8,Re),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Ae)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`Edit in JOSM`,target:e.josmTarget||`hidden_josm_target`,onClick:o[2]||=(0,t.withModifiers)(()=>{},[`stop`])},` JOSM `,8,ze),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(je)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`OSM Deep History`,target:`_blank`,onClick:o[3]||=(0,t.withModifiers)(()=>{},[`stop`])},` Deep H `,8,Be),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Me)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`OSM History Viewer`,target:`_blank`,onClick:o[4]||=(0,t.withModifiers)(()=>{},[`stop`])},` OSM H `,8,Ve)])])]),(0,t.createElementVNode)(`p`,He,` 📅 `+(0,t.toDisplayString)(n.feature.properties.created),1),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(ke)(e.feature.properties.username),title:`View ${e.feature.properties.username} OSM profile`,target:`_blank`,onClick:o[5]||=(0,t.withModifiers)(()=>{},[`stop`])},` 👤`+(0,t.toDisplayString)(e.feature.properties.username),9,Ue)]),(0,t.renderSlot)(r.$slots,`object-detail`,{},void 0,!0)]))}}),z=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ge=z(We,[[`__scopeId`,`data-v-4e68f036`]]);function B(e,t={}){if(e.bbox!=null&&!0!==t.recompute)return e.bbox;let n=[1/0,1/0,-1/0,-1/0];return E(e,e=>{n[0]>e[0]&&(n[0]=e[0]),n[1]>e[1]&&(n[1]=e[1]),n[2]<e[0]&&(n[2]=e[0]),n[3]<e[1]&&(n[3]=e[1])}),n}var Ke=B;function qe(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}var V=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Je=e=>e!=null,Ye=Object.prototype.toString,Xe=e=>Ye.call(e)===`[object Object]`,Ze=()=>{},Qe=$e();function $e(){var e,t;return V&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function et(...e){if(e.length!==1)return(0,t.toRef)(...e);let n=e[0];return typeof n==`function`?(0,t.readonly)((0,t.customRef)(()=>({get:n,set:Ze}))):(0,t.ref)(n)}function tt(e){return Array.isArray(e)?e:[e]}function nt(e,n,r){return(0,t.watch)(e,n,{...r,immediate:!0})}var rt=V?window:void 0;V&&window.document,V&&window.navigator,V&&window.location;function H(e){let n=(0,t.toValue)(e);return n?.$el??n}function it(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,t.computed)(()=>{let n=tt((0,t.toValue)(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return nt(()=>[r.value?.map(e=>H(e))??[rt].filter(e=>e!=null),tt((0,t.toValue)(r.value?e[1]:e[0])),tt((0,t.unref)(r.value?e[2]:e[1])),(0,t.toValue)(r.value?e[3]:e[2])],([e,t,r,i],a,o)=>{if(!e?.length||!t?.length||!r?.length)return;let s=Xe(i)?{...i}:i,c=e.flatMap(e=>t.flatMap(t=>r.map(r=>n(e,t,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function at(){let e=(0,t.shallowRef)(!1),n=(0,t.getCurrentInstance)();return n&&(0,t.onMounted)(()=>{e.value=!0},n),e}function ot(e){let n=at();return(0,t.computed)(()=>(n.value,!!e()))}function st(e,n,r={}){let{root:i,rootMargin:a,threshold:o=0,window:s=rt,immediate:c=!0}=r,l=ot(()=>s&&`IntersectionObserver`in s),u=(0,t.computed)(()=>tt((0,t.toValue)(e)).map(H).filter(Je)),d=Ze,f=(0,t.shallowRef)(c),p=l.value?(0,t.watch)(()=>[u.value,H(i),(0,t.toValue)(a),f.value],([e,t,r])=>{if(d(),!f.value||!e.length)return;let i=new IntersectionObserver(n,{root:H(t),rootMargin:r,threshold:o});e.forEach(e=>e&&i.observe(e)),d=()=>{i.disconnect(),d=Ze}},{immediate:c,flush:`post`}):Ze,m=()=>{d(),p(),f.value=!1};return qe(m),{isSupported:l,isActive:f,pause(){d(),f.value=!1},resume(){f.value=!0},stop:m}}function ct(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}function lt(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!t||t.tagName===`BODY`?!1:lt(t)}}function ut(e){let t=e||window.event,n=t.target;return lt(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}var dt=new WeakMap;function ft(e,n=!1){let r=(0,t.shallowRef)(n),i=null,a=``;(0,t.watch)(et(e),e=>{let n=ct((0,t.toValue)(e));if(n){let e=n;if(dt.get(e)||dt.set(e,e.style.overflow),e.style.overflow!==`hidden`&&(a=e.style.overflow),e.style.overflow===`hidden`)return r.value=!0;if(r.value)return e.style.overflow=`hidden`}},{immediate:!0});let o=()=>{let n=ct((0,t.toValue)(e));!n||r.value||(Qe&&(i=it(n,`touchmove`,e=>{ut(e)},{passive:!1})),n.style.overflow=`hidden`,r.value=!0)},s=()=>{let n=ct((0,t.toValue)(e));!n||!r.value||(Qe&&i?.(),n.style.overflow=a,dt.delete(n),r.value=!1)};return qe(s),(0,t.computed)({get(){return r.value},set(e){e?o():s()}})}var pt={mounted(e,t){typeof t.value==`function`?st(e,t.value):st(e,...t.value)}};function mt(){let e=!1,n=(0,t.shallowRef)(!1);return(r,i)=>{if(n.value=i.value,e)return;e=!0;let a=ft(r,i.value);(0,t.watch)(n,e=>a.value=e)}}mt();var ht=`https://maps.cartoway.com/styles/positron/style.json`,gt=`#f4f4f5`,_t=`bbox`,U=`lochas`,W={Bbox:{id:`bbox-layer`,type:`line`,source:_t,paint:{"line-color":`#000000`,"line-width":1,"line-dasharray":[2,2]}},PolygonBorder:{id:`feature-polygons-border`,type:`line`,source:U,paint:{"line-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"line-color":`#000000`},filter:[`in`,[`geometry-type`],[`literal`,[`Polygon`,`MultiPolygon`]]]},Polygon:{id:`feature-polygons`,type:`fill`,source:U,paint:{"fill-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.3],"fill-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter]},filter:[`in`,[`geometry-type`],[`literal`,[`Polygon`,`MultiPolygon`]]]},LineString:{id:`feature-lines`,type:`line`,source:U,paint:{"line-width":6,"line-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter],"line-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.5],"line-offset":[`case`,[`==`,[`get`,`is_before`],!0],-3,3]},layout:{"line-cap":`round`},filter:[`in`,[`geometry-type`],[`literal`,[`LineString`,`MultiLineString`]]]},LineStringBorder:{id:`feature-lines-border`,type:`line`,source:U,paint:{"line-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"line-color":`#000000`,"line-offset":[`case`,[`==`,[`get`,`is_before`],!0],-2,2]},layout:{"line-cap":`round`},filter:[`in`,[`geometry-type`],[`literal`,[`LineString`,`MultiLineString`]]]},Point:{id:`feature-points`,type:`circle`,source:U,paint:{"circle-radius":[`case`,[`boolean`,[`feature-state`,`hover`],!1],14,12],"circle-stroke-color":`#000000`,"circle-stroke-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"circle-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.3],"circle-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter]},filter:[`in`,[`geometry-type`],[`literal`,[`Point`,`MultiPoint`]]]}};function vt(e,t,n){var r=e.length,i=G(e[0],t),a=[],o,s,c;let l,u;for(n||=[],o=1;o<r;o++){for(l=e[o-1],u=e[o],s=c=G(u,t);;)if(!(i|s)){a.push(l),s===c?o===r-1&&a.push(u):(a.push(u),o<r-1&&(n.push(a),a=[]));break}else if(i&s)break;else i?(l=bt(l,u,i,t),i=G(l,t)):(u=bt(l,u,s,t),s=G(u,t));i=c}return a.length&&n.push(a),n}function yt(e,t){var n,r,i,a,o,s,c;for(r=1;r<=8;r*=2){for(n=[],i=e[e.length-1],a=!(G(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(G(s,t)&r),c!==a&&n.push(bt(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function bt(e,t,n,r){return n&8?[e[0]+(t[0]-e[0])*(r[3]-e[1])/(t[1]-e[1]),r[3]]:n&4?[e[0]+(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1]),r[1]]:n&2?[r[2],e[1]+(t[1]-e[1])*(r[2]-e[0])/(t[0]-e[0])]:n&1?[r[0],e[1]+(t[1]-e[1])*(r[0]-e[0])/(t[0]-e[0])]:null}function G(e,t){var n=0;return e[0]<t[0]?n|=1:e[0]>t[2]&&(n|=2),e[1]<t[1]?n|=4:e[1]>t[3]&&(n|=8),n}function xt(e,t){let n=F(e),r=n.type,i=e.type===`Feature`?e.properties:{},a=n.coordinates;switch(r){case`LineString`:case`MultiLineString`:{let e=[];return r===`LineString`&&(a=[a]),a.forEach(n=>{vt(n,t,e)}),e.length===1?_(e[0],i):y(e,i)}case`Polygon`:return g(St(a,t),i);case`MultiPolygon`:return b(a.map(e=>St(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function St(e,t){let n=[];for(let r of e){let e=yt(r,t);e.length>0&&((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&e.push(e[0]),e.length>=4&&n.push(e))}return n}var Ct=xt;function wt(e,t={}){let n=Number(e[0]),r=Number(e[1]),i=Number(e[2]),a=Number(e[3]);if(e.length===6)throw Error(`@turf/bbox-polygon does not support BBox with 6 positions`);let o=[n,r];return g([[o,[i,r],[i,a],[n,a],o]],t.properties,{bbox:e,id:t.id})}var Tt=wt,K=11102230246251565e-32,q=134217729,Et=(3+8*K)*K;function Dt(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function Ot(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function J(e){return new Float64Array(e)}var kt=(3+16*K)*K,At=(2+12*K)*K,jt=(9+64*K)*K*K,Y=J(4),Mt=J(8),Nt=J(12),Pt=J(16),X=J(4);function Ft(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=q*T,p=f-(f-T),m=T-p,f=q*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=q*D,p=f-(f-D),m=D-p,f=q*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,Y[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,Y[1]=y-(_+d)+(d-S),w=v+_,d=w-v,Y[2]=v-(w-d)+(_-d),Y[3]=w;let k=Ot(4,Y),A=At*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=jt*o+Et*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=q*s,p=f-(f-s),m=s-p,f=q*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=q*c,p=f-(f-c),m=c-p,f=q*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w;let ee=Dt(4,Y,4,X,Mt);b=T*u,f=q*T,p=f-(f-T),m=T-p,f=q*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=q*D,p=f-(f-D),m=D-p,f=q*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w;let te=Dt(ee,Mt,4,X,Nt);return b=s*u,f=q*s,p=f-(f-s),m=s-p,f=q*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=q*c,p=f-(f-c),m=c-p,f=q*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w,Pt[Dt(te,Nt,4,X,Pt)-1]}function It(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=kt*l?c:-Ft(e,t,n,r,i,a,l)}(7+56*K)*K,(3+28*K)*K,(26+288*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(8),J(8),J(8),J(4),J(8),J(8),J(8),J(12),J(192),J(192),(10+96*K)*K,(4+48*K)*K,(44+576*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(4),J(4),J(4),J(8),J(16),J(16),J(16),J(32),J(32),J(48),J(64),J(1152),J(1152),(16+224*K)*K,(5+72*K)*K,(71+1408*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(1152),J(1152),J(1152),J(1152),J(1152),J(2304),J(2304),J(3456),J(5760),J(8),J(8),J(8),J(16),J(24),J(48),J(48),J(96),J(192),J(384),J(384),J(384),J(768),J(96),J(96),J(96),J(1152);function Lt(e,t){var n,r,i=0,a,o,s,c,l,u,d,f=e[0],p=e[1],m=t.length;for(n=0;n<m;n++){r=0;var h=t[n],g=h.length-1;if(u=h[0],u[0]!==h[g][0]&&u[1]!==h[g][1])throw Error(`First and last coordinates in a ring must be the same`);for(o=u[0]-f,s=u[1]-p;r<g;r++){if(d=h[r+1],c=d[0]-f,l=d[1]-p,s===0&&l===0){if(c<=0&&o>=0||o<=0&&c>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(a=It(o,c,s,l,0,0),a===0)return 0;(a>0&&l>0&&s<=0||a<0&&l<=0&&s>0)&&i++}u=d,s=l,o=c}}return i%2!=0}function Z(e,t,n={}){if(!e)throw Error(`point is required`);if(!t)throw Error(`polygon is required`);let r=N(e),i=F(t),a=i.type,o=t.bbox,s=i.coordinates;if(o&&Rt(r,o)===!1)return!1;a===`Polygon`&&(s=[s]);let c=!1;for(var l=0;l<s.length;++l){let e=Lt(r,s[l]);if(e===0)return!n.ignoreBoundary;e&&(c=!0)}return c}function Rt(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var zt=d(l(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n||=self).RBush=r()})(e,function(){"use strict";function e(e,r,i,a,o){(function e(n,r,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,c=r-i+1,l=Math.log(s),u=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*u*(s-u)/s)*(c-s/2<0?-1:1);e(n,r,Math.max(i,Math.floor(r-c*u/s+d)),Math.min(a,Math.floor(r+(s-c)*u/s+d)),o)}var f=n[r],p=i,m=a;for(t(n,i,r),o(n[a],f)>0&&t(n,i,a);p<m;){for(t(n,p,m),p++,m--;o(n[p],f)<0;)p++;for(;o(n[m],f)>0;)m--}o(n[i],f)===0?t(n,i,m):t(n,++m,a),m<=r&&(i=m+1),r<=m&&(a=m-1)}})(e,r,i||0,a||e.length-1,o||n)}function t(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function n(e,t){return e<t?-1:e>t?1:0}var r=function(e){e===void 0&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(e,t,n){if(!n)return t.indexOf(e);for(var r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function a(e,t){o(e,0,e.children.length,t,e)}function o(e,t,n,r,i){i||=m(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var a=t;a<n;a++){var o=e.children[a];s(i,e.leaf?r(o):o)}return i}function s(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function c(e,t){return e.minX-t.minX}function l(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function f(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function p(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function m(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function h(t,n,r,i,a){for(var o=[n,r];o.length;)if(!((r=o.pop())-(n=o.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;e(t,s,n,r,a),o.push(n,s,s,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(e){var t=this.data,n=[];if(!p(e,t))return n;for(var r=this.toBBox,i=[];t;){for(var a=0;a<t.children.length;a++){var o=t.children[a],s=t.leaf?r(o):o;p(e,s)&&(t.leaf?n.push(o):f(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n},r.prototype.collides=function(e){var t=this.data;if(!p(e,t))return!1;for(var n=[];t;){for(var r=0;r<t.children.length;r++){var i=t.children[r],a=t.leaf?this.toBBox(i):i;if(p(e,a)){if(t.leaf||f(e,a))return!0;n.push(i)}}t=n.pop()}return!1},r.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var n=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},r.prototype.clear=function(){return this.data=m([]),this},r.prototype.remove=function(e,t){if(!e)return this;for(var n,r,a,o=this.data,s=this.toBBox(e),c=[],l=[];o||c.length;){if(o||(o=c.pop(),r=c[c.length-1],n=l.pop(),a=!0),o.leaf){var u=i(e,o.children,t);if(u!==-1)return o.children.splice(u,1),c.push(o),this._condense(c),this}a||o.leaf||!f(o,s)?r?(n++,o=r.children[n],a=!1):o=null:(c.push(o),l.push(n),n=0,r=o,o=o.children[0])}return this},r.prototype.toBBox=function(e){return e},r.prototype.compareMinX=function(e,t){return e.minX-t.minX},r.prototype.compareMinY=function(e,t){return e.minY-t.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(e){return this.data=e,this},r.prototype._all=function(e,t){for(var n=[];e;)e.leaf?t.push.apply(t,e.children):n.push.apply(n,e.children),e=n.pop();return t},r.prototype._build=function(e,t,n,r){var i,o=n-t+1,s=this._maxEntries;if(o<=s)return a(i=m(e.slice(t,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/s**(r-1))),(i=m([])).leaf=!1,i.height=r;var c=Math.ceil(o/s),l=c*Math.ceil(Math.sqrt(s));h(e,t,n,l,this.compareMinX);for(var u=t;u<=n;u+=l){var d=Math.min(u+l-1,n);h(e,u,d,c,this.compareMinY);for(var f=u;f<=d;f+=c){var p=Math.min(f+c-1,d);i.children.push(this._build(e,f,p,r-1))}}return a(i,this.toBBox),i},r.prototype._chooseSubtree=function(e,t,n,r){for(;r.push(t),!t.leaf&&r.length-1!==n;){for(var i=1/0,a=1/0,o=void 0,s=0;s<t.children.length;s++){var c=t.children[s],l=u(c),d=(f=e,p=c,(Math.max(p.maxX,f.maxX)-Math.min(p.minX,f.minX))*(Math.max(p.maxY,f.maxY)-Math.min(p.minY,f.minY))-l);d<a?(a=d,i=l<i?l:i,o=c):d===a&&l<i&&(i=l,o=c)}t=o||t.children[0]}var f,p;return t},r.prototype._insert=function(e,t,n){var r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),s(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)},r.prototype._split=function(e,t){var n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=m(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(n,s)},r.prototype._splitRoot=function(e,t){this.data=m([e,t]),this.data.height=e.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(e,t,n){for(var r,i,a,s,c,l,d,f=1/0,p=1/0,m=t;m<=n-t;m++){var h=o(e,0,m,this.toBBox),g=o(e,m,n,this.toBBox),_=(i=h,a=g,s=void 0,c=void 0,l=void 0,d=void 0,s=Math.max(i.minX,a.minX),c=Math.max(i.minY,a.minY),l=Math.min(i.maxX,a.maxX),d=Math.min(i.maxY,a.maxY),Math.max(0,l-s)*Math.max(0,d-c)),v=u(h)+u(g);_<f?(f=_,r=m,p=v<p?v:p):_===f&&v<p&&(p=v,r=m)}return r||n-t},r.prototype._chooseSplitAxis=function(e,t,n){var r=e.leaf?this.compareMinX:c,i=e.leaf?this.compareMinY:l;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)},r.prototype._allDistMargin=function(e,t,n,r){e.children.sort(r);for(var i=this.toBBox,a=o(e,0,t,i),c=o(e,n-t,n,i),l=d(a)+d(c),u=t;u<n-t;u++){var f=e.children[u];s(a,e.leaf?i(f):f),l+=d(a)}for(var p=n-t-1;p>=t;p--){var m=e.children[p];s(c,e.leaf?i(m):m),l+=d(c)}return l},r.prototype._adjustParentBBoxes=function(e,t,n){for(var r=n;r>=0;r--)s(t[r],e)},r.prototype._condense=function(e){for(var t=e.length-1,n=void 0;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children).splice(n.indexOf(e[t]),1):this.clear():a(e[t],this.toBBox)},r})}))(),1);function Bt(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&e.length===4)t=e;else if(Array.isArray(e)&&e.length===6)t=[e[0],e[1],e[3],e[4]];else if(e.type===`Feature`)t=B(e);else if(e.type===`FeatureCollection`)t=B(e);else throw Error(`invalid geojson`);return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}}var Vt=class{constructor(e=9){this.tree=new zt.default(e),this.tree.toBBox=Bt}insert(e){if(e.type!==`Feature`)throw Error(`invalid feature`);return e.bbox=e.bbox?e.bbox:B(e),this.tree.insert(e),this}load(e){var t=[];return Array.isArray(e)?e.forEach(function(e){if(e.type!==`Feature`)throw Error(`invalid features`);e.bbox=e.bbox?e.bbox:B(e),t.push(e)}):D(e,function(e){if(e.type!==`Feature`)throw Error(`invalid features`);e.bbox=e.bbox?e.bbox:B(e),t.push(e)}),this.tree.load(t),this}remove(e,t){if(e.type!==`Feature`)throw Error(`invalid feature`);return e.bbox=e.bbox?e.bbox:B(e),this.tree.remove(e,t),this}clear(){return this.tree.clear(),this}search(e){return v(this.tree.search(Bt(e)))}collides(e){return this.tree.collides(Bt(e))}all(){return v(this.tree.all())}toJSON(){return this.tree.toJSON()}fromJSON(e){return this.tree.fromJSON(e),this}};function Ht(e){return new Vt(e)}function Ut(e,t){if(t??={},!T(t))throw Error(`options is invalid`);var n=t.precision,r=t.coordinates,i=t.mutate;if(n=n==null||isNaN(n)?6:n,r=r==null||isNaN(r)?3:r,!e)throw Error(`<geojson> is required`);if(typeof n!=`number`)throw Error(`<precision> must be a number`);if(typeof r!=`number`)throw Error(`<coordinates> must be a number`);(i===!1||i===void 0)&&(e=JSON.parse(JSON.stringify(e)));var a=10**n;return E(e,function(e){Wt(e,a,r)}),e}function Wt(e,t,n){e.length>n&&e.splice(n,e.length);for(var r=0;r<e.length;r++)e[r]=Math.round(e[r]*t)/t;return e}function Gt(e){if(!e)throw Error(`geojson is required`);let t=[];return ee(e,e=>{Kt(e,t)}),v(t)}function Kt(e,t){let n=[],r=e.geometry;if(r!==null){switch(r.type){case`Polygon`:n=P(r);break;case`LineString`:n=[P(r)]}n.forEach(n=>{qt(n,e.properties).forEach(e=>{e.id=t.length,t.push(e)})})}}function qt(e,t){let n=[];return e.reduce((e,r)=>{let i=_([e,r],t);return i.bbox=Jt(e,r),n.push(i),r}),n}function Jt(e,t){let n=e[0],r=e[1],i=t[0],a=t[1];return[n<i?n:i,r<a?r:a,n>i?n:i,r>a?r:a]}var Yt=class{constructor(e=[],t=Xt){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=(e<<1)+1,a=t[r],o=r+1;if(o<this.length&&n(t[o],a)<0&&(r=o,a=t[o]),n(a,i)>=0)break;t[e]=a,e=r}t[e]=i}};function Xt(e,t){return e<t?-1:e>t?1:0}function Zt(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y===t.p.y||e.p.y>t.p.y?1:-1}function Qt(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y===t.rightSweepEvent.p.y||e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1}var $t=class{constructor(e,t,n,r){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=n,this.eventId=r,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}};function en(e,t){if(e.type===`FeatureCollection`){let n=e.features;for(let e=0;e<n.length;e++)an(n[e],t)}else an(e,t)}var tn=0,nn=0,rn=0;function an(e,t){let n=e.type===`Feature`?e.geometry:e,r=n.coordinates;(n.type===`Polygon`||n.type===`MultiLineString`)&&(r=[r]),n.type===`LineString`&&(r=[[r]]);for(let e=0;e<r.length;e++)for(let n=0;n<r[e].length;n++){let i=r[e][n][0],a=null;nn+=1;for(let o=0;o<r[e][n].length-1;o++){a=r[e][n][o+1];let s=new $t(i,tn,nn,rn),c=new $t(a,tn,nn,rn+1);s.otherEvent=c,c.otherEvent=s,Zt(s,c)>0?(c.isLeftEndpoint=!0,s.isLeftEndpoint=!1):(s.isLeftEndpoint=!0,c.isLeftEndpoint=!1),t.push(s),t.push(c),i=a,rn+=1}}tn+=1}var on=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function sn(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;let n=e.leftSweepEvent.p.x,r=e.leftSweepEvent.p.y,i=e.rightSweepEvent.p.x,a=e.rightSweepEvent.p.y,o=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,c=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,u=(l-s)*(i-n)-(c-o)*(a-r),d=(c-o)*(r-s)-(l-s)*(n-o),f=(i-n)*(r-s)-(a-r)*(n-o);if(u===0)return!1;let p=d/u,m=f/u;return p>=0&&p<=1&&m>=0&&m<=1?[n+p*(i-n),r+p*(a-r)]:!1}function cn(e,t){t||=!1;let n=[],r=new Yt([],Qt);for(;e.length;){let i=e.pop();if(i.isLeftEndpoint){let e=new on(i);for(let a=0;a<r.data.length;a++){let o=r.data[a];if(t&&o.leftSweepEvent.featureId===i.featureId)continue;let s=sn(e,o);s!==!1&&n.push(s)}r.push(e)}else i.isLeftEndpoint===!1&&r.pop()}return n}function ln(e,t){let n=new Yt([],Zt);return en(e,n),cn(n,t)}var un=ln;function dn(e,t,n={}){let{removeDuplicates:r=!0,ignoreSelfIntersections:i=!0}=n,a=[];e.type===`FeatureCollection`?a=a.concat(e.features):e.type===`Feature`?a.push(e):(e.type===`LineString`||e.type===`Polygon`||e.type===`MultiLineString`||e.type===`MultiPolygon`)&&a.push(m(e)),t.type===`FeatureCollection`?a=a.concat(t.features):t.type===`Feature`?a.push(t):(t.type===`LineString`||t.type===`Polygon`||t.type===`MultiLineString`||t.type===`MultiPolygon`)&&a.push(m(t));let o=un(v(a),i),s=[];if(r){let e={};o.forEach(t=>{let n=t.join(`,`);e[n]||(e[n]=!0,s.push(t))})}else s=o;return v(s.map(e=>h(e)))}function fn(e,t,n={}){var r=N(e),i=N(t),a=C(i[1]-r[1]),o=C(i[0]-r[0]),s=C(r[1]),c=C(i[1]),l=Math.sin(a/2)**2+Math.sin(o/2)**2*Math.cos(s)*Math.cos(c);return x(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}var pn=Object.defineProperty,mn=Object.defineProperties,hn=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,_n=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,yn=(e,t,n)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bn=(e,t)=>{for(var n in t||={})_n.call(t,n)&&yn(e,n,t[n]);if(gn)for(var n of gn(t))vn.call(t,n)&&yn(e,n,t[n]);return e},xn=(e,t)=>mn(e,hn(t));function Sn(e,t,n={}){if(!e||!t)throw Error(`lines and inputPoint are required arguments`);let r=N(t),i=h([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),a=0,o=0,s=-1;return ee(e,function(e,c,l){s!==l&&(s=l,o=0);let u=P(e);for(let e=0;e<u.length-1;e++){let s=h(u[e]),c=N(s),d=h(u[e+1]),f=N(d),p=fn(s,d,n),m,g;f[0]===r[0]&&f[1]===r[1]?[m,g]=[f,!0]:c[0]===r[0]&&c[1]===r[1]?[m,g]=[c,!1]:[m,g]=Dn(c,f,r);let _=fn(t,m,n);if(_<i.properties.pointDistance){let t=fn(s,m,n);i=h(m,{lineStringIndex:l,segmentIndex:g?e+1:e,totalDistance:a+t,lineDistance:o+t,segmentDistance:t,pointDistance:_,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),i.properties=xn(bn({},i.properties),{multiFeatureIndex:i.properties.lineStringIndex,index:i.properties.segmentIndex,location:i.properties.totalDistance,dist:i.properties.pointDistance})}a+=p,o+=p}}),i}function Q(e,t){let[n,r,i]=e,[a,o,s]=t;return n*a+r*o+i*s}function $(e,t){let[n,r,i]=e,[a,o,s]=t;return[r*s-i*o,i*a-n*s,n*o-r*a]}function Cn(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2)}function wn(e){let t=Cn(e);return[e[0]/t,e[1]/t,e[2]/t]}function Tn(e){let t=C(e[1]),n=C(e[0]);return[Math.cos(t)*Math.cos(n),Math.cos(t)*Math.sin(n),Math.sin(t)]}function En(e){let[t,n,r]=e,i=Math.min(Math.max(r,-1),1),a=S(Math.asin(i));return[S(Math.atan2(n,t)),a]}function Dn(e,t,n){let r=Tn(e),i=Tn(t),a=Tn(n),o=$(r,i);if(o[0]===0&&o[1]===0&&o[2]===0)return Q(r,i)>0?[[...t],!0]:[[...n],!1];let s=$(o,a);if(s[0]===0&&s[1]===0&&s[2]===0)return[[...t],!0];let c=wn($(s,o)),l=[-c[0],-c[1],-c[2]],u=Q(a,c)>Q(a,l)?c:l,d=wn(o),f=Q($(r,u),d),p=Q($(u,i),d);return f>=0&&p>=0?[En(u),!1]:Q(r,a)>Q(i,a)?[[...e],!1]:[[...t],!0]}function On(e,t){if(!e)throw Error(`line is required`);if(!t)throw Error(`splitter is required`);let n=me(e),r=me(t);if(n!==`LineString`)throw Error(`line must be LineString`);if(r===`FeatureCollection`)throw Error(`splitter cannot be a FeatureCollection`);if(r===`GeometryCollection`)throw Error(`splitter cannot be a GeometryCollection`);var i=Ut(t,{precision:7});switch(e.type!==`Feature`&&(e=m(e)),r){case`Point`:return An(e,i);case`MultiPoint`:return kn(e,i);case`LineString`:case`MultiLineString`:case`Polygon`:case`MultiPolygon`:return kn(e,dn(e,i,{ignoreSelfIntersections:!0}))}}function kn(e,t){var n=[],r=Ht();return ee(t,function(t){if(n.forEach(function(e,t){e.id=t}),!n.length)n=An(e,t).features,r.load(v(n));else{var i=r.search(t);if(i.features.length){var a=jn(t,i);n=n.filter(function(e){return e.id!==a.id}),r.remove(a),D(An(a,t),function(e){n.push(e),r.insert(e)})}}}),v(n)}function An(e,t){var n=[],r=P(e)[0],i=P(e)[e.geometry.coordinates.length-1];if(Mn(r,N(t))||Mn(i,N(t)))return v([e]);var a=Ht(),o=Gt(e);a.load(o);var s=a.search(t);if(!s.features.length)return v([e]);var c=jn(t,s),l=O(o,function(e,r,i){var a=P(r)[1],o=N(t);return i===c.id?(e.push(o),n.push(_(e)),Mn(o,a)?[o]:[o,a]):(e.push(a),e)},[r]);return l.length>1&&n.push(_(l)),v(n)}function jn(e,t){if(!t.features.length)throw Error(`lines must contain features`);if(t.features.length===1)return t.features[0];var n,r=1/0;return D(t,function(t){var i=Sn(t,e).properties.dist;i<r&&(n=t,r=i)}),n}function Mn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Nn(e,t){let n=F(e),r=F(t),i=n.type,a=r.type,o=n.coordinates,s=r.coordinates;switch(i){case`Point`:switch(a){case`Point`:return Gn(o,s);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPoint`:switch(a){case`Point`:return In(n,r);case`MultiPoint`:return Ln(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`LineString`:switch(a){case`Point`:return I(r,n,{ignoreEndVertices:!0});case`LineString`:return Bn(n,r);case`MultiPoint`:return Rn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`Polygon`:switch(a){case`Point`:return Z(r,n,{ignoreBoundary:!0});case`LineString`:return Hn(n,r);case`Polygon`:return Un(n,r);case`MultiPoint`:return zn(n,r);case`MultiPolygon`:return Fn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPolygon`:switch(a){case`Polygon`:return Pn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}default:throw Error(`feature1 `+i+` geometry not supported`)}}function Pn(e,t){return e.coordinates.some(e=>Un({type:`Polygon`,coordinates:e},t))}function Fn(e,t){return t.coordinates.every(t=>Un(e,{type:`Polygon`,coordinates:t}))}function In(e,t){let n,r=!1;for(n=0;n<e.coordinates.length;n++)if(Gn(e.coordinates[n],t.coordinates)){r=!0;break}return r}function Ln(e,t){for(let n of t.coordinates){let t=!1;for(let r of e.coordinates)if(Gn(n,r)){t=!0;break}if(!t)return!1}return!0}function Rn(e,t){let n=!1;for(let r of t.coordinates)if(I(r,e,{ignoreEndVertices:!0})&&(n=!0),!I(r,e))return!1;return!!n}function zn(e,t){for(let n of t.coordinates)if(!Z(n,e,{ignoreBoundary:!0}))return!1;return!0}function Bn(e,t){let n=!1;for(let r of t.coordinates)if(I({type:`Point`,coordinates:r},e,{ignoreEndVertices:!0})&&(n=!0),!I({type:`Point`,coordinates:r},e,{ignoreEndVertices:!1}))return!1;return n}function Vn(e,t){let n=e.coordinates,r=[];for(let e=0;e<n.length-1;e++){let i=_([n[e],n[e+1]]),a=On(i,m(t));a.features.length===0?r.push(i):r.push(...a.features)}return v(r)}function Hn(e,t){if(!Wn(B(e),B(t)))return!1;for(let n of t.coordinates)if(!Z(n,e))return!1;let n=!1,r=Vn(t,e);for(let t of r.features){let r=Kn(t.geometry.coordinates[0],t.geometry.coordinates[1]);if(!Z(r,e))return!1;!n&&Z(r,e,{ignoreBoundary:!0})&&(n=!0)}return n}function Un(e,t){if(e.type===`Feature`&&e.geometry===null||t.type===`Feature`&&t.geometry===null||!Wn(B(e),B(t)))return!1;let n=F(t).coordinates;for(let t of n)for(let n of t)if(!Z(n,e))return!1;return!0}function Wn(e,t){return!(e[0]>t[0]||e[2]<t[2]||e[1]>t[1]||e[3]<t[3])}function Gn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Kn(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var qn=Nn;function Jn(e){return wt(B(e))}var Yn=Jn;function Xn(e){return e.geometry&&(e.geometry.type===`LineString`||e.geometry.type===`MultiLineString`||e.geometry.type===`Polygon`||e.geometry.type===`MultiPolygon`)}function Zn(e,t){let n=e.map(e=>e.geometry?e.geometry.type===`Point`||e.geometry.type===`MultiPoint`?qn(Tt(t),e)?e:null:Xn(e)?Ct(e,t):null:null).filter(e=>e!==null);return n.length===0?null:Yn(v(n))}var Qn=.001,$n=1e-4;function er(e,t){return[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function tr(e){return er(e,Qn)}function nr(e){return er(e,$n)}var rr=[`id`],ir=z((0,t.defineComponent)({__name:`VMap`,props:{id:{},features:{},bbox:{}},setup(e){let r=e,i=(0,t.inject)(Ee,ht),a={top:60,left:60,right:60,bottom:80},o=(0,t.shallowRef)(),s=(0,t.shallowRef)(!1),c=(0,t.shallowRef)(),l=(0,t.shallowRef)(),u;(0,t.watch)(s,e=>{e?d():(o.value&&o.value.remove(),o.value=void 0)}),(0,t.watch)(()=>r.features,e=>{o.value&&s.value&&e&&(o.value.remove(),o.value=void 0,d())});function d(){if(!o.value){u=r.bbox?tr(r.bbox):void 0;let e=u?Zn(r.features,u):v(r.features);if(e){let t=nr(Ke(e)),s=[[t[0],t[1]],[t[2],t[3]]];o.value=new n.default.Map({hash:!1,container:`map-${r.id}`,bounds:s,fitBoundsOptions:{padding:a,animate:!1,maxZoom:17},style:i,cooperativeGestures:!0,attributionControl:!1}),o.value.addControl(new n.default.FullscreenControl),o.value.on(`load`,p)}}}function f(e){if(!o.value)throw Error(`Call initMap() function first.`);o.value.addSource(_t,{type:`geojson`,data:{type:`Feature`,geometry:{type:`Polygon`,coordinates:[[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]],[e[0],e[1]]]]},properties:{}}}),o.value.addLayer(W.Bbox)}function p(){if(!o.value)throw Error(`Call initMap() function first.`);u&&f(u),o.value.addSource(U,{type:`geojson`,data:{type:`FeatureCollection`,features:r.features}}),m(),y()}function m(){if(!o.value)throw Error(`Call initMap() function first.`);o.value.getLayer(W.Polygon.id)||o.value.addLayer(W.Polygon),o.value.getLayer(W.PolygonBorder.id)||o.value.addLayer(W.PolygonBorder),o.value.getLayer(W.LineStringBorder.id)||o.value.addLayer(W.LineStringBorder),o.value.getLayer(W.LineString.id)||o.value.addLayer(W.LineString),o.value.getLayer(W.Point.id)||o.value.addLayer(W.Point)}function h(e){!e.features||e.features.length===0||(l.value!==void 0&&x(),l.value=e.features[0],b(e.lngLat,e.features[0]))}function g(){o.value.getCanvas().style.cursor=`pointer`}function _(){o.value.getCanvas().style.cursor=``,l.value!==void 0&&(l.value=void 0),x()}function y(){if(!o.value)throw Error(`Call initMap() function first.`);Object.values(W).forEach(e=>{e.id!==`bbox-layer`&&(o.value.on(`mousemove`,e.id,h),o.value.on(`mouseenter`,e.id,g),o.value.on(`mouseleave`,e.id,_))})}function b(e,t){if(!o.value)throw Error(`Call initMap() function first.`);c.value=new n.default.Popup().setLngLat(e).setHTML(`${De[t.properties.objtype]}-${t.properties.id}-v${t.properties.version}`).addTo(o.value)}function x(){c.value?.remove(),c.value=void 0}function S([e]){s.value=e?.isIntersecting||!1}return(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{id:`map-${e.id}`,class:`v-map`},null,8,rr)),[[(0,t.unref)(pt),S]])}}),[[`__scopeId`,`data-v-e1815a55`]]),ar=[`id`],or={class:`group-header`},sr={class:`header-start`},cr=[`href`],lr=[`title`],ur={class:`header-center`},dr={key:0,class:`header-end`},fr={class:`group-content`},pr={key:0,class:`content-start`},mr={class:`before-list`},hr={class:`after-list`},gr=z((0,t.defineComponent)({__name:`LoChaGroup`,props:{id:{},index:{},features:{},josmTarget:{}},emits:[`navigate`],setup(e){(0,t.useCssVars)(e=>({v67f2bcc7:i.value}));let n=e,r=(0,t.useSlots)(),i=(0,t.computed)(()=>r[`content-start`]?`repeat(4, minmax(0, 1fr))`:`repeat(3, minmax(0, 1fr))`),a=(0,t.inject)(Te),{loCha:o,getBeforeFeatures:s,getAfterFeatures:c}=(0,t.inject)(we);if(!o.value)throw Error(`LoCha is empty.`);let l=(0,t.computed)(()=>{let e=[...new Set(s(n.features).map(e=>e.properties.tags?.name).filter(Boolean))],t=[...new Set(c(n.features).map(e=>e.properties.tags?.name).filter(Boolean))],r=e.length>0?e.join(`, `):`(unnamed)`,i=t.length>0?t.join(`, `):`(unnamed)`;return r===i?r:`${r} → ${i}`});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{id:e.id,class:`locha-group`},[(0,t.createElementVNode)(`div`,or,[(0,t.createElementVNode)(`div`,sr,[(0,t.createElementVNode)(`a`,{class:`anchor-button`,href:`#${e.id}`,onClick:i[0]||=(0,t.withModifiers)(t=>r.$emit(`navigate`,`#${e.id}`),[`prevent`])},`🔗`,8,cr),(0,t.createElementVNode)(`h3`,{class:`group-name`,title:l.value},(0,t.toDisplayString)(l.value),9,lr)]),(0,t.createElementVNode)(`div`,ur,[(0,t.renderSlot)(r.$slots,`header-center`,{index:e.index},void 0,!0)]),r.$slots[`header-end`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,dr,[(0,t.renderSlot)(r.$slots,`header-end`,{index:e.index},void 0,!0)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,fr,[r.$slots[`content-start`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pr,[(0,t.renderSlot)(r.$slots,`content-start`,{index:e.index},void 0,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,mr,[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(s)(e.features),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n.id},[(0,t.createVNode)(Ge,{feature:n,"josm-target":e.josmTarget},(0,t.createSlots)({_:2},[r.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`object-detail`,{feature:n,index:e.index},void 0,!0)]),key:`0`}:void 0]),1032,[`feature`,`josm-target`])]))),128))])]),(0,t.createElementVNode)(`div`,hr,[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(c)(e.features),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n.id},[(0,t.createVNode)(Ge,{feature:n,"josm-target":e.josmTarget},(0,t.createSlots)({_:2},[r.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`object-detail`,{feature:n,index:e.index},void 0,!0)]),key:`0`}:void 0]),1032,[`feature`,`josm-target`])]))),128))])]),(0,t.createVNode)(ir,{id:`${(0,t.unref)(a)}-${n.index}`,features:e.features,bbox:(0,t.unref)(o)?.bbox},null,8,[`id`,`features`,`bbox`])])],8,ar))}}),[[`__scopeId`,`data-v-5b721cff`]]);function _r(e,t={}){let{container:n=document,behavior:r=`smooth`,block:i=`start`,inline:a=`nearest`}=t,o=e.startsWith(`#`)?e.slice(1):e,s=n.querySelector(`#${CSS.escape(o)}`);return s?(s.scrollIntoView({behavior:r,block:i,inline:a}),!0):!1}var vr=[`name`],yr=z((0,t.defineComponent)({__name:`LoChaGroupList`,props:{hash:{}},setup(e){(0,t.useCssVars)(e=>({bf57d7a0:(0,t.unref)(a)}));let n=e,{groups:r}=(0,t.inject)(we),i=(0,t.inject)(Te),a=L.delete,o=(0,t.ref)(),s=(0,t.useTemplateRef)(`listRef`);function c(e){return`locha-${i}-group-${e}`}function l(){return`hidden_josm_target_${i}`}function u(e){o.value=e,history.replaceState(null,``,e),(0,t.nextTick)(()=>_r(e,{container:s.value??void 0}))}return(0,t.watch)(()=>n.hash,e=>{o.value=e,e&&(0,t.nextTick)(()=>_r(e,{container:s.value??void 0}))},{immediate:!0}),(0,t.onMounted)(()=>{let e=window.location.hash;e&&!n.hash&&u(e)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`listRef`,ref:s,class:`locha-group-list`},[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(r),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:r,class:(0,t.normalizeClass)({selected:o.value===`#${c(r)}`})},[(0,t.createVNode)(gr,{id:c(r),features:n,index:r,"josm-target":l(),onNavigate:u},(0,t.createSlots)({_:2},[e.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`object-detail`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`0`}:void 0,e.$slots[`header-center`]?{name:`header-center`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`header-center`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`1`}:void 0,e.$slots[`header-end`]?{name:`header-end`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`header-end`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`2`}:void 0,e.$slots[`content-start`]?{name:`content-start`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`content-start`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`3`}:void 0]),1032,[`id`,`features`,`index`,`josm-target`])],2))),128))]),(0,t.createElementVNode)(`iframe`,{name:l(),style:{display:`none`}},null,8,vr)],512))}}),[[`__scopeId`,`data-v-d3c72fff`]]),br={class:`locha`},xr={key:0,class:`user-feedback`};e.LoCha=z((0,t.defineComponent)({__name:`LoCha`,props:{id:{},data:{},mapStyleUrl:{default:ht},reasonCollapsed:{type:Boolean,default:!0},hash:{}},setup(e){let n=e;(0,t.provide)(Ce,n.reasonCollapsed),(0,t.provide)(Te,n.id),(0,t.provide)(Ee,n.mapStyleUrl);let r=Se();(0,t.provide)(we,r);let{featureCount:i,setLoCha:a}=r;return(0,t.watch)(()=>n.data,e=>{e&&a(e)},{immediate:!0}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,br,[(0,t.unref)(i)?((0,t.openBlock)(),(0,t.createBlock)(yr,{key:1,hash:e.hash},(0,t.createSlots)({_:2},[n.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`object-detail`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`0`}:void 0,n.$slots[`header-center`]?{name:`header-center`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`header-center`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`1`}:void 0,n.$slots[`header-end`]?{name:`header-end`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`header-end`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`2`}:void 0,n.$slots[`content-start`]?{name:`content-start`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`content-start`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`3`}:void 0]),1032,[`hash`])):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,xr,` ⚠️ No data `))]))}}),[[`__scopeId`,`data-v-34eb8402`]]),e.scrollToSection=_r});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`maplibre-gl`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`maplibre-gl`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.OSMLoChaComponent={},e.Vue,e.maplibregl))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n);var f=6371008.8,p={centimeters:f*100,centimetres:f*100,degrees:360/(2*Math.PI),feet:f*3.28084,inches:f*39.37,kilometers:f/1e3,kilometres:f/1e3,meters:f,metres:f,miles:f/1609.344,millimeters:f*1e3,millimetres:f*1e3,nauticalmiles:f/1852,radians:1,yards:f*1.0936};function m(e,t,n={}){let r={type:`Feature`};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function h(e,t,n={}){if(!e)throw Error(`coordinates is required`);if(!Array.isArray(e))throw Error(`coordinates must be an Array`);if(e.length<2)throw Error(`coordinates must be at least 2 numbers long`);if(!w(e[0])||!w(e[1]))throw Error(`coordinates must contain numbers`);return m({type:`Point`,coordinates:e},t,n)}function g(e,t,n={}){for(let t of e){if(t.length<4)throw Error(`Each LinearRing of a Polygon must have 4 or more Positions.`);if(t[t.length-1].length!==t[0].length)throw Error(`First and last Position are not equivalent.`);for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error(`First and last Position are not equivalent.`)}return m({type:`Polygon`,coordinates:e},t,n)}function _(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return m({type:`LineString`,coordinates:e},t,n)}function v(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function y(e,t,n={}){return m({type:`MultiLineString`,coordinates:e},t,n)}function b(e,t,n={}){return m({type:`MultiPolygon`,coordinates:e},t,n)}function x(e,t=`kilometers`){let n=p[t];if(!n)throw Error(t+` units is invalid`);return e*n}function S(e){return e%(2*Math.PI)*180/Math.PI}function C(e){return e%360*Math.PI/180}function w(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function T(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function E(e,t,n){if(e!==null)for(var r,i,a,o,s,c,l,u=0,d=0,f,p=e.type,m=p===`FeatureCollection`,h=p===`Feature`,g=m?e.features.length:1,_=0;_<g;_++){l=m?e.features[_].geometry:h?e.geometry:e,f=l?l.type===`GeometryCollection`:!1,s=f?l.geometries.length:1;for(var v=0;v<s;v++){var y=0,b=0;if(o=f?l.geometries[v]:l,o!==null){c=o.coordinates;var x=o.type;switch(u=n&&(x===`Polygon`||x===`MultiPolygon`)?1:0,x){case null:break;case`Point`:if(t(c,d,_,y,b)===!1)return!1;d++,y++;break;case`LineString`:case`MultiPoint`:for(r=0;r<c.length;r++){if(t(c[r],d,_,y,b)===!1)return!1;d++,x===`MultiPoint`&&y++}x===`LineString`&&y++;break;case`Polygon`:case`MultiLineString`:for(r=0;r<c.length;r++){for(i=0;i<c[r].length-u;i++){if(t(c[r][i],d,_,y,b)===!1)return!1;d++}x===`MultiLineString`&&y++,x===`Polygon`&&b++}x===`Polygon`&&y++;break;case`MultiPolygon`:for(r=0;r<c.length;r++){for(b=0,i=0;i<c[r].length;i++){for(a=0;a<c[r][i].length-u;a++){if(t(c[r][i][a],d,_,y,b)===!1)return!1;d++}b++}y++}break;case`GeometryCollection`:for(r=0;r<o.geometries.length;r++)if(E(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function D(e,t){if(e.type===`Feature`)t(e,0);else if(e.type===`FeatureCollection`)for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function O(e,t,n){var r=n;return D(e,function(e,i){r=i===0&&n===void 0?e:t(r,e,i)}),r}function k(e,t){var n,r,i,a,o,s,c,l,u,d,f=0,p=e.type===`FeatureCollection`,m=e.type===`Feature`,h=p?e.features.length:1;for(n=0;n<h;n++){for(s=p?e.features[n].geometry:m?e.geometry:e,l=p?e.features[n].properties:m?e.properties:{},u=p?e.features[n].bbox:m?e.bbox:void 0,d=p?e.features[n].id:m?e.id:void 0,c=s?s.type===`GeometryCollection`:!1,o=c?s.geometries.length:1,i=0;i<o;i++){if(a=c?s.geometries[i]:s,a===null){if(t(null,f,l,u,d)===!1)return!1;continue}switch(a.type){case`Point`:case`LineString`:case`MultiPoint`:case`Polygon`:case`MultiLineString`:case`MultiPolygon`:if(t(a,f,l,u,d)===!1)return!1;break;case`GeometryCollection`:for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],f,l,u,d)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}f++}}function A(e,t,n){var r=n;return k(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function ee(e,t){k(e,function(e,n,r,i,a){var o=e===null?null:e.type;switch(o){case null:case`Point`:case`LineString`:case`Polygon`:return t(m(e,r,{bbox:i,id:a}),n,0)===!1?!1:void 0}var s;switch(o){case`MultiPoint`:s=`Point`;break;case`MultiLineString`:s=`LineString`;break;case`MultiPolygon`:s=`Polygon`;break}for(var c=0;c<e.coordinates.length;c++){var l=e.coordinates[c];if(t(m({type:s,coordinates:l},r),n,c)===!1)return!1}})}function te(e){return A(e,(e,t)=>e+ne(t),0)}function ne(e){let t=0,n;switch(e.type){case`Polygon`:return re(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=re(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function re(e){let t=0;if(e&&e.length>0){t+=Math.abs(oe(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(oe(e[n]))}return t}var ie=f*f/2,ae=Math.PI/180;function oe(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*ae,c=a[1]*ae,l=o[0]*ae;n+=(l-s)*Math.sin(c),r++}return n*ie}var se=Object.defineProperty,j=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=class{constructor(e){this.direction=!1,this.compareProperties=!0,this.precision=10**-(e?.precision??17),this.direction=e?.direction??!1,this.compareProperties=e?.compareProperties??!0}compare(e,t){if(e.type!==t.type||!M(e,t))return!1;switch(e.type){case`Point`:return this.compareCoord(e.coordinates,t.coordinates);case`LineString`:return this.compareLine(e.coordinates,t.coordinates);case`Polygon`:return this.comparePolygon(e,t);case`GeometryCollection`:return this.compareGeometryCollection(e,t);case`Feature`:return this.compareFeature(e,t);case`FeatureCollection`:return this.compareFeatureCollection(e,t);default:if(e.type.startsWith(`Multi`)){let n=ue(e),r=ue(t);return n.every(e=>r.some(t=>this.compare(e,t)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<this.precision)}compareLine(e,t,n=0,r=!1){if(!M(e,t))return!1;let i=e,a=t;if(r&&!this.compareCoord(i[0],a[0])){let e=this.fixStartIndex(a,i);if(e)a=e;else return!1}let o=this.compareCoord(i[n],a[n]);return this.direction||o?this.comparePath(i,a):this.compareCoord(i[n],a[a.length-(1+n)])?this.comparePath(i.slice().reverse(),a):!1}fixStartIndex(e,t){let n,r=-1;for(let n=0;n<e.length;n++)if(this.compareCoord(e[n],t[0])){r=n;break}return r>=0&&(n=[].concat(e.slice(r,e.length),e.slice(1,r+1))),n}comparePath(e,t){return e.every((e,n)=>this.compareCoord(e,t[n]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){let n=e.coordinates.slice(1,e.coordinates.length),r=t.coordinates.slice(1,t.coordinates.length);return n.every(e=>r.some(t=>this.compareLine(e,t,1,!0)))}return!1}compareGeometryCollection(e,t){return M(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((e,n)=>this.compare(e,t.geometries[n]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?fe(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return M(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((e,n)=>this.compare(e,t.features[n]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};j(ce,`GeojsonEquality`);var le=ce;function M(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}j(M,`sameLength`);function ue(e){return e.coordinates.map(t=>({type:e.type.replace(`Multi`,``),coordinates:t}))}j(ue,`explode`);function de(e,t,n){return new le(n).compare(e,t)}j(de,`geojsonEquality`);function fe(e,t){if(e===null&&t===null)return!0;if(e===null||t===null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i of n){let n=e[i],r=t[i],a=pe(n)&&pe(r);if(a&&!fe(n,r)||!a&&n!==r)return!1}return!0}j(fe,`equal`);var pe=j(e=>typeof e==`object`&&!!e,`isObject`);function N(e){if(!e)throw Error(`coord is required`);if(!Array.isArray(e)){if(e.type===`Feature`&&e.geometry!==null&&e.geometry.type===`Point`)return[...e.geometry.coordinates];if(e.type===`Point`)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error(`coord must be GeoJSON Point or an Array of numbers`)}function P(e){if(Array.isArray(e))return e;if(e.type===`Feature`){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw Error(`coords must be GeoJSON Feature, Geometry Object or an Array`)}function F(e){return e.type===`Feature`?e.geometry:e}function me(e,t){return e.type===`FeatureCollection`?`FeatureCollection`:e.type===`GeometryCollection`?`GeometryCollection`:e.type===`Feature`&&e.geometry!==null?e.geometry.type:e.type}function I(e,t,n={}){let r=N(e),i=P(t);for(let e=0;e<i.length-1;e++){let t=!1;if(n.ignoreEndVertices&&(e===0&&(t=`start`),e===i.length-2&&(t=`end`),e===0&&e+1===i.length-1&&(t=`both`)),he(i[e],i[e+1],r,t,n.epsilon===void 0?null:n.epsilon))return!0}return!1}function he(e,t,n,r,i){let a=n[0],o=n[1],s=e[0],c=e[1],l=t[0],u=t[1],d=n[0]-s,f=n[1]-c,p=l-s,m=u-c,h=d*m-f*p;if(i!==null){if(Math.abs(h)>i)return!1}else if(h!==0)return!1;return Math.abs(p)===Math.abs(m)&&Math.abs(p)===0?r?!1:n[0]===e[0]&&n[1]===e[1]:r?r===`start`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<=l:l<=a&&a<s:m>0?c<o&&o<=u:u<=o&&o<c:r===`end`?Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<l:l<a&&a<=s:m>0?c<=o&&o<u:u<o&&o<=c:r===`both`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<l:l<a&&a<s:m>0?c<o&&o<u:u<o&&o<c:!1:Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<=l:l<=a&&a<=s:m>0?c<=o&&o<=u:u<=o&&o<=c}function ge(e,t={}){var n=typeof t==`object`?t.mutate:t;if(!e)throw Error(`geojson is required`);var r=me(e),i=[];switch(r){case`LineString`:i=_e(e,r);break;case`MultiLineString`:case`Polygon`:P(e).forEach(function(e){i.push(_e(e,r))});break;case`MultiPolygon`:P(e).forEach(function(e){var t=[];e.forEach(function(e){t.push(_e(e,r))}),i.push(t)});break;case`Point`:return e;case`MultiPoint`:var a={};P(e).forEach(function(e){var t=e.join(`-`);Object.prototype.hasOwnProperty.call(a,t)||(i.push(e),a[t]=!0)});break;default:throw Error(r+` geometry not supported`)}return e.coordinates?n===!0?(e.coordinates=i,e):{type:r,coordinates:i}:n===!0?(e.geometry.coordinates=i,e):m({type:r,coordinates:i},e.properties,{bbox:e.bbox,id:e.id})}function _e(e,t){let n=P(e);if(n.length===2&&!ve(n[0],n[1]))return n;let r=[],i=0,a=1,o=2;for(r.push(n[i]);o<n.length;)I(n[a],_([n[i],n[o]]))?a=o:(r.push(n[a]),i=a,a++,o=a),o++;if(r.push(n[a]),t===`Polygon`||t===`MultiPolygon`){if(I(r[0],_([r[1],r[r.length-2]]))&&(r.shift(),r.pop(),r.push(r[0])),r.length<4)throw Error(`invalid polygon, fewer than 4 points`);if(!ve(r[0],r[r.length-1]))throw Error(`invalid polygon, first and last points not equal`)}return r}function ve(e,t){return e[0]===t[0]&&e[1]===t[1]}function ye(e,t,n={}){let r=n.precision;if(r=r==null||isNaN(r)?6:r,typeof r!=`number`||!(r>=0))throw Error(`precision must be a positive number`);return F(e).type===F(t).type?de(ge(e),ge(t),{precision:r}):!1}var be=ye;function xe(e){return e.features.map(t=>{if(t.id==null){console.warn(`Skipping feature with null id`);return}let n=e.metadata.links[t.properties.links];if(!n){console.warn(`Feature ${t.id} has no group, skipping.`);return}let r=n.find(e=>e.before===t.id||e.after===t.id);if(!r){console.warn(`Feature ${t.id} has no link, skipping.`);return}let i=e.features.find(e=>e.properties.links===t.properties.links&&e.id!==t.id);return i?.geometry&&t.geometry&&(t.properties.geom=!be(t.geometry,i.geometry)),t.id===r.before?{...t,properties:{...t.properties,is_before:!0}}:t.id===r.after&&!n.filter(e=>`before`in e).length?{...t,properties:{...t.properties,is_new:!0}}:t.id===r.after||r.before===void 0&&r.after!==void 0?{...t,properties:{...t.properties,is_after:!0}}:t}).filter(e=>e!==void 0).sort((e,t)=>{let n=e.geometry,r=t.geometry;return!n&&!r?0:n?r?te(t)-te(e):-1:1})}var L={new:`#52c41a`,delete:`#FF0000`,updateBefore:`#FFA479`,updateAfter:`#F2BE00`},Se=Object.fromEntries([`new`,`delete`,`updateAfter`,`updateBefore`].map(e=>[e,e]));function Ce(){let e=(0,t.ref)(),n=(0,t.ref)([]),r=(0,t.computed)(()=>e.value?.features.length);function i(e){return e.reduce((e,t)=>{let n=t.properties.links;return e[n]||(e[n]=[]),e[n].push(t),e},[])}function a(t){l();let r={...t,features:xe(t)};e.value=r,n.value=i(r.features)}function o(e){return e.filter(e=>e.properties.is_before)}function s(e){return e.filter(e=>e.properties.is_after||e.properties.is_new)}function c(e){return e.properties.is_new?Se.new:e.properties.deleted?Se.delete:e.properties.is_before?Se.updateBefore:Se.updateAfter}function l(){e.value=void 0,n.value=[]}return{featureCount:r,loCha:e,groups:n,setLoCha:a,getStatus:c,getBeforeFeatures:o,getAfterFeatures:s}}var we=Symbol(`reasonCollapsed`),Te=Symbol(`loCha`),Ee=Symbol(`loChaInstanceId`),De=Symbol(`mapStyleUrl`),Oe={n:`node`,w:`way`,r:`relation`};function ke(e,t){return`https://www.openstreetmap.org/${Oe[e]}/${t}/history`}function Ae(e){return`https://www.openstreetmap.org/user/${encodeURIComponent(e)}`}function je(e,t){return`http://127.0.0.1:8111/load_object?objects=${e}${t}`}function Me(e,t){return`https://osmlab.github.io/osm-deep-history/#/${Oe[e]}/${t}`}function Ne(e,t){return`https://pewu.github.io/osm-history/#/${Oe[e]}/${t}`}var Pe={class:`locha-object`},Fe={class:`wrap`},Ie=[`href`],Le={class:`fab`},Re={class:`fab-menu`},ze=[`href`],Be=[`href`,`target`],Ve=[`href`],He=[`href`],Ue={class:`date`},We=[`href`,`title`],Ge=(0,t.defineComponent)({__name:`LoChaObject`,props:{feature:{},josmTarget:{}},setup(e){(0,t.useCssVars)(e=>({v642a69b5:o.value,e2a6f984:(0,t.unref)(L).delete,v6c07cced:(0,t.unref)(L).new}));let n=e,{getStatus:r}=(0,t.inject)(Te),i=(0,t.computed)(()=>r(n.feature)),a=(0,t.computed)(()=>{switch(i.value){case`new`:return`new`;case`delete`:return`deleted`;default:return``}}),o=(0,t.computed)(()=>L[i.value]);return(r,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`article`,Pe,[(0,t.createElementVNode)(`header`,null,[(0,t.createElementVNode)(`div`,Fe,[(0,t.createElementVNode)(`a`,{href:(0,t.unref)(ke)(e.feature.properties.objtype,e.feature.properties.id),title:`OSM History`,target:`_blank`,onClick:o[0]||=(0,t.withModifiers)(()=>{},[`stop`])},(0,t.toDisplayString)(`${e.feature.properties.objtype}${e.feature.properties.id}-v${e.feature.properties.version}`),9,Ie),i.value===`new`||i.value===`delete`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`status-content`,{"object-new":i.value===`new`,"object-deleted":i.value===`delete`}])},(0,t.toDisplayString)(a.value),3)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Le,[o[6]||=(0,t.createElementVNode)(`button`,{class:`fab-toggle`,type:`button`,title:`Tools`},` 🔧 Tools `,-1),(0,t.createElementVNode)(`div`,Re,[(0,t.createElementVNode)(`a`,{href:(0,t.unref)(ke)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`Edit in OSM iD`,target:`_blank`,onClick:o[1]||=(0,t.withModifiers)(()=>{},[`stop`])},` OSM iD `,8,ze),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(je)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`Edit in JOSM`,target:e.josmTarget||`hidden_josm_target`,onClick:o[2]||=(0,t.withModifiers)(()=>{},[`stop`])},` JOSM `,8,Be),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Me)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`OSM Deep History`,target:`_blank`,onClick:o[3]||=(0,t.withModifiers)(()=>{},[`stop`])},` Deep H `,8,Ve),(0,t.createElementVNode)(`a`,{href:(0,t.unref)(Ne)(e.feature.properties.objtype,e.feature.properties.id),class:`action-btn`,title:`OSM History Viewer`,target:`_blank`,onClick:o[4]||=(0,t.withModifiers)(()=>{},[`stop`])},` OSM H `,8,He)])])]),(0,t.createElementVNode)(`p`,Ue,` 📅 `+(0,t.toDisplayString)(n.feature.properties.created),1),e.feature.properties.username?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{key:0,href:(0,t.unref)(Ae)(e.feature.properties.username),title:`View ${e.feature.properties.username} OSM profile`,target:`_blank`,onClick:o[5]||=(0,t.withModifiers)(()=>{},[`stop`])},` 👤`+(0,t.toDisplayString)(e.feature.properties.username),9,We)):(0,t.createCommentVNode)(``,!0)]),(0,t.renderSlot)(r.$slots,`object-detail`,{},void 0,!0)]))}}),R=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ke=R(Ge,[[`__scopeId`,`data-v-fac1b144`]]);function z(e,t={}){if(e.bbox!=null&&!0!==t.recompute)return e.bbox;let n=[1/0,1/0,-1/0,-1/0];return E(e,e=>{n[0]>e[0]&&(n[0]=e[0]),n[1]>e[1]&&(n[1]=e[1]),n[2]<e[0]&&(n[2]=e[0]),n[3]<e[1]&&(n[3]=e[1])}),n}var qe=z;function Je(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}var B=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Ye=e=>e!=null,Xe=Object.prototype.toString,Ze=e=>Xe.call(e)===`[object Object]`,V=()=>{},Qe=$e();function $e(){var e,t;return B&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function et(...e){if(e.length!==1)return(0,t.toRef)(...e);let n=e[0];return typeof n==`function`?(0,t.readonly)((0,t.customRef)(()=>({get:n,set:V}))):(0,t.ref)(n)}function H(e){return Array.isArray(e)?e:[e]}function tt(e,n,r){return(0,t.watch)(e,n,{...r,immediate:!0})}var nt=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function rt(e){let n=(0,t.toValue)(e);return n?.$el??n}function it(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,t.computed)(()=>{let n=H((0,t.toValue)(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return tt(()=>[r.value?.map(e=>rt(e))??[nt].filter(e=>e!=null),H((0,t.toValue)(r.value?e[1]:e[0])),H((0,t.unref)(r.value?e[2]:e[1])),(0,t.toValue)(r.value?e[3]:e[2])],([e,t,r,i],a,o)=>{if(!e?.length||!t?.length||!r?.length)return;let s=Ze(i)?{...i}:i,c=e.flatMap(e=>t.flatMap(t=>r.map(r=>n(e,t,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function at(){let e=(0,t.shallowRef)(!1),n=(0,t.getCurrentInstance)();return n&&(0,t.onMounted)(()=>{e.value=!0},n),e}function ot(e){let n=at();return(0,t.computed)(()=>(n.value,!!e()))}function st(e,n,r={}){let{root:i,rootMargin:a,threshold:o=0,window:s=nt,immediate:c=!0}=r,l=ot(()=>s&&`IntersectionObserver`in s),u=(0,t.computed)(()=>H((0,t.toValue)(e)).map(rt).filter(Ye)),d=V,f=(0,t.shallowRef)(c),p=l.value?(0,t.watch)(()=>[u.value,rt(i),(0,t.toValue)(a),f.value],([e,t,r])=>{if(d(),!f.value||!e.length)return;let i=new IntersectionObserver(n,{root:rt(t),rootMargin:r,threshold:o});e.forEach(e=>e&&i.observe(e)),d=()=>{i.disconnect(),d=V}},{immediate:c,flush:`post`}):V,m=()=>{d(),p(),f.value=!1};return Je(m),{isSupported:l,isActive:f,pause(){d(),f.value=!1},resume(){f.value=!0},stop:m}}function ct(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}function lt(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!t||t.tagName===`BODY`?!1:lt(t)}}function ut(e){let t=e||window.event,n=t.target;return lt(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}var dt=new WeakMap;function ft(e,n=!1){let r=(0,t.shallowRef)(n),i=null,a=``;(0,t.watch)(et(e),e=>{let n=ct((0,t.toValue)(e));if(n){let e=n;if(dt.get(e)||dt.set(e,e.style.overflow),e.style.overflow!==`hidden`&&(a=e.style.overflow),e.style.overflow===`hidden`)return r.value=!0;if(r.value)return e.style.overflow=`hidden`}},{immediate:!0});let o=()=>{let n=ct((0,t.toValue)(e));!n||r.value||(Qe&&(i=it(n,`touchmove`,e=>{ut(e)},{passive:!1})),n.style.overflow=`hidden`,r.value=!0)},s=()=>{let n=ct((0,t.toValue)(e));!n||!r.value||(Qe&&i?.(),n.style.overflow=a,dt.delete(n),r.value=!1)};return Je(s),(0,t.computed)({get(){return r.value},set(e){e?o():s()}})}var pt={mounted(e,t){typeof t.value==`function`?st(e,t.value):st(e,...t.value)}};function mt(){let e=!1,n=(0,t.shallowRef)(!1);return(r,i)=>{if(n.value=i.value,e)return;e=!0;let a=ft(r,i.value);(0,t.watch)(n,e=>a.value=e)}}mt();var ht=`https://maps.cartoway.com/styles/positron/style.json`,gt=`#f4f4f5`,_t=`bbox`,U=`lochas`,W={Bbox:{id:`bbox-layer`,type:`line`,source:_t,paint:{"line-color":`#000000`,"line-width":1,"line-dasharray":[2,2]}},PolygonBorder:{id:`feature-polygons-border`,type:`line`,source:U,paint:{"line-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"line-color":`#000000`},filter:[`in`,[`geometry-type`],[`literal`,[`Polygon`,`MultiPolygon`]]]},Polygon:{id:`feature-polygons`,type:`fill`,source:U,paint:{"fill-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.3],"fill-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter]},filter:[`in`,[`geometry-type`],[`literal`,[`Polygon`,`MultiPolygon`]]]},LineString:{id:`feature-lines`,type:`line`,source:U,paint:{"line-width":6,"line-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter],"line-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.5],"line-offset":[`case`,[`==`,[`get`,`is_before`],!0],-3,3]},layout:{"line-cap":`round`},filter:[`in`,[`geometry-type`],[`literal`,[`LineString`,`MultiLineString`]]]},LineStringBorder:{id:`feature-lines-border`,type:`line`,source:U,paint:{"line-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"line-color":`#000000`,"line-offset":[`case`,[`==`,[`get`,`is_before`],!0],-2,2]},layout:{"line-cap":`round`},filter:[`in`,[`geometry-type`],[`literal`,[`LineString`,`MultiLineString`]]]},Point:{id:`feature-points`,type:`circle`,source:U,paint:{"circle-radius":[`case`,[`boolean`,[`feature-state`,`hover`],!1],14,12],"circle-stroke-color":`#000000`,"circle-stroke-width":[`case`,[`==`,[`get`,`is_before`],!0],1,2],"circle-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],1,.3],"circle-color":[`case`,[`==`,[`get`,`geom`],!1],gt,[`==`,[`get`,`is_new`],!0],L.new,[`==`,[`get`,`deleted`],!0],L.delete,[`==`,[`get`,`is_before`],!0],L.updateBefore,L.updateAfter]},filter:[`in`,[`geometry-type`],[`literal`,[`Point`,`MultiPoint`]]]}};function vt(e,t,n){var r=e.length,i=G(e[0],t),a=[],o,s,c;let l,u;for(n||=[],o=1;o<r;o++){for(l=e[o-1],u=e[o],s=c=G(u,t);;)if(!(i|s)){a.push(l),s===c?o===r-1&&a.push(u):(a.push(u),o<r-1&&(n.push(a),a=[]));break}else if(i&s)break;else i?(l=bt(l,u,i,t),i=G(l,t)):(u=bt(l,u,s,t),s=G(u,t));i=c}return a.length&&n.push(a),n}function yt(e,t){var n,r,i,a,o,s,c;for(r=1;r<=8;r*=2){for(n=[],i=e[e.length-1],a=!(G(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(G(s,t)&r),c!==a&&n.push(bt(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function bt(e,t,n,r){return n&8?[e[0]+(t[0]-e[0])*(r[3]-e[1])/(t[1]-e[1]),r[3]]:n&4?[e[0]+(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1]),r[1]]:n&2?[r[2],e[1]+(t[1]-e[1])*(r[2]-e[0])/(t[0]-e[0])]:n&1?[r[0],e[1]+(t[1]-e[1])*(r[0]-e[0])/(t[0]-e[0])]:null}function G(e,t){var n=0;return e[0]<t[0]?n|=1:e[0]>t[2]&&(n|=2),e[1]<t[1]?n|=4:e[1]>t[3]&&(n|=8),n}function xt(e,t){let n=F(e),r=n.type,i=e.type===`Feature`?e.properties:{},a=n.coordinates;switch(r){case`LineString`:case`MultiLineString`:{let e=[];return r===`LineString`&&(a=[a]),a.forEach(n=>{vt(n,t,e)}),e.length===1?_(e[0],i):y(e,i)}case`Polygon`:return g(St(a,t),i);case`MultiPolygon`:return b(a.map(e=>St(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function St(e,t){let n=[];for(let r of e){let e=yt(r,t);e.length>0&&((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&e.push(e[0]),e.length>=4&&n.push(e))}return n}var Ct=xt;function wt(e,t={}){let n=Number(e[0]),r=Number(e[1]),i=Number(e[2]),a=Number(e[3]);if(e.length===6)throw Error(`@turf/bbox-polygon does not support BBox with 6 positions`);let o=[n,r];return g([[o,[i,r],[i,a],[n,a],o]],t.properties,{bbox:e,id:t.id})}var Tt=wt,K=11102230246251565e-32,q=134217729,Et=(3+8*K)*K;function Dt(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function Ot(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function J(e){return new Float64Array(e)}var kt=(3+16*K)*K,At=(2+12*K)*K,jt=(9+64*K)*K*K,Y=J(4),Mt=J(8),Nt=J(12),Pt=J(16),X=J(4);function Ft(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=q*T,p=f-(f-T),m=T-p,f=q*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=q*D,p=f-(f-D),m=D-p,f=q*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,Y[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,Y[1]=y-(_+d)+(d-S),w=v+_,d=w-v,Y[2]=v-(w-d)+(_-d),Y[3]=w;let k=Ot(4,Y),A=At*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=jt*o+Et*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=q*s,p=f-(f-s),m=s-p,f=q*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=q*c,p=f-(f-c),m=c-p,f=q*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w;let ee=Dt(4,Y,4,X,Mt);b=T*u,f=q*T,p=f-(f-T),m=T-p,f=q*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=q*D,p=f-(f-D),m=D-p,f=q*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w;let te=Dt(ee,Mt,4,X,Nt);return b=s*u,f=q*s,p=f-(f-s),m=s-p,f=q*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=q*c,p=f-(f-c),m=c-p,f=q*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,X[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,X[1]=y-(_+d)+(d-S),w=v+_,d=w-v,X[2]=v-(w-d)+(_-d),X[3]=w,Pt[Dt(te,Nt,4,X,Pt)-1]}function It(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=kt*l?c:-Ft(e,t,n,r,i,a,l)}(7+56*K)*K,(3+28*K)*K,(26+288*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(8),J(8),J(8),J(4),J(8),J(8),J(8),J(12),J(192),J(192),(10+96*K)*K,(4+48*K)*K,(44+576*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(8),J(4),J(4),J(4),J(8),J(16),J(16),J(16),J(32),J(32),J(48),J(64),J(1152),J(1152),(16+224*K)*K,(5+72*K)*K,(71+1408*K)*K*K,J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(4),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(24),J(1152),J(1152),J(1152),J(1152),J(1152),J(2304),J(2304),J(3456),J(5760),J(8),J(8),J(8),J(16),J(24),J(48),J(48),J(96),J(192),J(384),J(384),J(384),J(768),J(96),J(96),J(96),J(1152);function Lt(e,t){var n,r,i=0,a,o,s,c,l,u,d,f=e[0],p=e[1],m=t.length;for(n=0;n<m;n++){r=0;var h=t[n],g=h.length-1;if(u=h[0],u[0]!==h[g][0]&&u[1]!==h[g][1])throw Error(`First and last coordinates in a ring must be the same`);for(o=u[0]-f,s=u[1]-p;r<g;r++){if(d=h[r+1],c=d[0]-f,l=d[1]-p,s===0&&l===0){if(c<=0&&o>=0||o<=0&&c>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(a=It(o,c,s,l,0,0),a===0)return 0;(a>0&&l>0&&s<=0||a<0&&l<=0&&s>0)&&i++}u=d,s=l,o=c}}return i%2!=0}function Z(e,t,n={}){if(!e)throw Error(`point is required`);if(!t)throw Error(`polygon is required`);let r=N(e),i=F(t),a=i.type,o=t.bbox,s=i.coordinates;if(o&&Rt(r,o)===!1)return!1;a===`Polygon`&&(s=[s]);let c=!1;for(var l=0;l<s.length;++l){let e=Lt(r,s[l]);if(e===0)return!n.ignoreBoundary;e&&(c=!0)}return c}function Rt(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var zt=d(l(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n||=self).RBush=r()})(e,function(){"use strict";function e(e,r,i,a,o){(function e(n,r,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,c=r-i+1,l=Math.log(s),u=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*u*(s-u)/s)*(c-s/2<0?-1:1);e(n,r,Math.max(i,Math.floor(r-c*u/s+d)),Math.min(a,Math.floor(r+(s-c)*u/s+d)),o)}var f=n[r],p=i,m=a;for(t(n,i,r),o(n[a],f)>0&&t(n,i,a);p<m;){for(t(n,p,m),p++,m--;o(n[p],f)<0;)p++;for(;o(n[m],f)>0;)m--}o(n[i],f)===0?t(n,i,m):t(n,++m,a),m<=r&&(i=m+1),r<=m&&(a=m-1)}})(e,r,i||0,a||e.length-1,o||n)}function t(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function n(e,t){return e<t?-1:e>t?1:0}var r=function(e){e===void 0&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(e,t,n){if(!n)return t.indexOf(e);for(var r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function a(e,t){o(e,0,e.children.length,t,e)}function o(e,t,n,r,i){i||=m(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var a=t;a<n;a++){var o=e.children[a];s(i,e.leaf?r(o):o)}return i}function s(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function c(e,t){return e.minX-t.minX}function l(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function f(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function p(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function m(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function h(t,n,r,i,a){for(var o=[n,r];o.length;)if(!((r=o.pop())-(n=o.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;e(t,s,n,r,a),o.push(n,s,s,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(e){var t=this.data,n=[];if(!p(e,t))return n;for(var r=this.toBBox,i=[];t;){for(var a=0;a<t.children.length;a++){var o=t.children[a],s=t.leaf?r(o):o;p(e,s)&&(t.leaf?n.push(o):f(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n},r.prototype.collides=function(e){var t=this.data;if(!p(e,t))return!1;for(var n=[];t;){for(var r=0;r<t.children.length;r++){var i=t.children[r],a=t.leaf?this.toBBox(i):i;if(p(e,a)){if(t.leaf||f(e,a))return!0;n.push(i)}}t=n.pop()}return!1},r.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var n=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},r.prototype.clear=function(){return this.data=m([]),this},r.prototype.remove=function(e,t){if(!e)return this;for(var n,r,a,o=this.data,s=this.toBBox(e),c=[],l=[];o||c.length;){if(o||(o=c.pop(),r=c[c.length-1],n=l.pop(),a=!0),o.leaf){var u=i(e,o.children,t);if(u!==-1)return o.children.splice(u,1),c.push(o),this._condense(c),this}a||o.leaf||!f(o,s)?r?(n++,o=r.children[n],a=!1):o=null:(c.push(o),l.push(n),n=0,r=o,o=o.children[0])}return this},r.prototype.toBBox=function(e){return e},r.prototype.compareMinX=function(e,t){return e.minX-t.minX},r.prototype.compareMinY=function(e,t){return e.minY-t.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(e){return this.data=e,this},r.prototype._all=function(e,t){for(var n=[];e;)e.leaf?t.push.apply(t,e.children):n.push.apply(n,e.children),e=n.pop();return t},r.prototype._build=function(e,t,n,r){var i,o=n-t+1,s=this._maxEntries;if(o<=s)return a(i=m(e.slice(t,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/s**(r-1))),(i=m([])).leaf=!1,i.height=r;var c=Math.ceil(o/s),l=c*Math.ceil(Math.sqrt(s));h(e,t,n,l,this.compareMinX);for(var u=t;u<=n;u+=l){var d=Math.min(u+l-1,n);h(e,u,d,c,this.compareMinY);for(var f=u;f<=d;f+=c){var p=Math.min(f+c-1,d);i.children.push(this._build(e,f,p,r-1))}}return a(i,this.toBBox),i},r.prototype._chooseSubtree=function(e,t,n,r){for(;r.push(t),!t.leaf&&r.length-1!==n;){for(var i=1/0,a=1/0,o=void 0,s=0;s<t.children.length;s++){var c=t.children[s],l=u(c),d=(f=e,p=c,(Math.max(p.maxX,f.maxX)-Math.min(p.minX,f.minX))*(Math.max(p.maxY,f.maxY)-Math.min(p.minY,f.minY))-l);d<a?(a=d,i=l<i?l:i,o=c):d===a&&l<i&&(i=l,o=c)}t=o||t.children[0]}var f,p;return t},r.prototype._insert=function(e,t,n){var r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),s(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)},r.prototype._split=function(e,t){var n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=m(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(n,s)},r.prototype._splitRoot=function(e,t){this.data=m([e,t]),this.data.height=e.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(e,t,n){for(var r,i,a,s,c,l,d,f=1/0,p=1/0,m=t;m<=n-t;m++){var h=o(e,0,m,this.toBBox),g=o(e,m,n,this.toBBox),_=(i=h,a=g,s=void 0,c=void 0,l=void 0,d=void 0,s=Math.max(i.minX,a.minX),c=Math.max(i.minY,a.minY),l=Math.min(i.maxX,a.maxX),d=Math.min(i.maxY,a.maxY),Math.max(0,l-s)*Math.max(0,d-c)),v=u(h)+u(g);_<f?(f=_,r=m,p=v<p?v:p):_===f&&v<p&&(p=v,r=m)}return r||n-t},r.prototype._chooseSplitAxis=function(e,t,n){var r=e.leaf?this.compareMinX:c,i=e.leaf?this.compareMinY:l;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)},r.prototype._allDistMargin=function(e,t,n,r){e.children.sort(r);for(var i=this.toBBox,a=o(e,0,t,i),c=o(e,n-t,n,i),l=d(a)+d(c),u=t;u<n-t;u++){var f=e.children[u];s(a,e.leaf?i(f):f),l+=d(a)}for(var p=n-t-1;p>=t;p--){var m=e.children[p];s(c,e.leaf?i(m):m),l+=d(c)}return l},r.prototype._adjustParentBBoxes=function(e,t,n){for(var r=n;r>=0;r--)s(t[r],e)},r.prototype._condense=function(e){for(var t=e.length-1,n=void 0;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children).splice(n.indexOf(e[t]),1):this.clear():a(e[t],this.toBBox)},r})}))(),1);function Bt(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&e.length===4)t=e;else if(Array.isArray(e)&&e.length===6)t=[e[0],e[1],e[3],e[4]];else if(e.type===`Feature`)t=z(e);else if(e.type===`FeatureCollection`)t=z(e);else throw Error(`invalid geojson`);return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}}var Vt=class{constructor(e=9){this.tree=new zt.default(e),this.tree.toBBox=Bt}insert(e){if(e.type!==`Feature`)throw Error(`invalid feature`);return e.bbox=e.bbox?e.bbox:z(e),this.tree.insert(e),this}load(e){var t=[];return Array.isArray(e)?e.forEach(function(e){if(e.type!==`Feature`)throw Error(`invalid features`);e.bbox=e.bbox?e.bbox:z(e),t.push(e)}):D(e,function(e){if(e.type!==`Feature`)throw Error(`invalid features`);e.bbox=e.bbox?e.bbox:z(e),t.push(e)}),this.tree.load(t),this}remove(e,t){if(e.type!==`Feature`)throw Error(`invalid feature`);return e.bbox=e.bbox?e.bbox:z(e),this.tree.remove(e,t),this}clear(){return this.tree.clear(),this}search(e){return v(this.tree.search(Bt(e)))}collides(e){return this.tree.collides(Bt(e))}all(){return v(this.tree.all())}toJSON(){return this.tree.toJSON()}fromJSON(e){return this.tree.fromJSON(e),this}};function Ht(e){return new Vt(e)}function Ut(e,t){if(t??={},!T(t))throw Error(`options is invalid`);var n=t.precision,r=t.coordinates,i=t.mutate;if(n=n==null||isNaN(n)?6:n,r=r==null||isNaN(r)?3:r,!e)throw Error(`<geojson> is required`);if(typeof n!=`number`)throw Error(`<precision> must be a number`);if(typeof r!=`number`)throw Error(`<coordinates> must be a number`);(i===!1||i===void 0)&&(e=JSON.parse(JSON.stringify(e)));var a=10**n;return E(e,function(e){Wt(e,a,r)}),e}function Wt(e,t,n){e.length>n&&e.splice(n,e.length);for(var r=0;r<e.length;r++)e[r]=Math.round(e[r]*t)/t;return e}function Gt(e){if(!e)throw Error(`geojson is required`);let t=[];return ee(e,e=>{Kt(e,t)}),v(t)}function Kt(e,t){let n=[],r=e.geometry;if(r!==null){switch(r.type){case`Polygon`:n=P(r);break;case`LineString`:n=[P(r)]}n.forEach(n=>{qt(n,e.properties).forEach(e=>{e.id=t.length,t.push(e)})})}}function qt(e,t){let n=[];return e.reduce((e,r)=>{let i=_([e,r],t);return i.bbox=Jt(e,r),n.push(i),r}),n}function Jt(e,t){let n=e[0],r=e[1],i=t[0],a=t[1];return[n<i?n:i,r<a?r:a,n>i?n:i,r>a?r:a]}var Yt=class{constructor(e=[],t=Xt){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=(e<<1)+1,a=t[r],o=r+1;if(o<this.length&&n(t[o],a)<0&&(r=o,a=t[o]),n(a,i)>=0)break;t[e]=a,e=r}t[e]=i}};function Xt(e,t){return e<t?-1:e>t?1:0}function Zt(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y===t.p.y||e.p.y>t.p.y?1:-1}function Qt(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y===t.rightSweepEvent.p.y||e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1}var $t=class{constructor(e,t,n,r){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=n,this.eventId=r,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}};function en(e,t){if(e.type===`FeatureCollection`){let n=e.features;for(let e=0;e<n.length;e++)an(n[e],t)}else an(e,t)}var tn=0,nn=0,rn=0;function an(e,t){let n=e.type===`Feature`?e.geometry:e,r=n.coordinates;(n.type===`Polygon`||n.type===`MultiLineString`)&&(r=[r]),n.type===`LineString`&&(r=[[r]]);for(let e=0;e<r.length;e++)for(let n=0;n<r[e].length;n++){let i=r[e][n][0],a=null;nn+=1;for(let o=0;o<r[e][n].length-1;o++){a=r[e][n][o+1];let s=new $t(i,tn,nn,rn),c=new $t(a,tn,nn,rn+1);s.otherEvent=c,c.otherEvent=s,Zt(s,c)>0?(c.isLeftEndpoint=!0,s.isLeftEndpoint=!1):(s.isLeftEndpoint=!0,c.isLeftEndpoint=!1),t.push(s),t.push(c),i=a,rn+=1}}tn+=1}var on=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function sn(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;let n=e.leftSweepEvent.p.x,r=e.leftSweepEvent.p.y,i=e.rightSweepEvent.p.x,a=e.rightSweepEvent.p.y,o=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,c=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,u=(l-s)*(i-n)-(c-o)*(a-r),d=(c-o)*(r-s)-(l-s)*(n-o),f=(i-n)*(r-s)-(a-r)*(n-o);if(u===0)return!1;let p=d/u,m=f/u;return p>=0&&p<=1&&m>=0&&m<=1?[n+p*(i-n),r+p*(a-r)]:!1}function cn(e,t){t||=!1;let n=[],r=new Yt([],Qt);for(;e.length;){let i=e.pop();if(i.isLeftEndpoint){let e=new on(i);for(let a=0;a<r.data.length;a++){let o=r.data[a];if(t&&o.leftSweepEvent.featureId===i.featureId)continue;let s=sn(e,o);s!==!1&&n.push(s)}r.push(e)}else i.isLeftEndpoint===!1&&r.pop()}return n}function ln(e,t){let n=new Yt([],Zt);return en(e,n),cn(n,t)}var un=ln;function dn(e,t,n={}){let{removeDuplicates:r=!0,ignoreSelfIntersections:i=!0}=n,a=[];e.type===`FeatureCollection`?a=a.concat(e.features):e.type===`Feature`?a.push(e):(e.type===`LineString`||e.type===`Polygon`||e.type===`MultiLineString`||e.type===`MultiPolygon`)&&a.push(m(e)),t.type===`FeatureCollection`?a=a.concat(t.features):t.type===`Feature`?a.push(t):(t.type===`LineString`||t.type===`Polygon`||t.type===`MultiLineString`||t.type===`MultiPolygon`)&&a.push(m(t));let o=un(v(a),i),s=[];if(r){let e={};o.forEach(t=>{let n=t.join(`,`);e[n]||(e[n]=!0,s.push(t))})}else s=o;return v(s.map(e=>h(e)))}function fn(e,t,n={}){var r=N(e),i=N(t),a=C(i[1]-r[1]),o=C(i[0]-r[0]),s=C(r[1]),c=C(i[1]),l=Math.sin(a/2)**2+Math.sin(o/2)**2*Math.cos(s)*Math.cos(c);return x(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}var pn=Object.defineProperty,mn=Object.defineProperties,hn=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,_n=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,yn=(e,t,n)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bn=(e,t)=>{for(var n in t||={})_n.call(t,n)&&yn(e,n,t[n]);if(gn)for(var n of gn(t))vn.call(t,n)&&yn(e,n,t[n]);return e},xn=(e,t)=>mn(e,hn(t));function Sn(e,t,n={}){if(!e||!t)throw Error(`lines and inputPoint are required arguments`);let r=N(t),i=h([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),a=0,o=0,s=-1;return ee(e,function(e,c,l){s!==l&&(s=l,o=0);let u=P(e);for(let e=0;e<u.length-1;e++){let s=h(u[e]),c=N(s),d=h(u[e+1]),f=N(d),p=fn(s,d,n),m,g;f[0]===r[0]&&f[1]===r[1]?[m,g]=[f,!0]:c[0]===r[0]&&c[1]===r[1]?[m,g]=[c,!1]:[m,g]=Dn(c,f,r);let _=fn(t,m,n);if(_<i.properties.pointDistance){let t=fn(s,m,n);i=h(m,{lineStringIndex:l,segmentIndex:g?e+1:e,totalDistance:a+t,lineDistance:o+t,segmentDistance:t,pointDistance:_,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),i.properties=xn(bn({},i.properties),{multiFeatureIndex:i.properties.lineStringIndex,index:i.properties.segmentIndex,location:i.properties.totalDistance,dist:i.properties.pointDistance})}a+=p,o+=p}}),i}function Q(e,t){let[n,r,i]=e,[a,o,s]=t;return n*a+r*o+i*s}function $(e,t){let[n,r,i]=e,[a,o,s]=t;return[r*s-i*o,i*a-n*s,n*o-r*a]}function Cn(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2)}function wn(e){let t=Cn(e);return[e[0]/t,e[1]/t,e[2]/t]}function Tn(e){let t=C(e[1]),n=C(e[0]);return[Math.cos(t)*Math.cos(n),Math.cos(t)*Math.sin(n),Math.sin(t)]}function En(e){let[t,n,r]=e,i=Math.min(Math.max(r,-1),1),a=S(Math.asin(i));return[S(Math.atan2(n,t)),a]}function Dn(e,t,n){let r=Tn(e),i=Tn(t),a=Tn(n),o=$(r,i);if(o[0]===0&&o[1]===0&&o[2]===0)return Q(r,i)>0?[[...t],!0]:[[...n],!1];let s=$(o,a);if(s[0]===0&&s[1]===0&&s[2]===0)return[[...t],!0];let c=wn($(s,o)),l=[-c[0],-c[1],-c[2]],u=Q(a,c)>Q(a,l)?c:l,d=wn(o),f=Q($(r,u),d),p=Q($(u,i),d);return f>=0&&p>=0?[En(u),!1]:Q(r,a)>Q(i,a)?[[...e],!1]:[[...t],!0]}function On(e,t){if(!e)throw Error(`line is required`);if(!t)throw Error(`splitter is required`);let n=me(e),r=me(t);if(n!==`LineString`)throw Error(`line must be LineString`);if(r===`FeatureCollection`)throw Error(`splitter cannot be a FeatureCollection`);if(r===`GeometryCollection`)throw Error(`splitter cannot be a GeometryCollection`);var i=Ut(t,{precision:7});switch(e.type!==`Feature`&&(e=m(e)),r){case`Point`:return An(e,i);case`MultiPoint`:return kn(e,i);case`LineString`:case`MultiLineString`:case`Polygon`:case`MultiPolygon`:return kn(e,dn(e,i,{ignoreSelfIntersections:!0}))}}function kn(e,t){var n=[],r=Ht();return ee(t,function(t){if(n.forEach(function(e,t){e.id=t}),!n.length)n=An(e,t).features,r.load(v(n));else{var i=r.search(t);if(i.features.length){var a=jn(t,i);n=n.filter(function(e){return e.id!==a.id}),r.remove(a),D(An(a,t),function(e){n.push(e),r.insert(e)})}}}),v(n)}function An(e,t){var n=[],r=P(e)[0],i=P(e)[e.geometry.coordinates.length-1];if(Mn(r,N(t))||Mn(i,N(t)))return v([e]);var a=Ht(),o=Gt(e);a.load(o);var s=a.search(t);if(!s.features.length)return v([e]);var c=jn(t,s),l=O(o,function(e,r,i){var a=P(r)[1],o=N(t);return i===c.id?(e.push(o),n.push(_(e)),Mn(o,a)?[o]:[o,a]):(e.push(a),e)},[r]);return l.length>1&&n.push(_(l)),v(n)}function jn(e,t){if(!t.features.length)throw Error(`lines must contain features`);if(t.features.length===1)return t.features[0];var n,r=1/0;return D(t,function(t){var i=Sn(t,e).properties.dist;i<r&&(n=t,r=i)}),n}function Mn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Nn(e,t){let n=F(e),r=F(t),i=n.type,a=r.type,o=n.coordinates,s=r.coordinates;switch(i){case`Point`:switch(a){case`Point`:return Gn(o,s);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPoint`:switch(a){case`Point`:return In(n,r);case`MultiPoint`:return Ln(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`LineString`:switch(a){case`Point`:return I(r,n,{ignoreEndVertices:!0});case`LineString`:return Bn(n,r);case`MultiPoint`:return Rn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`Polygon`:switch(a){case`Point`:return Z(r,n,{ignoreBoundary:!0});case`LineString`:return Hn(n,r);case`Polygon`:return Un(n,r);case`MultiPoint`:return zn(n,r);case`MultiPolygon`:return Fn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPolygon`:switch(a){case`Polygon`:return Pn(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}default:throw Error(`feature1 `+i+` geometry not supported`)}}function Pn(e,t){return e.coordinates.some(e=>Un({type:`Polygon`,coordinates:e},t))}function Fn(e,t){return t.coordinates.every(t=>Un(e,{type:`Polygon`,coordinates:t}))}function In(e,t){let n,r=!1;for(n=0;n<e.coordinates.length;n++)if(Gn(e.coordinates[n],t.coordinates)){r=!0;break}return r}function Ln(e,t){for(let n of t.coordinates){let t=!1;for(let r of e.coordinates)if(Gn(n,r)){t=!0;break}if(!t)return!1}return!0}function Rn(e,t){let n=!1;for(let r of t.coordinates)if(I(r,e,{ignoreEndVertices:!0})&&(n=!0),!I(r,e))return!1;return!!n}function zn(e,t){for(let n of t.coordinates)if(!Z(n,e,{ignoreBoundary:!0}))return!1;return!0}function Bn(e,t){let n=!1;for(let r of t.coordinates)if(I({type:`Point`,coordinates:r},e,{ignoreEndVertices:!0})&&(n=!0),!I({type:`Point`,coordinates:r},e,{ignoreEndVertices:!1}))return!1;return n}function Vn(e,t){let n=e.coordinates,r=[];for(let e=0;e<n.length-1;e++){let i=_([n[e],n[e+1]]),a=On(i,m(t));a.features.length===0?r.push(i):r.push(...a.features)}return v(r)}function Hn(e,t){if(!Wn(z(e),z(t)))return!1;for(let n of t.coordinates)if(!Z(n,e))return!1;let n=!1,r=Vn(t,e);for(let t of r.features){let r=Kn(t.geometry.coordinates[0],t.geometry.coordinates[1]);if(!Z(r,e))return!1;!n&&Z(r,e,{ignoreBoundary:!0})&&(n=!0)}return n}function Un(e,t){if(e.type===`Feature`&&e.geometry===null||t.type===`Feature`&&t.geometry===null||!Wn(z(e),z(t)))return!1;let n=F(t).coordinates;for(let t of n)for(let n of t)if(!Z(n,e))return!1;return!0}function Wn(e,t){return!(e[0]>t[0]||e[2]<t[2]||e[1]>t[1]||e[3]<t[3])}function Gn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Kn(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var qn=Nn;function Jn(e){return wt(z(e))}var Yn=Jn;function Xn(e){return e.geometry&&(e.geometry.type===`LineString`||e.geometry.type===`MultiLineString`||e.geometry.type===`Polygon`||e.geometry.type===`MultiPolygon`)}function Zn(e,t){let n=e.map(e=>e.geometry?e.geometry.type===`Point`||e.geometry.type===`MultiPoint`?qn(Tt(t),e)?e:null:Xn(e)?Ct(e,t):null:null).filter(e=>e!==null);return n.length===0?null:Yn(v(n))}var Qn=.001,$n=1e-4;function er(e,t){return[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function tr(e){return er(e,Qn)}function nr(e){return er(e,$n)}var rr=[`id`],ir=R((0,t.defineComponent)({__name:`VMap`,props:{id:{},features:{},bbox:{}},setup(e){let r=e,i=(0,t.inject)(De,ht),a={top:60,left:60,right:60,bottom:80},o=(0,t.shallowRef)(),s=(0,t.shallowRef)(!1),c=(0,t.shallowRef)(),l=(0,t.shallowRef)(),u;(0,t.watch)(s,e=>{e?d():(o.value&&o.value.remove(),o.value=void 0)}),(0,t.watch)(()=>r.features,e=>{o.value&&s.value&&e&&(o.value.remove(),o.value=void 0,d())});function d(){if(!o.value){u=r.bbox?tr(r.bbox):void 0;let e=u?Zn(r.features,u):v(r.features);if(e){let t=nr(qe(e)),s=[[t[0],t[1]],[t[2],t[3]]];o.value=new n.default.Map({hash:!1,container:`map-${r.id}`,bounds:s,fitBoundsOptions:{padding:a,animate:!1,maxZoom:17},style:i,cooperativeGestures:!0,attributionControl:!1}),o.value.addControl(new n.default.FullscreenControl),o.value.on(`load`,p)}}}function f(e){if(!o.value)throw Error(`Call initMap() function first.`);o.value.addSource(_t,{type:`geojson`,data:{type:`Feature`,geometry:{type:`Polygon`,coordinates:[[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]],[e[0],e[1]]]]},properties:{}}}),o.value.addLayer(W.Bbox)}function p(){if(!o.value)throw Error(`Call initMap() function first.`);u&&f(u),o.value.addSource(U,{type:`geojson`,data:{type:`FeatureCollection`,features:r.features}}),m(),y()}function m(){if(!o.value)throw Error(`Call initMap() function first.`);o.value.getLayer(W.Polygon.id)||o.value.addLayer(W.Polygon),o.value.getLayer(W.PolygonBorder.id)||o.value.addLayer(W.PolygonBorder),o.value.getLayer(W.LineStringBorder.id)||o.value.addLayer(W.LineStringBorder),o.value.getLayer(W.LineString.id)||o.value.addLayer(W.LineString),o.value.getLayer(W.Point.id)||o.value.addLayer(W.Point)}function h(e){!e.features||e.features.length===0||(l.value!==void 0&&x(),l.value=e.features[0],b(e.lngLat,e.features[0]))}function g(){o.value.getCanvas().style.cursor=`pointer`}function _(){o.value.getCanvas().style.cursor=``,l.value!==void 0&&(l.value=void 0),x()}function y(){if(!o.value)throw Error(`Call initMap() function first.`);Object.values(W).forEach(e=>{e.id!==`bbox-layer`&&(o.value.on(`mousemove`,e.id,h),o.value.on(`mouseenter`,e.id,g),o.value.on(`mouseleave`,e.id,_))})}function b(e,t){if(!o.value)throw Error(`Call initMap() function first.`);c.value=new n.default.Popup().setLngLat(e).setHTML(`${Oe[t.properties.objtype]}-${t.properties.id}-v${t.properties.version}`).addTo(o.value)}function x(){c.value?.remove(),c.value=void 0}function S([e]){s.value=e?.isIntersecting||!1}return(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{id:`map-${e.id}`,class:`v-map`},null,8,rr)),[[(0,t.unref)(pt),S]])}}),[[`__scopeId`,`data-v-e1815a55`]]),ar=[`id`],or={class:`group-header`},sr={class:`header-start`},cr=[`href`],lr=[`title`],ur={key:0,class:`name-before`},dr={key:1,class:`name-separator`},fr={key:2,class:`name-after`},pr={class:`header-center`},mr={key:0,class:`header-end`},hr={class:`group-content`},gr={key:0,class:`content-start`},_r={class:`before-list`},vr={class:`after-list`},yr=R((0,t.defineComponent)({__name:`LoChaGroup`,props:{id:{},index:{},features:{},josmTarget:{}},emits:[`navigate`],setup(e){(0,t.useCssVars)(e=>({cd71894a:i.value,v0e080b8e:a.value}));let n=e,r=(0,t.useSlots)(),i=(0,t.computed)(()=>r[`content-start`]?`repeat(4, minmax(0, 1fr))`:`repeat(3, minmax(0, 1fr))`),a=(0,t.computed)(()=>r[`header-end`]?`minmax(0, 1fr) minmax(0, 1fr) auto`:`minmax(0, 1fr) minmax(0, 1fr)`),o=(0,t.inject)(Ee),{loCha:s,getBeforeFeatures:c,getAfterFeatures:l}=(0,t.inject)(Te);if(!s.value)throw Error(`LoCha is empty.`);let u=(0,t.computed)(()=>{let e=[...new Set(c(n.features).map(e=>e.properties.tags?.name).filter(Boolean))],t=[...new Set(l(n.features).map(e=>e.properties.tags?.name).filter(Boolean))],r=e.length>0?e.join(`, `):null,i=t.length>0?t.join(`, `):null;return r===i?{before:null,after:i}:{before:r,after:i}}),d=(0,t.computed)(()=>{let{before:e,after:t}=u.value;return e&&t?`${e} → ${t}`:e??t??void 0});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{id:e.id,class:`locha-group`},[(0,t.createElementVNode)(`div`,or,[(0,t.createElementVNode)(`div`,sr,[(0,t.createElementVNode)(`a`,{class:`anchor-button`,href:`#${e.id}`,onClick:i[0]||=(0,t.withModifiers)(t=>r.$emit(`navigate`,`#${e.id}`),[`prevent`])},`🔗`,8,cr),(0,t.createElementVNode)(`h3`,{class:`group-name`,title:d.value},[u.value.before?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,ur,(0,t.toDisplayString)(u.value.before),1)):(0,t.createCommentVNode)(``,!0),u.value.before?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,dr,` → `)):(0,t.createCommentVNode)(``,!0),u.value.after?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fr,(0,t.toDisplayString)(u.value.after),1)):(0,t.createCommentVNode)(``,!0)],8,lr)]),(0,t.createElementVNode)(`div`,pr,[(0,t.renderSlot)(r.$slots,`header-center`,{index:e.index},void 0,!0)]),r.$slots[`header-end`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mr,[(0,t.renderSlot)(r.$slots,`header-end`,{index:e.index},void 0,!0)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,hr,[r.$slots[`content-start`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gr,[(0,t.renderSlot)(r.$slots,`content-start`,{index:e.index},void 0,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,_r,[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(c)(e.features),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n.id},[(0,t.createVNode)(Ke,{feature:n,"josm-target":e.josmTarget},(0,t.createSlots)({_:2},[r.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`object-detail`,{feature:n,index:e.index},void 0,!0)]),key:`0`}:void 0]),1032,[`feature`,`josm-target`])]))),128))])]),(0,t.createElementVNode)(`div`,vr,[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(l)(e.features),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n.id},[(0,t.createVNode)(Ke,{feature:n,"josm-target":e.josmTarget},(0,t.createSlots)({_:2},[r.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`object-detail`,{feature:n,index:e.index},void 0,!0)]),key:`0`}:void 0]),1032,[`feature`,`josm-target`])]))),128))])]),(0,t.createVNode)(ir,{id:`${(0,t.unref)(o)}-${n.index}`,features:e.features,bbox:(0,t.unref)(s)?.bbox},null,8,[`id`,`features`,`bbox`])])],8,ar))}}),[[`__scopeId`,`data-v-da7a6115`]]);function br(e,t={}){let{container:n=document,behavior:r=`smooth`,block:i=`start`,inline:a=`nearest`}=t,o=e.startsWith(`#`)?e.slice(1):e,s=n.querySelector(`#${CSS.escape(o)}`);return s?(s.scrollIntoView({behavior:r,block:i,inline:a}),!0):!1}var xr=[`name`],Sr=R((0,t.defineComponent)({__name:`LoChaGroupList`,props:{hash:{}},setup(e){(0,t.useCssVars)(e=>({v32a2838c:(0,t.unref)(a)}));let n=e,{groups:r}=(0,t.inject)(Te),i=(0,t.inject)(Ee),a=L.delete,o=(0,t.ref)(),s=(0,t.useTemplateRef)(`listRef`);function c(e){return`locha-${i}-group-${e}`}function l(){return`hidden_josm_target_${i}`}let u=!1;function d(e){if(o.value===e){u=!0,o.value=void 0,history.replaceState(null,``,`${location.pathname}${location.search}`),window.dispatchEvent(new CustomEvent(`locha-navigate`,{detail:{hash:void 0,instanceId:i}})),(0,t.nextTick)(()=>{u=!1});return}u=!0,o.value=e,history.replaceState(null,``,e),window.dispatchEvent(new CustomEvent(`locha-navigate`,{detail:{hash:e,instanceId:i}})),(0,t.nextTick)(()=>{u=!1,br(e,{container:s.value??void 0})})}function f(e){let{instanceId:t}=e.detail;t!==i&&(o.value=void 0)}return(0,t.watch)(()=>n.hash,e=>{u||(o.value=e,e&&(0,t.nextTick)(()=>br(e,{container:s.value??void 0})))},{immediate:!0}),(0,t.onMounted)(()=>{window.addEventListener(`locha-navigate`,f);let e=window.location.hash;e&&!n.hash&&d(e)}),(0,t.onUnmounted)(()=>{window.removeEventListener(`locha-navigate`,f)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`listRef`,ref:s,class:`locha-group-list`},[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(r),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:r,class:(0,t.normalizeClass)({selected:o.value===`#${c(r)}`})},[(0,t.createVNode)(yr,{id:c(r),features:n,index:r,"josm-target":l(),onNavigate:d},(0,t.createSlots)({_:2},[e.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`object-detail`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`0`}:void 0,e.$slots[`header-center`]?{name:`header-center`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`header-center`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`1`}:void 0,e.$slots[`header-end`]?{name:`header-end`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`header-end`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`2`}:void 0,e.$slots[`content-start`]?{name:`content-start`,fn:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`content-start`,(0,t.mergeProps)({ref_for:!0},n),void 0,!0)]),key:`3`}:void 0]),1032,[`id`,`features`,`index`,`josm-target`])],2))),128))]),(0,t.createElementVNode)(`iframe`,{name:l(),style:{display:`none`}},null,8,xr)],512))}}),[[`__scopeId`,`data-v-178acf78`]]),Cr={class:`locha`},wr={key:0,class:`user-feedback`};e.LoCha=R((0,t.defineComponent)({__name:`LoCha`,props:{id:{},data:{},mapStyleUrl:{default:ht},reasonCollapsed:{type:Boolean,default:!0},hash:{}},setup(e){let n=e;(0,t.provide)(we,n.reasonCollapsed),(0,t.provide)(Ee,n.id),(0,t.provide)(De,n.mapStyleUrl);let r=Ce();(0,t.provide)(Te,r);let{featureCount:i,setLoCha:a}=r;return(0,t.watch)(()=>n.data,e=>{e&&a(e)},{immediate:!0}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,Cr,[(0,t.unref)(i)?((0,t.openBlock)(),(0,t.createBlock)(Sr,{key:1,hash:e.hash},(0,t.createSlots)({_:2},[n.$slots[`object-detail`]?{name:`object-detail`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`object-detail`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`0`}:void 0,n.$slots[`header-center`]?{name:`header-center`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`header-center`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`1`}:void 0,n.$slots[`header-end`]?{name:`header-end`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`header-end`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`2`}:void 0,n.$slots[`content-start`]?{name:`content-start`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`content-start`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)),void 0,!0)]),key:`3`}:void 0]),1032,[`hash`])):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,wr,` ⚠️ No data `))]))}}),[[`__scopeId`,`data-v-34eb8402`]]),e.scrollToSection=br});
|
|
2
2
|
//# sourceMappingURL=index.umd.cjs.map
|