@defra/forms-engine-plugin 5.0.0-alpha → 5.0.0-alpha.1

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.
Files changed (51) hide show
  1. package/.public/assets-manifest.json +3 -5
  2. package/.public/javascripts/im-core.min.js +2 -0
  3. package/.public/javascripts/im-core.min.js.map +1 -0
  4. package/.public/javascripts/shared.min.js +1 -1
  5. package/.public/javascripts/shared.min.js.map +1 -1
  6. package/.public/javascripts/vendor/@defra.min.js +1 -1
  7. package/.public/javascripts/vendor/@defra.min.js.map +1 -1
  8. package/.public/stylesheets/application.min.css +1 -1
  9. package/.public/stylesheets/application.min.css.map +1 -1
  10. package/.server/client/javascripts/geospatial-map.js +8 -6
  11. package/.server/client/javascripts/geospatial-map.js.map +1 -1
  12. package/.server/client/javascripts/location-map.js +8 -1
  13. package/.server/client/javascripts/location-map.js.map +1 -1
  14. package/.server/client/javascripts/map.d.ts +6 -0
  15. package/.server/client/javascripts/map.js +10 -0
  16. package/.server/client/javascripts/map.js.map +1 -1
  17. package/.server/client/javascripts/sssi-dataset.d.ts +34 -0
  18. package/.server/client/javascripts/sssi-dataset.js +101 -0
  19. package/.server/client/javascripts/sssi-dataset.js.map +1 -0
  20. package/.server/client/stylesheets/shared.scss +0 -2
  21. package/.server/server/plugins/engine/components/EastingNorthingField.d.ts +2 -0
  22. package/.server/server/plugins/engine/components/GeospatialField.d.ts +1 -0
  23. package/.server/server/plugins/engine/components/GeospatialField.js +2 -0
  24. package/.server/server/plugins/engine/components/GeospatialField.js.map +1 -1
  25. package/.server/server/plugins/engine/components/LatLongField.d.ts +2 -0
  26. package/.server/server/plugins/engine/components/LocationFieldHelpers.d.ts +5 -0
  27. package/.server/server/plugins/engine/components/LocationFieldHelpers.js +12 -1
  28. package/.server/server/plugins/engine/components/LocationFieldHelpers.js.map +1 -1
  29. package/.server/server/plugins/engine/views/components/_location-field-base.html +3 -1
  30. package/.server/server/plugins/engine/views/components/geospatialfield.html +4 -1
  31. package/.server/server/plugins/map/routes/index.js +1 -1
  32. package/.server/server/plugins/map/routes/index.js.map +1 -1
  33. package/.server/server/plugins/map/types.d.ts +1 -25
  34. package/.server/server/plugins/map/types.js +1 -16
  35. package/.server/server/plugins/map/types.js.map +1 -1
  36. package/package.json +3 -3
  37. package/src/client/javascripts/geospatial-map.js +10 -6
  38. package/src/client/javascripts/location-map.js +11 -0
  39. package/src/client/javascripts/map.js +10 -0
  40. package/src/client/javascripts/sssi-dataset.js +106 -0
  41. package/src/client/stylesheets/shared.scss +0 -2
  42. package/src/server/plugins/engine/components/GeospatialField.ts +2 -0
  43. package/src/server/plugins/engine/components/LocationFieldHelpers.ts +21 -1
  44. package/src/server/plugins/engine/views/components/_location-field-base.html +3 -1
  45. package/src/server/plugins/engine/views/components/geospatialfield.html +4 -1
  46. package/src/server/plugins/map/routes/index.js +1 -1
  47. package/src/server/plugins/map/types.js +1 -16
  48. package/.public/javascripts/im-search-plugin.min.js +0 -2
  49. package/.public/javascripts/im-search-plugin.min.js.map +0 -1
  50. package/.public/javascripts/vendor/preact.min.js +0 -2
  51. package/.public/javascripts/vendor/preact.min.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fs","resolve","GeospatialFieldOptionsCountryEnum","StatusCodes","Joi","getAccessToken","find","get","request","httpRequest","filePath","import","meta","dirname","countries","JSON","parse","readFileSync","countrySchema","string","valid","Object","values","getRoutes","options","mapStyleResourceRoutes","mapProxyRoute","tileProxyRoute","geocodeProxyRoute","getGeospatialCountries","method","path","handler","h","query","targetUrl","URL","decodeURIComponent","url","token","searchParams","set","proxyResponse","toString","headers","Authorization","buffer","payload","contentType","res","response","type","auth","validate","object","keys","required","optional","z","y","x","params","getBuffer","Accept","json","gunzip","statusCode","OK","valueOf","code","header","_h","data","ordnanceSurveyApiKey","directory","omit","only","features","filter","feature","id"],"sources":["../../../../../src/server/plugins/map/routes/index.js"],"sourcesContent":["import fs from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport { GeospatialFieldOptionsCountryEnum } from '@defra/forms-model'\nimport { StatusCodes } from 'http-status-codes'\nimport Joi from 'joi'\n\nimport { getAccessToken } from '~/src/server/plugins/map/routes/get-os-token.js'\nimport { find } from '~/src/server/plugins/map/service.js'\nimport {\n get,\n request as httpRequest\n} from '~/src/server/services/httpService.js'\n\nconst filePath = resolve(import.meta.dirname, './vts/countries.geojson')\n\n/**\n * @type {FeatureCollection}\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nexport const countries = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n\nexport const countrySchema = Joi.string().valid(\n ...Object.values(GeospatialFieldOptionsCountryEnum)\n)\n\n/**\n * Gets the map support routes\n * @param {MapConfiguration} options - ordnance survey names api key\n */\nexport function getRoutes(options) {\n return [\n mapStyleResourceRoutes(),\n mapProxyRoute(options),\n tileProxyRoute(options),\n geocodeProxyRoute(options),\n getGeospatialCountries()\n ]\n}\n\n/**\n * Proxies ordnance survey requests from the front end to api.os.com\n * Used for the VTS map source by forwarding on the request\n * and adding the auth token and SRS (spatial reference system)\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction mapProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/map-proxy',\n handler: async (request, h) => {\n const { query } = request\n const targetUrl = new URL(decodeURIComponent(query.url))\n const token = await getAccessToken(options)\n\n targetUrl.searchParams.set('srs', '3857')\n\n const proxyResponse = await httpRequest('get', targetUrl.toString(), {\n headers: {\n Authorization: `Bearer ${token}`\n }\n })\n const buffer = proxyResponse.payload\n const contentType = proxyResponse.res.headers['content-type']\n const response = h.response(buffer)\n\n if (contentType) {\n response.type(contentType)\n }\n\n return response\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n url: Joi.string().required()\n })\n .optional()\n }\n }\n }\n}\n\n/**\n * Proxies ordnance survey requests from the front end to api.os.uk\n * Used for VTS map tiles forwarding on the request and adding the auth token\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction tileProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/tile/{z}/{y}/{x}.pbf',\n handler: async (request, h) => {\n const { z, y, x } = request.params\n const token = await getAccessToken(options)\n\n const url = `https://api.os.uk/maps/vector/v1/vts/tile/${z}/${y}/${x}.pbf?srs=3857`\n\n const getBuffer = /** @type {typeof get<Buffer>} */ (get)\n\n const { payload, res } = await getBuffer(url, {\n headers: {\n Authorization: `Bearer ${token}`,\n Accept: 'application/x-protobuf'\n },\n json: false,\n gunzip: true\n })\n\n if (res.statusCode && res.statusCode !== StatusCodes.OK.valueOf()) {\n return h.response('Tile fetch failed').code(res.statusCode)\n }\n\n return h\n .response(payload)\n .type('application/x-protobuf')\n .header('Cache-Control', 'public, max-age=86400')\n },\n options: {\n auth: false\n }\n }\n}\n\n/**\n * Proxies ordnance survey geocode requests from the front end to api.os.uk\n * Used for the gazzeteer address lookup to find name from query strings like postcode and place names\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapGeocodeGetRequestRefs>}\n */\nfunction geocodeProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/geocode-proxy',\n async handler(request, _h) {\n const { query } = request\n const data = await find(query.query, options.ordnanceSurveyApiKey)\n\n return data\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n query: Joi.string().required()\n })\n .required()\n }\n }\n }\n}\n\n/**\n * Resource routes to return sprites and glyphs\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction mapStyleResourceRoutes() {\n return {\n method: 'GET',\n path: '/api/maps/vts/{path*}',\n options: {\n auth: false,\n handler: {\n directory: {\n path: resolve(import.meta.dirname, './vts')\n }\n }\n }\n }\n}\n\n/**\n * Resource routes to return sprites and glyphs\n * @returns {ServerRoute<GeospatialCountriesGetRequestRefs>}\n */\nfunction getGeospatialCountries() {\n return {\n method: 'GET',\n path: '/api/maps/countries.geojson',\n handler: (request) => {\n const { omit, only } = request.query\n\n if (omit) {\n return {\n ...countries,\n features: countries.features.filter((feature) => feature.id !== omit)\n }\n }\n\n if (only) {\n return {\n ...countries,\n features: countries.features.filter((feature) => feature.id === only)\n }\n }\n\n return countries\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n omit: countrySchema.optional(),\n only: countrySchema.optional()\n })\n .optional()\n }\n }\n }\n}\n\n/**\n * @import { ServerRoute } from '@hapi/hapi'\n * @import { FeatureCollection } from 'geojson'\n * @import { MapConfiguration, MapProxyGetRequestRefs, MapGeocodeGetRequestRefs, MapReverseGeocodeGetRequestRefs, GeospatialCountriesGetRequestRefs } from '~/src/server/plugins/map/types.js'\n */\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,SAAS;AACxB,SAASC,OAAO,QAAQ,WAAW;AAEnC,SAASC,iCAAiC,QAAQ,oBAAoB;AACtE,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,GAAG,MAAM,KAAK;AAErB,SAASC,cAAc;AACvB,SAASC,IAAI;AACb,SACEC,GAAG,EACHC,OAAO,IAAIC,WAAW;AAGxB,MAAMC,QAAQ,GAAGT,OAAO,CAACU,MAAM,CAACC,IAAI,CAACC,OAAO,EAAE,yBAAyB,CAAC;;AAExE;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAAChB,EAAE,CAACiB,YAAY,CAACP,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEtE,OAAO,MAAMQ,aAAa,GAAGd,GAAG,CAACe,MAAM,CAAC,CAAC,CAACC,KAAK,CAC7C,GAAGC,MAAM,CAACC,MAAM,CAACpB,iCAAiC,CACpD,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASqB,SAASA,CAACC,OAAO,EAAE;EACjC,OAAO,CACLC,sBAAsB,CAAC,CAAC,EACxBC,aAAa,CAACF,OAAO,CAAC,EACtBG,cAAc,CAACH,OAAO,CAAC,EACvB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AAEC,OAAO,IAAKA,OAAO,CAACC,EAAE,KAAKL,IAAI;QACtE,CAAC;MACH;MAEA,IAAIC,IAAI,EAAE;QACR,OAAO;UACL,GAAG9D,SAAS;UACZ+D,QAAQ,EAAE/D,SAAS,CAAC+D,QAAQ,CAACC,MAAM,CAAEC,OAAO,IAAKA,OAAO,CAACC,EAAE,KAAKJ,IAAI;QACtE,CAAC;MACH;MAEA,OAAO9D,SAAS;IAClB,CAAC;IACDU,OAAO,EAAE;MACP4B,IAAI,EAAE,KAAK;MACXC,QAAQ,EAAE;QACRnB,KAAK,EAAE9B,GAAG,CAACkD,MAAM,CAAC,CAAC,CAChBC,IAAI,CAAC;UACJoB,IAAI,EAAEzD,aAAa,CAACuC,QAAQ,CAAC,CAAC;UAC9BmB,IAAI,EAAE1D,aAAa,CAACuC,QAAQ,CAAC;QAC/B,CAAC,CAAC,CACDA,QAAQ,CAAC;MACd;IACF;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["fs","resolve","GeospatialFieldOptionsCountryEnum","StatusCodes","Joi","getAccessToken","find","get","request","httpRequest","filePath","import","meta","dirname","countries","JSON","parse","readFileSync","countrySchema","string","valid","Object","values","getRoutes","options","mapStyleResourceRoutes","mapProxyRoute","tileProxyRoute","geocodeProxyRoute","getGeospatialCountries","method","path","handler","h","query","targetUrl","URL","decodeURIComponent","url","token","searchParams","set","proxyResponse","toString","headers","Authorization","buffer","payload","contentType","res","response","type","auth","validate","object","keys","required","optional","z","y","x","params","getBuffer","Accept","json","gunzip","statusCode","OK","valueOf","code","header","_h","data","ordnanceSurveyApiKey","directory","omit","only","features","filter","feature","id"],"sources":["../../../../../src/server/plugins/map/routes/index.js"],"sourcesContent":["import fs from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport { GeospatialFieldOptionsCountryEnum } from '@defra/forms-model'\nimport { StatusCodes } from 'http-status-codes'\nimport Joi from 'joi'\n\nimport { getAccessToken } from '~/src/server/plugins/map/routes/get-os-token.js'\nimport { find } from '~/src/server/plugins/map/service.js'\nimport {\n get,\n request as httpRequest\n} from '~/src/server/services/httpService.js'\n\nconst filePath = resolve(import.meta.dirname, './vts/countries.geojson')\n\n/**\n * @type {FeatureCollection}\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nexport const countries = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n\nexport const countrySchema = Joi.string().valid(\n ...Object.values(GeospatialFieldOptionsCountryEnum)\n)\n\n/**\n * Gets the map support routes\n * @param {MapConfiguration} options - ordnance survey names api key\n */\nexport function getRoutes(options) {\n return [\n mapStyleResourceRoutes(),\n mapProxyRoute(options),\n tileProxyRoute(options),\n geocodeProxyRoute(options),\n getGeospatialCountries()\n ]\n}\n\n/**\n * Proxies ordnance survey requests from the front end to api.os.com\n * Used for the VTS map source by forwarding on the request\n * and adding the auth token and SRS (spatial reference system)\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction mapProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/map-proxy',\n handler: async (request, h) => {\n const { query } = request\n const targetUrl = new URL(decodeURIComponent(query.url))\n const token = await getAccessToken(options)\n\n targetUrl.searchParams.set('srs', '3857')\n\n const proxyResponse = await httpRequest('get', targetUrl.toString(), {\n headers: {\n Authorization: `Bearer ${token}`\n }\n })\n const buffer = proxyResponse.payload\n const contentType = proxyResponse.res.headers['content-type']\n const response = h.response(buffer)\n\n if (contentType) {\n response.type(contentType)\n }\n\n return response\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n url: Joi.string().required()\n })\n .optional()\n }\n }\n }\n}\n\n/**\n * Proxies ordnance survey requests from the front end to api.os.uk\n * Used for VTS map tiles forwarding on the request and adding the auth token\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction tileProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/tile/{z}/{y}/{x}.pbf',\n handler: async (request, h) => {\n const { z, y, x } = request.params\n const token = await getAccessToken(options)\n\n const url = `https://api.os.uk/maps/vector/v1/vts/tile/${z}/${y}/${x}.pbf?srs=3857`\n\n const getBuffer = /** @type {typeof get<Buffer>} */ (get)\n\n const { payload, res } = await getBuffer(url, {\n headers: {\n Authorization: `Bearer ${token}`,\n Accept: 'application/x-protobuf'\n },\n json: false,\n gunzip: true\n })\n\n if (res.statusCode && res.statusCode !== StatusCodes.OK.valueOf()) {\n return h.response('Tile fetch failed').code(res.statusCode)\n }\n\n return h\n .response(payload)\n .type('application/x-protobuf')\n .header('Cache-Control', 'public, max-age=86400')\n },\n options: {\n auth: false\n }\n }\n}\n\n/**\n * Proxies ordnance survey geocode requests from the front end to api.os.uk\n * Used for the gazzeteer address lookup to find name from query strings like postcode and place names\n * @param {MapConfiguration} options - the map options\n * @returns {ServerRoute<MapGeocodeGetRequestRefs>}\n */\nfunction geocodeProxyRoute(options) {\n return {\n method: 'GET',\n path: '/api/geocode-proxy',\n async handler(request, _h) {\n const { query } = request\n const data = await find(query.query, options.ordnanceSurveyApiKey)\n\n return data\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n query: Joi.string().required()\n })\n .required()\n }\n }\n }\n}\n\n/**\n * Resource routes to return sprites and glyphs\n * @returns {ServerRoute<MapProxyGetRequestRefs>}\n */\nfunction mapStyleResourceRoutes() {\n return {\n method: 'GET',\n path: '/api/maps/vts/{path*}',\n options: {\n auth: false,\n handler: {\n directory: {\n path: resolve(import.meta.dirname, './vts')\n }\n }\n }\n }\n}\n\n/**\n * Resource routes to return sprites and glyphs\n * @returns {ServerRoute<GeospatialCountriesGetRequestRefs>}\n */\nfunction getGeospatialCountries() {\n return {\n method: 'GET',\n path: '/api/maps/countries.geojson',\n handler: (request) => {\n const { omit, only } = request.query\n\n if (omit) {\n return {\n ...countries,\n features: countries.features.filter((feature) => feature.id !== omit)\n }\n }\n\n if (only) {\n return {\n ...countries,\n features: countries.features.filter((feature) => feature.id === only)\n }\n }\n\n return countries\n },\n options: {\n auth: false,\n validate: {\n query: Joi.object()\n .keys({\n omit: countrySchema.optional(),\n only: countrySchema.optional()\n })\n .optional()\n }\n }\n }\n}\n\n/**\n * @import { ServerRoute } from '@hapi/hapi'\n * @import { FeatureCollection } from 'geojson'\n * @import { MapConfiguration, MapProxyGetRequestRefs, MapGeocodeGetRequestRefs, GeospatialCountriesGetRequestRefs } from '~/src/server/plugins/map/types.js'\n */\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,SAAS;AACxB,SAASC,OAAO,QAAQ,WAAW;AAEnC,SAASC,iCAAiC,QAAQ,oBAAoB;AACtE,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,GAAG,MAAM,KAAK;AAErB,SAASC,cAAc;AACvB,SAASC,IAAI;AACb,SACEC,GAAG,EACHC,OAAO,IAAIC,WAAW;AAGxB,MAAMC,QAAQ,GAAGT,OAAO,CAACU,MAAM,CAACC,IAAI,CAACC,OAAO,EAAE,yBAAyB,CAAC;;AAExE;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAAChB,EAAE,CAACiB,YAAY,CAACP,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEtE,OAAO,MAAMQ,aAAa,GAAGd,GAAG,CAACe,MAAM,CAAC,CAAC,CAACC,KAAK,CAC7C,GAAGC,MAAM,CAACC,MAAM,CAACpB,iCAAiC,CACpD,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASqB,SAASA,CAACC,OAAO,EAAE;EACjC,OAAO,CACLC,sBAAsB,CAAC,CAAC,EACxBC,aAAa,CAACF,OAAO,CAAC,EACtBG,cAAc,CAACH,OAAO,CAAC,EACvBI,iBAAiB,CAACJ,OAAO,CAAC,EAC1BK,sBAAsB,CAAC,CAAC,CACzB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASH,aAAaA,CAACF,OAAO,EAA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AAE/D,SAAS,CAAC+D,QAAQ,CAACC,MAAM,CAAEC,OAAO,IAAKA,OAAO,CAACC,EAAE,KAAKJ,IAAI;QACtE,CAAC;MACH;MAEA,OAAO9D,SAAS;IAClB,CAAC;IACDU,OAAO,EAAE;MACP4B,IAAI,EAAE,KAAK;MACXC,QAAQ,EAAE;QACRnB,KAAK,EAAE9B,GAAG,CAACkD,MAAM,CAAC,CAAC,CAChBC,IAAI,CAAC;UACJoB,IAAI,EAAEzD,aAAa,CAACuC,QAAQ,CAAC,CAAC;UAC9BmB,IAAI,EAAE1D,aAAa,CAACuC,QAAQ,CAAC;QAC/B,CAAC,CAAC,CACDA,QAAQ,CAAC;MACd;IACF;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -20,19 +20,6 @@ export type MapGeocodeQuery = {
20
20
  */
21
21
  query: string;
22
22
  };
