sveltekit-ui 1.1.17 → 1.1.19
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/Components/Alert/index.svelte +88 -0
- package/dist/Components/Alert/index.svelte.js +101 -0
- package/dist/Components/ArrowToggle/index.svelte +62 -0
- package/dist/Components/Attachment/index.svelte +77 -0
- package/dist/Components/Attachment/index.svelte.js +119 -0
- package/dist/Components/Audio/index.svelte +193 -0
- package/dist/Components/Audio/index.svelte.js +463 -0
- package/dist/Components/AudioEditor/index.svelte +252 -0
- package/dist/Components/AudioEditor/index.svelte.js +977 -0
- package/dist/Components/AudioEditor/samples/alloy-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/echo-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/fable-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/nova-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/onyx-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/shimmer-voice-sample.mp3 +0 -0
- package/dist/Components/AuthCodeInput/index.svelte +85 -0
- package/dist/Components/AuthCodeInput/index.svelte.js +95 -0
- package/dist/Components/Breadcrumbs/index.svelte +27 -0
- package/dist/Components/Breadcrumbs/index.svelte.js +88 -0
- package/dist/Components/Button/index.svelte +721 -0
- package/dist/Components/Button/index.svelte.js +375 -0
- package/dist/Components/Chart/Klines/index.svelte +87 -0
- package/dist/Components/Chart/index.svelte +226 -0
- package/dist/Components/Chart/index.svelte.js +1099 -0
- package/dist/Components/ChartInput/DisplayNav/Klines/index.svelte +150 -0
- package/dist/Components/ChartInput/DisplayNav/Lines/index.svelte +45 -0
- package/dist/Components/ChartInput/DisplayNav/index.svelte +297 -0
- package/dist/Components/ChartInput/EditPanel/index.svelte +155 -0
- package/dist/Components/ChartInput/index.svelte +21 -0
- package/dist/Components/ChartInput/index.svelte.js +671 -0
- package/dist/Components/Checkbox/index.svelte +411 -0
- package/dist/Components/Checkbox/index.svelte.js +178 -0
- package/dist/Components/Code/index.svelte +23 -0
- package/dist/Components/Code/index.svelte.js +33 -0
- package/dist/Components/Color/index.svelte +51 -0
- package/dist/Components/Color/index.svelte.js +31 -0
- package/dist/Components/ColorInput/ChromaPicker/index.svelte +50 -0
- package/dist/Components/ColorInput/ColorPalette/index.svelte +62 -0
- package/dist/Components/ColorInput/OpacityPicker/index.svelte +68 -0
- package/dist/Components/ColorInput/ShowcasePicker/index.svelte +136 -0
- package/dist/Components/ColorInput/index.svelte +70 -0
- package/dist/Components/ColorInput/index.svelte.js +386 -0
- package/dist/Components/ConditionsInput/index.svelte +46 -0
- package/dist/Components/ConditionsInput/index.svelte.js +201 -0
- package/dist/Components/Confetti/index.svelte +98 -0
- package/dist/Components/Confetti/index.svelte.js +94 -0
- package/dist/Components/Content/index.svelte +500 -0
- package/dist/Components/Content/index.svelte.js +910 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte +31 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte.js +258 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte +31 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte.js +258 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte +58 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +206 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte +28 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte.js +224 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte +44 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +272 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte +41 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +202 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte +19 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +117 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte +60 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +542 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte +47 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte.js +185 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte +35 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +222 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte +20 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +84 -0
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte +25 -0
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +91 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte +352 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte.js +1436 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte +64 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte.js +97 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte +184 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/index.svelte +41 -0
- package/dist/Components/ContentInput/index.svelte +78 -0
- package/dist/Components/ContentInput/index.svelte.js +1197 -0
- package/dist/Components/CronInput/index.svelte +78 -0
- package/dist/Components/CronInput/index.svelte.js +198 -0
- package/dist/Components/DataTypeInput/index.svelte +174 -0
- package/dist/Components/DataTypeInput/index.svelte.js +565 -0
- package/dist/Components/Dropdown/index.svelte +116 -0
- package/dist/Components/Dropdown/index.svelte.js +403 -0
- package/dist/Components/EmailAddress/index.svelte +22 -0
- package/dist/Components/EmailAddress/index.svelte.js +45 -0
- package/dist/Components/ErrorX/index.svelte +58 -0
- package/dist/Components/Eye/index.svelte +57 -0
- package/dist/Components/FileInput/index.svelte +146 -0
- package/dist/Components/FileInput/index.svelte.js +225 -0
- package/dist/Components/Hamburger/index.svelte +99 -0
- package/dist/Components/HorizScrollBox/index.svelte +145 -0
- package/dist/Components/Icon/index.svelte +412 -0
- package/dist/Components/Icon/index.svelte.js +116 -0
- package/dist/Components/IconInput/index.svelte +77 -0
- package/dist/Components/IconInput/index.svelte.js +259 -0
- package/dist/Components/Image/index.svelte +126 -0
- package/dist/Components/Image/index.svelte.js +116 -0
- package/dist/Components/ImageEditor/Image/CropBox/index.svelte +165 -0
- package/dist/Components/ImageEditor/Image/index.svelte +104 -0
- package/dist/Components/ImageEditor/Panels/AI/index.svelte +44 -0
- package/dist/Components/ImageEditor/Panels/Crop/index.svelte +96 -0
- package/dist/Components/ImageEditor/Panels/File/QualityPicker/index.svelte +124 -0
- package/dist/Components/ImageEditor/Panels/File/index.svelte +74 -0
- package/dist/Components/ImageEditor/Panels/Filters/index.svelte +46 -0
- package/dist/Components/ImageEditor/Panels/Resize/index.svelte +58 -0
- package/dist/Components/ImageEditor/index.svelte +93 -0
- package/dist/Components/ImageEditor/index.svelte.js +1961 -0
- package/dist/Components/ImageSlider/index.svelte +124 -0
- package/dist/Components/ImageSlider/index.svelte.js +99 -0
- package/dist/Components/InfoBox/index.svelte +89 -0
- package/dist/Components/Json/Nested/index.svelte +157 -0
- package/dist/Components/Json/index.svelte +60 -0
- package/dist/Components/Json/index.svelte.js +594 -0
- package/dist/Components/LabeledItem/index.svelte +102 -0
- package/dist/Components/Layout/NavBar/FullNav/index.svelte +52 -0
- package/dist/Components/Layout/NavBar/NavGuts/index.svelte +87 -0
- package/dist/Components/Layout/NavBar/index.svelte +72 -0
- package/dist/Components/Layout/index.svelte +149 -0
- package/dist/Components/Layout/index.svelte.js +360 -0
- package/dist/Components/Link/index.svelte +47 -0
- package/dist/Components/Link/index.svelte.js +136 -0
- package/dist/Components/LoadingSuccessDiv/index.svelte +51 -0
- package/dist/Components/LoadingWheel/index.svelte +38 -0
- package/dist/Components/Location/index.svelte +79 -0
- package/dist/Components/Location/index.svelte.js +288 -0
- package/dist/Components/LocationInput/index.svelte +197 -0
- package/dist/Components/LocationInput/index.svelte.js +965 -0
- package/dist/Components/Number/index.svelte +47 -0
- package/dist/Components/Number/index.svelte.js +151 -0
- package/dist/Components/PhoneCountryCode/index.svelte +7 -0
- package/dist/Components/PhoneCountryCode/index.svelte.js +260 -0
- package/dist/Components/PhoneNumber/index.svelte +22 -0
- package/dist/Components/PhoneNumber/index.svelte.js +41 -0
- package/dist/Components/Popover/index.svelte +396 -0
- package/dist/Components/Popover/index.svelte.js +319 -0
- package/dist/Components/Qr/index.svelte +85 -0
- package/dist/Components/Qr/index.svelte.js +301 -0
- package/dist/Components/QrInput/index.svelte +47 -0
- package/dist/Components/QrInput/index.svelte.js +218 -0
- package/dist/Components/Slider/index.svelte +239 -0
- package/dist/Components/Slider/index.svelte.js +469 -0
- package/dist/Components/Spacer/index.svelte +41 -0
- package/dist/Components/StoragePicker/DisplayFile/index.svelte +15 -0
- package/dist/Components/StoragePicker/index.svelte +187 -0
- package/dist/Components/StoragePicker/index.svelte.js +592 -0
- package/dist/Components/SuccessCheck/index.svelte +56 -0
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte +117 -0
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +456 -0
- package/dist/Components/TableAdvanced/FilterInput/index.svelte +54 -0
- package/dist/Components/TableAdvanced/FilterInput/index.svelte.js +247 -0
- package/dist/Components/TableAdvanced/Pagination/index.svelte +43 -0
- package/dist/Components/TableAdvanced/Pagination/index.svelte.js +97 -0
- package/dist/Components/TableAdvanced/SortByInput/index.svelte +72 -0
- package/dist/Components/TableAdvanced/SortByInput/index.svelte.js +176 -0
- package/dist/Components/TableAdvanced/index.svelte +275 -0
- package/dist/Components/TableAdvanced/index.svelte.js +1565 -0
- package/dist/Components/Tag/index.svelte +45 -0
- package/dist/Components/Tag/index.svelte.js +76 -0
- package/dist/Components/TextArrayInput/index.svelte +108 -0
- package/dist/Components/TextArrayInput/index.svelte.js +239 -0
- package/dist/Components/TextInput/PasswordTooltip/index.svelte +89 -0
- package/dist/Components/TextInput/index.svelte +223 -0
- package/dist/Components/TextInput/index.svelte.js +447 -0
- package/dist/Components/Time/index.svelte +7 -0
- package/dist/Components/Time/index.svelte.js +38 -0
- package/dist/Components/TimeInput/NumberToggler/index.svelte +34 -0
- package/dist/Components/TimeInput/NumberToggler/index.svelte.js +79 -0
- package/dist/Components/TimeInput/index.js +702 -0
- package/dist/Components/TimeInput/index.svelte +211 -0
- package/dist/Components/TimeInput/index.svelte.js +638 -0
- package/dist/Components/Tooltip/index.svelte +143 -0
- package/dist/Components/TransparentBackground/index.svelte +153 -0
- package/dist/Components/TypingDots/index.svelte +84 -0
- package/dist/Components/VariablePathInput/index.svelte +63 -0
- package/dist/Components/VariablePathInput/index.svelte.js +273 -0
- package/dist/Components/VideoTBD/index.svelte +100 -0
- package/dist/Components/XFollow/index.svelte +42 -0
- package/dist/Components/XPost/index.svelte +52 -0
- package/dist/Components/XPost/index.svelte.js +64 -0
- package/dist/Components/YoutubeChannelButton/index.svelte +82 -0
- package/dist/Components/YoutubeVideo/index.svelte +73 -0
- package/dist/Components/YoutubeVideo/index.svelte.js +54 -0
- package/dist/actions/draggable.js +49 -0
- package/dist/actions/index.js +24 -0
- package/dist/actions/no_spaces.js +33 -0
- package/dist/actions/numbers_only.js +26 -0
- package/dist/actions/scroll_y.js +28 -0
- package/dist/actions/stop_scroll_propagation_y.js +42 -0
- package/dist/actions/swipe_handler.js +295 -0
- package/dist/client/astc_formatting/index.js +1128 -0
- package/dist/client/docs/index.js +7622 -0
- package/dist/client/index.js +735 -0
- package/dist/client/types/index.js +2812 -0
- package/dist/index.js +180 -0
- package/dist/style.css +682 -0
- package/package.json +2 -2
- package/src/lib/Components/Chart/index.svelte.js +11 -2
|
@@ -0,0 +1,965 @@
|
|
|
1
|
+
import { create_unique_id, set_closurable } from "../../client/index.js"
|
|
2
|
+
import { create_button_manager } from "../Button/index.svelte.js"
|
|
3
|
+
import { create_popover_manager } from "../Popover/index.svelte.js"
|
|
4
|
+
import { create_text_input_manager } from "../TextInput/index.svelte.js"
|
|
5
|
+
import { create_dropdown_manager } from "../Dropdown/index.svelte.js"
|
|
6
|
+
import { create_checkbox_manager } from "../Checkbox/index.svelte.js"
|
|
7
|
+
import { browser } from "$app/environment"
|
|
8
|
+
|
|
9
|
+
export function create_location_input_manager(config) {
|
|
10
|
+
const id = create_unique_id(null, 20)
|
|
11
|
+
|
|
12
|
+
const poi_categories = [
|
|
13
|
+
{ key: "Airport", name: "Airport" },
|
|
14
|
+
{ key: "AirportGate", name: "Airport Gate" },
|
|
15
|
+
{ key: "AirportTerminal", name: "Airport Terminal" },
|
|
16
|
+
{ key: "AmusementPark", name: "Amusement Park" },
|
|
17
|
+
{ key: "ATM", name: "ATM" },
|
|
18
|
+
{ key: "Aquarium", name: "Aquarium" },
|
|
19
|
+
{ key: "Bakery", name: "Bakery" },
|
|
20
|
+
{ key: "Bank", name: "Bank" },
|
|
21
|
+
{ key: "Beach", name: "Beach" },
|
|
22
|
+
{ key: "Brewery", name: "Brewery" },
|
|
23
|
+
{ key: "Cafe", name: "Cafe" },
|
|
24
|
+
{ key: "Campground", name: "Campground" },
|
|
25
|
+
{ key: "CarRental", name: "Car Rental" },
|
|
26
|
+
{ key: "EVCharger", name: "EV Charger" },
|
|
27
|
+
{ key: "FireStation", name: "Fire Station" },
|
|
28
|
+
{ key: "FitnessCenter", name: "Fitness Center" },
|
|
29
|
+
{ key: "FoodMarket", name: "Food Market" },
|
|
30
|
+
{ key: "GasStation", name: "Gas Station" },
|
|
31
|
+
{ key: "Hospital", name: "Hospital" },
|
|
32
|
+
{ key: "Hotel", name: "Hotel" },
|
|
33
|
+
{ key: "Laundry", name: "Laundry" },
|
|
34
|
+
{ key: "Library", name: "Library" },
|
|
35
|
+
{ key: "Marina", name: "Marina" },
|
|
36
|
+
{ key: "MovieTheater", name: "Movie Theater" },
|
|
37
|
+
{ key: "Museum", name: "Museum" },
|
|
38
|
+
{ key: "NationalPark", name: "National Park" },
|
|
39
|
+
{ key: "Nightlife", name: "Nightlife" },
|
|
40
|
+
{ key: "Park", name: "Park" },
|
|
41
|
+
{ key: "Parking", name: "Parking" },
|
|
42
|
+
{ key: "Pharmacy", name: "Pharmacy" },
|
|
43
|
+
{ key: "Playground", name: "Playground" },
|
|
44
|
+
{ key: "Police", name: "Police Station" },
|
|
45
|
+
{ key: "PostOffice", name: "Post Office" },
|
|
46
|
+
{ key: "PublicTransport", name: "Public Transport" },
|
|
47
|
+
{ key: "ReligiousSite", name: "Religious Site" },
|
|
48
|
+
{ key: "Restaurant", name: "Restaurant" },
|
|
49
|
+
{ key: "Restroom", name: "Restroom" },
|
|
50
|
+
{ key: "School", name: "School" },
|
|
51
|
+
{ key: "Stadium", name: "Stadium" },
|
|
52
|
+
{ key: "Store", name: "Store" },
|
|
53
|
+
{ key: "Theater", name: "Theater" },
|
|
54
|
+
{ key: "University", name: "University" },
|
|
55
|
+
{ key: "Winery", name: "Winery" },
|
|
56
|
+
{ key: "Zoo", name: "Zoo" },
|
|
57
|
+
{ key: "AnimalService", name: "Animal Service" },
|
|
58
|
+
{ key: "AutomotiveRepair", name: "Automotive Repair" },
|
|
59
|
+
{ key: "Baseball", name: "Baseball" },
|
|
60
|
+
{ key: "Basketball", name: "Basketball" },
|
|
61
|
+
{ key: "Beauty", name: "Beauty" },
|
|
62
|
+
{ key: "Bowling", name: "Bowling" },
|
|
63
|
+
{ key: "Castle", name: "Castle" },
|
|
64
|
+
{ key: "ConventionCenter", name: "Convention Center" },
|
|
65
|
+
{ key: "Distillery", name: "Distillery" },
|
|
66
|
+
{ key: "Fairground", name: "Fairground" },
|
|
67
|
+
{ key: "Fishing", name: "Fishing" },
|
|
68
|
+
{ key: "Fortress", name: "Fortress" },
|
|
69
|
+
{ key: "GoKart", name: "Go Kart" },
|
|
70
|
+
{ key: "Golf", name: "Golf" },
|
|
71
|
+
{ key: "Hiking", name: "Hiking" },
|
|
72
|
+
{ key: "Kayaking", name: "Kayaking" },
|
|
73
|
+
{ key: "Landmark", name: "Landmark" },
|
|
74
|
+
{ key: "Mailbox", name: "Mailbox" },
|
|
75
|
+
{ key: "MiniGolf", name: "Mini Golf" },
|
|
76
|
+
{ key: "MusicVenue", name: "Music Venue" },
|
|
77
|
+
{ key: "NationalMonument", name: "National Monument" },
|
|
78
|
+
{ key: "Planetarium", name: "Planetarium" },
|
|
79
|
+
{ key: "RockClimbing", name: "Rock Climbing" },
|
|
80
|
+
{ key: "RVPark", name: "RV Park" },
|
|
81
|
+
{ key: "SkatePark", name: "Skate Park" },
|
|
82
|
+
{ key: "Skating", name: "Skating" },
|
|
83
|
+
{ key: "Skiing", name: "Skiing" },
|
|
84
|
+
{ key: "Soccer", name: "Soccer" },
|
|
85
|
+
{ key: "Spa", name: "Spa" },
|
|
86
|
+
{ key: "Surfing", name: "Surfing" },
|
|
87
|
+
{ key: "Swimming", name: "Swimming" },
|
|
88
|
+
{ key: "Tennis", name: "Tennis" },
|
|
89
|
+
{ key: "Volleyball", name: "Volleyball" },
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
const search_ac_result_types = [
|
|
93
|
+
// {
|
|
94
|
+
// key: "poi",
|
|
95
|
+
// name: "POI",
|
|
96
|
+
// description: "A point of interest.",
|
|
97
|
+
// },
|
|
98
|
+
{
|
|
99
|
+
key: "address",
|
|
100
|
+
name: "Address",
|
|
101
|
+
description: "An address such as a street address, suburb, city, state, or country.",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: "physicalFeature",
|
|
105
|
+
name: "Physical Feature",
|
|
106
|
+
description: "A natural physical feature, such as a river, mountain, or delta.",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "pointOfInterest",
|
|
110
|
+
name: "Point of Interest",
|
|
111
|
+
description: "A point of interest.",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "query",
|
|
115
|
+
name: "Query",
|
|
116
|
+
description: "A search query string.",
|
|
117
|
+
},
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
const address_categories = [
|
|
121
|
+
{
|
|
122
|
+
key: "Country",
|
|
123
|
+
name: "Country",
|
|
124
|
+
description: "Countries and regions.",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: "AdministrativeArea",
|
|
128
|
+
name: "Administrative Area",
|
|
129
|
+
description: "The primary administrative divisions of countries or regions.",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: "SubAdministrativeArea",
|
|
133
|
+
name: "Sub-Administrative Area",
|
|
134
|
+
description: "The secondary administrative divisions of countries or regions.",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: "Locality",
|
|
138
|
+
name: "Locality",
|
|
139
|
+
description: "Local administrative divisions, postal cities and populated places.",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: "SubLocality",
|
|
143
|
+
name: "Sub-Locality",
|
|
144
|
+
description: "Local administrative sub-divisions, postal city sub-districts, and neighborhoods.",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: "PostalCode",
|
|
148
|
+
name: "Postal Code",
|
|
149
|
+
description: "A code assigned to addresses for mail sorting and delivery.",
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
const countries = [
|
|
154
|
+
{ key: "AF", name: "Afghanistan" },
|
|
155
|
+
{ key: "AX", name: "Åland Islands" },
|
|
156
|
+
{ key: "AL", name: "Albania" },
|
|
157
|
+
{ key: "DZ", name: "Algeria" },
|
|
158
|
+
{ key: "AS", name: "American Samoa" },
|
|
159
|
+
{ key: "AD", name: "Andorra" },
|
|
160
|
+
{ key: "AO", name: "Angola" },
|
|
161
|
+
{ key: "AI", name: "Anguilla" },
|
|
162
|
+
{ key: "AQ", name: "Antarctica" },
|
|
163
|
+
{ key: "AG", name: "Antigua and Barbuda" },
|
|
164
|
+
{ key: "AR", name: "Argentina" },
|
|
165
|
+
{ key: "AM", name: "Armenia" },
|
|
166
|
+
{ key: "AW", name: "Aruba" },
|
|
167
|
+
{ key: "AU", name: "Australia" },
|
|
168
|
+
{ key: "AT", name: "Austria" },
|
|
169
|
+
{ key: "AZ", name: "Azerbaijan" },
|
|
170
|
+
{ key: "BS", name: "Bahamas" },
|
|
171
|
+
{ key: "BH", name: "Bahrain" },
|
|
172
|
+
{ key: "BD", name: "Bangladesh" },
|
|
173
|
+
{ key: "BB", name: "Barbados" },
|
|
174
|
+
{ key: "BY", name: "Belarus" },
|
|
175
|
+
{ key: "BE", name: "Belgium" },
|
|
176
|
+
{ key: "BZ", name: "Belize" },
|
|
177
|
+
{ key: "BJ", name: "Benin" },
|
|
178
|
+
{ key: "BM", name: "Bermuda" },
|
|
179
|
+
{ key: "BT", name: "Bhutan" },
|
|
180
|
+
{ key: "BO", name: "Bolivia (Plurinational State of)" },
|
|
181
|
+
{ key: "BQ", name: "Bonaire, Sint Eustatius and Saba" },
|
|
182
|
+
{ key: "BA", name: "Bosnia and Herzegovina" },
|
|
183
|
+
{ key: "BW", name: "Botswana" },
|
|
184
|
+
{ key: "BV", name: "Bouvet Island" },
|
|
185
|
+
{ key: "BR", name: "Brazil" },
|
|
186
|
+
{ key: "IO", name: "British Indian Ocean Territory" },
|
|
187
|
+
{ key: "BN", name: "Brunei Darussalam" },
|
|
188
|
+
{ key: "BG", name: "Bulgaria" },
|
|
189
|
+
{ key: "BF", name: "Burkina Faso" },
|
|
190
|
+
{ key: "BI", name: "Burundi" },
|
|
191
|
+
{ key: "CV", name: "Cabo Verde" },
|
|
192
|
+
{ key: "KH", name: "Cambodia" },
|
|
193
|
+
{ key: "CM", name: "Cameroon" },
|
|
194
|
+
{ key: "CA", name: "Canada" },
|
|
195
|
+
{ key: "KY", name: "Cayman Islands" },
|
|
196
|
+
{ key: "CF", name: "Central African Republic" },
|
|
197
|
+
{ key: "TD", name: "Chad" },
|
|
198
|
+
{ key: "CL", name: "Chile" },
|
|
199
|
+
{ key: "CN", name: "China" },
|
|
200
|
+
{ key: "CX", name: "Christmas Island" },
|
|
201
|
+
{ key: "CC", name: "Cocos (Keeling) Islands" },
|
|
202
|
+
{ key: "CO", name: "Colombia" },
|
|
203
|
+
{ key: "KM", name: "Comoros" },
|
|
204
|
+
{ key: "CG", name: "Congo" },
|
|
205
|
+
{ key: "CD", name: "Congo (Democratic Republic of the)" },
|
|
206
|
+
{ key: "CK", name: "Cook Islands" },
|
|
207
|
+
{ key: "CR", name: "Costa Rica" },
|
|
208
|
+
{ key: "HR", name: "Croatia" },
|
|
209
|
+
{ key: "CU", name: "Cuba" },
|
|
210
|
+
{ key: "CW", name: "Curaçao" },
|
|
211
|
+
{ key: "CY", name: "Cyprus" },
|
|
212
|
+
{ key: "CZ", name: "Czechia" },
|
|
213
|
+
{ key: "CI", name: "Côte d'Ivoire" },
|
|
214
|
+
{ key: "DK", name: "Denmark" },
|
|
215
|
+
{ key: "DJ", name: "Djibouti" },
|
|
216
|
+
{ key: "DM", name: "Dominica" },
|
|
217
|
+
{ key: "DO", name: "Dominican Republic" },
|
|
218
|
+
{ key: "EC", name: "Ecuador" },
|
|
219
|
+
{ key: "EG", name: "Egypt" },
|
|
220
|
+
{ key: "SV", name: "El Salvador" },
|
|
221
|
+
{ key: "GQ", name: "Equatorial Guinea" },
|
|
222
|
+
{ key: "ER", name: "Eritrea" },
|
|
223
|
+
{ key: "EE", name: "Estonia" },
|
|
224
|
+
{ key: "SZ", name: "Eswatini" },
|
|
225
|
+
{ key: "ET", name: "Ethiopia" },
|
|
226
|
+
{ key: "FK", name: "Falkland Islands (Malvinas)" },
|
|
227
|
+
{ key: "FO", name: "Faroe Islands" },
|
|
228
|
+
{ key: "FJ", name: "Fiji" },
|
|
229
|
+
{ key: "FI", name: "Finland" },
|
|
230
|
+
{ key: "FR", name: "France" },
|
|
231
|
+
{ key: "GF", name: "French Guiana" },
|
|
232
|
+
{ key: "PF", name: "French Polynesia" },
|
|
233
|
+
{ key: "TF", name: "French Southern Territories" },
|
|
234
|
+
{ key: "GA", name: "Gabon" },
|
|
235
|
+
{ key: "GM", name: "Gambia" },
|
|
236
|
+
{ key: "GE", name: "Georgia" },
|
|
237
|
+
{ key: "DE", name: "Germany" },
|
|
238
|
+
{ key: "GH", name: "Ghana" },
|
|
239
|
+
{ key: "GI", name: "Gibraltar" },
|
|
240
|
+
{ key: "GR", name: "Greece" },
|
|
241
|
+
{ key: "GL", name: "Greenland" },
|
|
242
|
+
{ key: "GD", name: "Grenada" },
|
|
243
|
+
{ key: "GP", name: "Guadeloupe" },
|
|
244
|
+
{ key: "GU", name: "Guam" },
|
|
245
|
+
{ key: "GT", name: "Guatemala" },
|
|
246
|
+
{ key: "GG", name: "Guernsey" },
|
|
247
|
+
{ key: "GN", name: "Guinea" },
|
|
248
|
+
{ key: "GW", name: "Guinea-Bissau" },
|
|
249
|
+
{ key: "GY", name: "Guyana" },
|
|
250
|
+
{ key: "HT", name: "Haiti" },
|
|
251
|
+
{ key: "HM", name: "Heard Island and McDonald Islands" },
|
|
252
|
+
{ key: "VA", name: "Holy See" },
|
|
253
|
+
{ key: "HN", name: "Honduras" },
|
|
254
|
+
{ key: "HK", name: "Hong Kong" },
|
|
255
|
+
{ key: "HU", name: "Hungary" },
|
|
256
|
+
{ key: "IS", name: "Iceland" },
|
|
257
|
+
{ key: "IN", name: "India" },
|
|
258
|
+
{ key: "ID", name: "Indonesia" },
|
|
259
|
+
{ key: "IR", name: "Iran (Islamic Republic of)" },
|
|
260
|
+
{ key: "IQ", name: "Iraq" },
|
|
261
|
+
{ key: "IE", name: "Ireland" },
|
|
262
|
+
{ key: "IM", name: "Isle of Man" },
|
|
263
|
+
{ key: "IL", name: "Israel" },
|
|
264
|
+
{ key: "IT", name: "Italy" },
|
|
265
|
+
{ key: "JM", name: "Jamaica" },
|
|
266
|
+
{ key: "JP", name: "Japan" },
|
|
267
|
+
{ key: "JE", name: "Jersey" },
|
|
268
|
+
{ key: "JO", name: "Jordan" },
|
|
269
|
+
{ key: "KZ", name: "Kazakhstan" },
|
|
270
|
+
{ key: "KE", name: "Kenya" },
|
|
271
|
+
{ key: "KI", name: "Kiribati" },
|
|
272
|
+
{ key: "KP", name: "Korea (Democratic People's Republic of)" },
|
|
273
|
+
{ key: "KR", name: "Korea (Republic of)" },
|
|
274
|
+
{ key: "KW", name: "Kuwait" },
|
|
275
|
+
{ key: "KG", name: "Kyrgyzstan" },
|
|
276
|
+
{ key: "LA", name: "Lao People's Democratic Republic" },
|
|
277
|
+
{ key: "LV", name: "Latvia" },
|
|
278
|
+
{ key: "LB", name: "Lebanon" },
|
|
279
|
+
{ key: "LS", name: "Lesotho" },
|
|
280
|
+
{ key: "LR", name: "Liberia" },
|
|
281
|
+
{ key: "LY", name: "Libya" },
|
|
282
|
+
{ key: "LI", name: "Liechtenstein" },
|
|
283
|
+
{ key: "LT", name: "Lithuania" },
|
|
284
|
+
{ key: "LU", name: "Luxembourg" },
|
|
285
|
+
{ key: "MO", name: "Macao" },
|
|
286
|
+
{ key: "MG", name: "Madagascar" },
|
|
287
|
+
{ key: "MW", name: "Malawi" },
|
|
288
|
+
{ key: "MY", name: "Malaysia" },
|
|
289
|
+
{ key: "MV", name: "Maldives" },
|
|
290
|
+
{ key: "ML", name: "Mali" },
|
|
291
|
+
{ key: "MT", name: "Malta" },
|
|
292
|
+
{ key: "MH", name: "Marshall Islands" },
|
|
293
|
+
{ key: "MQ", name: "Martinique" },
|
|
294
|
+
{ key: "MR", name: "Mauritania" },
|
|
295
|
+
{ key: "MU", name: "Mauritius" },
|
|
296
|
+
{ key: "YT", name: "Mayotte" },
|
|
297
|
+
{ key: "MX", name: "Mexico" },
|
|
298
|
+
{ key: "FM", name: "Micronesia (Federated States of)" },
|
|
299
|
+
{ key: "MD", name: "Moldova (Republic of)" },
|
|
300
|
+
{ key: "MC", name: "Monaco" },
|
|
301
|
+
{ key: "MN", name: "Mongolia" },
|
|
302
|
+
{ key: "ME", name: "Montenegro" },
|
|
303
|
+
{ key: "MS", name: "Montserrat" },
|
|
304
|
+
{ key: "MA", name: "Morocco" },
|
|
305
|
+
{ key: "MZ", name: "Mozambique" },
|
|
306
|
+
{ key: "MM", name: "Myanmar" },
|
|
307
|
+
{ key: "NA", name: "Namibia" },
|
|
308
|
+
{ key: "NR", name: "Nauru" },
|
|
309
|
+
{ key: "NP", name: "Nepal" },
|
|
310
|
+
{ key: "NL", name: "Netherlands" },
|
|
311
|
+
{ key: "NC", name: "New Caledonia" },
|
|
312
|
+
{ key: "NZ", name: "New Zealand" },
|
|
313
|
+
{ key: "NI", name: "Nicaragua" },
|
|
314
|
+
{ key: "NE", name: "Niger" },
|
|
315
|
+
{ key: "NG", name: "Nigeria" },
|
|
316
|
+
{ key: "NU", name: "Niue" },
|
|
317
|
+
{ key: "NF", name: "Norfolk Island" },
|
|
318
|
+
{ key: "MK", name: "North Macedonia" },
|
|
319
|
+
{ key: "MP", name: "Northern Mariana Islands" },
|
|
320
|
+
{ key: "NO", name: "Norway" },
|
|
321
|
+
{ key: "OM", name: "Oman" },
|
|
322
|
+
{ key: "PK", name: "Pakistan" },
|
|
323
|
+
{ key: "PW", name: "Palau" },
|
|
324
|
+
{ key: "PS", name: "Palestine, State of" },
|
|
325
|
+
{ key: "PA", name: "Panama" },
|
|
326
|
+
{ key: "PG", name: "Papua New Guinea" },
|
|
327
|
+
{ key: "PY", name: "Paraguay" },
|
|
328
|
+
{ key: "PE", name: "Peru" },
|
|
329
|
+
{ key: "PH", name: "Philippines" },
|
|
330
|
+
{ key: "PN", name: "Pitcairn" },
|
|
331
|
+
{ key: "PL", name: "Poland" },
|
|
332
|
+
{ key: "PT", name: "Portugal" },
|
|
333
|
+
{ key: "PR", name: "Puerto Rico" },
|
|
334
|
+
{ key: "QA", name: "Qatar" },
|
|
335
|
+
{ key: "RE", name: "Réunion" },
|
|
336
|
+
{ key: "RO", name: "Romania" },
|
|
337
|
+
{ key: "RU", name: "Russian Federation" },
|
|
338
|
+
{ key: "RW", name: "Rwanda" },
|
|
339
|
+
{ key: "BL", name: "Saint Barthélemy" },
|
|
340
|
+
{ key: "SH", name: "Saint Helena, Ascension and Tristan da Cunha" },
|
|
341
|
+
{ key: "KN", name: "Saint Kitts and Nevis" },
|
|
342
|
+
{ key: "LC", name: "Saint Lucia" },
|
|
343
|
+
{ key: "MF", name: "Saint Martin (French part)" },
|
|
344
|
+
{ key: "PM", name: "Saint Pierre and Miquelon" },
|
|
345
|
+
{ key: "VC", name: "Saint Vincent and the Grenadines" },
|
|
346
|
+
{ key: "WS", name: "Samoa" },
|
|
347
|
+
{ key: "SM", name: "San Marino" },
|
|
348
|
+
{ key: "ST", name: "Sao Tome and Principe" },
|
|
349
|
+
{ key: "SA", name: "Saudi Arabia" },
|
|
350
|
+
{ key: "SN", name: "Senegal" },
|
|
351
|
+
{ key: "RS", name: "Serbia" },
|
|
352
|
+
{ key: "SC", name: "Seychelles" },
|
|
353
|
+
{ key: "SL", name: "Sierra Leone" },
|
|
354
|
+
{ key: "SG", name: "Singapore" },
|
|
355
|
+
{ key: "SX", name: "Sint Maarten (Dutch part)" },
|
|
356
|
+
{ key: "SK", name: "Slovakia" },
|
|
357
|
+
{ key: "SI", name: "Slovenia" },
|
|
358
|
+
{ key: "SB", name: "Solomon Islands" },
|
|
359
|
+
{ key: "SO", name: "Somalia" },
|
|
360
|
+
{ key: "ZA", name: "South Africa" },
|
|
361
|
+
{ key: "GS", name: "South Georgia and the South Sandwich Islands" },
|
|
362
|
+
{ key: "SS", name: "South Sudan" },
|
|
363
|
+
{ key: "ES", name: "Spain" },
|
|
364
|
+
{ key: "LK", name: "Sri Lanka" },
|
|
365
|
+
{ key: "SD", name: "Sudan" },
|
|
366
|
+
{ key: "SR", name: "Suriname" },
|
|
367
|
+
{ key: "SJ", name: "Svalbard and Jan Mayen" },
|
|
368
|
+
{ key: "SE", name: "Sweden" },
|
|
369
|
+
{ key: "CH", name: "Switzerland" },
|
|
370
|
+
{ key: "SY", name: "Syrian Arab Republic" },
|
|
371
|
+
{ key: "TW", name: "Taiwan" },
|
|
372
|
+
{ key: "TJ", name: "Tajikistan" },
|
|
373
|
+
{ key: "TZ", name: "Tanzania, United Republic of" },
|
|
374
|
+
{ key: "TH", name: "Thailand" },
|
|
375
|
+
{ key: "TL", name: "Timor-Leste" },
|
|
376
|
+
{ key: "TG", name: "Togo" },
|
|
377
|
+
{ key: "TK", name: "Tokelau" },
|
|
378
|
+
{ key: "TO", name: "Tonga" },
|
|
379
|
+
{ key: "TT", name: "Trinidad and Tobago" },
|
|
380
|
+
{ key: "TN", name: "Tunisia" },
|
|
381
|
+
{ key: "TR", name: "Turkey" },
|
|
382
|
+
{ key: "TM", name: "Turkmenistan" },
|
|
383
|
+
{ key: "TC", name: "Turks and Caicos Islands" },
|
|
384
|
+
{ key: "TV", name: "Tuvalu" },
|
|
385
|
+
{ key: "UG", name: "Uganda" },
|
|
386
|
+
{ key: "UA", name: "Ukraine" },
|
|
387
|
+
{ key: "AE", name: "United Arab Emirates" },
|
|
388
|
+
{ key: "GB", name: "United Kingdom of Great Britain and Northern Ireland" },
|
|
389
|
+
{ key: "UM", name: "United States Minor Outlying Islands" },
|
|
390
|
+
{ key: "US", name: "United States of America" },
|
|
391
|
+
{ key: "UY", name: "Uruguay" },
|
|
392
|
+
{ key: "UZ", name: "Uzbekistan" },
|
|
393
|
+
{ key: "VU", name: "Vanuatu" },
|
|
394
|
+
{ key: "VE", name: "Venezuela (Bolivarian Republic of)" },
|
|
395
|
+
{ key: "VN", name: "Viet Nam" },
|
|
396
|
+
{ key: "VG", name: "Virgin Islands (British)" },
|
|
397
|
+
{ key: "VI", name: "Virgin Islands (U.S.)" },
|
|
398
|
+
{ key: "WF", name: "Wallis and Futuna" },
|
|
399
|
+
{ key: "EH", name: "Western Sahara" },
|
|
400
|
+
{ key: "YE", name: "Yemen" },
|
|
401
|
+
{ key: "ZM", name: "Zambia" },
|
|
402
|
+
{ key: "ZW", name: "Zimbabwe" },
|
|
403
|
+
]
|
|
404
|
+
|
|
405
|
+
// const celestial_bodies = {
|
|
406
|
+
// earth: "Earth",
|
|
407
|
+
// earths_moon: "Earth's Moon",
|
|
408
|
+
// mars: "Mars",
|
|
409
|
+
// sun: "Sun",
|
|
410
|
+
// asteroid: "Asteroid",
|
|
411
|
+
// milky_way: "Milky Way Galaxy",
|
|
412
|
+
// mercury: "Mercury",
|
|
413
|
+
// venus: "Venus",
|
|
414
|
+
// jupiter: "Jupiter",
|
|
415
|
+
// saturn: "Saturn",
|
|
416
|
+
// uranus: "Uranus",
|
|
417
|
+
// neptune: "Neptune",
|
|
418
|
+
// pluto: "Pluto",
|
|
419
|
+
// comet: "Comet",
|
|
420
|
+
// star: "Star",
|
|
421
|
+
// black_hole: "Black Hole",
|
|
422
|
+
// other: "Other",
|
|
423
|
+
// }
|
|
424
|
+
|
|
425
|
+
let popover_manager = $state(null)
|
|
426
|
+
let popover_button_manager = $state(null)
|
|
427
|
+
let extra_popover_manager = $state(null)
|
|
428
|
+
let extra_popover_button_manager = $state(null)
|
|
429
|
+
let finish_button_manager = $state(null)
|
|
430
|
+
let suggestions_prepped = $state(null)
|
|
431
|
+
let search_text_input_manager = $state(null)
|
|
432
|
+
let search_button_manager = $state(null)
|
|
433
|
+
let is_dark_mode_checkbox_manager = $state(null)
|
|
434
|
+
let clear_suggestions_button_manager = $state(null)
|
|
435
|
+
let search_filter_within_map_boundries_checkbox_manager = $state(null)
|
|
436
|
+
let search_filter_include_poi_categories_dropdown_manager = $state(null)
|
|
437
|
+
let search_filter_exclude_poi_categories_dropdown_manager = $state(null)
|
|
438
|
+
let search_filter_limit_to_countries_dropdown_manager = $state(null)
|
|
439
|
+
let search_filter_result_type_dropdown_manager = $state(null)
|
|
440
|
+
let search_filter_include_address_categories_dropdown_manager = $state(null)
|
|
441
|
+
let search_filter_exclude_address_categories_dropdown_manager = $state(null)
|
|
442
|
+
|
|
443
|
+
let height = $derived(
|
|
444
|
+
set_closurable(config?.height, null) ? `${set_closurable(config?.height, null)}rem` : "min(40rem, 50vh)"
|
|
445
|
+
)
|
|
446
|
+
let width = $derived(
|
|
447
|
+
set_closurable(config?.width, null) ? `${set_closurable(config?.width, null)}rem` : "clamp(60rem, 80vw, 100%)"
|
|
448
|
+
)
|
|
449
|
+
let label = $derived(set_closurable(config?.label, null))
|
|
450
|
+
let is_popover = $derived(set_closurable(config?.is_popover, true))
|
|
451
|
+
let is_popover_button = $derived(set_closurable(config?.is_popover_button, false))
|
|
452
|
+
let is_show_search = $derived(set_closurable(config?.is_show_search, true))
|
|
453
|
+
let mapkit_js_token = $derived(set_closurable(config?.mapkit_js_token, null))
|
|
454
|
+
|
|
455
|
+
let val = $state(null)
|
|
456
|
+
let map = $state(null)
|
|
457
|
+
|
|
458
|
+
let mapkit_load_promise = $state(null)
|
|
459
|
+
async function load_mapkit_script() {
|
|
460
|
+
if (!mapkit_load_promise) {
|
|
461
|
+
mapkit_load_promise = new Promise(async (resolve, reject) => {
|
|
462
|
+
if (browser && !document?.querySelector('script[src="https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.core.js"]')) {
|
|
463
|
+
window.init_map_kit = () => {
|
|
464
|
+
delete window.init_map_kit
|
|
465
|
+
window.init_map_kit_loaded = true
|
|
466
|
+
resolve()
|
|
467
|
+
}
|
|
468
|
+
const script = document.createElement("script")
|
|
469
|
+
script.src = "https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.core.js"
|
|
470
|
+
script.crossOrigin = "anonymous"
|
|
471
|
+
script.async = true
|
|
472
|
+
script.setAttribute("data-callback", "init_map_kit")
|
|
473
|
+
script.setAttribute("data-libraries", "full-map,services")
|
|
474
|
+
script.setAttribute("data-token", mapkit_js_token)
|
|
475
|
+
document.head.appendChild(script)
|
|
476
|
+
} else {
|
|
477
|
+
let attempt_count = 0
|
|
478
|
+
const max_attempts = 50
|
|
479
|
+
const check_init_mapkit = setInterval(() => {
|
|
480
|
+
attempt_count++
|
|
481
|
+
if (window.init_map_kit_loaded) {
|
|
482
|
+
clearInterval(check_init_mapkit)
|
|
483
|
+
resolve()
|
|
484
|
+
} else if (attempt_count > max_attempts) {
|
|
485
|
+
clearInterval(check_init_mapkit)
|
|
486
|
+
reject(new Error("MapKit initialization timeout"))
|
|
487
|
+
}
|
|
488
|
+
}, 100)
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
}
|
|
492
|
+
return mapkit_load_promise
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
async function initialize_map() {
|
|
496
|
+
console.log("initialize_map")
|
|
497
|
+
if (!browser) {
|
|
498
|
+
console.log("document is not defined")
|
|
499
|
+
return
|
|
500
|
+
}
|
|
501
|
+
await load_mapkit_script()
|
|
502
|
+
if (!window.mapkit) {
|
|
503
|
+
console.log("MapKit is not defined")
|
|
504
|
+
return
|
|
505
|
+
}
|
|
506
|
+
const is_map_div_found = document?.querySelector(`#map_${id}`)
|
|
507
|
+
if (!is_map_div_found) {
|
|
508
|
+
console.log("Map div not found")
|
|
509
|
+
return
|
|
510
|
+
}
|
|
511
|
+
const initial_region = new mapkit.CoordinateRegion(
|
|
512
|
+
new mapkit.Coordinate(val?.latitude ?? 37.3316850890998, val?.longitude ?? -122.030067374026),
|
|
513
|
+
new mapkit.CoordinateSpan(0.1, 0.1)
|
|
514
|
+
)
|
|
515
|
+
if (!map) {
|
|
516
|
+
map = new mapkit.Map(`map_${id}`)
|
|
517
|
+
}
|
|
518
|
+
map.annotations = []
|
|
519
|
+
map.region = initial_region
|
|
520
|
+
map.colorScheme = is_dark_mode_checkbox_manager?.val ? "dark" : "light"
|
|
521
|
+
if (val?.place_id) {
|
|
522
|
+
const lookup = new mapkit.PlaceLookup()
|
|
523
|
+
lookup.getPlace(val?.place_id, (error, place) => {
|
|
524
|
+
if (error) {
|
|
525
|
+
console.error("Place lookup error:", error)
|
|
526
|
+
return
|
|
527
|
+
}
|
|
528
|
+
const marker = new mapkit.PlaceAnnotation(place)
|
|
529
|
+
map.addAnnotation(marker)
|
|
530
|
+
const accessory = new mapkit.PlaceSelectionAccessory()
|
|
531
|
+
marker.selectionAccessory = accessory
|
|
532
|
+
marker.selected = true
|
|
533
|
+
})
|
|
534
|
+
} else if (val?.name) {
|
|
535
|
+
// make annotation with name maybe? or use muid
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function suggestion_clicked(input) {
|
|
540
|
+
if (input?.id) {
|
|
541
|
+
const lookup = new mapkit.PlaceLookup()
|
|
542
|
+
lookup.getPlace(input?.id, (error, place) => {
|
|
543
|
+
if (error) {
|
|
544
|
+
console.error("Place lookup error:", error)
|
|
545
|
+
return
|
|
546
|
+
}
|
|
547
|
+
const center = place.coordinate
|
|
548
|
+
const span = new mapkit.CoordinateSpan(0.01, 0.01)
|
|
549
|
+
const region = new mapkit.CoordinateRegion(center, span)
|
|
550
|
+
map.region = region
|
|
551
|
+
const marker = new mapkit.PlaceAnnotation(place)
|
|
552
|
+
marker.addEventListener("select", (input) => {
|
|
553
|
+
// i think there is a mistake where this doesnt give pointOfInterestCategory
|
|
554
|
+
val = {
|
|
555
|
+
place_id: place?.id,
|
|
556
|
+
muid: place?.muid,
|
|
557
|
+
poi_category: place?.pointOfInterestCategory,
|
|
558
|
+
latitude: place?.coordinate?.latitude,
|
|
559
|
+
longitude: place?.coordinate?.longitude,
|
|
560
|
+
name:
|
|
561
|
+
place?.name && place?.name == place?.locality && place?.administrativeArea
|
|
562
|
+
? `${place?.locality}, ${place?.administrativeArea}`
|
|
563
|
+
: place?.name,
|
|
564
|
+
formatted_address: place?.formattedAddress,
|
|
565
|
+
country: place?.country,
|
|
566
|
+
country_code: place?.countryCode,
|
|
567
|
+
administrative_area: place?.administrativeArea,
|
|
568
|
+
administrative_area_code: place?.administrativeAreaCode,
|
|
569
|
+
locality: place?.locality,
|
|
570
|
+
sub_locality: place?.subLocality,
|
|
571
|
+
full_thoroughfare: place?.fullThoroughfare,
|
|
572
|
+
}
|
|
573
|
+
})
|
|
574
|
+
map.addAnnotation(marker)
|
|
575
|
+
const accessory = new mapkit.PlaceSelectionAccessory()
|
|
576
|
+
marker.selectionAccessory = accessory
|
|
577
|
+
marker.selected = true
|
|
578
|
+
})
|
|
579
|
+
} else if (input?.coordinate) {
|
|
580
|
+
const center = input.coordinate
|
|
581
|
+
const span = new mapkit.CoordinateSpan(0.01, 0.01)
|
|
582
|
+
const region = new mapkit.CoordinateRegion(center, span)
|
|
583
|
+
map.region = region
|
|
584
|
+
}
|
|
585
|
+
suggestions_prepped = []
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function prepare_search_options(is_autocomplete = false) {
|
|
589
|
+
const result_type = Array.isArray(search_filter_result_type_dropdown_manager?.val)
|
|
590
|
+
? search_filter_result_type_dropdown_manager?.val
|
|
591
|
+
: []
|
|
592
|
+
let options = {
|
|
593
|
+
includeAddresses: result_type.length == 0 || result_type.includes("address"),
|
|
594
|
+
includePointsOfInterest: result_type.length == 0 || result_type.includes("pointOfInterest"),
|
|
595
|
+
includePhysicalFeatures: result_type.length == 0 || result_type.includes("physicalFeature"),
|
|
596
|
+
}
|
|
597
|
+
if (is_autocomplete) {
|
|
598
|
+
options.includeQueries = result_type.length == 0 || result_type.includes("query")
|
|
599
|
+
}
|
|
600
|
+
if (map) {
|
|
601
|
+
options.coordinate = map.center
|
|
602
|
+
}
|
|
603
|
+
if (search_filter_within_map_boundries_checkbox_manager?.val && map) {
|
|
604
|
+
options.region = map.region
|
|
605
|
+
}
|
|
606
|
+
if (
|
|
607
|
+
Array.isArray(search_filter_limit_to_countries_dropdown_manager?.val) &&
|
|
608
|
+
search_filter_limit_to_countries_dropdown_manager?.val.length > 0
|
|
609
|
+
) {
|
|
610
|
+
options.limitToCountries = search_filter_limit_to_countries_dropdown_manager?.val.join(",")
|
|
611
|
+
}
|
|
612
|
+
if (
|
|
613
|
+
Array.isArray(search_filter_include_poi_categories_dropdown_manager?.val) &&
|
|
614
|
+
search_filter_include_poi_categories_dropdown_manager?.val.length > 0
|
|
615
|
+
) {
|
|
616
|
+
options.pointOfInterestFilter = mapkit.PointOfInterestFilter.including(
|
|
617
|
+
search_filter_include_poi_categories_dropdown_manager?.val
|
|
618
|
+
)
|
|
619
|
+
}
|
|
620
|
+
if (
|
|
621
|
+
Array.isArray(search_filter_include_address_categories_dropdown_manager?.val) &&
|
|
622
|
+
search_filter_include_address_categories_dropdown_manager?.val.length > 0
|
|
623
|
+
) {
|
|
624
|
+
options.addressFilter = mapkit.AddressFilter.including(
|
|
625
|
+
search_filter_include_address_categories_dropdown_manager?.val.map(
|
|
626
|
+
(category) => mapkit.AddressCategory[category]
|
|
627
|
+
)
|
|
628
|
+
)
|
|
629
|
+
}
|
|
630
|
+
if (
|
|
631
|
+
Array.isArray(search_filter_exclude_address_categories_dropdown_manager?.val) &&
|
|
632
|
+
search_filter_exclude_address_categories_dropdown_manager?.val.length > 0
|
|
633
|
+
) {
|
|
634
|
+
options.addressFilter = mapkit.AddressFilter.excluding(
|
|
635
|
+
search_filter_exclude_address_categories_dropdown_manager?.val.map(
|
|
636
|
+
(category) => mapkit.AddressCategory[category]
|
|
637
|
+
)
|
|
638
|
+
)
|
|
639
|
+
}
|
|
640
|
+
return options
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function search_for_autocomplete(input) {
|
|
644
|
+
if (!input) {
|
|
645
|
+
suggestions_prepped = []
|
|
646
|
+
return
|
|
647
|
+
}
|
|
648
|
+
const autocomplete_search_options = prepare_search_options(true)
|
|
649
|
+
const place_search = new mapkit.Search()
|
|
650
|
+
place_search.autocomplete(
|
|
651
|
+
input,
|
|
652
|
+
(error, result) => {
|
|
653
|
+
if (error) {
|
|
654
|
+
console.error("Autocomplete error:", error)
|
|
655
|
+
return
|
|
656
|
+
}
|
|
657
|
+
if (result.results.length > 0) {
|
|
658
|
+
let suggestions_prepped_loc = []
|
|
659
|
+
if (Array.isArray(result.results)) {
|
|
660
|
+
for (let suggestion of result.results) {
|
|
661
|
+
let choose_selection_button_manager = $state(null)
|
|
662
|
+
if (suggestion?.id) {
|
|
663
|
+
choose_selection_button_manager = create_button_manager({
|
|
664
|
+
support_icon: "arrow_tailed",
|
|
665
|
+
is_uniform: true,
|
|
666
|
+
on_click: () => suggestion_clicked(suggestion),
|
|
667
|
+
})
|
|
668
|
+
} else {
|
|
669
|
+
choose_selection_button_manager = create_button_manager({
|
|
670
|
+
support_icon: "magnifying_glass",
|
|
671
|
+
is_uniform: true,
|
|
672
|
+
on_click: () => search_for(`${suggestion?.displayLines?.[0]}`),
|
|
673
|
+
})
|
|
674
|
+
}
|
|
675
|
+
suggestions_prepped_loc.push({
|
|
676
|
+
...suggestion,
|
|
677
|
+
choose_selection_button_manager,
|
|
678
|
+
})
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
suggestions_prepped = suggestions_prepped_loc
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
autocomplete_search_options
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function search_for(input) {
|
|
689
|
+
const search_options = prepare_search_options()
|
|
690
|
+
if (!map) {
|
|
691
|
+
console.log("map not found")
|
|
692
|
+
return
|
|
693
|
+
}
|
|
694
|
+
map.removeAnnotations(map.annotations)
|
|
695
|
+
const place_search = new mapkit.Search()
|
|
696
|
+
place_search.search(
|
|
697
|
+
input,
|
|
698
|
+
(error, result) => {
|
|
699
|
+
if (error) {
|
|
700
|
+
console.error("Search error:", error)
|
|
701
|
+
return
|
|
702
|
+
}
|
|
703
|
+
if (result.places.length > 0) {
|
|
704
|
+
if (!search_filter_within_map_boundries_checkbox_manager?.val) {
|
|
705
|
+
const center = result.places[0].coordinate
|
|
706
|
+
const span = new mapkit.CoordinateSpan(0.01, 0.01)
|
|
707
|
+
const region = new mapkit.CoordinateRegion(center, span)
|
|
708
|
+
map.region = region
|
|
709
|
+
}
|
|
710
|
+
for (const place of result.places) {
|
|
711
|
+
const marker = new mapkit.PlaceAnnotation(place)
|
|
712
|
+
marker.addEventListener("select", (input) => {
|
|
713
|
+
val = {
|
|
714
|
+
place_id: place?.id,
|
|
715
|
+
muid: place?.muid,
|
|
716
|
+
poi_category: place?.pointOfInterestCategory,
|
|
717
|
+
latitude: place?.coordinate?.latitude,
|
|
718
|
+
longitude: place?.coordinate?.longitude,
|
|
719
|
+
name:
|
|
720
|
+
place?.name && place?.name == place?.locality && place?.administrativeArea
|
|
721
|
+
? `${place?.locality}, ${place?.administrativeArea}`
|
|
722
|
+
: place?.name,
|
|
723
|
+
formatted_address: place?.formattedAddress,
|
|
724
|
+
country: place?.country,
|
|
725
|
+
country_code: place?.countryCode,
|
|
726
|
+
administrative_area: place?.administrativeArea,
|
|
727
|
+
administrative_area_code: place?.administrativeAreaCode,
|
|
728
|
+
locality: place?.locality,
|
|
729
|
+
sub_locality: place?.subLocality,
|
|
730
|
+
full_thoroughfare: place?.fullThoroughfare,
|
|
731
|
+
}
|
|
732
|
+
})
|
|
733
|
+
map.addAnnotation(marker)
|
|
734
|
+
const accessory = new mapkit.PlaceSelectionAccessory()
|
|
735
|
+
marker.selectionAccessory = accessory
|
|
736
|
+
if (result.places.length == 1) {
|
|
737
|
+
marker.selected = true
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
suggestions_prepped = []
|
|
742
|
+
},
|
|
743
|
+
search_options
|
|
744
|
+
)
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function set_val(input) {
|
|
748
|
+
val = input
|
|
749
|
+
if (map) {
|
|
750
|
+
initialize_map()
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function reset_map() {
|
|
755
|
+
// const el = document.getElementById(`map_${id}`)
|
|
756
|
+
// if (el) {
|
|
757
|
+
// // optional: remove child nodes or clear old map if you want
|
|
758
|
+
// // el.innerHTML = ''
|
|
759
|
+
// map = new mapkit.Map(`map_${id}`)
|
|
760
|
+
// }
|
|
761
|
+
initialize_map()
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function finish() {
|
|
765
|
+
popover_manager.close()
|
|
766
|
+
if (typeof config?.on_finish == "function") {
|
|
767
|
+
config?.on_finish(val)
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function init(config) {
|
|
772
|
+
val = config?.val
|
|
773
|
+
popover_manager = create_popover_manager({
|
|
774
|
+
target_width: 600,
|
|
775
|
+
target_height: 600,
|
|
776
|
+
type: "center",
|
|
777
|
+
header: "Location",
|
|
778
|
+
on_open: () => {
|
|
779
|
+
if (!map) {
|
|
780
|
+
setTimeout(() => {
|
|
781
|
+
initialize_map()
|
|
782
|
+
}, 20)
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
})
|
|
786
|
+
popover_button_manager = create_button_manager({
|
|
787
|
+
type: "outlined",
|
|
788
|
+
is_compressed: true,
|
|
789
|
+
text: () => (val?.name && val?.name.length > 0 ? val?.name : "Select Location"),
|
|
790
|
+
popover_target: () => `popover_${popover_manager?.id}`,
|
|
791
|
+
})
|
|
792
|
+
extra_popover_manager = create_popover_manager({
|
|
793
|
+
target_width: 200,
|
|
794
|
+
target_height: 300,
|
|
795
|
+
type: "dropdown",
|
|
796
|
+
anchor_id: () => `button_${extra_popover_button_manager?.id}`,
|
|
797
|
+
})
|
|
798
|
+
extra_popover_button_manager = create_button_manager({
|
|
799
|
+
type: "soft",
|
|
800
|
+
support_icon: "three_dots",
|
|
801
|
+
icon_sw: 60,
|
|
802
|
+
is_uniform: true,
|
|
803
|
+
popover_target: () => `popover_${extra_popover_manager?.id}`,
|
|
804
|
+
})
|
|
805
|
+
search_text_input_manager = create_text_input_manager({
|
|
806
|
+
type: "search",
|
|
807
|
+
on_change: (input) => search_for_autocomplete(input),
|
|
808
|
+
})
|
|
809
|
+
search_button_manager = create_button_manager({
|
|
810
|
+
text: "Search",
|
|
811
|
+
is_compressed: true,
|
|
812
|
+
is_disabled: () => !search_text_input_manager?.val,
|
|
813
|
+
on_click: () => search_for(search_text_input_manager?.val),
|
|
814
|
+
})
|
|
815
|
+
clear_suggestions_button_manager = create_button_manager({
|
|
816
|
+
support_icon: "x",
|
|
817
|
+
is_uniform: true,
|
|
818
|
+
on_click: () => (suggestions_prepped = []),
|
|
819
|
+
})
|
|
820
|
+
is_dark_mode_checkbox_manager = create_checkbox_manager({
|
|
821
|
+
label: "Dark Color Scheme",
|
|
822
|
+
type: "toggle",
|
|
823
|
+
val: config?.is_dark_color_scheme == true ? true : false,
|
|
824
|
+
on_change: (input) => {
|
|
825
|
+
if (map?.colorScheme) {
|
|
826
|
+
map.colorScheme = input ? "dark" : "light"
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
})
|
|
830
|
+
search_filter_within_map_boundries_checkbox_manager = create_checkbox_manager({
|
|
831
|
+
label: "Search Within Map Boundries",
|
|
832
|
+
type: "toggle",
|
|
833
|
+
val: false,
|
|
834
|
+
})
|
|
835
|
+
search_filter_include_poi_categories_dropdown_manager = create_dropdown_manager({
|
|
836
|
+
label: "Include POI Categories",
|
|
837
|
+
is_multiselect: true,
|
|
838
|
+
is_button_compressed: true,
|
|
839
|
+
options: poi_categories,
|
|
840
|
+
})
|
|
841
|
+
search_filter_exclude_poi_categories_dropdown_manager = create_dropdown_manager({
|
|
842
|
+
label: "Exclude POI Categories",
|
|
843
|
+
is_multiselect: true,
|
|
844
|
+
is_button_compressed: true,
|
|
845
|
+
options: poi_categories,
|
|
846
|
+
})
|
|
847
|
+
search_filter_limit_to_countries_dropdown_manager = create_dropdown_manager({
|
|
848
|
+
label: "Limit to Countries",
|
|
849
|
+
is_multiselect: true,
|
|
850
|
+
is_button_compressed: true,
|
|
851
|
+
options: countries,
|
|
852
|
+
})
|
|
853
|
+
search_filter_result_type_dropdown_manager = create_dropdown_manager({
|
|
854
|
+
label: "Filter Result Type",
|
|
855
|
+
is_multiselect: true,
|
|
856
|
+
is_button_compressed: true,
|
|
857
|
+
options: search_ac_result_types,
|
|
858
|
+
})
|
|
859
|
+
search_filter_include_address_categories_dropdown_manager = create_dropdown_manager({
|
|
860
|
+
label: "Include Address Categories",
|
|
861
|
+
is_multiselect: true,
|
|
862
|
+
is_button_compressed: true,
|
|
863
|
+
options: address_categories,
|
|
864
|
+
})
|
|
865
|
+
search_filter_exclude_address_categories_dropdown_manager = create_dropdown_manager({
|
|
866
|
+
label: "Exclude Address Categories",
|
|
867
|
+
is_multiselect: true,
|
|
868
|
+
is_button_compressed: true,
|
|
869
|
+
options: address_categories,
|
|
870
|
+
})
|
|
871
|
+
finish_button_manager = create_button_manager({
|
|
872
|
+
text: "Finish",
|
|
873
|
+
is_disabled: () => !val,
|
|
874
|
+
mt: 1,
|
|
875
|
+
on_click: () => finish(),
|
|
876
|
+
})
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
init(config)
|
|
880
|
+
|
|
881
|
+
return {
|
|
882
|
+
id,
|
|
883
|
+
get val() {
|
|
884
|
+
return val
|
|
885
|
+
},
|
|
886
|
+
get map() {
|
|
887
|
+
return map
|
|
888
|
+
},
|
|
889
|
+
get is_popover() {
|
|
890
|
+
return is_popover
|
|
891
|
+
},
|
|
892
|
+
get is_popover_button() {
|
|
893
|
+
return is_popover_button
|
|
894
|
+
},
|
|
895
|
+
get popover_button_manager() {
|
|
896
|
+
return popover_button_manager
|
|
897
|
+
},
|
|
898
|
+
get label() {
|
|
899
|
+
return label
|
|
900
|
+
},
|
|
901
|
+
get height() {
|
|
902
|
+
return height
|
|
903
|
+
},
|
|
904
|
+
get width() {
|
|
905
|
+
return width
|
|
906
|
+
},
|
|
907
|
+
get is_show_search() {
|
|
908
|
+
return is_show_search
|
|
909
|
+
},
|
|
910
|
+
get popover_manager() {
|
|
911
|
+
return popover_manager
|
|
912
|
+
},
|
|
913
|
+
get extra_popover_manager() {
|
|
914
|
+
return extra_popover_manager
|
|
915
|
+
},
|
|
916
|
+
get extra_popover_button_manager() {
|
|
917
|
+
return extra_popover_button_manager
|
|
918
|
+
},
|
|
919
|
+
get finish_button_manager() {
|
|
920
|
+
return finish_button_manager
|
|
921
|
+
},
|
|
922
|
+
get suggestions_prepped() {
|
|
923
|
+
return suggestions_prepped
|
|
924
|
+
},
|
|
925
|
+
get is_dark_mode_checkbox_manager() {
|
|
926
|
+
return is_dark_mode_checkbox_manager
|
|
927
|
+
},
|
|
928
|
+
get clear_suggestions_button_manager() {
|
|
929
|
+
return clear_suggestions_button_manager
|
|
930
|
+
},
|
|
931
|
+
get search_text_input_manager() {
|
|
932
|
+
return search_text_input_manager
|
|
933
|
+
},
|
|
934
|
+
get search_button_manager() {
|
|
935
|
+
return search_button_manager
|
|
936
|
+
},
|
|
937
|
+
get search_filter_within_map_boundries_checkbox_manager() {
|
|
938
|
+
return search_filter_within_map_boundries_checkbox_manager
|
|
939
|
+
},
|
|
940
|
+
get search_filter_include_poi_categories_dropdown_manager() {
|
|
941
|
+
return search_filter_include_poi_categories_dropdown_manager
|
|
942
|
+
},
|
|
943
|
+
get search_filter_exclude_poi_categories_dropdown_manager() {
|
|
944
|
+
return search_filter_exclude_poi_categories_dropdown_manager
|
|
945
|
+
},
|
|
946
|
+
get search_filter_limit_to_countries_dropdown_manager() {
|
|
947
|
+
return search_filter_limit_to_countries_dropdown_manager
|
|
948
|
+
},
|
|
949
|
+
get search_filter_result_type_dropdown_manager() {
|
|
950
|
+
return search_filter_result_type_dropdown_manager
|
|
951
|
+
},
|
|
952
|
+
get search_filter_include_address_categories_dropdown_manager() {
|
|
953
|
+
return search_filter_include_address_categories_dropdown_manager
|
|
954
|
+
},
|
|
955
|
+
get search_filter_exclude_address_categories_dropdown_manager() {
|
|
956
|
+
return search_filter_exclude_address_categories_dropdown_manager
|
|
957
|
+
},
|
|
958
|
+
get mapkit_js_token() {
|
|
959
|
+
return mapkit_js_token
|
|
960
|
+
},
|
|
961
|
+
initialize_map,
|
|
962
|
+
set_val,
|
|
963
|
+
reset_map,
|
|
964
|
+
}
|
|
965
|
+
}
|