summaryrefslogtreecommitdiff
path: root/searx/static/themes/simple/js/mapresult.min.js.map
blob: 863198f0e70c569875b83489821db896a06c8c60 (plain)
1
{"version":3,"mappings":";4CAIA,EAAO,QAAS,oBAAqB,eAAmC,EAAc,CACpF,EAAM,gBAAgB,CACtB,KAAK,UAAU,OAAO,mBAAmB,CAEzC,GAAM,CACJ,OACA,QACA,YACA,cACA,MACA,eACA,QACA,SACA,OACA,SACA,aACA,UACA,UACA,8BAdI,CACJ,OACA,QACA,YACA,cACA,MACA,eACA,QACA,SACA,OACA,SACA,aACA,UACA,UACA,SACE,MAAM,OAAO,sBAdf,OACA,QACA,YACA,cACA,MACA,eACA,QACA,SACA,OACA,SACA,aACA,UACA,UACA,cAEF,yBAAO,uBAEP,GAAM,CAAE,cAAe,EAAQ,SAAQ,SAAQ,cAAe,KAAK,QAE7D,EAAM,OAAO,WAAW,GAAU,IAAI,CACtC,EAAM,OAAO,WAAW,GAAU,IAAI,CACtC,EAAO,IAAI,EAAK,CAAE,QAAS,GAAI,eAAgB,GAAO,CAAC,CACvD,EAAM,IAAI,EAAM,CACZ,SACR,OAAQ,CAAC,IAAI,EAAU,CAAE,OAAQ,IAAI,EAAI,CAAE,QAAS,GAAI,CAAC,CAAE,CAAC,CAAC,CACvD,OACP,CAAC,CAEF,GAAI,CACF,IAAM,EAAe,IAAI,EAAa,CACpC,SAAU,CACR,IAAI,EAAQ,CACV,SAAU,IAAI,EAAM,EAAW,CAAC,EAAK,EAAI,CAAC,CAAC,CAC5C,CAAC,CACH,CACF,CAAC,CAEI,EAAc,IAAI,EAAY,CAClC,OAAQ,EACR,MAAO,IAAI,EAAM,CACf,MAAO,IAAI,EAAO,CAChB,OAAQ,EACR,KAAM,IAAI,EAAK,CAAE,MAAO,UAAW,CAAC,CACrC,CAAC,CACH,CAAC,CACH,CAAC,CAEF,EAAI,SAAS,EAAY,OAClB,EAAO,CACd,QAAQ,MAAM,iCAAkC,EAAM,CAGxD,GAAI,EACF,GAAI,CACF,IAAM,EAAY,IAAI,EAAa,CACjC,SAAU,IAAI,GAAS,CAAC,aAAa,KAAK,MAAM,EAAW,CAAE,CAC3D,eAAgB,YAChB,kBAAmB,YACpB,CAAC,CACH,CAAC,CAEI,EAAW,IAAI,EAAY,CAC/B,OAAQ,EACR,MAAO,IAAI,EAAM,CACf,OAAQ,IAAI,EAAO,CAAE,MAAO,UAAW,MAAO,EAAG,CAAC,CAClD,KAAM,IAAI,EAAK,CAAE,MAAO,YAAa,CAAC,CACvC,CAAC,CACH,CAAC,CAEF,EAAI,SAAS,EAAS,CAEtB,EAAK,IAAI,EAAU,WAAW,CAAE,CAAE,QAAS,CAAC,GAAI,GAAI,GAAI,GAAG,CAAE,CAAC,OACvD,EAAO,CACd,QAAQ,MAAM,kCAAmC,EAAM,GAG3D","names":[],"ignoreList":[],"sources":["../../../../../client/simple/src/js/main/mapresult.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { listen } from \"../core/toolkit.ts\";\n\nlisten(\"click\", \".searxng_init_map\", async function (this: HTMLElement, event: Event) {\n  event.preventDefault();\n  this.classList.remove(\"searxng_init_map\");\n\n  const {\n    View,\n    OlMap,\n    TileLayer,\n    VectorLayer,\n    OSM,\n    VectorSource,\n    Style,\n    Stroke,\n    Fill,\n    Circle,\n    fromLonLat,\n    GeoJSON,\n    Feature,\n    Point\n  } = await import(\"../pkg/ol.ts\");\n  import(\"ol/ol.css\");\n\n  const { leafletTarget: target, mapLon, mapLat, mapGeojson } = this.dataset;\n\n  const lon = Number.parseFloat(mapLon || \"0\");\n  const lat = Number.parseFloat(mapLat || \"0\");\n  const view = new View({ maxZoom: 16, enableRotation: false });\n  const map = new OlMap({\n    target: target,\n    layers: [new TileLayer({ source: new OSM({ maxZoom: 16 }) })],\n    view: view\n  });\n\n  try {\n    const markerSource = new VectorSource({\n      features: [\n        new Feature({\n          geometry: new Point(fromLonLat([lon, lat]))\n        })\n      ]\n    });\n\n    const markerLayer = new VectorLayer({\n      source: markerSource,\n      style: new Style({\n        image: new Circle({\n          radius: 6,\n          fill: new Fill({ color: \"#3050ff\" })\n        })\n      })\n    });\n\n    map.addLayer(markerLayer);\n  } catch (error) {\n    console.error(\"Failed to create marker layer:\", error);\n  }\n\n  if (mapGeojson) {\n    try {\n      const geoSource = new VectorSource({\n        features: new GeoJSON().readFeatures(JSON.parse(mapGeojson), {\n          dataProjection: \"EPSG:4326\",\n          featureProjection: \"EPSG:3857\"\n        })\n      });\n\n      const geoLayer = new VectorLayer({\n        source: geoSource,\n        style: new Style({\n          stroke: new Stroke({ color: \"#3050ff\", width: 2 }),\n          fill: new Fill({ color: \"#3050ff33\" })\n        })\n      });\n\n      map.addLayer(geoLayer);\n\n      view.fit(geoSource.getExtent(), { padding: [20, 20, 20, 20] });\n    } catch (error) {\n      console.error(\"Failed to create GeoJSON layer:\", error);\n    }\n  }\n});\n"],"file":"js/mapresult.min.js"}