23
- /**
24
- * Map reverse geocode query params
25
- */
26
- export type MapReverseGeocodeQuery = {
27
- /**
28
- * - the Easting point
29
- */
30
- easting: number;
31
- /**
32
- * - the Northing point
33
- */
34
- northing: number;
35
- };
36
23
  /**
37
24
  * Geospatial countries query params
38
25
  */
@@ -64,15 +51,6 @@ export type MapGeocodeGetRequestRefs = {
64
51
  */
65
52
  Query: MapGeocodeQuery;
66
53
  };
67
- /**
68
- * Map reverse geocode get request
69
- */
70
- export type MapReverseGeocodeGetRequestRefs = {
71
- /**
72
- * - Request query
73
- */
74
- Query: MapReverseGeocodeQuery;
75
- };
76
54
  /**
77
55
  * Map countries geojson get request
78
56
  */
@@ -84,11 +62,9 @@ export type GeospatialCountriesGetRequestRefs = {
84
62
  };
85
63
  export type MapProxyRequestRefs = MapProxyGetRequestRefs;
86
64
  export type MapGeocodeRequestRefs = MapGeocodeGetRequestRefs;
87
- export type MapReverseGeocodeRequestRefs = MapReverseGeocodeGetRequestRefs;
88
65
  export type MapProxyGetRequest = Request<MapGeocodeGetRequestRefs>;
