@mapbox/mcp-server 0.12.7 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/config/toolConfig.d.ts +0 -10
- package/dist/commonjs/config/toolConfig.d.ts.map +1 -1
- package/dist/commonjs/config/toolConfig.js +0 -36
- package/dist/commonjs/config/toolConfig.js.map +1 -1
- package/dist/commonjs/resources/compute/ComputeResource.d.ts +20 -0
- package/dist/commonjs/resources/compute/ComputeResource.d.ts.map +1 -0
- package/dist/commonjs/resources/compute/ComputeResource.js +49 -0
- package/dist/commonjs/resources/compute/ComputeResource.js.map +1 -0
- package/dist/commonjs/resources/inline-payload/InlinePayloadResource.d.ts +17 -0
- package/dist/commonjs/resources/inline-payload/InlinePayloadResource.d.ts.map +1 -0
- package/dist/commonjs/resources/inline-payload/InlinePayloadResource.js +46 -0
- package/dist/commonjs/resources/inline-payload/InlinePayloadResource.js.map +1 -0
- package/dist/commonjs/resources/resourceRegistry.d.ts +4 -2
- package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -1
- package/dist/commonjs/resources/resourceRegistry.js +16 -6
- package/dist/commonjs/resources/resourceRegistry.js.map +1 -1
- package/dist/commonjs/resources/ui-apps/MapAppUIResource.d.ts +27 -0
- package/dist/commonjs/resources/ui-apps/MapAppUIResource.d.ts.map +1 -0
- package/dist/commonjs/resources/ui-apps/{DirectionsAppUIResource.js → MapAppUIResource.js} +15 -17
- package/dist/commonjs/resources/ui-apps/MapAppUIResource.js.map +1 -0
- package/dist/commonjs/resources/ui-apps/mapAppHtml.d.ts +19 -0
- package/dist/commonjs/resources/ui-apps/mapAppHtml.d.ts.map +1 -0
- package/dist/commonjs/resources/ui-apps/mapAppHtml.js +1621 -0
- package/dist/commonjs/resources/ui-apps/mapAppHtml.js.map +1 -0
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js +46 -41
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js.map +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +6 -3
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js +3 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/category-search-tool/buildCategorySearchRequestUrl.d.ts +30 -0
- package/dist/commonjs/tools/category-search-tool/buildCategorySearchRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/category-search-tool/buildCategorySearchRequestUrl.js +39 -0
- package/dist/commonjs/tools/category-search-tool/buildCategorySearchRequestUrl.js.map +1 -0
- package/dist/commonjs/tools/difference-tool/DifferenceTool.d.ts.map +1 -1
- package/dist/commonjs/tools/difference-tool/DifferenceTool.js +19 -3
- package/dist/commonjs/tools/difference-tool/DifferenceTool.js.map +1 -1
- package/dist/commonjs/tools/difference-tool/DifferenceTool.output.schema.d.ts +4 -1
- package/dist/commonjs/tools/difference-tool/DifferenceTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/difference-tool/DifferenceTool.output.schema.js +7 -3
- package/dist/commonjs/tools/difference-tool/DifferenceTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts +0 -9
- package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.js +9 -4
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js +40 -78
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.d.ts +4 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.js +10 -4
- package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.d.ts +2 -2
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.js +4 -12
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.js.map +1 -1
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.d.ts.map +1 -1
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.js +52 -18
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.js.map +1 -1
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts +4 -1
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.js +7 -3
- package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/ground-location-tool/buildReverseGeocodeUrl.d.ts +19 -0
- package/dist/commonjs/tools/ground-location-tool/buildReverseGeocodeUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/ground-location-tool/buildReverseGeocodeUrl.js +26 -0
- package/dist/commonjs/tools/ground-location-tool/buildReverseGeocodeUrl.js.map +1 -0
- package/dist/commonjs/tools/intersect-tool/IntersectTool.d.ts.map +1 -1
- package/dist/commonjs/tools/intersect-tool/IntersectTool.js +19 -3
- package/dist/commonjs/tools/intersect-tool/IntersectTool.js.map +1 -1
- package/dist/commonjs/tools/intersect-tool/IntersectTool.output.schema.d.ts +4 -1
- package/dist/commonjs/tools/intersect-tool/IntersectTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/intersect-tool/IntersectTool.output.schema.js +7 -3
- package/dist/commonjs/tools/intersect-tool/IntersectTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.d.ts.map +1 -1
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.js +51 -47
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.js.map +1 -1
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.output.schema.d.ts +4 -5
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.output.schema.js +7 -3
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/isochrone-tool/buildIsochroneRequestUrl.d.ts +28 -0
- package/dist/commonjs/tools/isochrone-tool/buildIsochroneRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/isochrone-tool/buildIsochroneRequestUrl.js +44 -0
- package/dist/commonjs/tools/isochrone-tool/buildIsochroneRequestUrl.js.map +1 -0
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.d.ts.map +1 -1
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.js +61 -34
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.js.map +1 -1
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.output.schema.d.ts +8 -5
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.output.schema.js +11 -5
- package/dist/commonjs/tools/map-matching-tool/MapMatchingTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/map-matching-tool/buildMapMatchingRequestUrl.d.ts +25 -0
- package/dist/commonjs/tools/map-matching-tool/buildMapMatchingRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/map-matching-tool/buildMapMatchingRequestUrl.js +33 -0
- package/dist/commonjs/tools/map-matching-tool/buildMapMatchingRequestUrl.js.map +1 -0
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.d.ts.map +1 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.input.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.input.schema.js +19 -4
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.input.schema.js.map +1 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.js +32 -33
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.js.map +1 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.output.schema.d.ts +3 -5
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.output.schema.js +6 -1
- package/dist/commonjs/tools/optimization-tool/OptimizationTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/optimization-tool/buildOptimizationRequestUrl.d.ts +30 -0
- package/dist/commonjs/tools/optimization-tool/buildOptimizationRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/optimization-tool/buildOptimizationRequestUrl.js +45 -0
- package/dist/commonjs/tools/optimization-tool/buildOptimizationRequestUrl.js.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.d.ts +60 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.d.ts.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts +41 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js +99 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.js +246 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.js.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts +97 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.js +35 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.js.map +1 -0
- package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +1 -1
- package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +3 -3
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts +10 -0
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +58 -48
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +3 -0
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js +3 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.d.ts +37 -0
- package/dist/commonjs/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.js +51 -0
- package/dist/commonjs/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.js.map +1 -0
- package/dist/commonjs/tools/shared/polygonSchema.d.ts +15 -0
- package/dist/commonjs/tools/shared/polygonSchema.d.ts.map +1 -1
- package/dist/commonjs/tools/shared/polygonSchema.js +23 -2
- package/dist/commonjs/tools/shared/polygonSchema.js.map +1 -1
- package/dist/commonjs/tools/toolRegistry.d.ts +3 -2
- package/dist/commonjs/tools/toolRegistry.d.ts.map +1 -1
- package/dist/commonjs/tools/toolRegistry.js +2 -0
- package/dist/commonjs/tools/toolRegistry.js.map +1 -1
- package/dist/commonjs/tools/union-tool/UnionTool.d.ts.map +1 -1
- package/dist/commonjs/tools/union-tool/UnionTool.js +22 -3
- package/dist/commonjs/tools/union-tool/UnionTool.js.map +1 -1
- package/dist/commonjs/tools/union-tool/UnionTool.output.schema.d.ts +4 -1
- package/dist/commonjs/tools/union-tool/UnionTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/union-tool/UnionTool.output.schema.js +7 -3
- package/dist/commonjs/tools/union-tool/UnionTool.output.schema.js.map +1 -1
- package/dist/commonjs/tools/union-tool/buildPolygonOpsMapPayload.d.ts +21 -0
- package/dist/commonjs/tools/union-tool/buildPolygonOpsMapPayload.d.ts.map +1 -0
- package/dist/commonjs/tools/union-tool/buildPolygonOpsMapPayload.js +72 -0
- package/dist/commonjs/tools/union-tool/buildPolygonOpsMapPayload.js.map +1 -0
- package/dist/commonjs/utils/computeRef.d.ts +38 -0
- package/dist/commonjs/utils/computeRef.d.ts.map +1 -0
- package/dist/commonjs/utils/computeRef.js +116 -0
- package/dist/commonjs/utils/computeRef.js.map +1 -0
- package/dist/commonjs/utils/inlinePayloadRef.d.ts +32 -0
- package/dist/commonjs/utils/inlinePayloadRef.d.ts.map +1 -0
- package/dist/commonjs/utils/inlinePayloadRef.js +56 -0
- package/dist/commonjs/utils/inlinePayloadRef.js.map +1 -0
- package/dist/commonjs/utils/mapAppPayload.d.ts +206 -0
- package/dist/commonjs/utils/mapAppPayload.d.ts.map +1 -0
- package/dist/commonjs/utils/mapAppPayload.js +129 -0
- package/dist/commonjs/utils/mapAppPayload.js.map +1 -0
- package/dist/commonjs/utils/selfFetchRef.d.ts +25 -0
- package/dist/commonjs/utils/selfFetchRef.d.ts.map +1 -0
- package/dist/commonjs/utils/selfFetchRef.js +75 -0
- package/dist/commonjs/utils/selfFetchRef.js.map +1 -0
- package/dist/commonjs/utils/storeMapPayload.d.ts +71 -0
- package/dist/commonjs/utils/storeMapPayload.d.ts.map +1 -0
- package/dist/commonjs/utils/storeMapPayload.js +153 -0
- package/dist/commonjs/utils/storeMapPayload.js.map +1 -0
- package/dist/commonjs/version.json +3 -3
- package/dist/esm/config/toolConfig.d.ts +0 -10
- package/dist/esm/config/toolConfig.d.ts.map +1 -1
- package/dist/esm/config/toolConfig.js +0 -35
- package/dist/esm/config/toolConfig.js.map +1 -1
- package/dist/esm/resources/compute/ComputeResource.d.ts +20 -0
- package/dist/esm/resources/compute/ComputeResource.d.ts.map +1 -0
- package/dist/esm/resources/compute/ComputeResource.js +45 -0
- package/dist/esm/resources/compute/ComputeResource.js.map +1 -0
- package/dist/esm/resources/inline-payload/InlinePayloadResource.d.ts +17 -0
- package/dist/esm/resources/inline-payload/InlinePayloadResource.d.ts.map +1 -0
- package/dist/esm/resources/inline-payload/InlinePayloadResource.js +42 -0
- package/dist/esm/resources/inline-payload/InlinePayloadResource.js.map +1 -0
- package/dist/esm/resources/resourceRegistry.d.ts +4 -2
- package/dist/esm/resources/resourceRegistry.d.ts.map +1 -1
- package/dist/esm/resources/resourceRegistry.js +16 -6
- package/dist/esm/resources/resourceRegistry.js.map +1 -1
- package/dist/esm/resources/ui-apps/MapAppUIResource.d.ts +27 -0
- package/dist/esm/resources/ui-apps/MapAppUIResource.d.ts.map +1 -0
- package/dist/esm/resources/ui-apps/{DirectionsAppUIResource.js → MapAppUIResource.js} +13 -15
- package/dist/esm/resources/ui-apps/MapAppUIResource.js.map +1 -0
- package/dist/esm/resources/ui-apps/mapAppHtml.d.ts +19 -0
- package/dist/esm/resources/ui-apps/mapAppHtml.d.ts.map +1 -0
- package/dist/esm/resources/ui-apps/mapAppHtml.js +1617 -0
- package/dist/esm/resources/ui-apps/mapAppHtml.js.map +1 -0
- package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js +46 -41
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js.map +1 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +6 -3
- package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js +3 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
- package/dist/esm/tools/category-search-tool/buildCategorySearchRequestUrl.d.ts +30 -0
- package/dist/esm/tools/category-search-tool/buildCategorySearchRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/category-search-tool/buildCategorySearchRequestUrl.js +36 -0
- package/dist/esm/tools/category-search-tool/buildCategorySearchRequestUrl.js.map +1 -0
- package/dist/esm/tools/difference-tool/DifferenceTool.d.ts.map +1 -1
- package/dist/esm/tools/difference-tool/DifferenceTool.js +19 -3
- package/dist/esm/tools/difference-tool/DifferenceTool.js.map +1 -1
- package/dist/esm/tools/difference-tool/DifferenceTool.output.schema.d.ts +4 -1
- package/dist/esm/tools/difference-tool/DifferenceTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/difference-tool/DifferenceTool.output.schema.js +7 -3
- package/dist/esm/tools/difference-tool/DifferenceTool.output.schema.js.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.d.ts +0 -9
- package/dist/esm/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.js +9 -4
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.js.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.js +41 -79
- package/dist/esm/tools/directions-tool/DirectionsTool.js.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.d.ts +4 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.js +10 -4
- package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.js.map +1 -1
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.d.ts +2 -2
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.js +4 -12
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.js.map +1 -1
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.d.ts.map +1 -1
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.js +52 -18
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.js.map +1 -1
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts +4 -1
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.js +7 -3
- package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.js.map +1 -1
- package/dist/esm/tools/ground-location-tool/buildReverseGeocodeUrl.d.ts +19 -0
- package/dist/esm/tools/ground-location-tool/buildReverseGeocodeUrl.d.ts.map +1 -0
- package/dist/esm/tools/ground-location-tool/buildReverseGeocodeUrl.js +23 -0
- package/dist/esm/tools/ground-location-tool/buildReverseGeocodeUrl.js.map +1 -0
- package/dist/esm/tools/intersect-tool/IntersectTool.d.ts.map +1 -1
- package/dist/esm/tools/intersect-tool/IntersectTool.js +19 -3
- package/dist/esm/tools/intersect-tool/IntersectTool.js.map +1 -1
- package/dist/esm/tools/intersect-tool/IntersectTool.output.schema.d.ts +4 -1
- package/dist/esm/tools/intersect-tool/IntersectTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/intersect-tool/IntersectTool.output.schema.js +7 -3
- package/dist/esm/tools/intersect-tool/IntersectTool.output.schema.js.map +1 -1
- package/dist/esm/tools/isochrone-tool/IsochroneTool.d.ts.map +1 -1
- package/dist/esm/tools/isochrone-tool/IsochroneTool.js +51 -47
- package/dist/esm/tools/isochrone-tool/IsochroneTool.js.map +1 -1
- package/dist/esm/tools/isochrone-tool/IsochroneTool.output.schema.d.ts +4 -5
- package/dist/esm/tools/isochrone-tool/IsochroneTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/isochrone-tool/IsochroneTool.output.schema.js +7 -3
- package/dist/esm/tools/isochrone-tool/IsochroneTool.output.schema.js.map +1 -1
- package/dist/esm/tools/isochrone-tool/buildIsochroneRequestUrl.d.ts +28 -0
- package/dist/esm/tools/isochrone-tool/buildIsochroneRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/isochrone-tool/buildIsochroneRequestUrl.js +41 -0
- package/dist/esm/tools/isochrone-tool/buildIsochroneRequestUrl.js.map +1 -0
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.d.ts.map +1 -1
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.js +61 -34
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.js.map +1 -1
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.output.schema.d.ts +8 -5
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.output.schema.js +11 -5
- package/dist/esm/tools/map-matching-tool/MapMatchingTool.output.schema.js.map +1 -1
- package/dist/esm/tools/map-matching-tool/buildMapMatchingRequestUrl.d.ts +25 -0
- package/dist/esm/tools/map-matching-tool/buildMapMatchingRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/map-matching-tool/buildMapMatchingRequestUrl.js +30 -0
- package/dist/esm/tools/map-matching-tool/buildMapMatchingRequestUrl.js.map +1 -0
- package/dist/esm/tools/optimization-tool/OptimizationTool.d.ts.map +1 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.input.schema.d.ts.map +1 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.input.schema.js +19 -4
- package/dist/esm/tools/optimization-tool/OptimizationTool.input.schema.js.map +1 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.js +32 -33
- package/dist/esm/tools/optimization-tool/OptimizationTool.js.map +1 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.output.schema.d.ts +3 -5
- package/dist/esm/tools/optimization-tool/OptimizationTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.output.schema.js +6 -1
- package/dist/esm/tools/optimization-tool/OptimizationTool.output.schema.js.map +1 -1
- package/dist/esm/tools/optimization-tool/buildOptimizationRequestUrl.d.ts +30 -0
- package/dist/esm/tools/optimization-tool/buildOptimizationRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/optimization-tool/buildOptimizationRequestUrl.js +42 -0
- package/dist/esm/tools/optimization-tool/buildOptimizationRequestUrl.js.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.d.ts +60 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.d.ts.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts +41 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js +96 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.js +242 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.js.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts +97 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.js +32 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.js.map +1 -0
- package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +1 -1
- package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +3 -3
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts +10 -0
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +58 -48
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +3 -0
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js +3 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.d.ts +37 -0
- package/dist/esm/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.js +48 -0
- package/dist/esm/tools/search-and-geocode-tool/buildSearchAndGeocodeRequestUrl.js.map +1 -0
- package/dist/esm/tools/shared/polygonSchema.d.ts +15 -0
- package/dist/esm/tools/shared/polygonSchema.d.ts.map +1 -1
- package/dist/esm/tools/shared/polygonSchema.js +23 -2
- package/dist/esm/tools/shared/polygonSchema.js.map +1 -1
- package/dist/esm/tools/toolRegistry.d.ts +3 -2
- package/dist/esm/tools/toolRegistry.d.ts.map +1 -1
- package/dist/esm/tools/toolRegistry.js +2 -0
- package/dist/esm/tools/toolRegistry.js.map +1 -1
- package/dist/esm/tools/union-tool/UnionTool.d.ts.map +1 -1
- package/dist/esm/tools/union-tool/UnionTool.js +22 -3
- package/dist/esm/tools/union-tool/UnionTool.js.map +1 -1
- package/dist/esm/tools/union-tool/UnionTool.output.schema.d.ts +4 -1
- package/dist/esm/tools/union-tool/UnionTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/union-tool/UnionTool.output.schema.js +7 -3
- package/dist/esm/tools/union-tool/UnionTool.output.schema.js.map +1 -1
- package/dist/esm/tools/union-tool/buildPolygonOpsMapPayload.d.ts +21 -0
- package/dist/esm/tools/union-tool/buildPolygonOpsMapPayload.d.ts.map +1 -0
- package/dist/esm/tools/union-tool/buildPolygonOpsMapPayload.js +69 -0
- package/dist/esm/tools/union-tool/buildPolygonOpsMapPayload.js.map +1 -0
- package/dist/esm/utils/computeRef.d.ts +38 -0
- package/dist/esm/utils/computeRef.d.ts.map +1 -0
- package/dist/esm/utils/computeRef.js +111 -0
- package/dist/esm/utils/computeRef.js.map +1 -0
- package/dist/esm/utils/inlinePayloadRef.d.ts +32 -0
- package/dist/esm/utils/inlinePayloadRef.d.ts.map +1 -0
- package/dist/esm/utils/inlinePayloadRef.js +51 -0
- package/dist/esm/utils/inlinePayloadRef.js.map +1 -0
- package/dist/esm/utils/mapAppPayload.d.ts +206 -0
- package/dist/esm/utils/mapAppPayload.d.ts.map +1 -0
- package/dist/esm/utils/mapAppPayload.js +124 -0
- package/dist/esm/utils/mapAppPayload.js.map +1 -0
- package/dist/esm/utils/selfFetchRef.d.ts +25 -0
- package/dist/esm/utils/selfFetchRef.d.ts.map +1 -0
- package/dist/esm/utils/selfFetchRef.js +70 -0
- package/dist/esm/utils/selfFetchRef.js.map +1 -0
- package/dist/esm/utils/storeMapPayload.d.ts +71 -0
- package/dist/esm/utils/storeMapPayload.d.ts.map +1 -0
- package/dist/esm/utils/storeMapPayload.js +145 -0
- package/dist/esm/utils/storeMapPayload.js.map +1 -0
- package/dist/esm/version.json +3 -3
- package/package.json +2 -2
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.d.ts +0 -29
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.d.ts.map +0 -1
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.js.map +0 -1
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.d.ts +0 -45
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.d.ts.map +0 -1
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.js +0 -640
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.js.map +0 -1
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.d.ts +0 -29
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.d.ts.map +0 -1
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.js.map +0 -1
- package/dist/esm/resources/ui-apps/directionsAppHtml.d.ts +0 -45
- package/dist/esm/resources/ui-apps/directionsAppHtml.d.ts.map +0 -1
- package/dist/esm/resources/ui-apps/directionsAppHtml.js +0 -636
- package/dist/esm/resources/ui-apps/directionsAppHtml.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render the directions MCP App HTML.
|
|
3
|
-
*
|
|
4
|
-
* The same template is consumed by two ingress paths:
|
|
5
|
-
*
|
|
6
|
-
* 1. **MCP Apps spec** — `DirectionsAppUIResource` reads this resource at
|
|
7
|
-
* `ui://mapbox/directions-app/index.html`. The iframe loads, the agent's
|
|
8
|
-
* tool result is delivered via the `ui/notifications/tool-result`
|
|
9
|
-
* postMessage event, and `extractRoute()` pulls the route out of
|
|
10
|
-
* `structuredContent.routes[0]`.
|
|
11
|
-
*
|
|
12
|
-
* 2. **Legacy MCP-UI spec** — `directions_tool` inlines a `rawHtml`
|
|
13
|
-
* UIResource into its content array (gated by `isMcpUiEnabled()`). The
|
|
14
|
-
* HTML is generated at tool-execute time with the call's input params
|
|
15
|
-
* baked in as an `initialData` script block; the iframe uses those params
|
|
16
|
-
* to self-fetch the route from the Directions API, so it never depends on
|
|
17
|
-
* the host delivering the tool result.
|
|
18
|
-
*
|
|
19
|
-
* One source of truth for the rendering logic; two slim entry conditions.
|
|
20
|
-
*/
|
|
21
|
-
export declare const MAPBOX_GL_VERSION = "3.12.0";
|
|
22
|
-
export interface DirectionsAppInitialParams {
|
|
23
|
-
coordinates: {
|
|
24
|
-
longitude: number;
|
|
25
|
-
latitude: number;
|
|
26
|
-
}[];
|
|
27
|
-
routing_profile?: string;
|
|
28
|
-
alternatives?: boolean;
|
|
29
|
-
exclude?: string;
|
|
30
|
-
depart_at?: string;
|
|
31
|
-
arrive_by?: string;
|
|
32
|
-
max_height?: number;
|
|
33
|
-
max_width?: number;
|
|
34
|
-
max_weight?: number;
|
|
35
|
-
}
|
|
36
|
-
export interface DirectionsAppInitialData {
|
|
37
|
-
params: DirectionsAppInitialParams;
|
|
38
|
-
}
|
|
39
|
-
export declare function renderDirectionsAppHtml(params: {
|
|
40
|
-
publicToken: string;
|
|
41
|
-
apiEndpoint: string;
|
|
42
|
-
glVersion?: string;
|
|
43
|
-
initialData?: DirectionsAppInitialData;
|
|
44
|
-
}): string;
|
|
45
|
-
//# sourceMappingURL=directionsAppHtml.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directionsAppHtml.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,0BAA0B,CAAC;CACpC;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC,GAAG,MAAM,CAmmBT"}
|
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Mapbox, Inc.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
/**
|
|
4
|
-
* Render the directions MCP App HTML.
|
|
5
|
-
*
|
|
6
|
-
* The same template is consumed by two ingress paths:
|
|
7
|
-
*
|
|
8
|
-
* 1. **MCP Apps spec** — `DirectionsAppUIResource` reads this resource at
|
|
9
|
-
* `ui://mapbox/directions-app/index.html`. The iframe loads, the agent's
|
|
10
|
-
* tool result is delivered via the `ui/notifications/tool-result`
|
|
11
|
-
* postMessage event, and `extractRoute()` pulls the route out of
|
|
12
|
-
* `structuredContent.routes[0]`.
|
|
13
|
-
*
|
|
14
|
-
* 2. **Legacy MCP-UI spec** — `directions_tool` inlines a `rawHtml`
|
|
15
|
-
* UIResource into its content array (gated by `isMcpUiEnabled()`). The
|
|
16
|
-
* HTML is generated at tool-execute time with the call's input params
|
|
17
|
-
* baked in as an `initialData` script block; the iframe uses those params
|
|
18
|
-
* to self-fetch the route from the Directions API, so it never depends on
|
|
19
|
-
* the host delivering the tool result.
|
|
20
|
-
*
|
|
21
|
-
* One source of truth for the rendering logic; two slim entry conditions.
|
|
22
|
-
*/
|
|
23
|
-
export const MAPBOX_GL_VERSION = '3.12.0';
|
|
24
|
-
export function renderDirectionsAppHtml(params) {
|
|
25
|
-
const { publicToken, apiEndpoint, initialData } = params;
|
|
26
|
-
const glVersion = params.glVersion ?? MAPBOX_GL_VERSION;
|
|
27
|
-
const initialDataScript = initialData
|
|
28
|
-
? `<script id="initial-data" type="application/json">${escapeForScript(JSON.stringify(initialData))}</script>`
|
|
29
|
-
: '';
|
|
30
|
-
return `<!DOCTYPE html>
|
|
31
|
-
<html lang="en">
|
|
32
|
-
<head>
|
|
33
|
-
<meta charset="UTF-8">
|
|
34
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
35
|
-
<title>Directions Preview</title>
|
|
36
|
-
<link href="https://api.mapbox.com/mapbox-gl-js/v${glVersion}/mapbox-gl.css" rel="stylesheet">
|
|
37
|
-
<script src="https://api.mapbox.com/mapbox-gl-js/v${glVersion}/mapbox-gl.js"></script>
|
|
38
|
-
<style>
|
|
39
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
40
|
-
html, body { width: 100%; height: 100%; overflow: hidden;
|
|
41
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
|
42
|
-
#map { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
|
43
|
-
#summary {
|
|
44
|
-
position: absolute; top: 12px; left: 12px; z-index: 10;
|
|
45
|
-
background: rgba(15, 23, 42, 0.88); color: #f1f5f9;
|
|
46
|
-
padding: 8px 12px; border-radius: 6px;
|
|
47
|
-
font-size: 13px; font-weight: 500;
|
|
48
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
49
|
-
max-width: calc(100% - 24px);
|
|
50
|
-
}
|
|
51
|
-
#loading {
|
|
52
|
-
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
|
|
53
|
-
color: #666; font-size: 16px; z-index: 10; pointer-events: none;
|
|
54
|
-
}
|
|
55
|
-
#error {
|
|
56
|
-
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
|
|
57
|
-
color: #d32f2f; background: #ffebee; border-radius: 8px;
|
|
58
|
-
padding: 20px; max-width: 400px; text-align: center; z-index: 10;
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
61
|
-
</head>
|
|
62
|
-
<body>
|
|
63
|
-
<div id="map"></div>
|
|
64
|
-
<div id="summary" style="display:none"></div>
|
|
65
|
-
<div id="loading">Loading directions…</div>
|
|
66
|
-
<div id="error" style="display:none"></div>
|
|
67
|
-
${initialDataScript}
|
|
68
|
-
|
|
69
|
-
<script>
|
|
70
|
-
(function() {
|
|
71
|
-
var TOKEN = ${JSON.stringify(publicToken)};
|
|
72
|
-
var API_ENDPOINT = ${JSON.stringify(apiEndpoint)};
|
|
73
|
-
|
|
74
|
-
var loadingEl = document.getElementById('loading');
|
|
75
|
-
var errorEl = document.getElementById('error');
|
|
76
|
-
var summaryEl = document.getElementById('summary');
|
|
77
|
-
|
|
78
|
-
var map = null;
|
|
79
|
-
var mapLoaded = false;
|
|
80
|
-
var pendingRoute = null;
|
|
81
|
-
var currentDisplayMode = 'inline';
|
|
82
|
-
// Track markers across re-renders so we can remove them before drawing the
|
|
83
|
-
// next route — otherwise a second tool-result delivery stacks pins.
|
|
84
|
-
var routeMarkers = [];
|
|
85
|
-
// One render "cycle" per tool call delivered to this iframe. A new
|
|
86
|
-
// tool-input (or baked initial-data) delivery starts a new cycle by
|
|
87
|
-
// bumping \`generation\`; async callbacks that captured an older value are
|
|
88
|
-
// stale and must not touch the UI. This dedupes self-fetch vs tool-result
|
|
89
|
-
// within one call WITHOUT permanently blocking later calls that reuse
|
|
90
|
-
// this same iframe instance.
|
|
91
|
-
var generation = 0;
|
|
92
|
-
var renderedGeneration = -1; // generation whose route is on screen (-1 = none)
|
|
93
|
-
var selfFetchGeneration = -1; // generation that started a self-fetch (-1 = none)
|
|
94
|
-
|
|
95
|
-
// -------------------------------------------------------------------------
|
|
96
|
-
// Self-fetch: build a Directions API request directly from the tool call's
|
|
97
|
-
// input parameters and fetch the route ourselves, so this map never
|
|
98
|
-
// depends on the tool response carrying geometries="geojson".
|
|
99
|
-
//
|
|
100
|
-
// Mirrors src/tools/directions-tool/buildDirectionsRequestUrl.ts — kept in
|
|
101
|
-
// sync by the parity test in
|
|
102
|
-
// test/tools/directions-tool/directionsUrlParity.test.ts. Always forces
|
|
103
|
-
// geometries=geojson regardless of what the tool call itself requested.
|
|
104
|
-
// -------------------------------------------------------------------------
|
|
105
|
-
function formatIsoDateTimeClient(dateTime) {
|
|
106
|
-
var noTzWithSeconds = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/;
|
|
107
|
-
if (noTzWithSeconds.test(dateTime)) {
|
|
108
|
-
return dateTime.substring(0, dateTime.lastIndexOf(':'));
|
|
109
|
-
}
|
|
110
|
-
return dateTime;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function encodeExcludeClient(value) {
|
|
114
|
-
return value
|
|
115
|
-
.replace(/,/g, '%2C')
|
|
116
|
-
.replace(/\\(/g, '%28')
|
|
117
|
-
.replace(/\\)/g, '%29')
|
|
118
|
-
.replace(/ /g, '%20');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function buildDirectionsApiUrl(params, publicToken, apiEndpoint) {
|
|
122
|
-
var coords = params.coordinates
|
|
123
|
-
.map(function(c) { return c.longitude + ',' + c.latitude; })
|
|
124
|
-
.join(';');
|
|
125
|
-
var encodedCoords = encodeURIComponent(coords);
|
|
126
|
-
var profile = params.routing_profile || 'mapbox/driving-traffic';
|
|
127
|
-
|
|
128
|
-
var qp = new URLSearchParams();
|
|
129
|
-
qp.append('access_token', publicToken);
|
|
130
|
-
qp.append('geometries', 'geojson');
|
|
131
|
-
qp.append('alternatives', params.alternatives ? 'true' : 'false');
|
|
132
|
-
qp.append(
|
|
133
|
-
'annotations',
|
|
134
|
-
profile === 'mapbox/driving-traffic'
|
|
135
|
-
? 'distance,congestion,speed'
|
|
136
|
-
: 'distance,speed'
|
|
137
|
-
);
|
|
138
|
-
qp.append('overview', 'full');
|
|
139
|
-
|
|
140
|
-
if (params.depart_at) {
|
|
141
|
-
qp.append('depart_at', formatIsoDateTimeClient(params.depart_at));
|
|
142
|
-
} else if (params.arrive_by) {
|
|
143
|
-
qp.append('arrive_by', formatIsoDateTimeClient(params.arrive_by));
|
|
144
|
-
}
|
|
145
|
-
if (params.max_height !== undefined && params.max_height !== null) {
|
|
146
|
-
qp.append('max_height', String(params.max_height));
|
|
147
|
-
}
|
|
148
|
-
if (params.max_width !== undefined && params.max_width !== null) {
|
|
149
|
-
qp.append('max_width', String(params.max_width));
|
|
150
|
-
}
|
|
151
|
-
if (params.max_weight !== undefined && params.max_weight !== null) {
|
|
152
|
-
qp.append('max_weight', String(params.max_weight));
|
|
153
|
-
}
|
|
154
|
-
qp.append('steps', 'true');
|
|
155
|
-
|
|
156
|
-
var queryString = qp.toString();
|
|
157
|
-
if (params.exclude) {
|
|
158
|
-
queryString += '&exclude=' + encodeExcludeClient(params.exclude);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return apiEndpoint + 'directions/v5/' + profile + '/' + encodedCoords + '?' + queryString;
|
|
162
|
-
}
|
|
163
|
-
// Exposed so the parity test (Node vm sandbox) can call this in isolation.
|
|
164
|
-
window.__buildDirectionsApiUrl = buildDirectionsApiUrl;
|
|
165
|
-
|
|
166
|
-
// Params arrive via postMessage and are untrusted: they get interpolated
|
|
167
|
-
// into the request URL, so validate the pieces our encoding does not
|
|
168
|
-
// neutralize. routing_profile is spliced into the URL path unencoded, and
|
|
169
|
-
// encodeExcludeClient only escapes ',', '(', ')' and spaces — characters
|
|
170
|
-
// like '&' or '../' path segments would otherwise let a hostile sibling
|
|
171
|
-
// frame reshape the request. Server-side input is zod-validated before it
|
|
172
|
-
// reaches buildDirectionsRequestUrl; this mirrors those guarantees for
|
|
173
|
-
// the client copy.
|
|
174
|
-
function isSafeDirectionsParams(params) {
|
|
175
|
-
if (!params || !Array.isArray(params.coordinates)) return false;
|
|
176
|
-
if (params.coordinates.length < 2) return false;
|
|
177
|
-
for (var i = 0; i < params.coordinates.length; i++) {
|
|
178
|
-
var c = params.coordinates[i];
|
|
179
|
-
if (!c || typeof c.longitude !== 'number' || !isFinite(c.longitude)) return false;
|
|
180
|
-
if (typeof c.latitude !== 'number' || !isFinite(c.latitude)) return false;
|
|
181
|
-
}
|
|
182
|
-
if (params.routing_profile !== undefined && params.routing_profile !== null) {
|
|
183
|
-
if (typeof params.routing_profile !== 'string') return false;
|
|
184
|
-
if (!/^mapbox\\/[a-z-]+$/.test(params.routing_profile)) return false;
|
|
185
|
-
}
|
|
186
|
-
if (params.exclude !== undefined && params.exclude !== null) {
|
|
187
|
-
if (typeof params.exclude !== 'string') return false;
|
|
188
|
-
if (!/^[A-Za-z0-9_,.() -]+$/.test(params.exclude)) return false;
|
|
189
|
-
}
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function fetchRouteFromDirectionsApi(params) {
|
|
194
|
-
// Every delivery (tool-input notification or baked initial-data) starts
|
|
195
|
-
// a new render cycle, even when the guard below prevents the fetch from
|
|
196
|
-
// actually running — the new call must still invalidate the previous
|
|
197
|
-
// cycle's in-flight callbacks and error-suppression state.
|
|
198
|
-
generation++;
|
|
199
|
-
if (!TOKEN || !isSafeDirectionsParams(params)) return;
|
|
200
|
-
var gen = generation; // captured by the callbacks below
|
|
201
|
-
selfFetchGeneration = gen; // marked only when the fetch actually proceeds
|
|
202
|
-
var url = buildDirectionsApiUrl(params, TOKEN, API_ENDPOINT);
|
|
203
|
-
fetch(url)
|
|
204
|
-
.then(function(res) {
|
|
205
|
-
if (!res.ok) {
|
|
206
|
-
return res
|
|
207
|
-
.json()
|
|
208
|
-
.catch(function() { return null; })
|
|
209
|
-
.then(function(body) {
|
|
210
|
-
var msg =
|
|
211
|
-
body && body.message
|
|
212
|
-
? body.message
|
|
213
|
-
: 'Directions API error (' + res.status + ')';
|
|
214
|
-
throw new Error(msg);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return res.json();
|
|
218
|
-
})
|
|
219
|
-
.then(function(data) {
|
|
220
|
-
if (gen !== generation) return; // stale: a newer call started
|
|
221
|
-
if (renderedGeneration === gen) return; // cycle already drawn (tool-result won)
|
|
222
|
-
var route = data && data.routes && data.routes[0];
|
|
223
|
-
var picked = route ? pickRouteGeometry(route) : null;
|
|
224
|
-
if (picked) {
|
|
225
|
-
renderRoute(picked);
|
|
226
|
-
} else {
|
|
227
|
-
showError('Directions API returned no route.');
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
.catch(function(err) {
|
|
231
|
-
if (gen !== generation) return;
|
|
232
|
-
if (renderedGeneration === gen) return;
|
|
233
|
-
showError(
|
|
234
|
-
'Could not fetch route: ' + (err && err.message ? err.message : err)
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// -------------------------------------------------------------------------
|
|
240
|
-
// MCP App postMessage protocol (skipped silently in MCP-UI rawHtml mode)
|
|
241
|
-
// -------------------------------------------------------------------------
|
|
242
|
-
var messageId = 0;
|
|
243
|
-
var pendingRequests = new Map();
|
|
244
|
-
|
|
245
|
-
function sendRequest(method, params) {
|
|
246
|
-
var id = ++messageId;
|
|
247
|
-
try { window.parent.postMessage({ jsonrpc: '2.0', id: id, method: method, params: params || {} }, '*'); } catch (_) {}
|
|
248
|
-
return new Promise(function(resolve, reject) {
|
|
249
|
-
pendingRequests.set(id, { resolve: resolve, reject: reject });
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
function sendNotification(method, params) {
|
|
253
|
-
try { window.parent.postMessage({ jsonrpc: '2.0', method: method, params: params || {} }, '*'); } catch (_) {}
|
|
254
|
-
}
|
|
255
|
-
function requestSizeToFit() {
|
|
256
|
-
if (currentDisplayMode !== 'inline') return;
|
|
257
|
-
sendNotification('ui/notifications/size-changed', { height: 500 });
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
window.addEventListener('message', function(event) {
|
|
261
|
-
// Only the embedding host (parent frame) is a legitimate sender. Any
|
|
262
|
-
// frame in the page can obtain this window's reference and postMessage
|
|
263
|
-
// crafted notifications; pinning the source window blocks that while
|
|
264
|
-
// staying host-agnostic — the host's origin is unknowable at
|
|
265
|
-
// HTML-generation time, so an origin allowlist isn't possible for a
|
|
266
|
-
// portable MCP App. (Standalone/top-level, window.parent === window,
|
|
267
|
-
// so self-posted messages still work for manual testing.)
|
|
268
|
-
if (event.source !== window.parent) return;
|
|
269
|
-
var message = event.data;
|
|
270
|
-
if (!message || typeof message !== 'object') return;
|
|
271
|
-
|
|
272
|
-
if (message.id !== undefined && pendingRequests.has(message.id)) {
|
|
273
|
-
var handlers = pendingRequests.get(message.id);
|
|
274
|
-
pendingRequests.delete(message.id);
|
|
275
|
-
if (message.error) handlers.reject(new Error(message.error.message));
|
|
276
|
-
else handlers.resolve(message.result);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (message.method === 'ui/notifications/tool-input' && message.params) {
|
|
280
|
-
fetchRouteFromDirectionsApi(message.params.arguments);
|
|
281
|
-
}
|
|
282
|
-
if (message.method === 'ui/notifications/tool-result' && message.params) {
|
|
283
|
-
handleToolResult(message.params);
|
|
284
|
-
}
|
|
285
|
-
if (message.method === 'ui/notifications/host-context-changed' && message.params) {
|
|
286
|
-
var ctx = message.params;
|
|
287
|
-
if (ctx.displayMode) {
|
|
288
|
-
currentDisplayMode = ctx.displayMode;
|
|
289
|
-
if (map) setTimeout(function() { map.resize(); }, 100);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
sendRequest('ui/initialize', {
|
|
295
|
-
protocolVersion: '2026-01-26',
|
|
296
|
-
appCapabilities: {},
|
|
297
|
-
appInfo: { name: 'Directions Preview', version: '1.0.0' }
|
|
298
|
-
}).then(function() {
|
|
299
|
-
sendNotification('ui/notifications/initialized', {});
|
|
300
|
-
}, function() {
|
|
301
|
-
sendNotification('ui/notifications/initialized', {});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// -------------------------------------------------------------------------
|
|
305
|
-
// Map init
|
|
306
|
-
// -------------------------------------------------------------------------
|
|
307
|
-
function initMap() {
|
|
308
|
-
if (!TOKEN) {
|
|
309
|
-
loadingEl.style.display = 'none';
|
|
310
|
-
errorEl.textContent = 'No Mapbox public token available. Set MAPBOX_PUBLIC_TOKEN or grant tokens:read to the OAuth client.';
|
|
311
|
-
errorEl.style.display = 'block';
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
if (typeof mapboxgl === 'undefined') {
|
|
315
|
-
loadingEl.style.display = 'none';
|
|
316
|
-
errorEl.textContent = 'Mapbox GL JS failed to load.';
|
|
317
|
-
errorEl.style.display = 'block';
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
mapboxgl.accessToken = TOKEN;
|
|
322
|
-
map = new mapboxgl.Map({
|
|
323
|
-
container: 'map',
|
|
324
|
-
style: 'mapbox://styles/mapbox/streets-v12',
|
|
325
|
-
center: [0, 20],
|
|
326
|
-
zoom: 1.5
|
|
327
|
-
});
|
|
328
|
-
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
|
|
329
|
-
map.on('load', function() {
|
|
330
|
-
mapLoaded = true;
|
|
331
|
-
if (pendingRoute) {
|
|
332
|
-
drawRoute(pendingRoute);
|
|
333
|
-
pendingRoute = null;
|
|
334
|
-
} else {
|
|
335
|
-
consumeInitialData();
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
map.on('error', function(e) {
|
|
339
|
-
console.error('Mapbox error:', e && e.error && e.error.message ? e.error.message : e);
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
initMap();
|
|
343
|
-
|
|
344
|
-
// -------------------------------------------------------------------------
|
|
345
|
-
// Initial data path (MCP-UI rawHtml): the tool call's input params were
|
|
346
|
-
// baked in server-side. Self-fetch the route from the Directions API
|
|
347
|
-
// rather than relying on baked-in geometry from the tool response.
|
|
348
|
-
// -------------------------------------------------------------------------
|
|
349
|
-
function consumeInitialData() {
|
|
350
|
-
var el = document.getElementById('initial-data');
|
|
351
|
-
if (!el || !el.textContent) return;
|
|
352
|
-
try {
|
|
353
|
-
var data = JSON.parse(el.textContent);
|
|
354
|
-
if (!data || !data.params) return;
|
|
355
|
-
fetchRouteFromDirectionsApi(data.params);
|
|
356
|
-
} catch (_) { /* ignore */ }
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function handleToolResult(result) {
|
|
360
|
-
// A tool-result that isn't paired with this cycle's self-fetch (no
|
|
361
|
-
// tool-input was delivered for it — e.g. hosts that only send
|
|
362
|
-
// tool-result) represents a new tool call, so it starts its own render
|
|
363
|
-
// cycle. A paired result belongs to the cycle its tool-input opened;
|
|
364
|
-
// bumping for it would wrongly invalidate the in-flight self-fetch.
|
|
365
|
-
if (selfFetchGeneration !== generation) generation++;
|
|
366
|
-
var route = extractRoute(result);
|
|
367
|
-
if (route) {
|
|
368
|
-
// Authoritative geometry: always (re)render — drawRoute removes the
|
|
369
|
-
// previous route's layers/markers, which is what lets a host reuse
|
|
370
|
-
// one iframe across sequential directions_tool calls.
|
|
371
|
-
renderRoute(route);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// Fallback: large directions responses are stored as a temporary resource
|
|
376
|
-
// (mapbox://temp/directions-id) and the structuredContent is stripped of
|
|
377
|
-
// geometry to keep the agent context light. Read it back via the
|
|
378
|
-
// MCP Apps host resources/read bridge.
|
|
379
|
-
var tempUri = findTempResourceUri(result);
|
|
380
|
-
if (tempUri) {
|
|
381
|
-
var gen = generation;
|
|
382
|
-
loadingEl.textContent = 'Fetching full route…';
|
|
383
|
-
sendRequest('resources/read', { uri: tempUri }).then(
|
|
384
|
-
function(rr) {
|
|
385
|
-
if (gen !== generation) return; // stale: a newer call started
|
|
386
|
-
var fetched = readResourceJson(rr);
|
|
387
|
-
var fetchedRoute = fetched ? extractRoute({ structuredContent: fetched }) : null;
|
|
388
|
-
if (fetchedRoute) {
|
|
389
|
-
renderRoute(fetchedRoute);
|
|
390
|
-
} else if (renderedGeneration !== gen) {
|
|
391
|
-
showError('Could not parse route from the temporary resource.');
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
function(err) {
|
|
395
|
-
if (gen !== generation || renderedGeneration === gen) return;
|
|
396
|
-
showError('Could not read temporary resource: ' + (err && err.message ? err.message : err));
|
|
397
|
-
}
|
|
398
|
-
);
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// No geometry in this result. Suppress the hard error only when this
|
|
403
|
-
// cycle's self-fetch is handling it (in flight, already rendered, or it
|
|
404
|
-
// already reported its own error via its .catch() handler). An unpaired
|
|
405
|
-
// result opened a fresh cycle above, so a route left over from an
|
|
406
|
-
// earlier call never suppresses this error.
|
|
407
|
-
if (selfFetchGeneration === generation) return;
|
|
408
|
-
|
|
409
|
-
showError('Could not find route data in tool result.');
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function renderRoute(route) {
|
|
413
|
-
renderedGeneration = generation;
|
|
414
|
-
if (route.summary) {
|
|
415
|
-
summaryEl.textContent = route.summary;
|
|
416
|
-
summaryEl.style.display = 'block';
|
|
417
|
-
}
|
|
418
|
-
if (!map) { loadingEl.style.display = 'none'; return; }
|
|
419
|
-
if (mapLoaded) drawRoute(route);
|
|
420
|
-
else pendingRoute = route;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function showError(message) {
|
|
424
|
-
loadingEl.style.display = 'none';
|
|
425
|
-
errorEl.textContent = message;
|
|
426
|
-
errorEl.style.display = 'block';
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// Mapbox MCP server emits the URI in the summary text content of large
|
|
430
|
-
// responses: "Resource URI: mapbox://temp/directions-<hex>".
|
|
431
|
-
function findTempResourceUri(result) {
|
|
432
|
-
if (!result || !Array.isArray(result.content)) return null;
|
|
433
|
-
for (var i = 0; i < result.content.length; i++) {
|
|
434
|
-
var c = result.content[i];
|
|
435
|
-
if (c && c.type === 'text' && typeof c.text === 'string') {
|
|
436
|
-
var m = c.text.match(/mapbox:\\/\\/temp\\/directions-[0-9a-fA-F]+/);
|
|
437
|
-
if (m) return m[0];
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return null;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// resources/read responses have shape: { contents: [{ text: "<json>", ... }] }
|
|
444
|
-
function readResourceJson(rr) {
|
|
445
|
-
if (!rr || !Array.isArray(rr.contents) || rr.contents.length === 0) return null;
|
|
446
|
-
var first = rr.contents[0];
|
|
447
|
-
if (!first || typeof first.text !== 'string') return null;
|
|
448
|
-
try { return JSON.parse(first.text); } catch (_) { return null; }
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function extractRoute(result) {
|
|
452
|
-
var sc = result && result.structuredContent;
|
|
453
|
-
if (sc && Array.isArray(sc.routes) && sc.routes.length > 0) {
|
|
454
|
-
var picked = pickRouteGeometry(sc.routes[0]);
|
|
455
|
-
if (picked) return picked;
|
|
456
|
-
}
|
|
457
|
-
if (result && Array.isArray(result.content)) {
|
|
458
|
-
for (var i = 0; i < result.content.length; i++) {
|
|
459
|
-
var c = result.content[i];
|
|
460
|
-
if (c && c.type === 'text' && typeof c.text === 'string') {
|
|
461
|
-
try {
|
|
462
|
-
var parsed = JSON.parse(c.text);
|
|
463
|
-
if (parsed && Array.isArray(parsed.routes) && parsed.routes[0]) {
|
|
464
|
-
var picked2 = pickRouteGeometry(parsed.routes[0]);
|
|
465
|
-
if (picked2) return picked2;
|
|
466
|
-
}
|
|
467
|
-
if (parsed && parsed.geometry && parsed.geometry.coordinates) {
|
|
468
|
-
return parsed;
|
|
469
|
-
}
|
|
470
|
-
} catch (_) { /* not JSON */ }
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// Mapbox Directions can return geometry in 3 shapes:
|
|
478
|
-
// - GeoJSON : { type: 'LineString', coordinates: [[lng,lat], ...] }
|
|
479
|
-
// - polyline : "encoded_string" (precision 5, default)
|
|
480
|
-
// - polyline6: "encoded_string" (precision 6)
|
|
481
|
-
// We accept all three and normalize to GeoJSON for rendering.
|
|
482
|
-
function pickRouteGeometry(route) {
|
|
483
|
-
if (!route || !route.geometry) return null;
|
|
484
|
-
var g = route.geometry;
|
|
485
|
-
if (typeof g === 'object' && Array.isArray(g.coordinates) && g.coordinates.length) {
|
|
486
|
-
return { geometry: g, summary: buildSummary(route) };
|
|
487
|
-
}
|
|
488
|
-
if (typeof g === 'string' && g.length > 0) {
|
|
489
|
-
// Pick precision: polyline6 strings often contain '_' / '@'-like density
|
|
490
|
-
// but the response usually carries a hint at top level. Try 6 first if
|
|
491
|
-
// the response object says so, else 5.
|
|
492
|
-
var coords = decodePolyline(g, 5);
|
|
493
|
-
if (coords.length > 0 && coordsLookSane(coords)) {
|
|
494
|
-
return {
|
|
495
|
-
geometry: { type: 'LineString', coordinates: coords },
|
|
496
|
-
summary: buildSummary(route)
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
coords = decodePolyline(g, 6);
|
|
500
|
-
if (coords.length > 0 && coordsLookSane(coords)) {
|
|
501
|
-
return {
|
|
502
|
-
geometry: { type: 'LineString', coordinates: coords },
|
|
503
|
-
summary: buildSummary(route)
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function coordsLookSane(coords) {
|
|
511
|
-
for (var i = 0; i < coords.length; i++) {
|
|
512
|
-
var c = coords[i];
|
|
513
|
-
if (!Array.isArray(c) || c.length !== 2) return false;
|
|
514
|
-
if (c[0] < -180 || c[0] > 180 || c[1] < -90 || c[1] > 90) return false;
|
|
515
|
-
}
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// Standard Google/Mapbox polyline decoder. Precision = 5 (default) or 6.
|
|
520
|
-
function decodePolyline(str, precision) {
|
|
521
|
-
precision = precision || 5;
|
|
522
|
-
var factor = Math.pow(10, precision);
|
|
523
|
-
var coords = [];
|
|
524
|
-
var lat = 0;
|
|
525
|
-
var lng = 0;
|
|
526
|
-
var i = 0;
|
|
527
|
-
while (i < str.length) {
|
|
528
|
-
var shift = 0;
|
|
529
|
-
var result = 0;
|
|
530
|
-
var b;
|
|
531
|
-
do {
|
|
532
|
-
b = str.charCodeAt(i++) - 63;
|
|
533
|
-
result |= (b & 0x1f) << shift;
|
|
534
|
-
shift += 5;
|
|
535
|
-
} while (b >= 0x20 && i < str.length);
|
|
536
|
-
lat += (result & 1) ? ~(result >> 1) : (result >> 1);
|
|
537
|
-
shift = 0;
|
|
538
|
-
result = 0;
|
|
539
|
-
do {
|
|
540
|
-
b = str.charCodeAt(i++) - 63;
|
|
541
|
-
result |= (b & 0x1f) << shift;
|
|
542
|
-
shift += 5;
|
|
543
|
-
} while (b >= 0x20 && i < str.length);
|
|
544
|
-
lng += (result & 1) ? ~(result >> 1) : (result >> 1);
|
|
545
|
-
coords.push([lng / factor, lat / factor]);
|
|
546
|
-
}
|
|
547
|
-
return coords;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function buildSummary(route) {
|
|
551
|
-
var parts = [];
|
|
552
|
-
if (typeof route.distance === 'number') {
|
|
553
|
-
parts.push((route.distance / 1609.34).toFixed(1) + ' mi');
|
|
554
|
-
}
|
|
555
|
-
if (typeof route.duration === 'number') {
|
|
556
|
-
parts.push(Math.round(route.duration / 60) + ' min');
|
|
557
|
-
}
|
|
558
|
-
return parts.length ? 'Route: ' + parts.join(', ') : 'Route';
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
function drawRoute(route) {
|
|
562
|
-
if (!route.geometry || !route.geometry.coordinates || !route.geometry.coordinates.length) {
|
|
563
|
-
loadingEl.style.display = 'none';
|
|
564
|
-
errorEl.textContent = 'Route geometry is empty.';
|
|
565
|
-
errorEl.style.display = 'block';
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
errorEl.style.display = 'none';
|
|
570
|
-
|
|
571
|
-
if (route.summary && summaryEl.style.display === 'none') {
|
|
572
|
-
summaryEl.textContent = route.summary;
|
|
573
|
-
summaryEl.style.display = 'block';
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if (map.getLayer('route-line')) map.removeLayer('route-line');
|
|
577
|
-
if (map.getSource('route')) map.removeSource('route');
|
|
578
|
-
// Remove any markers from a prior render so we don't stack pins.
|
|
579
|
-
for (var mi = 0; mi < routeMarkers.length; mi++) {
|
|
580
|
-
routeMarkers[mi].remove();
|
|
581
|
-
}
|
|
582
|
-
routeMarkers = [];
|
|
583
|
-
|
|
584
|
-
map.addSource('route', {
|
|
585
|
-
type: 'geojson',
|
|
586
|
-
data: { type: 'Feature', geometry: route.geometry, properties: {} }
|
|
587
|
-
});
|
|
588
|
-
map.addLayer({
|
|
589
|
-
id: 'route-line',
|
|
590
|
-
type: 'line',
|
|
591
|
-
source: 'route',
|
|
592
|
-
layout: { 'line-join': 'round', 'line-cap': 'round' },
|
|
593
|
-
paint: { 'line-color': '#3b82f6', 'line-width': 5, 'line-opacity': 0.85 }
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
var coords = route.geometry.coordinates;
|
|
597
|
-
routeMarkers.push(
|
|
598
|
-
new mapboxgl.Marker({ color: '#22c55e' })
|
|
599
|
-
.setLngLat(coords[0])
|
|
600
|
-
.setPopup(new mapboxgl.Popup().setText('Start'))
|
|
601
|
-
.addTo(map)
|
|
602
|
-
);
|
|
603
|
-
routeMarkers.push(
|
|
604
|
-
new mapboxgl.Marker({ color: '#ef4444' })
|
|
605
|
-
.setLngLat(coords[coords.length - 1])
|
|
606
|
-
.setPopup(new mapboxgl.Popup().setText('End'))
|
|
607
|
-
.addTo(map)
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
var lngs = coords.map(function(c) { return c[0]; });
|
|
611
|
-
var lats = coords.map(function(c) { return c[1]; });
|
|
612
|
-
var bounds = [
|
|
613
|
-
[Math.min.apply(null, lngs), Math.min.apply(null, lats)],
|
|
614
|
-
[Math.max.apply(null, lngs), Math.max.apply(null, lats)]
|
|
615
|
-
];
|
|
616
|
-
|
|
617
|
-
loadingEl.style.display = 'none';
|
|
618
|
-
requestSizeToFit();
|
|
619
|
-
setTimeout(function() {
|
|
620
|
-
map.resize();
|
|
621
|
-
map.fitBounds(bounds, {
|
|
622
|
-
padding: { top: 70, bottom: 30, left: 30, right: 30 },
|
|
623
|
-
duration: 600
|
|
624
|
-
});
|
|
625
|
-
}, 60);
|
|
626
|
-
}
|
|
627
|
-
})();
|
|
628
|
-
</script>
|
|
629
|
-
</body>
|
|
630
|
-
</html>`;
|
|
631
|
-
}
|
|
632
|
-
function escapeForScript(s) {
|
|
633
|
-
// Prevent </script> inside JSON from breaking out of the script tag.
|
|
634
|
-
return s.replace(/<\/script>/gi, '<\\/script>');
|
|
635
|
-
}
|
|
636
|
-
//# sourceMappingURL=directionsAppHtml.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directionsAppHtml.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAkB1C,MAAM,UAAU,uBAAuB,CAAC,MAKvC;IACC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACzD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,iBAAiB,CAAC;IAExD,MAAM,iBAAiB,GAAG,WAAW;QACnC,CAAC,CAAC,qDAAqD,eAAe,CAClE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAC5B,WAAW;QACd,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;;mDAM0C,SAAS;oDACR,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B3D,iBAAiB;;;;gBAIH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;uBACpB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8iB1C,CAAC;AACT,CAAC;AAED,SAAS,eAAe,CAAC,CAAS;IAChC,qEAAqE;IACrE,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC"}
|