89
66
  export type MapGeocodeGetRequest = Request<MapGeocodeGetRequestRefs>;
90
- export type MapReverseGeocodeGetRequest = Request<MapReverseGeocodeGetRequestRefs>;
91
- export type MapRequest = MapProxyGetRequest | MapGeocodeGetRequest | MapReverseGeocodeGetRequest;
67
+ export type MapRequest = MapProxyGetRequest | MapGeocodeGetRequest;
92
68
  export type OsNamesFindResponse = {
93
69
  /**
94
70
  * - Metadata about the search request and results.
@@ -21,13 +21,6 @@
21
21
  * @property {string} query - name query
22
22
  */
23
23
 
24
- /**
25
- * Map reverse geocode query params
26
- * @typedef {object} MapReverseGeocodeQuery
27
- * @property {number} easting - the Easting point
28
- * @property {number} northing - the Northing point
29
- */
30
-
31
24
  /**
32
25
  * Geospatial countries query params
33
26
  * @typedef {object} GeospatialCountriesQuery
@@ -47,12 +40,6 @@
47
40
  * @property {MapGeocodeQuery} Query - Request query
48
41
  */
49
42
 
50
- /**
51
- * Map reverse geocode get request
52
- * @typedef {object} MapReverseGeocodeGetRequestRefs
53
- * @property {MapReverseGeocodeQuery} Query - Request query
54
- */
55
-
56
43
  /**
57
44
  * Map countries geojson get request
58
45
  * @typedef {object} GeospatialCountriesGetRequestRefs
@@ -62,11 +49,9 @@
62
49
  /**
63
50
  * @typedef {MapProxyGetRequestRefs} MapProxyRequestRefs
64
51
  * @typedef {MapGeocodeGetRequestRefs} MapGeocodeRequestRefs
65
- * @typedef {MapReverseGeocodeGetRequestRefs} MapReverseGeocodeRequestRefs
66
52
  * @typedef {Request<MapGeocodeGetRequestRefs>} MapProxyGetRequest
67
53
  * @typedef {Request<MapGeocodeGetRequestRefs>} MapGeocodeGetRequest
68
- * @typedef {Request<MapReverseGeocodeGetRequestRefs>} MapReverseGeocodeGetRequest
69
- * @typedef {MapProxyGetRequest | MapGeocodeGetRequest | MapReverseGeocodeGetRequest} MapRequest
54
+ * @typedef {MapProxyGetRequest | MapGeocodeGetRequest } MapRequest
70
55
  */
71
56
 
72
57
  //
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/server/plugins/map/types.js"],"sourcesContent":["/**\n * @typedef {{\n * ordnanceSurveyApiKey: string\n * ordnanceSurveyApiSecret: string\n * }} MapConfiguration\n */\n\n//\n// Route types\n//\n\n/**\n * Map proxy query params\n * @typedef {object} MapProxyQuery\n * @property {string} url - the proxied url\n */\n\n/**\n * Map geocode query params\n * @typedef {object} MapGeocodeQuery\n * @property {string} query - name query\n */\n\n/**\n * Map reverse geocode query params\n * @typedef {object} MapReverseGeocodeQuery\n * @property {number} easting - the Easting point\n * @property {number} northing - the Northing point\n */\n\n/**\n * Geospatial countries query params\n * @typedef {object} GeospatialCountriesQuery\n * @property {string} omit - the country to omit\n * @property {string} only - the country to include\n */\n\n/**\n * Map geocode get request\n * @typedef {object} MapProxyGetRequestRefs\n * @property {MapProxyQuery} Query - Request query\n */\n\n/**\n * Map geocode get request\n * @typedef {object} MapGeocodeGetRequestRefs\n * @property {MapGeocodeQuery} Query - Request query\n */\n\n/**\n * Map reverse geocode get request\n * @typedef {object} MapReverseGeocodeGetRequestRefs\n * @property {MapReverseGeocodeQuery} Query - Request query\n */\n\n/**\n * Map countries geojson get request\n * @typedef {object} GeospatialCountriesGetRequestRefs\n * @property {GeospatialCountriesQuery} Query - Request query\n */\n\n/**\n * @typedef {MapProxyGetRequestRefs} MapProxyRequestRefs\n * @typedef {MapGeocodeGetRequestRefs} MapGeocodeRequestRefs\n * @typedef {MapReverseGeocodeGetRequestRefs} MapReverseGeocodeRequestRefs\n * @typedef {Request<MapGeocodeGetRequestRefs>} MapProxyGetRequest\n * @typedef {Request<MapGeocodeGetRequestRefs>} MapGeocodeGetRequest\n * @typedef {Request<MapReverseGeocodeGetRequestRefs>} MapReverseGeocodeGetRequest\n * @typedef {MapProxyGetRequest | MapGeocodeGetRequest | MapReverseGeocodeGetRequest} MapRequest\n */\n\n//\n// Service types\n//\n\n/**\n * @typedef {object} OsNamesFindResponse\n * @property {OsNamesFindHeader} header - Metadata about the search request and results.\n * @property {OsNamesFindResult[]} results - An array of matched place records from the search.\n */\n\n/**\n * @typedef {object} OsNamesFindHeader\n * @property {string} uri - The query URI (usually same as search text).\n * @property {string} query - The original text query string passed to the API.\n * @property {string} format - The response format returned (e.g., \"JSON\").\n * @property {number} maxresults - The maximum number of results requested.\n * @property {number} offset - The offset used in the search results.\n * @property {number} totalresults - The total number of results that matched the query.\n * @property {string} filter - The original filter string passed to the API.\n */\n\n/**\n * @typedef {object} OsNamesFindGazetteerEntry\n * @property {string} ID - Unique identifier for the place/feature.\n * @property {string} NAMES_URI - A URI (identifier) for this named feature.\n * @property {string} NAME1 - Primary name of the feature.\n * @property {string} TYPE - General type classification of the feature.\n * @property {string} LOCAL_TYPE - Local or more specific type classification.\n * @property {number} GEOMETRY_X - Easting coordinate (British National Grid).\n * @property {number} GEOMETRY_Y - Northing coordinate (British National Grid).\n * @property {number} MOST_DETAIL_VIEW_RES - Most detailed resolution available.\n * @property {number} LEAST_DETAIL_VIEW_RES - Least detailed resolution available.\n * @property {number} [MBR_XMIN] - Minimum bounding box X (easting).\n * @property {number} [MBR_YMIN] - Minimum bounding box Y (northing).\n * @property {number} [MBR_XMAX] - Maximum bounding box X (easting).\n * @property {number} [MBR_YMAX] - Maximum bounding box Y (northing).\n * @property {string} [DISTRICT_BOROUGH] - (Optional) District borough.\n * @property {string} [DISTRICT_BOROUGH_URI] - (Optional) URI for the district borough.\n * @property {string} [DISTRICT_BOROUGH_TYPE] - (Optional) Type of the district borough.\n * @property {string} [POSTCODE_DISTRICT] - (Optional) Postcode district.\n * @property {string} [POSTCODE_DISTRICT_URI] - (Optional) URI for the postcode district.\n * @property {string} [POPULATED_PLACE] - (Optional) Name of associated populated place.\n * @property {string} [POPULATED_PLACE_URI] - (Optional) URI of populated place.\n * @property {string} [POPULATED_PLACE_TYPE] - (Optional) Type of populated place.\n * @property {string} [COUNTY_UNITARY] - (Optional) County or unitary authority name.\n * @property {string} [COUNTY_UNITARY_URI] - (Optional) URI for county/unitary authority.\n * @property {string} [COUNTY_UNITARY_TYPE] - (Optional) Classification of county/unitary authority.\n * @property {string} [REGION] - (Optional) Region name.\n * @property {string} [REGION_URI] - (Optional) URI for region.\n * @property {string} [COUNTRY] - (Optional) Country name.\n * @property {string} [COUNTRY_URI] - (Optional) URI for country.\n */\n\n/**\n * OS names GAZETTEER_ENTRY response\n * @typedef {object} OsNamesFindResult\n * @property {OsNamesFindGazetteerEntry} GAZETTEER_ENTRY - Gazetteer entry\n */\n\n/**\n * @import { Request } from '@hapi/hapi'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/server/plugins/map/types.js"],"sourcesContent":["/**\n * @typedef {{\n * ordnanceSurveyApiKey: string\n * ordnanceSurveyApiSecret: string\n * }} MapConfiguration\n */\n\n//\n// Route types\n//\n\n/**\n * Map proxy query params\n * @typedef {object} MapProxyQuery\n * @property {string} url - the proxied url\n */\n\n/**\n * Map geocode query params\n * @typedef {object} MapGeocodeQuery\n * @property {string} query - name query\n */\n\n/**\n * Geospatial countries query params\n * @typedef {object} GeospatialCountriesQuery\n * @property {string} omit - the country to omit\n * @property {string} only - the country to include\n */\n\n/**\n * Map geocode get request\n * @typedef {object} MapProxyGetRequestRefs\n * @property {MapProxyQuery} Query - Request query\n */\n\n/**\n * Map geocode get request\n * @typedef {object} MapGeocodeGetRequestRefs\n * @property {MapGeocodeQuery} Query - Request query\n */\n\n/**\n * Map countries geojson get request\n * @typedef {object} GeospatialCountriesGetRequestRefs\n * @property {GeospatialCountriesQuery} Query - Request query\n */\n\n/**\n * @typedef {MapProxyGetRequestRefs} MapProxyRequestRefs\n * @typedef {MapGeocodeGetRequestRefs} MapGeocodeRequestRefs\n * @typedef {Request<MapGeocodeGetRequestRefs>} MapProxyGetRequest\n * @typedef {Request<MapGeocodeGetRequestRefs>} MapGeocodeGetRequest\n * @typedef {MapProxyGetRequest | MapGeocodeGetRequest } MapRequest\n */\n\n//\n// Service types\n//\n\n/**\n * @typedef {object} OsNamesFindResponse\n * @property {OsNamesFindHeader} header - Metadata about the search request and results.\n * @property {OsNamesFindResult[]} results - An array of matched place records from the search.\n */\n\n/**\n * @typedef {object} OsNamesFindHeader\n * @property {string} uri - The query URI (usually same as search text).\n * @property {string} query - The original text query string passed to the API.\n * @property {string} format - The response format returned (e.g., \"JSON\").\n * @property {number} maxresults - The maximum number of results requested.\n * @property {number} offset - The offset used in the search results.\n * @property {number} totalresults - The total number of results that matched the query.\n * @property {string} filter - The original filter string passed to the API.\n */\n\n/**\n * @typedef {object} OsNamesFindGazetteerEntry\n * @property {string} ID - Unique identifier for the place/feature.\n * @property {string} NAMES_URI - A URI (identifier) for this named feature.\n * @property {string} NAME1 - Primary name of the feature.\n * @property {string} TYPE - General type classification of the feature.\n * @property {string} LOCAL_TYPE - Local or more specific type classification.\n * @property {number} GEOMETRY_X - Easting coordinate (British National Grid).\n * @property {number} GEOMETRY_Y - Northing coordinate (British National Grid).\n * @property {number} MOST_DETAIL_VIEW_RES - Most detailed resolution available.\n * @property {number} LEAST_DETAIL_VIEW_RES - Least detailed resolution available.\n * @property {number} [MBR_XMIN] - Minimum bounding box X (easting).\n * @property {number} [MBR_YMIN] - Minimum bounding box Y (northing).\n * @property {number} [MBR_XMAX] - Maximum bounding box X (easting).\n * @property {number} [MBR_YMAX] - Maximum bounding box Y (northing).\n * @property {string} [DISTRICT_BOROUGH] - (Optional) District borough.\n * @property {string} [DISTRICT_BOROUGH_URI] - (Optional) URI for the district borough.\n * @property {string} [DISTRICT_BOROUGH_TYPE] - (Optional) Type of the district borough.\n * @property {string} [POSTCODE_DISTRICT] - (Optional) Postcode district.\n * @property {string} [POSTCODE_DISTRICT_URI] - (Optional) URI for the postcode district.\n * @property {string} [POPULATED_PLACE] - (Optional) Name of associated populated place.\n * @property {string} [POPULATED_PLACE_URI] - (Optional) URI of populated place.\n * @property {string} [POPULATED_PLACE_TYPE] - (Optional) Type of populated place.\n * @property {string} [COUNTY_UNITARY] - (Optional) County or unitary authority name.\n * @property {string} [COUNTY_UNITARY_URI] - (Optional) URI for county/unitary authority.\n * @property {string} [COUNTY_UNITARY_TYPE] - (Optional) Classification of county/unitary authority.\n * @property {string} [REGION] - (Optional) Region name.\n * @property {string} [REGION_URI] - (Optional) URI for region.\n * @property {string} [COUNTRY] - (Optional) Country name.\n * @property {string} [COUNTRY_URI] - (Optional) URI for country.\n */\n\n/**\n * OS names GAZETTEER_ENTRY response\n * @typedef {object} OsNamesFindResult\n * @property {OsNamesFindGazetteerEntry} GAZETTEER_ENTRY - Gazetteer entry\n */\n\n/**\n * @import { Request } from '@hapi/hapi'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-engine-plugin",
3
- "version": "5.0.0-alpha",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "Defra forms engine",
5
5
  "type": "module",
6
6
  "files": [
@@ -87,9 +87,9 @@
87
87
  },
88
88
  "license": "SEE LICENSE IN LICENSE",
89
89
  "dependencies": {
90
- "@defra/forms-model": "^3.0.686",
90
+ "@defra/forms-model": "^3.0.687",
91
91
  "@defra/hapi-tracing": "^1.29.0",
92
- "@defra/interactive-map": "^0.0.22-alpha",
92
+ "@defra/interactive-map": "^0.0.33-alpha",
93
93
  "@elastic/ecs-pino-format": "^1.5.0",
94
94
  "@hapi/boom": "^10.0.1",
95
95
  "@hapi/bourne": "^3.0.0",
@@ -1,8 +1,6 @@
1
1
  // @ts-expect-error - no types
2
2
  import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'
3
3
  // @ts-expect-error - no types
4
- import { maplibreLayerAdapter } from '@defra/interactive-map/plugins/datasets/adapters/maplibre'
5
- // @ts-expect-error - no types
6
4
  import createDrawPlugin from '@defra/interactive-map/plugins/draw-ml'
7
5
  import { bbox } from '@turf/bbox'
8
6
 
@@ -11,8 +9,10 @@ import {
11
9
  createMap,
12
10
  defaultConfig,
13
11
  getCentroidGridRef,
14
- getCoordinateGridRef
12
+ getCoordinateGridRef,
13
+ getMapLayers
15
14
  } from './map.js'
15
+ import sssiDataset from './sssi-dataset.js'
16
16
  import { formatDelimtedList } from './utils.js'
17
17
 
18
18
  const helpPanelConfig = {
@@ -173,12 +173,12 @@ export function processGeospatial(config, geospatial, index) {
173
173
  const drawPlugin = createDrawPlugin()
174
174
  const plugins = [drawPlugin]
175
175
  const country = geospatial.dataset.country
176
+ const mapLayers = getMapLayers(geospatial.dataset.maplayers)
176
177
 
177
178
  if (country) {
178
179
  // Add the country bounds as a dataset plugin to show the valid area on the map
179
180
  // and provide feedback to the user when they add features outside of the bounds.
180
- const datasetsPlugin = createDatasetsPlugin({
181
- layerAdapter: maplibreLayerAdapter,
181
+ const countriesDatasetPlugin = createDatasetsPlugin({
182
182
  datasets: [
183
183
  {
184
184
  id: 'invalid-area',
@@ -206,7 +206,11 @@ export function processGeospatial(config, geospatial, index) {
206
206
  ]
207
207
  })
208
208
 
209
- plugins.push(datasetsPlugin)
209
+ plugins.push(countriesDatasetPlugin)
210
+ }
211
+
212
+ if (mapLayers.includes('sssi')) {
213
+ plugins.push(createDatasetsPlugin(sssiDataset))
210
214
  }
211
215
 
212
216
  const initConfig = {
@@ -1,13 +1,18 @@
1
+ // @ts-expect-error - no types
2
+ import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'
3
+
1
4
  import {
2
5
  EVENTS,
3
6
  centerMap,
4
7
  createMap,
5
8
  defaultConfig,
6
9
  eastingNorthingToLatLong,
10
+ getMapLayers,
7
11
  latLongToEastingNorthing,
8
12
  latLongToOsGridRef,
9
13
  osGridRefToLatLong
10
14
  } from './map.js'
15
+ import sssiDataset from './sssi-dataset.js'
11
16
 
12
17
  const LOCATION_FIELD_SELECTOR = 'input.govuk-input'
13
18
 
@@ -418,6 +423,12 @@ export function processLocation(config, location, index) {
418
423
 
419
424
  locationInputs.after(mapContainer)
420
425
 
426
+ const mapLayers = getMapLayers(location.dataset.maplayers)
427
+
428
+ if (mapLayers.includes('sssi')) {
429
+ initConfig.plugins = [createDatasetsPlugin(sssiDataset)]
430
+ }
431
+
421
432
  const { map, interactPlugin } = createMap(mapId, initConfig, config)
422
433
 
423
434
  map.on(
@@ -357,6 +357,16 @@ export function centerMap(map, mapProvider, center) {
357
357
  })
358
358
  }
359
359
 
360
+ /**
361
+ * Parse CSV string layers
362
+ * @param {string | undefined} layers
363
+ * @returns {string[]}
364
+ */
365
+ export function getMapLayers(layers) {
366
+ const trimmed = layers?.trim()
367
+ return trimmed ? trimmed.split(',') : []
368
+ }
369
+
360
370
  /**
361
371
  * @typedef {object} InteractiveMap - an instance of a InteractiveMap
362
372
  * @property {Function} on - register callback listeners to map events
@@ -0,0 +1,106 @@
1
+ const style = {
2
+ stroke: '#00897B',
3
+ fillPattern: 'diagonal-cross-hatch',
4
+ fillPatternForegroundColor: '#00897B',
5
+ fillPatternBackgroundColor: 'transparent'
6
+ }
7
+ const minZoom = 12
8
+
9
+ const englandWFS =
10
+ 'https://environment.data.gov.uk/geoservices/datasets/ba8dc201-66ef-4983-9d46-7378af21027e/ogc/features/v1/collections/Sites_of_Special_Scientific_Interest_England/items?f=json'
11
+ const walesWFS =
12
+ 'https://datamap.gov.wales/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=inspire-nrw:NRW_SSSI&outputFormat=application/json&srsName=EPSG:4326'
13
+ const scotlandWFS =
14
+ 'https://services1.arcgis.com/LM9GyVFsughzHdbO/ArcGIS/rest/services/Sites_of_Special_Scientific_Interest/FeatureServer/0/query?f=geojson&where=1%3D1&geometryType=esriGeometryEnvelope&inSR=4326&spatialRel=esriSpatialRelIntersects&returnGeometry=true&outFields=*'
15
+
16
+ /**
17
+ * @type {TransformRequestArgs}
18
+ */
19
+ export function sssiEnglandRequestTransformer(url, { bbox }) {
20
+ const uri = new URL(url)
21
+ uri.searchParams.set('bbox', bbox.join(','))
22
+
23
+ return {
24
+ url: uri.toString()
25
+ }
26
+ }
27
+
28
+ /**
29
+ * @type {TransformRequestArgs}
30
+ */
31
+ export function sssiWalesRequestTransformer(url, { bbox }) {
32
+ const uri = new URL(url)
33
+ uri.searchParams.set('bbox', `${bbox.join(',')},EPSG:4326`)
34
+
35
+ return {
36
+ url: uri.toString()
37
+ }
38
+ }
39
+
40
+ /**
41
+ * @type {TransformRequestArgs}
42
+ */
43
+ export function sssiScotlandRequestTransformer(url, { bbox }) {
44
+ const uri = new URL(url)
45
+ uri.searchParams.set('geometry', bbox.join(','))
46
+
47
+ return {
48
+ url: uri.toString()
49
+ }
50
+ }
51
+
52
+ export default {
53
+ datasets: [
54
+ {
55
+ id: 'sssi-england',
56
+ label: 'Sites of Special Scientific Interest',
57
+ dynamicGeoJSON: {
58
+ url: englandWFS,
59
+ idProperty: 'ref_code',
60
+ transformRequest: sssiEnglandRequestTransformer
61
+ },
62
+ minZoom,
63
+ style,
64
+ showInKey: true,
65
+ showInMenu: false
66
+ },
67
+ {
68
+ id: 'sssi-wales',
69
+ label: 'SSSI Wales',
70
+ dynamicGeoJSON: {
71
+ url: walesWFS,
72
+ idProperty: 'id',
73
+ transformRequest: sssiWalesRequestTransformer
74
+ },
75
+ minZoom,
76
+ style,
77
+ showInKey: false,
78
+ showInMenu: false
79
+ },
80
+ {
81
+ id: 'sssi-scotland',
82
+ label: 'SSSI Scotland',
83
+ dynamicGeoJSON: {
84
+ url: scotlandWFS,
85
+ idProperty: 'OBJECTID',
86
+ transformRequest: sssiScotlandRequestTransformer
87
+ },
88
+ minZoom,
89
+ style,
90
+ showInKey: false,
91
+ showInMenu: false
92
+ }
93
+ ]
94
+ }
95
+
96
+ /**
97
+ * @typedef {object} TransformRequestOptions
98
+ * @property {string[]} bbox - the bounding box coordinates
99
+ */
100
+
101
+ /**
102
+ * Transforms the request URL with bounding box parameters
103
+ * @callback TransformRequestArgs
104
+ * @param {string} url - the request URL
105
+ * @param {TransformRequestOptions} options - the bounding box coordinates
106
+ */
@@ -5,11 +5,9 @@
5
5
  @use "location-fields";
6
6
 
7
7
  @use "@defra/interactive-map/css" as core;
8
- @use "@defra/interactive-map/plugins/interact/css" as interact;
9
8
  @use "@defra/interactive-map/plugins/map-styles/css" as mapStyles;
10
9
  @use "@defra/interactive-map/plugins/search/css" as search;
11
10
  @use "@defra/interactive-map/plugins/scale-bar/css" as scaleBar;
12
- @use "@defra/interactive-map/plugins/draw-ml/css" as drawMl;
13
11
 
14
12
  // Use default GDS Transport font for autocomplete
15
13
  .autocomplete__hint,
@@ -6,6 +6,7 @@ import {
6
6
  FormComponent,
7
7
  isGeospatialState
8
8
  } from './FormComponent.js'
9
+ import { getMapLayers } from './LocationFieldHelpers.js'
9
10
  import { getGeospatialSchema } from './helpers/geospatial.js'
10
11
  import { type RenderContext } from './types.js'
11
12
  import { type Translator } from '../i18n/types.js'
@@ -102,6 +103,7 @@ export class GeospatialField extends FormComponent {
102
103
  ...viewModel,
103
104
  country: this.options.countries?.at(0),
104
105
  geometryTypes: this.options.geometryTypes,
106
+ mapLayers: getMapLayers(this),
105
107
  value
106
108
  }
107
109
  }
@@ -2,7 +2,9 @@ import { type Context, type CustomValidator } from 'joi'
2
2
 
3
3
  import { type EastingNorthingField } from './EastingNorthingField.js'
4
4
  import { isFormValue } from './FormComponent.js'
5
+ import { type GeospatialField } from './GeospatialField.js'
5
6
  import { type LatLongField } from './LatLongField.js'
7
+ import { type OsGridRefField } from './OsGridRefField.js'
6
8
  import {
7
9
  type DateInputItem,
8
10
  type Label,
@@ -87,6 +89,23 @@ export function deduplicateErrorsByHref(
87
89
  )
88
90
  }
89
91
 
92
+ export function getMapLayers(
93
+ component:
94
+ | GeospatialField
95
+ | OsGridRefField
96
+ | LatLongField
97
+ | EastingNorthingField
98
+ ) {
99
+ const { mapLayers } = component.options
100
+ const layers = []
101
+
102
+ if (mapLayers?.sssi) {
103
+ layers.push('sssi')
104
+ }
105
+
106
+ return layers.join(',')
107
+ }
108
+
90
109
  export function getLocationFieldViewModel(
91
110
  component: LocationField,
92
111
  viewModel: ViewModel & {
@@ -167,7 +186,8 @@ export function getLocationFieldViewModel(
167
186
  const result = {
168
187
  ...viewModel,
169
188
  fieldset,
170
- items
189
+ items,
190
+ mapLayers: getMapLayers(component)
171
191
  }
172
192
 
173
193
  if (component.options.instructionText) {
@@ -70,7 +70,9 @@
70
70
 
71
71
  {% set hasErrors = showFieldsetError and component.model.errorMessage %}
72
72
 
73
- <div class="govuk-form-group app-location-field {{ "govuk-form-group--error" if hasErrors }}" data-locationtype="{{component.type | lower}}">
73
+ <div class="govuk-form-group app-location-field {{ "govuk-form-group--error" if hasErrors }}"
74
+ data-locationtype="{{component.type | lower}}"
75
+ data-maplayers="{{component.model.mapLayers}}">
74
76
  {{ govukFieldset({
75
77
  legend: {
76
78
  text: component.model.fieldset.legend.text,
@@ -1,7 +1,10 @@
1
1
  {% from "govuk/components/textarea/macro.njk" import govukTextarea %}
2
2
 
3
3
  {% macro GeospatialField(component) %}
4
- <div class="app-geospatial-field" data-country="{{component.model.country}}" data-geometryTypes="{{component.model.geometryTypes}}">
4
+ <div class="app-geospatial-field"
5
+ data-country="{{component.model.country}}"
6
+ data-geometryTypes="{{component.model.geometryTypes}}"
7
+ data-maplayers="{{component.model.mapLayers}}">
5
8
  {{ govukTextarea(component.model) }}
6
9
  </div>
7
10
  {% endmacro %}
@@ -218,5 +218,5 @@ function getGeospatialCountries() {
218
218
  /**
219
219
  * @import { ServerRoute } from '@hapi/hapi'
220
220
  * @import { FeatureCollection } from 'geojson'
221
- * @import { MapConfiguration, MapProxyGetRequestRefs, MapGeocodeGetRequestRefs, MapReverseGeocodeGetRequestRefs, GeospatialCountriesGetRequestRefs } from '../types.js'
221
+ * @import { MapConfiguration, MapProxyGetRequestRefs, MapGeocodeGetRequestRefs, GeospatialCountriesGetRequestRefs } from '../types.js'
222
222
  */
@@ -21,13 +21,6 @@
21
21
  * @property {string} query - name query
22
22
  */
23
23
 
24
- /**
25
- * Map reverse geocode query params
26
- * @typedef {object} MapReverseGeocodeQuery
27
- * @property {number} easting - the Easting point
28
- * @property {number} northing - the Northing point
29
- */
30
-
31
24
  /**
32
25
  * Geospatial countries query params
33
26
  * @typedef {object} GeospatialCountriesQuery
@@ -47,12 +40,6 @@
47
40
  * @property {MapGeocodeQuery} Query - Request query
48
41
  */
49
42
 
50
- /**
51
- * Map reverse geocode get request
52
- * @typedef {object} MapReverseGeocodeGetRequestRefs
53
- * @property {MapReverseGeocodeQuery} Query - Request query
54
- */
55
-
56
43
  /**
57
44
  * Map countries geojson get request
58
45
  * @typedef {object} GeospatialCountriesGetRequestRefs
@@ -62,11 +49,9 @@
62
49
  /**
63
50
  * @typedef {MapProxyGetRequestRefs} MapProxyRequestRefs
64
51
  * @typedef {MapGeocodeGetRequestRefs} MapGeocodeRequestRefs
65
- * @typedef {MapReverseGeocodeGetRequestRefs} MapReverseGeocodeRequestRefs
66
52
  * @typedef {Request<MapGeocodeGetRequestRefs>} MapProxyGetRequest
67
53
  * @typedef {Request<MapGeocodeGetRequestRefs>} MapGeocodeGetRequest
68
- * @typedef {Request<MapReverseGeocodeGetRequestRefs>} MapReverseGeocodeGetRequest
69
- * @typedef {MapProxyGetRequest | MapGeocodeGetRequest | MapReverseGeocodeGetRequest} MapRequest
54
+ * @typedef {MapProxyGetRequest | MapGeocodeGetRequest } MapRequest
70
55
  */
71
56
 
72
57
  //
@@ -1,2 +0,0 @@
1
- (self.webpackChunk=self.webpackChunk||[]).push([[254],{354:(e,c,r)=>{function f(e,c){return c||(c=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(c)}}))}r.d(c,{A:()=>f})}}]);
2
- //# sourceMappingURL=im-search-plugin.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"javascripts/im-search-plugin.min.js","mappings":"qEAAA,SAASA,EAAuBC,EAAGC,GACjC,OAAOA,IAAMA,EAAID,EAAEE,MAAM,IAAKC,OAAOC,OAAOD,OAAOE,iBAAiBL,EAAG,CACrEM,IAAK,CACHC,MAAOJ,OAAOC,OAAOH,MAG3B,C","sources":["webpack:///../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js"],"sourcesContent":["function _taggedTemplateLiteral(e, t) {\n return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {\n raw: {\n value: Object.freeze(t)\n }\n }));\n}\nexport { _taggedTemplateLiteral as default };"],"names":["_taggedTemplateLiteral","e","t","slice","Object","freeze","defineProperties","raw","value"],"sourceRoot":""}
@@ -1,2 +0,0 @@
1
- (self.webpackChunk=self.webpackChunk||[]).push([[641],{452:(n,e,t)=>{t.d(e,{Ob:()=>Fn,q6:()=>l.q6,d5:()=>on,Ay:()=>Un,Qv:()=>hn,XX:()=>pn,xJ:()=>Nn,hb:()=>x,NT:()=>F,vJ:()=>g,Nf:()=>k,Kr:()=>S,WO:()=>b,li:()=>C,J0:()=>y});var _,r,o,u,l=t(126),i=0,c=[],f=l.fF,a=f.__b,s=f.__r,p=f.diffed,h=f.__c,d=f.unmount,v=f.__;function m(n,e){f.__h&&f.__h(r,n,i||e),i=0;var t=r.__H||(r.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function y(n){return i=1,b(D,n)}function b(n,e,t){var o=m(_++,2);if(o.t=n,!o.__c&&(o.__=[t?t(e):D(void 0,e),function(n){var e=o.__N?o.__N[0]:o.__[0],t=o.t(e,n);e!==t&&(o.__N=[t,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var u=function(n,e,t){if(!o.__c.__H)return!0;var _=o.__c.__H.__.filter(function(n){return n.__c});if(_.every(function(n){return!n.__N}))return!l||l.call(this,n,e,t);var r=o.__c.props!==n;return _.some(function(n){if(n.__N){var e=n.__[0];n.__=n.__N,n.__N=void 0,e!==n.__[0]&&(r=!0)}}),l&&l.call(this,n,e,t)||r};r.__f=!0;var l=r.shouldComponentUpdate,i=r.componentWillUpdate;r.componentWillUpdate=function(n,e,t){if(this.__e){var _=l;l=void 0,u(n,e,t),l=_}i&&i.call(this,n,e,t)},r.shouldComponentUpdate=u}return o.__N||o.__}function g(n,e){var t=m(_++,3);!f.__s&&T(t.__H,e)&&(t.__=n,t.u=e,r.__H.__h.push(t))}function k(n,e){var t=m(_++,4);!f.__s&&T(t.__H,e)&&(t.__=n,t.u=e,r.__h.push(t))}function C(n){return i=5,S(function(){return{current:n}},[])}function w(n,e,t){i=6,k(function(){if("function"==typeof n){var t=n(e());return function(){n(null),t&&"function"==typeof t&&t()}}if(n)return n.current=e(),function(){return n.current=null}},null==t?t:t.concat(n))}function S(n,e){var t=m(_++,7);return T(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function x(n,e){return i=8,S(function(){return n},e)}function F(n){var e=r.context[n.__c],t=m(_++,9);return t.c=n,e?(null==t.__&&(t.__=!0,e.sub(r)),e.props.value):n.__}function N(n,e){f.useDebugValue&&f.useDebugValue(e?e(n):n)}function P(){var n=m(_++,11);if(!n.__){for(var e=r.__v;null!==e&&!e.__m&&null!==e.__;)e=e.__;var t=e.__m||(e.__m=[0,0]);n.__="P"+t[0]+"-"+t[1]++}return n.__}function E(){for(var n;n=c.shift();){var e=n.__H;if(n.__P&&e)try{e.__h.some(H),e.__h.some(R),e.__h=[]}catch(r){e.__h=[],f.__e(r,n.__v)}}}f.__b=function(n){r=null,a&&a(n)},f.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),v&&v(n,e)},f.__r=function(n){s&&s(n),_=0;var e=(r=n.__c).__H;e&&(o===r?(e.__h=[],r.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(H),e.__h.some(R),e.__h=[],_=0)),o=r},f.diffed=function(n){p&&p(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(1!==c.push(e)&&u===f.requestAnimationFrame||((u=f.requestAnimationFrame)||A)(E)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),o=r=null},f.__c=function(n,e){e.some(function(n){try{n.__h.some(H),n.__h=n.__h.filter(function(n){return!n.__||R(n)})}catch(r){e.some(function(n){n.__h&&(n.__h=[])}),e=[],f.__e(r,n.__v)}}),h&&h(n,e)},f.unmount=function(n){d&&d(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.some(function(n){try{H(n)}catch(n){e=n}}),t.__H=void 0,e&&f.__e(e,t.__v))};var U="function"==typeof requestAnimationFrame;function A(n){var e,t=function(){clearTimeout(_),U&&cancelAnimationFrame(e),setTimeout(n)},_=setTimeout(t,35);U&&(e=requestAnimationFrame(t))}function H(n){var e=r,t=n.__c;"function"==typeof t&&(n.__c=void 0,t()),r=e}function R(n){var e=r;n.__c=n.__(),r=e}function T(n,e){return!n||n.length!==e.length||e.some(function(e,t){return e!==n[t]})}function D(n,e){return"function"==typeof e?e(n):e}function O(n,e){for(var t in e)n[t]=e[t];return n}function W(n,e){for(var t in n)if("__source"!==t&&!(t in e))return!0;for(var _ in e)if("__source"!==_&&n[_]!==e[_])return!0;return!1}function M(n,e){var t=e(),_=y({t:{__:t,u:e}}),r=_[0].t,o=_[1];return k(function(){r.__=t,r.u=e,I(r)&&o({t:r})},[n,t,e]),g(function(){return I(r)&&o({t:r}),n(function(){I(r)&&o({t:r})})},[n]),t}function I(n){try{return!((e=n.__)===(t=n.u())&&(0!==e||1/e==1/t)||e!=e&&t!=t)}catch(n){return!0}var e,t}function L(n){n()}function X(n){return n}function V(){return[!1,L]}var $=k;function K(n,e){this.props=n,this.context=e}(K.prototype=new l.uA).isPureReactComponent=!0,K.prototype.shouldComponentUpdate=function(n,e){return W(this.props,n)||W(this.state,e)};var q=l.fF.__b;l.fF.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),q&&q(n)};var B="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911,z=function(n,e){return null==n?null:(0,l.v2)((0,l.v2)(n).map(e))},j={map:z,forEach:z,count:function(n){return n?(0,l.v2)(n).length:0},only:function(n){var e=(0,l.v2)(n);if(1!==e.length)throw"Children.only";return e[0]},toArray:l.v2},J=l.fF.__e;l.fF.__e=function(n,e,t,_){if(n.then)for(var r,o=e;o=o.__;)if((r=o.__c)&&r.__c)return null==e.__e&&(e.__e=t.__e,e.__k=t.__k),r.__c(n,e);J(n,e,t,_)};var Q=l.fF.unmount;function Y(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=O({},n)).__c&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return Y(n,e,t)})),n}function Z(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return Z(n,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function G(){this.__u=0,this.o=null,this.__b=null}function nn(n){if(!n.__)return null;var e=n.__.__c;return e&&e.__a&&e.__a(n)}function en(){this.i=null,this.l=null}l.fF.unmount=function(n){var e=n.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),Q&&Q(n)},(G.prototype=new l.uA).__c=function(n,e){var t=e.__c,_=this;null==_.o&&(_.o=[]),_.o.push(t);var r=nn(_.__v),o=!1,u=function(){o||_.__z||(o=!0,t.__R=null,r?r(i):i())};t.__R=u;var l=t.__P;t.__P=null;var i=function(){if(! --_.__u){if(_.state.__a){var n=_.state.__a;_.__v.__k[0]=Z(n,n.__c.__P,n.__c.__O)}var e;for(_.setState({__a:_.__b=null});e=_.o.pop();)e.__P=l,e.forceUpdate()}};_.__u++||32&e.__u||_.setState({__a:_.__b=_.__v.__k[0]}),n.then(u,u)},G.prototype.componentWillUnmount=function(){this.o=[]},G.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),_=this.__v.__k[0].__c;this.__v.__k[0]=Y(this.__b,t,_.__O=_.__P)}this.__b=null}var r=e.__a&&(0,l.n)(l.FK,null,n.fallback);return r&&(r.__u&=-33),[(0,l.n)(l.FK,null,e.__a?null:n.children),r]};var tn=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function _n(n){return this.getChildContext=function(){return n.context},n.children}function rn(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){(0,l.XX)(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var _=e.__v;null!==_&&!_.__m&&null!==_.__;)_=_.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:_.__m},contains:function(){return!0},namespaceURI:t.namespaceURI,insertBefore:function(n,t){this.childNodes.push(n),e.h.insertBefore(n,t)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.h.removeChild(n)}}}(0,l.XX)((0,l.n)(_n,{context:e.context},n.__v),e.v)}function on(n,e){var t=(0,l.n)(rn,{__v:n,h:e});return t.containerInfo=e,t}(en.prototype=new l.uA).__a=function(n){var e=this,t=nn(e.__v),_=e.l.get(n);return _[0]++,function(r){var o=function(){e.props.revealOrder?(_.push(r),tn(e,n,_)):r()};t?t(o):o()}},en.prototype.render=function(n){this.i=null,this.l=new Map;var e=(0,l.v2)(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},en.prototype.componentDidUpdate=en.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){tn(n,t,e)})};var un="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ln=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,cn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,fn=/[A-Z0-9]/g,an="undefined"!=typeof document,sn=function(n){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function pn(n,e,t){return null==e.__k&&(e.textContent=""),(0,l.XX)(n,e),"function"==typeof t&&t(),n?n.__c:null}function hn(n,e,t){return(0,l.Qv)(n,e),"function"==typeof t&&t(),n?n.__c:null}l.uA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(l.uA.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var dn=l.fF.event;function vn(){}function mn(){return this.cancelBubble}function yn(){return this.defaultPrevented}l.fF.event=function(n){return dn&&(n=dn(n)),n.persist=vn,n.isPropagationStopped=mn,n.isDefaultPrevented=yn,n.nativeEvent=n};var bn,gn={enumerable:!1,configurable:!0,get:function(){return this.class}},kn=l.fF.vnode;l.fF.vnode=function(n){"string"==typeof n.type&&function(n){var e=n.props,t=n.type,_={},r=-1===t.indexOf("-");for(var o in e){var u=e[o];if(!("value"===o&&"defaultValue"in e&&null==u||an&&"children"===o&&"noscript"===t||"class"===o||"className"===o)){var i=o.toLowerCase();"defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===u?u="":"translate"===i&&"no"===u?u=!1:"o"===i[0]&&"n"===i[1]?"ondoubleclick"===i?o="ondblclick":"onchange"!==i||"input"!==t&&"textarea"!==t||sn(e.type)?"onfocus"===i?o="onfocusin":"onblur"===i?o="onfocusout":cn.test(o)&&(o=i):i=o="oninput":r&&ln.test(o)?o=o.replace(fn,"-$&").toLowerCase():null===u&&(u=void 0),"oninput"===i&&_[o=i]&&(o="oninputCapture"),_[o]=u}}"select"==t&&_.multiple&&Array.isArray(_.value)&&(_.value=(0,l.v2)(e.children).forEach(function(n){n.props.selected=-1!=_.value.indexOf(n.props.value)})),"select"==t&&null!=_.defaultValue&&(_.value=(0,l.v2)(e.children).forEach(function(n){n.props.selected=_.multiple?-1!=_.defaultValue.indexOf(n.props.value):_.defaultValue==n.props.value})),e.class&&!e.className?(_.class=e.class,Object.defineProperty(_,"className",gn)):e.className&&(_.class=_.className=e.className),n.props=_}(n),n.$$typeof=un,kn&&kn(n)};var Cn=l.fF.__r;l.fF.__r=function(n){Cn&&Cn(n),bn=n.__c};var wn=l.fF.diffed;l.fF.diffed=function(n){wn&&wn(n);var e=n.props,t=n.__e;null!=t&&"textarea"===n.type&&"value"in e&&e.value!==t.value&&(t.value=null==e.value?"":e.value),bn=null};var Sn={ReactCurrentDispatcher:{current:{readContext:function(n){return bn.__n[n.__c].props.value},useCallback:x,useContext:F,useDebugValue:N,useDeferredValue:X,useEffect:g,useId:P,useImperativeHandle:w,useInsertionEffect:$,useLayoutEffect:k,useMemo:S,useReducer:b,useRef:C,useState:y,useSyncExternalStore:M,useTransition:V}}};function xn(n){return!!n&&n.$$typeof===un}function Fn(n){return xn(n)?l.Ob.apply(null,arguments):n}function Nn(n){return!!n.__k&&((0,l.XX)(null,n),!0)}var Pn=l.FK,En=xn,Un={useState:y,useId:P,useReducer:b,useEffect:g,useLayoutEffect:k,useInsertionEffect:$,useTransition:V,useDeferredValue:X,useSyncExternalStore:M,startTransition:L,useRef:C,useImperativeHandle:w,useMemo:S,useCallback:x,useContext:F,useDebugValue:N,version:"18.3.1",Children:j,render:pn,hydrate:hn,unmountComponentAtNode:Nn,createPortal:on,createElement:l.n,createContext:l.q6,createFactory:function(n){return l.n.bind(null,n)},cloneElement:Fn,createRef:l._3,Fragment:l.FK,isValidElement:xn,isElement:En,isFragment:function(n){return xn(n)&&n.type===l.FK},isMemo:function(n){return!!n&&"string"==typeof n.displayName&&n.displayName.startsWith("Memo(")},findDOMNode:function(n){return n&&(n.base||1===n.nodeType&&n)||null},Component:l.uA,PureComponent:K,memo:function(n,e){function t(n){var t=this.props.ref,_=t==n.ref;return!_&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!_:W(this.props,n)}function _(e){return this.shouldComponentUpdate=t,(0,l.n)(n,e)}return _.displayName="Memo("+(n.displayName||n.name)+")",_.prototype.isReactComponent=!0,_.__f=!0,_.type=n,_},forwardRef:function(n){function e(e){var t=O({},e);return delete t.ref,n(t,e.ref||null)}return e.$$typeof=B,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e},flushSync:function(n,e){return n(e)},unstable_batchedUpdates:function(n,e){return n(e)},StrictMode:Pn,Suspense:G,SuspenseList:en,lazy:function(n){var e,t,_,r=null;function o(o){if(e||(e=n()).then(function(n){n&&(r=n.default||n),_=!0},function(n){t=n,_=!0}),t)throw t;if(!_)throw e;return r?(0,l.n)(r,o):null}return o.displayName="Lazy",o.__f=!0,o},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Sn}},126:(n,e,t)=>{t.d(e,{FK:()=>S,Ob:()=>J,Qv:()=>j,XX:()=>z,_3:()=>w,fF:()=>r,n:()=>k,q6:()=>Q,uA:()=>x,v2:()=>T});var _,r,o,u,l,i,c,f,a,s,p,h,d={},v=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function b(n,e){for(var t in e)n[t]=e[t];return n}function g(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function k(n,e,t){var r,o,u,l={};for(u in e)"key"==u?r=e[u]:"ref"==u?o=e[u]:l[u]=e[u];if(arguments.length>2&&(l.children=arguments.length>3?_.call(arguments,2):t),"function"==typeof n&&null!=n.defaultProps)for(u in n.defaultProps)void 0===l[u]&&(l[u]=n.defaultProps[u]);return C(n,l,r,o,null)}function C(n,e,t,_,u){var l={type:n,props:e,key:t,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==u?++o:u,__i:-1,__u:0};return null==u&&null!=r.vnode&&r.vnode(l),l}function w(){return{current:null}}function S(n){return n.children}function x(n,e){this.props=n,this.context=e}function F(n,e){if(null==e)return n.__?F(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if(null!=(t=n.__k[e])&&null!=t.__e)return t.__e;return"function"==typeof n.type?F(n):null}function N(n){if(n.__P&&n.__d){var e=n.__v,t=e.__e,_=[],o=[],u=b({},e);u.__v=e.__v+1,r.vnode&&r.vnode(u),I(n.__P,u,e,n.__n,n.__P.namespaceURI,32&e.__u?[t]:null,_,null==t?F(e):t,!!(32&e.__u),o),u.__v=e.__v,u.__.__k[u.__i]=u,X(_,u,o),e.__e=e.__=null,u.__e!=t&&P(u)}}function P(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(e){if(null!=e&&null!=e.__e)return n.__e=n.__c.base=e.__e}),P(n)}function E(n){(!n.__d&&(n.__d=!0)&&u.push(n)&&!U.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||i)(U)}function U(){for(var n,e=1;u.length;)u.length>e&&u.sort(c),n=u.shift(),e=u.length,N(n);U.__r=0}function A(n,e,t,_,r,o,u,l,i,c,f){var a,s,p,h,m,y,b,g=_&&_.__k||v,k=e.length;for(i=H(t,e,g,i,k),a=0;a<k;a++)null!=(p=t.__k[a])&&(s=-1!=p.__i&&g[p.__i]||d,p.__i=a,y=I(n,p,s,r,o,u,l,i,c,f),h=p.__e,p.ref&&s.ref!=p.ref&&(s.ref&&K(s.ref,null,p),f.push(p.ref,p.__c||h,p)),null==m&&null!=h&&(m=h),(b=!!(4&p.__u))||s.__k===p.__k?i=R(p,i,n,b):"function"==typeof p.type&&void 0!==y?i=y:h&&(i=h.nextSibling),p.__u&=-7);return t.__e=m,i}function H(n,e,t,_,r){var o,u,l,i,c,f=t.length,a=f,s=0;for(n.__k=new Array(r),o=0;o<r;o++)null!=(u=e[o])&&"boolean"!=typeof u&&"function"!=typeof u?("string"==typeof u||"number"==typeof u||"bigint"==typeof u||u.constructor==String?u=n.__k[o]=C(null,u,null,null,null):y(u)?u=n.__k[o]=C(S,{children:u},null,null,null):void 0===u.constructor&&u.__b>0?u=n.__k[o]=C(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):n.__k[o]=u,i=o+s,u.__=n,u.__b=n.__b+1,l=null,-1!=(c=u.__i=D(u,t,i,a))&&(a--,(l=t[c])&&(l.__u|=2)),null==l||null==l.__v?(-1==c&&(r>f?s--:r<f&&s++),"function"!=typeof u.type&&(u.__u|=4)):c!=i&&(c==i-1?s--:c==i+1?s++:(c>i?s--:s++,u.__u|=4))):n.__k[o]=null;if(a)for(o=0;o<f;o++)null!=(l=t[o])&&!(2&l.__u)&&(l.__e==_&&(_=F(l)),q(l,l));return _}function R(n,e,t,_){var r,o;if("function"==typeof n.type){for(r=n.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=n,e=R(r[o],e,t,_));return e}n.__e!=e&&(_&&(e&&n.type&&!e.parentNode&&(e=F(n)),t.insertBefore(n.__e,e||null)),e=n.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function T(n,e){return e=e||[],null==n||"boolean"==typeof n||(y(n)?n.some(function(n){T(n,e)}):e.push(n)),e}function D(n,e,t,_){var r,o,u,l=n.key,i=n.type,c=e[t],f=null!=c&&!(2&c.__u);if(null===c&&null==l||f&&l==c.key&&i==c.type)return t;if(_>(f?1:0))for(r=t-1,o=t+1;r>=0||o<e.length;)if(null!=(c=e[u=r>=0?r--:o++])&&!(2&c.__u)&&l==c.key&&i==c.type)return u;return-1}function O(n,e,t){"-"==e[0]?n.setProperty(e,null==t?"":t):n[e]=null==t?"":"number"!=typeof t||m.test(e)?t:t+"px"}function W(n,e,t,_,r){var o,u;n:if("style"==e)if("string"==typeof t)n.style.cssText=t;else{if("string"==typeof _&&(n.style.cssText=_=""),_)for(e in _)t&&e in t||O(n.style,e,"");if(t)for(e in t)_&&t[e]==_[e]||O(n.style,e,t[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(f,"$1")),u=e.toLowerCase(),e=u in n||"onFocusOut"==e||"onFocusIn"==e?u.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?_?t.u=_.u:(t.u=a,n.addEventListener(e,o?p:s,o)):n.removeEventListener(e,o?p:s,o);else{if("http://www.w3.org/2000/svg"==r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in n)try{n[e]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||!1===t&&"-"!=e[4]?n.removeAttribute(e):n.setAttribute(e,"popover"==e&&1==t?"":t))}}function M(n){return function(e){if(this.l){var t=this.l[e.type+n];if(null==e.t)e.t=a++;else if(e.t<t.u)return;return t(r.event?r.event(e):e)}}}function I(n,e,t,_,o,u,l,i,c,f){var a,s,p,h,d,m,k,C,w,F,N,P,E,U,H,R=e.type;if(void 0!==e.constructor)return null;128&t.__u&&(c=!!(32&t.__u),u=[i=e.__e=t.__e]),(a=r.__b)&&a(e);n:if("function"==typeof R)try{if(C=e.props,w="prototype"in R&&R.prototype.render,F=(a=R.contextType)&&_[a.__c],N=a?F?F.props.value:a.__:_,t.__c?k=(s=e.__c=t.__c).__=s.__E:(w?e.__c=s=new R(C,N):(e.__c=s=new x(C,N),s.constructor=R,s.render=B),F&&F.sub(s),s.state||(s.state={}),s.__n=_,p=s.__d=!0,s.__h=[],s._sb=[]),w&&null==s.__s&&(s.__s=s.state),w&&null!=R.getDerivedStateFromProps&&(s.__s==s.state&&(s.__s=b({},s.__s)),b(s.__s,R.getDerivedStateFromProps(C,s.__s))),h=s.props,d=s.state,s.__v=e,p)w&&null==R.getDerivedStateFromProps&&null!=s.componentWillMount&&s.componentWillMount(),w&&null!=s.componentDidMount&&s.__h.push(s.componentDidMount);else{if(w&&null==R.getDerivedStateFromProps&&C!==h&&null!=s.componentWillReceiveProps&&s.componentWillReceiveProps(C,N),e.__v==t.__v||!s.__e&&null!=s.shouldComponentUpdate&&!1===s.shouldComponentUpdate(C,s.__s,N)){e.__v!=t.__v&&(s.props=C,s.state=s.__s,s.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(n){n&&(n.__=e)}),v.push.apply(s.__h,s._sb),s._sb=[],s.__h.length&&l.push(s);break n}null!=s.componentWillUpdate&&s.componentWillUpdate(C,s.__s,N),w&&null!=s.componentDidUpdate&&s.__h.push(function(){s.componentDidUpdate(h,d,m)})}if(s.context=N,s.props=C,s.__P=n,s.__e=!1,P=r.__r,E=0,w)s.state=s.__s,s.__d=!1,P&&P(e),a=s.render(s.props,s.state,s.context),v.push.apply(s.__h,s._sb),s._sb=[];else do{s.__d=!1,P&&P(e),a=s.render(s.props,s.state,s.context),s.state=s.__s}while(s.__d&&++E<25);s.state=s.__s,null!=s.getChildContext&&(_=b(b({},_),s.getChildContext())),w&&!p&&null!=s.getSnapshotBeforeUpdate&&(m=s.getSnapshotBeforeUpdate(h,d)),U=null!=a&&a.type===S&&null==a.key?V(a.props.children):a,i=A(n,y(U)?U:[U],e,t,_,o,u,l,i,c,f),s.base=e.__e,e.__u&=-161,s.__h.length&&l.push(s),k&&(s.__E=s.__=null)}catch(n){if(e.__v=null,c||null!=u)if(n.then){for(e.__u|=c?160:128;i&&8==i.nodeType&&i.nextSibling;)i=i.nextSibling;u[u.indexOf(i)]=null,e.__e=i}else{for(H=u.length;H--;)g(u[H]);L(e)}else e.__e=t.__e,e.__k=t.__k,n.then||L(e);r.__e(n,e,t)}else null==u&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):i=e.__e=$(t.__e,e,t,_,o,u,l,c,f);return(a=r.diffed)&&a(e),128&e.__u?void 0:i}function L(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(L))}function X(n,e,t){for(var _=0;_<t.length;_++)K(t[_],t[++_],t[++_]);r.__c&&r.__c(e,n),n.some(function(e){try{n=e.__h,e.__h=[],n.some(function(n){n.call(e)})}catch(n){r.__e(n,e.__v)}})}function V(n){return"object"!=typeof n||null==n||n.__b>0?n:y(n)?n.map(V):b({},n)}function $(n,e,t,o,u,l,i,c,f){var a,s,p,h,v,m,b,k=t.props||d,C=e.props,w=e.type;if("svg"==w?u="http://www.w3.org/2000/svg":"math"==w?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=l)for(a=0;a<l.length;a++)if((v=l[a])&&"setAttribute"in v==!!w&&(w?v.localName==w:3==v.nodeType)){n=v,l[a]=null;break}if(null==n){if(null==w)return document.createTextNode(C);n=document.createElementNS(u,w,C.is&&C),c&&(r.__m&&r.__m(e,l),c=!1),l=null}if(null==w)k===C||c&&n.data==C||(n.data=C);else{if(l=l&&_.call(n.childNodes),!c&&null!=l)for(k={},a=0;a<n.attributes.length;a++)k[(v=n.attributes[a]).name]=v.value;for(a in k)v=k[a],"dangerouslySetInnerHTML"==a?p=v:"children"==a||a in C||"value"==a&&"defaultValue"in C||"checked"==a&&"defaultChecked"in C||W(n,a,null,v,u);for(a in C)v=C[a],"children"==a?h=v:"dangerouslySetInnerHTML"==a?s=v:"value"==a?m=v:"checked"==a?b=v:c&&"function"!=typeof v||k[a]===v||W(n,a,v,k[a],u);if(s)c||p&&(s.__html==p.__html||s.__html==n.innerHTML)||(n.innerHTML=s.__html),e.__k=[];else if(p&&(n.innerHTML=""),A("template"==e.type?n.content:n,y(h)?h:[h],e,t,o,"foreignObject"==w?"http://www.w3.org/1999/xhtml":u,l,i,l?l[0]:t.__k&&F(t,0),c,f),null!=l)for(a=l.length;a--;)g(l[a]);c||(a="value","progress"==w&&null==m?n.removeAttribute("value"):null!=m&&(m!==n[a]||"progress"==w&&!m||"option"==w&&m!=k[a])&&W(n,a,m,k[a],u),a="checked",null!=b&&b!=n[a]&&W(n,a,b,k[a],u))}return n}function K(n,e,t){try{if("function"==typeof n){var _="function"==typeof n.__u;_&&n.__u(),_&&null==e||(n.__u=n(e))}else n.current=e}catch(n){r.__e(n,t)}}function q(n,e,t){var _,o;if(r.unmount&&r.unmount(n),(_=n.ref)&&(_.current&&_.current!=n.__e||K(_,null,e)),null!=(_=n.__c)){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(n){r.__e(n,e)}_.base=_.__P=null}if(_=n.__k)for(o=0;o<_.length;o++)_[o]&&q(_[o],e,t||"function"!=typeof n.type);t||g(n.__e),n.__c=n.__=n.__e=void 0}function B(n,e,t){return this.constructor(n,t)}function z(n,e,t){var o,u,l,i;e==document&&(e=document.documentElement),r.__&&r.__(n,e),u=(o="function"==typeof t)?null:t&&t.__k||e.__k,l=[],i=[],I(e,n=(!o&&t||e).__k=k(S,null,[n]),u||d,d,e.namespaceURI,!o&&t?[t]:u?null:e.firstChild?_.call(e.childNodes):null,l,!o&&t?t:u?u.__e:e.firstChild,o,i),X(l,n,i)}function j(n,e){z(n,e,j)}function J(n,e,t){var r,o,u,l,i=b({},n.props);for(u in n.type&&n.type.defaultProps&&(l=n.type.defaultProps),e)"key"==u?r=e[u]:"ref"==u?o=e[u]:i[u]=void 0===e[u]&&null!=l?l[u]:e[u];return arguments.length>2&&(i.children=arguments.length>3?_.call(arguments,2):t),C(n.type,i,r||n.key,o||n.ref,null)}function Q(n){function e(n){var t,_;return this.getChildContext||(t=new Set,(_={})[e.__c]=this,this.getChildContext=function(){return _},this.componentWillUnmount=function(){t=null},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&t.forEach(function(n){n.__e=!0,E(n)})},this.sub=function(n){t.add(n);var e=n.componentWillUnmount;n.componentWillUnmount=function(){t&&t.delete(n),e&&e.call(n)}}),n.children}return e.__c="__cC"+h++,e.__=n,e.Provider=e.__l=(e.Consumer=function(n,e){return n.children(e)}).contextType=e,e}_=v.slice,r={__e:function(n,e,t,_){for(var r,o,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(n)),u=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(n,_||{}),u=r.__d),u)return r.__E=r}catch(e){n=e}throw n}},o=0,x.prototype.setState=function(n,e){var t;t=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=b({},this.state),"function"==typeof n&&(n=n(b({},t),this.props)),n&&b(t,n),null!=n&&this.__v&&(e&&this._sb.push(e),E(this))},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),E(this))},x.prototype.render=S,u=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(n,e){return n.__v.__b-e.__v.__b},U.__r=0,f=/(PointerCapture)$|Capture$/i,a=0,s=M(!1),p=M(!0),h=0},247:(n,e,t)=>{t.d(e,{FD:()=>o,FK:()=>_.FK,Y:()=>o});var _=t(126),r=0;function o(n,e,t,o,u,l){e||(e={});var i,c,f=e;if("ref"in f)for(c in f={},e)"ref"==c?i=e[c]:f[c]=e[c];var a={type:n,props:f,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--r,__i:-1,__u:0,__source:u,__self:l};if("function"==typeof n&&(i=n.defaultProps))for(c in i)void 0===f[c]&&(f[c]=i[c]);return _.fF.vnode&&_.fF.vnode(a),a}Array.isArray},818:(n,e,t)=>{t.d(e,{Hr:()=>r});var _=t(452);function r(n){return{render:function(e){(0,_.XX)(e,n)},unmount:function(){(0,_.xJ)(n)}}}}}]);
2
- //# sourceMappingURL=preact.min.js.map