@freightos/fusion-location-input 2.2.4-fusion-dev-2 → 2.2.5-fusion-dev-2-437f072d
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/README.md +26 -26
- package/build/asset-manifest.json +1 -1
- package/build/main.bundle.js +1 -150
- package/build/main.bundle.js.map +1 -1
- package/build/{precache-manifest.88c5201968510ddb43431b13d8680db6.js → precache-manifest.25508c5a11cac23349bf2f73aacb5ec5.js} +1 -1
- package/build/service-worker.js +1 -1
- package/package.json +67 -67
- package/public/index.html +9 -9
package/README.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Fusion Location Input #
|
|
2
|
-
It is a React front-end shared component library.
|
|
3
|
-
contains Fusion Location Input component that allows to enter Location(full address), City, Port.
|
|
4
|
-
|
|
5
|
-
### Owners ###
|
|
6
|
-
|
|
7
|
-
* nowwar@freightos.com
|
|
8
|
-
|
|
9
|
-
### Technology Stack ###
|
|
10
|
-
|
|
11
|
-
* ReactJS ( FrontEnd Library )
|
|
12
|
-
|
|
13
|
-
----
|
|
14
|
-
|
|
15
|
-
### Consume from your app/micro-front
|
|
16
|
-
|
|
17
|
-
- Using npm or yarn to install the package `npm install --save @freightos/fusion-location-input`
|
|
18
|
-
- Consume in your application by importing components from commodity ui library:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import ReactDOM from 'react-dom';
|
|
23
|
-
import { LocationInput } from '@freightos/fusion-location-input';
|
|
24
|
-
|
|
25
|
-
ReactDOM.render(<LocationInput />, document.getElementById('root'));
|
|
26
|
-
```
|
|
1
|
+
# Fusion Location Input #
|
|
2
|
+
It is a React front-end shared component library.
|
|
3
|
+
contains Fusion Location Input component that allows to enter Location(full address), City, Port.
|
|
4
|
+
|
|
5
|
+
### Owners ###
|
|
6
|
+
|
|
7
|
+
* nowwar@freightos.com
|
|
8
|
+
|
|
9
|
+
### Technology Stack ###
|
|
10
|
+
|
|
11
|
+
* ReactJS ( FrontEnd Library )
|
|
12
|
+
|
|
13
|
+
----
|
|
14
|
+
|
|
15
|
+
### Consume from your app/micro-front
|
|
16
|
+
|
|
17
|
+
- Using npm or yarn to install the package `npm install --save @freightos/fusion-location-input`
|
|
18
|
+
- Consume in your application by importing components from commodity ui library:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import ReactDOM from 'react-dom';
|
|
23
|
+
import { LocationInput } from '@freightos/fusion-location-input';
|
|
24
|
+
|
|
25
|
+
ReactDOM.render(<LocationInput />, document.getElementById('root'));
|
|
26
|
+
```
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main.js": "/main.bundle.js",
|
|
4
4
|
"main.js.map": "/main.bundle.js.map",
|
|
5
5
|
"index.html": "/index.html",
|
|
6
|
-
"precache-manifest.
|
|
6
|
+
"precache-manifest.25508c5a11cac23349bf2f73aacb5ec5.js": "/precache-manifest.25508c5a11cac23349bf2f73aacb5ec5.js",
|
|
7
7
|
"service-worker.js": "/service-worker.js"
|
|
8
8
|
},
|
|
9
9
|
"entrypoints": [
|
package/build/main.bundle.js
CHANGED
|
@@ -1,151 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):"function"===typeof define&&define.amd?define("FusionLocationInput",["react","@freightos/design-system","styled-components","@freightos/freightos-i18n","@freightos/http-client","lodash"],t):"object"===typeof exports?exports.FusionLocationInput=t(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):e.FusionLocationInput=t(e.React,e["@freightos/design-system"],e["styled-components"],e["@freightos/freightos-i18n"],e["@freightos/http-client"],e.lodash)}(this,(function(e,t,n,o,r,a){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="http://ship.freightos.local:8800/FusionLocationInput/",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=a},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n.n(o),a=n(1),i=n(3),l=n(5);const s="airport",c="seaport",d="fulfillment_center",u="address_book",p="last_mile_address",m="address",f={[s]:{label:"Airports",key:s,icon:"mode-air"},[c]:{label:"Ports",key:c,icon:"mode-ship"},[d]:{label:"Fulfillment centers",key:d,icon:"fulfillment-center"},[u]:{key:u,groupedBy:"address"},[p]:{key:p,groupedBy:"address"},[m]:{label:"Address",key:m,icon:"location"}},g="single",y="multiple",h="origin",v="destination",b={XXLARGE:a.tokens.fdsComponentSpacingXxl,XLARGE:a.tokens.fdsComponentSpacingXl,LARGE:a.tokens.fdsComponentSpacingLg,MEDIUM:a.tokens.fdsComponentSpacingMd,SMALL:a.tokens.fdsComponentSpacingSm,XSMALL:a.tokens.fdsComponentSpacingXs,XXSMALL:a.tokens.fdsComponentSpacingXxs,NONE:0},S={VERTICAL:"vertical",HORIZONTAL:"horizontal"};var E=n(2),C=n.n(E);const O=C.a.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: ${e=>{let{$direction:t}=e;return t===S.VERTICAL?"column":"row"}};
|
|
4
|
-
flex-wrap: ${e=>{let{$wrap:t}=e;return t?"wrap":"nowrap"}};
|
|
5
|
-
align-items: ${e=>{let{$alignItems:t}=e;return t}};
|
|
6
|
-
justify-content: ${e=>{let{$justifyContent:t}=e;return t}};
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
|
|
9
|
-
${e=>{let{$fullWidth:t}=e;return t&&E.css`
|
|
10
|
-
width: 100%;
|
|
11
|
-
`}}
|
|
12
|
-
${e=>{let{$direction:t,$spacing:n}=e;return t===S.VERTICAL?E.css`
|
|
13
|
-
> *:not(:first-child) {
|
|
14
|
-
margin-top: ${n};
|
|
15
|
-
}
|
|
16
|
-
`:E.css`
|
|
17
|
-
> *:not(:first-child) {
|
|
18
|
-
margin-left: ${n};
|
|
19
|
-
}
|
|
20
|
-
`}};
|
|
21
|
-
`;var $=e=>{let{direction:t=S.HORIZONTAL,alignItems:n="start",spacing:o=b.NONE,wrap:a,justifyContent:i,fullWidth:l,...s}=e;return r.a.createElement(O,Object.assign({},s,{$direction:t,$alignItems:n,$spacing:o,$wrap:a,$justifyContent:i,$fullWidth:l}),s.children)},w=n(4),T=n.n(w);const k=async(e,t,n)=>{try{const o=e.reduce((e,t)=>({...e,[f[t].key]:{type:t.toUpperCase(),...(null===n||void 0===n?void 0:n.code)?{searchTerm:n.name}:{},...f[t].groupedBy?{groupedBy:f[t].groupedBy}:{}}}),{});return(await T.a.post("/geocoder/api/v3/geocoder/locations",{query:t,limit:5,sources:o})).data}catch(o){return console.error("Error fetching locations:",o),{results:{}}}},L=E.createGlobalStyle`
|
|
22
|
-
.ant-select-dropdown {
|
|
23
|
-
.ant-select-dropdown-menu {
|
|
24
|
-
max-height: 400px;
|
|
25
|
-
padding: 0 !important;
|
|
26
|
-
margin-top: 0 !important;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`,_=C()(a.Select)`
|
|
30
|
-
.ant-select-selection__rendered {
|
|
31
|
-
min-width: 100% !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
li.ant-select-selection__choice {
|
|
35
|
-
border-radius: ${a.tokens.fdsBorderRadiusXl};
|
|
36
|
-
border: none;
|
|
37
|
-
border-color: ${a.tokens.fdsColorPrimaryBlue};
|
|
38
|
-
color: ${a.tokens.fdsColorPrimaryBlue};
|
|
39
|
-
background-color: ${a.tokens.fdsColorPrimaryBlue10};
|
|
40
|
-
line-height: 10px !important;
|
|
41
|
-
margin-right: ${a.tokens.fdsComponentSpacingXxs};
|
|
42
|
-
width: fit-content;
|
|
43
|
-
max-width: 90px;
|
|
44
|
-
height: ${a.tokens.fdsSizeMd} !important;
|
|
45
|
-
${e=>{let{size:t}=e;return"large"===t?`\n\t\t\tmargin-top: ${a.tokens.fdsComponentSpacingSm} !important;\n\t\t`:"\n\t\t\tmargin-top: 5px !important;\n\t\t"}}
|
|
46
|
-
|
|
47
|
-
.ant-select-selection__choice__remove {
|
|
48
|
-
color: ${a.tokens.fdsColorPrimaryBlue};
|
|
49
|
-
margin-top: ${a.tokens.fdsComponentSpacingXs} !important;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.ant-select-selection__choice__content {
|
|
53
|
-
line-height: ${a.tokens.fdsSizeMd} !important;
|
|
54
|
-
height: ${a.tokens.fdsSizeMd} !important;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
li.ant-select-selection__choice__disabled {
|
|
59
|
-
border: none;
|
|
60
|
-
background-color: transparent;
|
|
61
|
-
padding: 0;
|
|
62
|
-
padding-left: 0;
|
|
63
|
-
width: fit-content;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.ant-select-dropdown .ant-select-not-found {
|
|
67
|
-
cursor: pointer !important;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.ant-select-selection-selected-value {
|
|
71
|
-
max-width: 280px !important;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
li.ant-select-search.ant-select-search--inline {
|
|
75
|
-
margin-left: -1px !important;
|
|
76
|
-
}
|
|
77
|
-
.ant-select-search__field {
|
|
78
|
-
color: ${a.tokens.fdsColorPrimaryGray80} !important;
|
|
79
|
-
}
|
|
80
|
-
${e=>{let{$hasError:t}=e;return t&&`\n\t\t.ant-select-selection {\n\t\t\tcolor: ${a.tokens.fdsColorSemanticRed};\n \t\tborder: 1px solid ${a.tokens.fdsColorSemanticRed};\n \t\tbackground-color: ${a.tokens.fdsColorSemanticRed10};\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ${a.tokens.fdsColorSemanticRed};\n\t\t}\n\t`}}
|
|
81
|
-
`,x=C.a.span`
|
|
82
|
-
font-size: ${a.tokens.fdsFontSizeSm} !important;
|
|
83
|
-
`,I=C.a.div`
|
|
84
|
-
font-size: ${a.tokens.fdsFontSizeSm} !important;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
text-overflow: ellipsis;
|
|
87
|
-
display: -webkit-box;
|
|
88
|
-
-webkit-line-clamp: 2;
|
|
89
|
-
-webkit-box-orient: vertical;
|
|
90
|
-
`,A=C()(a.Menu)`
|
|
91
|
-
cursor: pointer !important;
|
|
92
|
-
|
|
93
|
-
.ant-menu-item-group-title {
|
|
94
|
-
padding: 0;
|
|
95
|
-
color: ${a.tokens.fdsBodyTextColorDisabled};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.ant-menu-item {
|
|
99
|
-
padding: 0;
|
|
100
|
-
white-space: normal;
|
|
101
|
-
line-height: normal;
|
|
102
|
-
|
|
103
|
-
&:hover {
|
|
104
|
-
background-color: #f5f5f5;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
`,j=C.a.div`
|
|
108
|
-
font-size: ${a.tokens.fdsFontSizeSm};
|
|
109
|
-
line-height: ${a.tokens.fdsSizeSm};
|
|
110
|
-
font-family: ${a.tokens.fdsHeadingsFontFamily};
|
|
111
|
-
`;C()(a.Icon)`
|
|
112
|
-
margin-right: 0 !important;
|
|
113
|
-
vertical-align: bottom;
|
|
114
|
-
`;class P{static isProduction(){return"prod"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}static isTest(){return"test"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}static isLocal(){return"dev"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}}const R=e=>(e||"").trim().toUpperCase(),F=e=>{const t=(e=>{try{return"string"===typeof e?JSON.parse(e):null}catch{return null}})(null===e||void 0===e?void 0:e.key);return R((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue))},M=e=>{const t=[];JSON.stringify(e,(e,n)=>(t.push(e),n));const n=Array.from(new Set(t)).sort();return JSON.stringify(e,n)},U=e=>{const{displayLabel:t,selectedValue:n,formattedNameOrAddress:o,code:r,countryCode:a,stateOrProvince:i,city:l,latitude:s,longitude:c,postalOrZipCode:d,sourceType:u,locationType:p,type:m,countryName:f}=e||{};return{displayLabel:t,selectedValue:n||r,formattedNameOrAddress:o,code:r||n,country:a,countryName:f,stateOrProvince:null!==i&&void 0!==i?i:null,city:null!==l&&void 0!==l?l:null,latitude:null!==s&&void 0!==s?s:null,longitude:null!==c&&void 0!==c?c:null,postalOrZipCode:null!==d&&void 0!==d?d:null,sourceType:null!==u&&void 0!==u?u:null,locationType:null!==p&&void 0!==p?p:null,type:null!==m&&void 0!==m?m:u}},z=e=>{try{const t="string"===typeof(null===e||void 0===e?void 0:e.key)?JSON.parse(q(e.key)):e;return M(U(t))}catch{return M(U(e))}},V=e=>{const t=e=>(e=>{if(e){var t;const n=e.label||e.selectedValue;return{key:z(e),label:n?r.a.createElement(r.a.Fragment,null,r.a.createElement(a.Icon,{type:e.sourceType?null===(t=f[e.sourceType])||void 0===t?void 0:t.icon:"location",size:"tiny"}),"\xa0",r.a.createElement(x,null,n)):void 0}}})(e);return Array.isArray(e)?e.map(t):t(e)},N=(e,t,n)=>async o=>{if(!o)return[];const r=""!==e?[e]:t;let a=(await k(r,o,n)).results;return a[m]&&(a=(e=>{let t={...e};const n=e[m].filter(e=>e.sourceType===d);if(n.length>0){const{address:e,...o}=t;t={...o,[d]:n,address:e.filter(e=>e.type!==d)}}return t})(a)),Object.keys(a).map(e=>{var t;return{label:(null===(t=f[e])||void 0===t?void 0:t.label)||e,options:a[e].map(e=>({...e,type:e.sourceType}))}})},D=async(e,t)=>{const n=Array.isArray(e)?e:[e];t((await Promise.all(n.map(async e=>{try{const t=null===e||void 0===e?void 0:e.key,n=q(t);return{key:n,...JSON.parse(n)}}catch(t){return}}))).filter(Boolean))},W=(e,t,n,o,l)=>{if(t===y){const t=Array.isArray(e)?e:[];if(t.length<=n)o(t),D(t,l);else{var c,d;const e=(null===(c=JSON.parse(null===(d=t[0])||void 0===d?void 0:d.key))||void 0===c?void 0:c.sourceType)===s?n>1?"airports":"airport":n>1?"ports":"port";a.Message.danger(r.a.createElement(r.a.Fragment,null,r.a.createElement(i.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",r.a.createElement(i.TranslatableText,{stringId:e})))}}else o(e),D(e,l)},X=e=>{var t,n,o;let r=null;try{if("string"===typeof(null===e||void 0===e?void 0:e.key)){const t=JSON.parse(e.key);r=(null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue)||null}}catch{}return((null!==(t=null!==(n=null!==(o=r)&&void 0!==o?o:null===e||void 0===e?void 0:e.code)&&void 0!==n?n:null===e||void 0===e?void 0:e.selectedValue)&&void 0!==t?t:"")||"").trim().toUpperCase()},B=e=>e&&(e===m||e===p||e===u||e===d),q=e=>"string"===typeof e?e.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):e,G=/^[^-]*-\s*(.+?),/,K=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=(e,t)=>[...e[m]||[],...e[d]||[]].filter(e=>((e,t)=>{if(!e.displayLabel)return!1;const n=e.displayLabel.match(G);if(!(null===n||void 0===n?void 0:n[1]))return!1;const o=n[1].trim(),r=t.trim().split(/\s+/).map(K);return new RegExp(`\\b${r.join("\\s+")}\\b`,"i").test(o)})(e,t)),J=e=>{const t=e.selectedValue||e.displayLabel||e.code,n={...e,selectedValue:t,displayLabel:e.displayLabel||t,country:e.countryCode||e.country,type:e.type||e.sourceType};return n.country&&delete n.countryCode,{key:JSON.stringify(n),label:t}},Z=async e=>{let{autofillLocationAddress:t,autofillLocationCode:n,supportedLocationModes:o,customer:r,userCountryCode:a}=e;if(!t&&!n)return null;let i=null;if(t){const{results:e={}}=await k(o,t,r);i=((e,t)=>{if(0===e.length)return null;if(1===e.length||!t)return e[0];return e.find(e=>{var n;return(null===(n=e.countryCode)||void 0===n?void 0:n.toLowerCase())===t.toLowerCase()})||e[0]})(H(e,t),a)}if(!i&&n){const{results:e={}}=await k(o,n,r);i=((e,t)=>{const n=e[s]||[],o=e[c]||[],r=R(t);return[...n,...o].find(e=>R(null===e||void 0===e?void 0:e.code)===r)})(e,n)}return i?J(i):null},Y="totalShipment",Q="unitsShipment",ee="containerPackages",te="celsius",ne="fahrenheit",oe={["FRO"]:{[te]:"-10\xbaC or below",[ne]:"14\xbaF or below"},["COL"]:{[te]:"From +2\xbaC To +8\xbaC",[ne]:"From 35.6\xbaF To 46.4\xbaF"},["ERT"]:{[te]:"From +2\xbaC To +25\xbaC",[ne]:"From 35.6\xbaF To 77\xbaF"},["CRT"]:{[te]:"From +15\xbaC To +25\xbaC",[ne]:"From 59\xbaF To 77\xbaF"}},re="quotation",ae="units",ie="totals",le="container",se="CBM",ce="CFT",de="kg",ue="box",pe="uld",me=async e=>{await(async e=>{let{method:t,url:n="",data:o={},options:r={}}=e;const a=(()=>{if("get"===t){return[Object.keys(o).length?`${n}?${new URLSearchParams(o).toString()}`:n,r]}if("post"===t){const e={...null===r||void 0===r?void 0:r.headers,accept:"application/json","content-type":"multipart/form-data"};return[n,o,{...r,headers:e}]}return[n,o,r]})();return await T.a[t](...a)})({method:"put",url:"/webcargo-alpha/backend/api.php",options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:e}})},fe=C.a.div`
|
|
115
|
-
color: ${a.tokens.fdsColorPrimaryGray60};
|
|
116
|
-
font-size: ${a.tokens.fdsSizeXs};
|
|
117
|
-
font-weight: ${a.tokens.fdsFontWeightRegular};
|
|
118
|
-
margin-bottom: ${a.tokens.fdsComponentSpacingSm};
|
|
119
|
-
i {
|
|
120
|
-
margin-right: ${a.tokens.fdsComponentSpacingSm};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
`,ge=C()($)`
|
|
124
|
-
padding-left: 0 !important;
|
|
125
|
-
`,ye=C()(a.Icon)`
|
|
126
|
-
margin-right: 0 !important;
|
|
127
|
-
vertical-align: bottom;
|
|
128
|
-
`,he=C.a.span`
|
|
129
|
-
white-space: nowrap;
|
|
130
|
-
min-width: 0;
|
|
131
|
-
color: ${a.tokens.fdsColorPrimaryGray80};
|
|
132
|
-
overflow: hidden;
|
|
133
|
-
text-overflow: ellipsis;
|
|
134
|
-
${e=>{let{$isLocationLabel:t}=e;return!t&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"}}
|
|
135
|
-
${e=>{let{$isPort:t}=e;if(void 0!==t)return`min-width: ${t?"65px":"55px"};`}};
|
|
136
|
-
`,ve=C()(a.Avatar)`
|
|
137
|
-
border: 1px solid ${a.tokens.fdsColorPrimaryGray20};
|
|
138
|
-
width: ${a.tokens.fdsSizeSm};
|
|
139
|
-
height: ${a.tokens.fdsSizeSm};
|
|
140
|
-
`,be=C()($)`
|
|
141
|
-
overflow: hidden !important;
|
|
142
|
-
font-size: 10px; //TODO: FSN-145
|
|
143
|
-
line-height: 15px;
|
|
144
|
-
flex: 1;
|
|
145
|
-
min-width: 0;
|
|
146
|
-
`,Se=C()($)`
|
|
147
|
-
:last-child {
|
|
148
|
-
padding-bottom: 0 !important;
|
|
149
|
-
}
|
|
150
|
-
`,Ee=e=>e?e.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",Ce=e=>{const t=e.reduce((e,t)=>{const n=t.country;return e[n]||(e[n]=[]),e[n].push(t),e},{});return Object.keys(t).forEach(e=>{t[e].sort((e,t)=>e.selectedValue.localeCompare(t.selectedValue))}),t};var Oe=e=>{let{text:t="",testId:n,isPort:i,isLocationLabel:l=!1,children:s=null}=e;const c=Object(o.useRef)(null),[d,u]=Object(o.useState)(!1);Object(o.useEffect)(()=>{(()=>{if(c.current){const e=c.current,t=e.scrollWidth>e.clientWidth;u(t)}})()},[t]);const p=r.a.createElement(he,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:i},s||t);return d?r.a.createElement(a.Tooltip,{title:t,"data-test-id":n+"-tooltip"},r.a.createElement(he,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:i},s||t)):p};var $e=e=>{let{search:t,index:n,dataTestId:o}=e;const i=t.origin.length>1,l=t.destination.length>1,s=i?Ce(t.origin):{[t.origin[0].country]:t.origin},d=l?Ce(t.destination):{[t.destination[0].country]:t.destination};return r.a.createElement($,{alignItems:"center",spacing:b.XSMALL,fullWidth:!0},Object.keys(s).map(e=>{const t=s[e].map(e=>e.selectedValue).join(", ");return r.a.createElement(Oe,{key:e,text:t,isLocationLabel:!0,testId:`${o}-origin-${n}`,isPort:s[e][0].type===c},r.a.createElement(ve,{type:"flag",country:e,size:"small","data-test-id":`${o}-origin-flag-${n}`,style:{marginRight:"4px"}}),t)}),r.a.createElement(a.Icon,{type:"arrow-forward",style:{marginRight:0,color:a.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(d).map(e=>{const t=d[e].map(e=>e.selectedValue).join(", ");return r.a.createElement(Oe,{key:e,text:t,isLocationLabel:!0,testId:`${o}-destination-${n}`,isPort:d[e][0].type===c},r.a.createElement(ve,{type:"flag",country:e,size:"small","data-test-id":`${o}-destination-flag-${n}`,style:{marginRight:"4px"}}),t)}))};var we=e=>{var t,n,i;let{search:l,index:s,dataTestId:c}=e;const d=l.platform_type,u=(e=>{const t=e.shipment_details.type;if(t===ie)return["box-total"];if(t===ae){const t=e.shipment_details[Q];if((null===t||void 0===t?void 0:t.packageType)===ue){return t.boxPackages.reduce((e,t)=>{var n,o;const r=null===(n=t.type)||void 0===n||null===(o=n.value)||void 0===o?void 0:o.icon;return e.includes(r)||e.push(r),e},[])}return(null===t||void 0===t?void 0:t.packageType)===pe?["uld"]:["box"]}return t===le?["container"]:["box"]})(l),{units:p,volume:m,weight:f,weightUnit:g,volumeUnit:y}=Object(o.useMemo)(()=>(e=>{const t=e.shipment_details.type;if(e.platform_type===re)return{units:0,volume:0,weight:0,weightUnit:de,volumeUnit:se};switch(t){case le:{var n;let t=0,o=0;return null===(n=e.shipment_details[ee])||void 0===n||n.forEach(e=>{const n=Number(e.units)||0;if(n>0){t+=n;const r=parseInt(e.dimensions.value,10);o+=n*(r/20)}}),{units:t,volume:o,weight:null,weightUnit:null,volumeUnit:"TEU"}}case ae:{const t=e.shipment_details[Q],n=(null===t||void 0===t?void 0:t.volumeUnit)===ce?1728:1e6;if((null===t||void 0===t?void 0:t.packageType)===ue){const e=Ee(null===t||void 0===t?void 0:t.boxPackages.reduce((e,t)=>e+parseFloat(t.width||"0")*parseFloat(t.height||"0")*parseFloat(t.length||"0")*parseFloat(t.units||"0")/n,0)),o=Ee(t.boxPackages.reduce((e,t)=>e+parseFloat(t.weight||"0"),0));return{units:t.boxPackages.reduce((e,t)=>e+parseFloat(t.units||"0"),0),volume:e,weight:o,weightUnit:t.weightUnit,volumeUnit:t.volumeUnit}}if((null===t||void 0===t?void 0:t.packageType)===pe){const e=Ee(t.uldPackages.reduce((e,t)=>e+parseFloat(t.volume||"0"),0)),n=Ee(t.uldPackages.reduce((e,t)=>e+parseFloat(t.weight||"0"),0));return{units:t.uldPackages.length,volume:e,weight:n,weightUnit:t.weightUnit,volumeUnit:t.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:de,volumeUnit:se}}case ie:{var o,r,a,i,l;const t=Ee(parseFloat((null===(o=e.shipment_details[Y])||void 0===o?void 0:o.volume)||"0")),n=Ee(parseFloat((null===(r=e.shipment_details[Y])||void 0===r?void 0:r.weight)||"0"));return{units:(null===(a=e.shipment_details[Y])||void 0===a?void 0:a.units)||0,volume:t,weight:n,weightUnit:(null===(i=e.shipment_details[Y])||void 0===i?void 0:i.weightUnit)||de,volumeUnit:(null===(l=e.shipment_details[Y])||void 0===l?void 0:l.volumeUnit)||se}}default:return{units:0,volume:0,weight:0,weightUnit:de,volumeUnit:se}}})(l),[l]),h=1===l.commodity.length&&l.commodity[0].is_temperature,v=(null===(t=l.commodity_temperature)||void 0===t?void 0:t.tempRange)&&h?oe[null===(n=l.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(i=l.commodity_temperature)||void 0===i?void 0:i.temperatureSystem]:"";return r.a.createElement($,{spacing:b.XSMALL,alignItems:"center",fullWidth:!0,key:s},d===re?r.a.createElement(be,{alignItems:"center",spacing:b.SMALL,style:{flex:1}},u.map((e,t)=>r.a.createElement(ye,{type:e,key:`${s}-${t}`,size:"tiny","data-test-id":`${c}rs-package-icon-${s}-${t}`})),r.a.createElement(Oe,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`})):r.a.createElement(be,{alignItems:"center",spacing:b.SMALL},r.a.createElement($,{alignItems:"center",spacing:b.XSMALL,"data-test-id":`rs-${s}-units`},p,"\xa0",u.map((e,t)=>r.a.createElement(ye,{type:e,key:`${s}-${t}`,size:"tiny","data-test-id":`${c}rs-package-icon-${s}-${t}`}))),r.a.createElement("span",{"data-test-id":`${c}rs-volume-${s}`},m,"\xa0",y),f&&r.a.createElement("span",{"data-test-id":`${c}rs-weight-${s}`},f,"\xa0",g),r.a.createElement(Oe,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`}),h&&r.a.createElement($,{alignItems:"center",spacing:b.XSMALL,"data-test-id":`${c}rs-temperature-${s}`},r.a.createElement(a.Icon,{type:"temperature-low",size:"tiny","data-test-id":`${c}rs-temperature-icon-${s}`}),r.a.createElement("span",{style:{whiteSpace:"nowrap"}},v))))};const Te=e=>{let{search:t,index:n,setIsOpen:o,dataTestId:i,onRecentSearchSelect:l}=e;return r.a.createElement(ge,{direction:S.VERTICAL,fullWidth:!0,spacing:b.XSMALL,key:t.id,style:{padding:a.tokens.fdsComponentSpacingSm},"data-test-id":`${i}rs-card-${n}`,onClick:()=>{(async()=>{l(t);try{await me(t.id)}catch(e){console.error(e)}o(!1)})()}},r.a.createElement($e,{search:t,index:n,dataTestId:i}),r.a.createElement(we,{search:t,index:n,dataTestId:i}))};var ke=e=>{let{recentSearches:t,setIsOpen:n,dataTestId:o,onRecentSearchSelect:l,initialValues:s}=e;const c=t?(e=>[...e].sort((e,t)=>{if(e.is_saved!==t.is_saved)return e.is_saved?-1:1;if(e.is_saved&&t.is_saved){const n=new Date(e.saved_update_date).getTime();return new Date(t.saved_update_date).getTime()-n}const n=new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date||0).getTime())).getTime();return new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date||0).getTime())).getTime()-n}).slice(0,6))(t):[];return r.a.createElement(A,null,r.a.createElement(fe,null,r.a.createElement(a.Icon,{"data-test-id":o+"rs-icon",color:a.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),r.a.createElement(i.TranslatableText,{stringId:"Recent searches"})),r.a.createElement(Se,{direction:S.VERTICAL,fullWidth:!0},c.map((e,t)=>r.a.createElement(Te,{onRecentSearchSelect:l,initialValues:s,search:e,index:t,key:e.id,setIsOpen:n,dataTestId:o}))))};var Le=e=>{let{isLoading:t,recentSearches:n,searchKey:o,dataTestId:l,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}=e;return o||n&&0!==n.length?t?r.a.createElement(a.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!o.trim()?r.a.createElement(ke,{recentSearches:n,dataTestId:l,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}):o.trim()?r.a.createElement(j,null,r.a.createElement(i.TranslatableText,{stringId:"No matching results",module:i.TRANSLATION_MODULES.SearchAndBook})):null:null};var _e=e=>{let{fetchOptions:t,renderedOptions:n,recentSearches:i=[],hasError:s,mode:c,dataTestId:d,value:u,debounceTimeout:p=800,activeLocationMode:m,defaultLocation:y,onChange:h,...v}=e;const[b,S]=Object(o.useState)([]),[E,C]=Object(o.useState)(!1),[O,$]=Object(o.useState)(""),w=Object(o.useRef)(0),[T,k]=Object(o.useState)(!1),x=Object(o.useRef)();Object(o.useEffect)(()=>{u&&0!==u.length||T||(S([]),$(""))},[u,T]),Object(o.useEffect)(()=>(""!==m&&S(e=>e.filter(e=>e.label===f[m].label)),k(!1),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{document.activeElement.blur(),document.body.click();const e=document.querySelector(".ant-select-focused");e&&e.classList.remove("ant-select-focused")},100),()=>{x.current&&clearTimeout(x.current)}),[m]);const I=Object(o.useMemo)(()=>Object(l.debounce)(async e=>{$(e),w.current+=1;const n=w.current;S([]),C(!0);let o=null;try{const r=await t(e);n===w.current&&(S(r),o=r)}catch(r){console.error("Error fetching options:",r),n===w.current&&a.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."})}finally{if(n===w.current)return C(!1),o}},p),[t,p]);Object(o.useEffect)(()=>{if(!(null===y||void 0===y?void 0:y.code))return;(async()=>{try{S([]),C(!0);const e=await t(y.code);if(S(e),!e||0===e.length)return;let n=null;if(y.type){const t=e.find(e=>{var t;return e.label.toLowerCase()===(null===(t=f[y.type])||void 0===t?void 0:t.label.toLowerCase())});(null===t||void 0===t?void 0:t.options)&&(n=t.options.find(e=>e.code.toLowerCase()===y.code.toLowerCase()||e.selectedValue.toLowerCase()===y.code.toLowerCase()))}if(n||(n=e.map(e=>e.options).flat().find(e=>e.code.toLowerCase()===y.code.toLowerCase()||e.selectedValue.toLowerCase()===y.code.toLowerCase())),n&&h){const e=J(n);h([e])}}catch(e){P.isLocal()&&console.error("Error loading default location:",e)}finally{C(!1)}})()},[null===y||void 0===y?void 0:y.code,null===y||void 0===y?void 0:y.type]);const A=E||O.trim()||(null===i||void 0===i?void 0:i.length)>0,j=T&&A?2:3;return r.a.createElement(r.a.Fragment,null,r.a.createElement(L,null),r.a.createElement(_,Object.assign({maxTagCount:j,onSearch:I,$hasError:s,loading:E,options:b,filterOption:!1,notFoundContent:r.a.createElement(Le,{isLoading:E,recentSearches:i,searchKey:O,dataTestId:d,setIsOpen:k,onRecentSearchSelect:v.onRecentSearchSelect,initialValues:v.initialValues}),mode:c,"data-test-id":d+"-selector",allowClear:c===g,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:e=>{k(e),S([]),$("")},open:T&&(E||O.trim()||(null===i||void 0===i?void 0:i.length)>0),value:u,onChange:h},v),n(b)))};var xe=e=>{let{omittedPorts:t,dataTestId:n}=e;const o=t.map(e=>{var t;return null===(t=JSON.parse(e.key))||void 0===t?void 0:t.selectedValue});return r.a.createElement(a.Tooltip,{title:o.join(",")},r.a.createElement(x,{"data-test-id":n+"-extra-ports"},"+"+t.length))};t.default=e=>{let{value:t,onChange:n,hasError:l,dataTestId:s="location-input",isOriginLocation:c=!0,maxPorts:p=1,supportedLocationModes:m,customer:S,defaultLocation:E,autofillLocationAddress:C,autofillLocationCode:O,userCountryCode:w,...T}=e;const[k,L]=Object(o.useState)(t),[_,A]=Object(o.useState)(1===m.length?m[0]:""),[j,P]=Object(o.useState)(B(_)||""===_?g:y),M=Object(o.useRef)(t),U=Object(o.useRef)(null);Object(o.useEffect)(()=>{B(_)?P(g):P(y)},[_]),Object(o.useEffect)(()=>{L(t),M.current=t,Array.isArray(t)&&t.length>0?A(t[0].type):(null===E||void 0===E?void 0:E.type)?A(E.type):A("")},[t,null===E||void 0===E?void 0:E.type]);const q=Object(o.useRef)({onChange:n,selectionMode:j,maxPorts:p});return Object(o.useEffect)(()=>{q.current={onChange:n,selectionMode:j,maxPorts:p}},[n,j,p]),Object(o.useEffect)(()=>{const e=`${C||""}::${O||""}`;if(!C&&!O)return;if(e===U.current)return;const t=M.current,{selectionMode:n,maxPorts:o}=q.current,r=n===y&&"number"===typeof o&&o>1&&Array.isArray(t)&&t.length<o;if((e=>!!e&&(Array.isArray(e)?e.length>0:Object.keys(e).length>0))(t)&&!r)return;(async()=>{try{const t=await Z({autofillLocationAddress:C,autofillLocationCode:O,supportedLocationModes:m,customer:S,userCountryCode:w});if(!t)return;const{onChange:n,selectionMode:o,maxPorts:r}=q.current,a=M.current;if(o===y&&"number"===typeof r&&r>1&&Array.isArray(a)){const e=F(t),i=new Set((a||[]).map(e=>R((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))));if(!e||i.has(e))return;const l=V(a)||[],s=[...Array.isArray(l)?l.filter(Boolean):[],t].slice(0,r);W(s,o,r,L,n)}else W(o===y?[t]:t,o,r,L,n);U.current=e}catch(t){console.error("Error performing autofill:",t)}})()},[C,O,m,S,w]),r.a.createElement(_e,Object.assign({mode:j,dataTestId:s,hasError:l,placeholder:r.a.createElement(i.TranslatableText,{style:{fontSize:a.tokens.fdsFontSizeBase},stringId:"Select "+(c?h:v)}),value:V(k),fetchOptions:N(_,m,S),renderedOptions:e=>((e,t)=>{if((e||[]).some(e=>{var t;return(null===e||void 0===e||null===(t=e.options)||void 0===t?void 0:t.length)>0}))return e.map(e=>{var n;const o=Object.values(f).find(t=>t.label===e.label),i=null===o||void 0===o?void 0:o.icon;return r.a.createElement(a.Select.OptGroup,{label:r.a.createElement("span",{style:{fontFamily:"Open Sans"}},r.a.createElement(a.Icon,{size:"tiny",type:i}),"\xa0 \xa0",e.label),key:e.label,"data-test-id":`${t}-group-${e.label}`},null===(n=e.options)||void 0===n?void 0:n.map(n=>{const{countryCode:o,selectedValue:l,displayLabel:s,type:c}=n;return r.a.createElement(a.Option,{value:z(n),title:l,"data-test-id":`${t}-${e.label}-${l}`,style:{paddingLeft:"8px"},label:r.a.createElement(r.a.Fragment,null,r.a.createElement(a.Icon,{type:i,size:"tiny"}),"\xa0",r.a.createElement(x,null,l)),key:n.code},r.a.createElement($,{fullWidth:!0,justifyContent:"space-between"},r.a.createElement($,{spacing:b.XSMALL},r.a.createElement("span",null,r.a.createElement(a.Avatar,{type:"flag",country:o,size:"small",style:{width:a.tokens.fdsSizeSm,height:a.tokens.fdsSizeSm}})),r.a.createElement(I,null,s)),c===d&&r.a.createElement(a.Icon,{type:"amazon",size:"small"}),c===u&&r.a.createElement(a.Chip,{type:"neutral",iconType:"address-book"})))}))})})(e,s),onChange:e=>{const t=null!==e&&void 0!==e?e:[],o=j===y&&Array.isArray(t)&&t.length>0?((e,t)=>{const n=new Map;for(const l of Array.isArray(t)?t:[]){var o;const e=X(l);e&&n.set(e,(null!==(o=n.get(e))&&void 0!==o?o:0)+1)}const r=new Map;for(const l of e){var a;const e=X(l);e&&r.set(e,(null!==(a=r.get(e))&&void 0!==a?a:0)+1)}for(const[l,s]of r){var i;const e=null!==(i=n.get(l))&&void 0!==i?i:0;if(s>e&&e>0)return l}return null})(t,k):null;null!==o?((e,t,n,o)=>{const r=(Array.isArray(t)?t:[]).filter(t=>X(t)!==e);n(r),D(r,o)})(o,k,L,n):W(t,j,p,L,n),A("")},activeLocationMode:_,maxTagPlaceholder:e=>r.a.createElement(xe,{omittedPorts:e,dataTestId:s}),defaultLocation:E},T))}}])}));
|
|
1
|
+
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):"function"===typeof define&&define.amd?define("FusionLocationInput",["react","@freightos/design-system","styled-components","@freightos/freightos-i18n","@freightos/http-client","lodash"],e):"object"===typeof exports?exports.FusionLocationInput=e(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):t.FusionLocationInput=e(t.React,t["@freightos/design-system"],t["styled-components"],t["@freightos/freightos-i18n"],t["@freightos/http-client"],t.lodash)}(this,(function(t,e,n,r,o,a){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="http://ship.freightos.local:8800/FusionLocationInput/",n(n.s=7)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){t.exports=n(8)},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e,n){t.exports=n(9)},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"===typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(L){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),i=new x(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return k()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=w(i,n);if(c){if(c===s)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(L){return{type:"throw",arg:L}}}t.wrap=u;var s={};function d(){}function f(){}function p(){}var m={};c(m,o,(function(){return this}));var v=Object.getPrototypeOf,h=v&&v(v(E([])));h&&h!==e&&n.call(h,o)&&(m=h);var y=p.prototype=d.prototype=Object.create(m);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var r;this._invoke=function(o,a){function i(){return new e((function(r,i){!function r(o,a,i,c){var u=l(t[o],t,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"===typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(d).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,c)}))}c(u.arg)}(o,a,r,i)}))}return r=r?r.then(i,i):i()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,s;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=p,c(y,"constructor",p),c(p,"constructor",f),f.displayName=c(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(b.prototype),c(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new b(u(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(y),c(y,i,"Generator"),c(y,o,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=E,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return i.type="throw",i.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,s):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=r}catch(o){"object"===typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";n.r(e);var r=n(2),o=n.n(r);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){if(t){if("string"===typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function c(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(l){return void n(l)}c.done?e(u):Promise.resolve(u).then(r,o)}function l(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(t){u(a,r,o,i,c,"next",t)}function c(t){u(a,r,o,i,c,"throw",t)}i(void 0)}))}}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(u){o=!0,a=u}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var f,p=n(0),m=n.n(p),v=n(1),h=n(4),y=n(6);function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b="airport",w="seaport",S="fulfillment_center",O="address_book",x="last_mile_address",E="address",k=(g(f={},b,{label:"Airports",key:b,icon:"mode-air"}),g(f,w,{label:"Ports",key:w,icon:"mode-ship"}),g(f,S,{label:"Fulfillment centers",key:S,icon:"fulfillment-center"}),g(f,O,{key:O,groupedBy:"address"}),g(f,x,{key:x,groupedBy:"address"}),g(f,E,{label:"Address",key:E,icon:"location"}),f),L="single",_="multiple",C="origin",T="destination";function j(t){if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=i(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw o}}}}function P(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function I(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A={XXLARGE:v.tokens.fdsComponentSpacingXxl,XLARGE:v.tokens.fdsComponentSpacingXl,LARGE:v.tokens.fdsComponentSpacingLg,MEDIUM:v.tokens.fdsComponentSpacingMd,SMALL:v.tokens.fdsComponentSpacingSm,XSMALL:v.tokens.fdsComponentSpacingXs,XXSMALL:v.tokens.fdsComponentSpacingXxs,NONE:0},F="vertical",R="horizontal";function M(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var U,N,z,D,V,$,W,G,X,B,q,K=n(3),J=n.n(K),H=J.a.div(U||(U=M(["\n\tdisplay: flex;\n\tflex-direction: ",";\n\tflex-wrap: ",";\n\talign-items: ",";\n\tjustify-content: ",";\n\tbox-sizing: border-box;\n\n\t","\n\t",";\n"])),(function(t){return t.$direction===F?"column":"row"}),(function(t){return t.$wrap?"wrap":"nowrap"}),(function(t){return t.$alignItems}),(function(t){return t.$justifyContent}),(function(t){return t.$fullWidth&&Object(K.css)(N||(N=M(["\n\t\t\twidth: 100%;\n\t\t"])))}),(function(t){var e=t.$direction,n=t.$spacing;return e===F?Object(K.css)(z||(z=M(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-top: ",";\n\t\t\t\t\t}\n\t\t\t "])),n):Object(K.css)(D||(D=M(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-left: ",";\n\t\t\t\t\t}\n\t\t\t "])),n)})),Y=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],Z=function(t){var e=t.direction,n=void 0===e?R:e,r=t.alignItems,o=void 0===r?"start":r,a=t.spacing,i=void 0===a?A.NONE:a,c=t.wrap,u=t.justifyContent,l=t.fullWidth,s=d(t,Y);return m.a.createElement(H,Object.assign({},s,{$direction:n,$alignItems:o,$spacing:i,$wrap:c,$justifyContent:u,$fullWidth:l}),s.children)},Q=n(5),tt=n.n(Q),et=function(){var t=l(o.a.mark((function t(e,n,r){var a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a=e.reduce((function(t,e){return I(I({},t),{},g({},k[e].key,I(I({type:e.toUpperCase()},(null===r||void 0===r?void 0:r.code)?{searchTerm:r.name}:{}),k[e].groupedBy?{groupedBy:k[e].groupedBy}:{})))}),{}),t.next=4,tt.a.post("/geocoder/api/v3/geocoder/locations",{query:n,limit:5,sources:a});case 4:return i=t.sent,t.abrupt("return",i.data);case 8:return t.prev=8,t.t0=t.catch(0),console.error("Error fetching locations:",t.t0),t.abrupt("return",{results:{}});case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n,r){return t.apply(this,arguments)}}(),nt=Object(K.createGlobalStyle)(V||(V=M(["\n .ant-select-dropdown {\n .ant-select-dropdown-menu {\n max-height: 400px;\n padding: 0 !important;\n margin-top: 0 !important;\n }\n }\n"]))),rt=J()(v.Select)($||($=M(["\n\t.ant-select-selection__rendered {\n\t\tmin-width: 100% !important;\n\t}\n\n\tli.ant-select-selection__choice {\n\t\tborder-radius: ",";\n\t\tborder: none;\n\t\tborder-color: ",";\n\t\tcolor: ",";\n\t\tbackground-color: ",";\n\t\tline-height: 10px !important;\n\t\tmargin-right: ",";\n\t\twidth: fit-content;\n\t\tmax-width: 90px;\n\t\theight: "," !important;\n\t\t","\n\n\t\t.ant-select-selection__choice__remove {\n\t\t\tcolor: ",";\n\t\t\tmargin-top: "," !important;\n\t\t}\n\n\t\t.ant-select-selection__choice__content {\n\t\t\tline-height: "," !important;\n\t\t\theight: "," !important;\n\t\t}\n\t}\n\n\tli.ant-select-selection__choice__disabled {\n\t\tborder: none;\n\t\tbackground-color: transparent;\n\t\tpadding: 0;\n\t\tpadding-left: 0;\n\t\twidth: fit-content;\n\t}\n\n\t.ant-select-dropdown .ant-select-not-found {\n\t\tcursor: pointer !important;\n\t}\n\n\t.ant-select-selection-selected-value {\n\t\tmax-width: 280px !important;\n\t}\n\n\tli.ant-select-search.ant-select-search--inline {\n\t\tmargin-left: -1px !important;\n\t}\n\t.ant-select-search__field {\n\t\tcolor: "," !important;\n\t}\n\t","\n"])),v.tokens.fdsBorderRadiusXl,v.tokens.fdsColorPrimaryBlue,v.tokens.fdsColorPrimaryBlue,v.tokens.fdsColorPrimaryBlue10,v.tokens.fdsComponentSpacingXxs,v.tokens.fdsSizeMd,(function(t){return"large"===t.size?"\n\t\t\tmargin-top: ".concat(v.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"}),v.tokens.fdsColorPrimaryBlue,v.tokens.fdsComponentSpacingXs,v.tokens.fdsSizeMd,v.tokens.fdsSizeMd,v.tokens.fdsColorPrimaryGray80,(function(t){return t.$hasError&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(v.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(v.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(v.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(v.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")})),ot=J.a.span(W||(W=M(["\n\tfont-size: "," !important;\n"])),v.tokens.fdsFontSizeSm),at=J.a.div(G||(G=M(["\n\tfont-size: "," !important;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 2;\n\t-webkit-box-orient: vertical;\n"])),v.tokens.fdsFontSizeSm),it=J()(v.Menu)(X||(X=M(["\n\tcursor: pointer !important;\n\n\t.ant-menu-item-group-title {\n\t\tpadding: 0;\n\t\tcolor: ",";\n\t}\n\n\t.ant-menu-item {\n\t\tpadding: 0;\n\t\twhite-space: normal;\n\t\tline-height: normal;\n\n\t\t&:hover {\n\t\t\tbackground-color: #f5f5f5;\n\t\t}\n\t}\n"])),v.tokens.fdsBodyTextColorDisabled),ct=J.a.div(B||(B=M(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),v.tokens.fdsFontSizeSm,v.tokens.fdsSizeSm,v.tokens.fdsHeadingsFontFamily);J()(v.Icon)(q||(q=M(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"])));function ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var lt,st,dt,ft,pt,mt,vt,ht,yt,gt,bt,wt,St=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,r=[{key:"isProduction",value:function(){return"prod"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}},{key:"isTest",value:function(){return"test"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}},{key:"isLocal",value:function(){return"dev"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}}],(n=null)&&ut(e.prototype,n),r&&ut(e,r),t}(),Ot=["address"],xt=function(t){return(t||"").trim().toUpperCase()},Et=function(t){var e=function(t){try{return"string"===typeof t?JSON.parse(t):null}catch(e){return null}}(null===t||void 0===t?void 0:t.key);return xt((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},kt=function(t){var e=[];JSON.stringify(t,(function(t,n){return e.push(t),n}));var n=Array.from(new Set(e)).sort();return JSON.stringify(t,n)},Lt=function(t){var e=t||{},n=e.displayLabel,r=e.selectedValue,o=e.formattedNameOrAddress,a=e.code,i=e.countryCode,c=e.stateOrProvince,u=e.city,l=e.latitude,s=e.longitude,d=e.postalOrZipCode,f=e.sourceType,p=e.locationType,m=e.type;return{displayLabel:n,selectedValue:r||a,formattedNameOrAddress:o,code:a||r,country:i,countryName:e.countryName,stateOrProvince:null!==c&&void 0!==c?c:null,city:null!==u&&void 0!==u?u:null,latitude:null!==l&&void 0!==l?l:null,longitude:null!==s&&void 0!==s?s:null,postalOrZipCode:null!==d&&void 0!==d?d:null,sourceType:null!==f&&void 0!==f?f:null,locationType:null!==p&&void 0!==p?p:null,type:null!==m&&void 0!==m?m:f}},_t=function(t){try{var e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(Rt(t.key)):t;return kt(Lt(e))}catch(n){return kt(Lt(t))}},Ct=function(t){var e=function(t){return function(t){if(t){var e,n=t.label||t.selectedValue;return{key:_t(t),label:n?m.a.createElement(m.a.Fragment,null,m.a.createElement(v.Icon,{type:t.sourceType?null===(e=k[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",m.a.createElement(ot,null,n)):void 0}}}(t)};return Array.isArray(t)?t.map(e):e(t)},Tt=function(t){var e=I({},t),n=t[E].filter((function(t){return t.sourceType===S}));if(n.length>0){var r,o=e,a=o.address;e=I(I({},d(o,Ot)),{},(g(r={},S,n),g(r,"address",a.filter((function(t){return t.type!==S}))),r))}return e},jt=function(t,e,n){return function(){var r=l(o.a.mark((function r(a){var i,c,u;return o.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a){r.next=2;break}return r.abrupt("return",[]);case 2:return i=""!==t?[t]:e,r.next=5,et(i,a,n);case 5:return c=r.sent,(u=c.results)[E]&&(u=Tt(u)),r.abrupt("return",Object.keys(u).map((function(t){var e;return{label:(null===(e=k[t])||void 0===e?void 0:e.label)||t,options:u[t].map((function(t){return I(I({},t),{},{type:t.sourceType})}))}})));case 9:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()},Pt=function(){var t=l(o.a.mark((function t(e,n){var r,a;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Array.isArray(e)?e:[e],t.next=3,Promise.all(r.map(function(){var t=l(o.a.mark((function t(e){var n,r,a;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=null===e||void 0===e?void 0:e.key,r=Rt(n),a=JSON.parse(r),t.abrupt("return",I({key:r},a));case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()));case 3:a=t.sent,n(a.filter(Boolean));case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),It=function(t,e,n,r,o){if(e===_){var a=Array.isArray(t)?t:[];if(a.length<=n)r(a),Pt(a,o);else{var i,c,u=(null===(i=JSON.parse(null===(c=a[0])||void 0===c?void 0:c.key))||void 0===i?void 0:i.sourceType)===b?n>1?"airports":"airport":n>1?"ports":"port";v.Message.danger(m.a.createElement(m.a.Fragment,null,m.a.createElement(h.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",m.a.createElement(h.TranslatableText,{stringId:u})))}}else r(t),Pt(t,o)},At=function(t){var e,n,r,o=null;try{if("string"===typeof(null===t||void 0===t?void 0:t.key)){var a=JSON.parse(t.key);o=(null===a||void 0===a?void 0:a.code)||(null===a||void 0===a?void 0:a.selectedValue)||null}}catch(i){}return((null!==(e=null!==(n=null!==(r=o)&&void 0!==r?r:null===t||void 0===t?void 0:t.code)&&void 0!==n?n:null===t||void 0===t?void 0:t.selectedValue)&&void 0!==e?e:"")||"").trim().toUpperCase()},Ft=function(t){return t&&(t===E||t===x||t===O||t===S)},Rt=function(t){return"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t},Mt=/^[^-]*-\s*(.+?),/,Ut=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},Nt=function(t,e){var n=t[E]||[],r=t[S]||[];return[].concat(c(n),c(r)).filter((function(t){return function(t,e){if(!t.displayLabel)return!1;var n=t.displayLabel.match(Mt);if(!(null===n||void 0===n?void 0:n[1]))return!1;var r=n[1].trim(),o=e.trim().split(/\s+/).map(Ut);return new RegExp("\\b".concat(o.join("\\s+"),"\\b"),"i").test(r)}(t,e)}))},zt=function(t,e){return 0===t.length?null:1!==t.length&&e&&t.find((function(t){var n;return(null===(n=t.countryCode)||void 0===n?void 0:n.toLowerCase())===e.toLowerCase()}))||t[0]},Dt=function(t,e){var n=t[b]||[],r=t[w]||[],o=xt(e);return[].concat(c(n),c(r)).find((function(t){return xt(null===t||void 0===t?void 0:t.code)===o}))},Vt=function(t){var e=t.selectedValue||t.displayLabel||t.code,n=I(I({},t),{},{selectedValue:e,displayLabel:t.displayLabel||e,country:t.countryCode||t.country,type:t.type||t.sourceType});return n.country&&delete n.countryCode,{key:JSON.stringify(n),label:e}},$t=function(){var t=l(o.a.mark((function t(e){var n,r,a,i,c,u,l,s,d,f,p;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.autofillLocationAddress,r=e.autofillLocationCode,a=e.supportedLocationModes,i=e.customer,c=e.userCountryCode,n||r){t.next=3;break}return t.abrupt("return",null);case 3:if(u=null,!n){t.next=12;break}return t.next=7,et(a,n,i);case 7:l=t.sent,s=l.results,d=Nt(void 0===s?{}:s,n),u=zt(d,c);case 12:if(u||!r){t.next=19;break}return t.next=15,et(a,r,i);case 15:f=t.sent,p=f.results,u=Dt(void 0===p?{}:p,r);case 19:return t.abrupt("return",u?Vt(u):null);case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Wt="totalShipment",Gt="unitsShipment",Xt="containerPackages",Bt="celsius",qt="fahrenheit",Kt="COL",Jt="ERT",Ht="CRT",Yt=(g(pt={},"FRO",(g(lt={},Bt,"-10\xbaC or below"),g(lt,qt,"14\xbaF or below"),lt)),g(pt,Kt,(g(st={},Bt,"From +2\xbaC To +8\xbaC"),g(st,qt,"From 35.6\xbaF To 46.4\xbaF"),st)),g(pt,Jt,(g(dt={},Bt,"From +2\xbaC To +25\xbaC"),g(dt,qt,"From 35.6\xbaF To 77\xbaF"),dt)),g(pt,Ht,(g(ft={},Bt,"From +15\xbaC To +25\xbaC"),g(ft,qt,"From 59\xbaF To 77\xbaF"),ft)),pt),Zt="quotation",Qt="units",te="totals",ee="container",ne="CBM",re="CFT",oe="kg",ae="box",ie="uld",ce=function(){var t=l(o.a.mark((function t(e){var n,r,a,i,u,l,s,d;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.method,r=e.url,a=void 0===r?"":r,i=e.data,u=void 0===i?{}:i,l=e.options,s=void 0===l?{}:l,d=function(){if("get"===n)return[Object.keys(u).length?"".concat(a,"?").concat(new URLSearchParams(u).toString()):a,s];if("post"===n){var t=I(I({},null===s||void 0===s?void 0:s.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[a,u,I(I({},s),{},{headers:t})]}return[a,u,s]}(),t.next=4,tt.a[n].apply(tt.a,c(d));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ue=function(){var t=l(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ce({method:"put",url:"".concat("/webcargo-alpha","/backend/api.php"),options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:e}});case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),le=J.a.div(mt||(mt=M(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),v.tokens.fdsColorPrimaryGray60,v.tokens.fdsSizeXs,v.tokens.fdsFontWeightRegular,v.tokens.fdsComponentSpacingSm,v.tokens.fdsComponentSpacingSm),se=J()(Z)(vt||(vt=M(["\n\tpadding-left: 0 !important;\n"]))),de=J()(v.Icon)(ht||(ht=M(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),fe=J.a.span(yt||(yt=M(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),v.tokens.fdsColorPrimaryGray80,(function(t){return!t.$isLocationLabel&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"}),(function(t){var e=t.$isPort;if(void 0!==e)return"min-width: ".concat(e?"65px":"55px",";")})),pe=J()(v.Avatar)(gt||(gt=M(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),v.tokens.fdsColorPrimaryGray20,v.tokens.fdsSizeSm,v.tokens.fdsSizeSm),me=J()(Z)(bt||(bt=M(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),ve=J()(Z)(wt||(wt=M(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"]))),he=function(t){return t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0"},ye=function(t){var e=t.reduce((function(t,e){var n=e.country;return t[n]||(t[n]=[]),t[n].push(e),t}),{});return Object.keys(e).forEach((function(t){e[t].sort((function(t,e){return t.selectedValue.localeCompare(e.selectedValue)}))})),e},ge=function(t){var e=t.text,n=void 0===e?"":e,r=t.testId,o=t.isPort,a=void 0===o?void 0:o,i=t.isLocationLabel,c=void 0!==i&&i,u=t.children,l=void 0===u?null:u,d=Object(p.useRef)(null),f=s(Object(p.useState)(!1),2),h=f[0],y=f[1];Object(p.useEffect)((function(){!function(){if(d.current){var t=d.current,e=t.scrollWidth>t.clientWidth;y(e)}}()}),[n]);var g=m.a.createElement(fe,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n);return h?m.a.createElement(v.Tooltip,{title:n,"data-test-id":"".concat(r,"-tooltip")},m.a.createElement(fe,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n)):g},be=function(t){var e=t.search,n=t.index,r=t.dataTestId,o=e.origin.length>1,a=e.destination.length>1,i=o?ye(e.origin):g({},e.origin[0].country,e.origin),c=a?ye(e.destination):g({},e.destination[0].country,e.destination);return m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,fullWidth:!0},Object.keys(i).map((function(t){var e=i[t].map((function(t){return t.selectedValue})).join(", ");return m.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-origin-").concat(n),isPort:i[t][0].type===w},m.a.createElement(pe,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e)})),m.a.createElement(v.Icon,{type:"arrow-forward",style:{marginRight:0,color:v.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(c).map((function(t){var e=c[t].map((function(t){return t.selectedValue})).join(", ");return m.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-destination-").concat(n),isPort:c[t][0].type===w},m.a.createElement(pe,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e)})))},we=function(t){var e,n,r,o=t.search,a=t.index,i=t.dataTestId,c=o.platform_type,u=function(t){var e=t.shipment_details.type;if(e===te)return["box-total"];if(e===Qt){var n=t.shipment_details[Gt];return(null===n||void 0===n?void 0:n.packageType)===ae?n.boxPackages.reduce((function(t,e){var n,r,o=null===(n=e.type)||void 0===n||null===(r=n.value)||void 0===r?void 0:r.icon;return t.includes(o)||t.push(o),t}),[]):(null===n||void 0===n?void 0:n.packageType)===ie?["uld"]:["box"]}return e===ee?["container"]:["box"]}(o),l=Object(p.useMemo)((function(){return function(t){var e=t.shipment_details.type;if(t.platform_type===Zt)return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne};switch(e){case ee:var n,r=0,o=0;return null===(n=t.shipment_details[Xt])||void 0===n||n.forEach((function(t){var e=Number(t.units)||0;if(e>0){r+=e;var n=parseInt(t.dimensions.value,10);o+=e*(n/20)}})),{units:r,volume:o,weight:null,weightUnit:null,volumeUnit:"TEU"};case Qt:var a=t.shipment_details[Gt],i=(null===a||void 0===a?void 0:a.volumeUnit)===re?1728:1e6;if((null===a||void 0===a?void 0:a.packageType)===ae){var c=he(null===a||void 0===a?void 0:a.boxPackages.reduce((function(t,e){return t+parseFloat(e.width||"0")*parseFloat(e.height||"0")*parseFloat(e.length||"0")*parseFloat(e.units||"0")/i}),0)),u=he(a.boxPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:a.boxPackages.reduce((function(t,e){return t+parseFloat(e.units||"0")}),0),volume:c,weight:u,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}if((null===a||void 0===a?void 0:a.packageType)===ie){var l=he(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.volume||"0")}),0)),s=he(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:a.uldPackages.length,volume:l,weight:s,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne};case te:var d,f,p,m,v,h=he(parseFloat((null===(d=t.shipment_details[Wt])||void 0===d?void 0:d.volume)||"0")),y=he(parseFloat((null===(f=t.shipment_details[Wt])||void 0===f?void 0:f.weight)||"0"));return{units:(null===(p=t.shipment_details[Wt])||void 0===p?void 0:p.units)||0,volume:h,weight:y,weightUnit:(null===(m=t.shipment_details[Wt])||void 0===m?void 0:m.weightUnit)||oe,volumeUnit:(null===(v=t.shipment_details[Wt])||void 0===v?void 0:v.volumeUnit)||ne};default:return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne}}}(o)}),[o]),s=l.units,d=l.volume,f=l.weight,h=l.weightUnit,y=l.volumeUnit,g=1===o.commodity.length&&o.commodity[0].is_temperature,b=(null===(e=o.commodity_temperature)||void 0===e?void 0:e.tempRange)&&g?Yt[null===(n=o.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(r=o.commodity_temperature)||void 0===r?void 0:r.temperatureSystem]:"";return m.a.createElement(Z,{spacing:A.XSMALL,alignItems:"center",fullWidth:!0,key:a},c===Zt?m.a.createElement(me,{alignItems:"center",spacing:A.SMALL,style:{flex:1}},u.map((function(t,e){return m.a.createElement(de,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})})),m.a.createElement(ge,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)})):m.a.createElement(me,{alignItems:"center",spacing:A.SMALL},m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,"data-test-id":"rs-".concat(a,"-units")},s,"\xa0",u.map((function(t,e){return m.a.createElement(de,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})}))),m.a.createElement("span",{"data-test-id":"".concat(i,"rs-volume-").concat(a)},d,"\xa0",y),f&&m.a.createElement("span",{"data-test-id":"".concat(i,"rs-weight-").concat(a)},f,"\xa0",h),m.a.createElement(ge,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)}),g&&m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,"data-test-id":"".concat(i,"rs-temperature-").concat(a)},m.a.createElement(v.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(i,"rs-temperature-icon-").concat(a)}),m.a.createElement("span",{style:{whiteSpace:"nowrap"}},b))))},Se=function(t){var e=t.search,n=t.index,r=t.setIsOpen,a=t.dataTestId,i=t.onRecentSearchSelect,c=function(){var t=l(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i(e),t.prev=1,t.next=4,ue(e.id);case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.error(t.t0);case 9:r(!1);case 10:case"end":return t.stop()}}),t,null,[[1,6]])})));return function(){return t.apply(this,arguments)}}();return m.a.createElement(se,{direction:F,fullWidth:!0,spacing:A.XSMALL,key:e.id,style:{padding:v.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(a,"rs-card-").concat(n),onClick:function(){c()}},m.a.createElement(be,{search:e,index:n,dataTestId:a}),m.a.createElement(we,{search:e,index:n,dataTestId:a}))},Oe=function(t){var e=t.recentSearches,n=t.setIsOpen,r=t.dataTestId,o=t.onRecentSearchSelect,a=t.initialValues,i=e?function(t){return c(t).sort((function(t,e){if(t.is_saved!==e.is_saved)return t.is_saved?-1:1;if(t.is_saved&&e.is_saved){var n=new Date(t.saved_update_date).getTime();return new Date(e.saved_update_date).getTime()-n}var r=new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date||0).getTime())).getTime();return new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date||0).getTime())).getTime()-r})).slice(0,6)}(e):[];return m.a.createElement(it,null,m.a.createElement(le,null,m.a.createElement(v.Icon,{"data-test-id":"".concat(r,"rs-icon"),color:v.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),m.a.createElement(h.TranslatableText,{stringId:"Recent searches"})),m.a.createElement(ve,{direction:F,fullWidth:!0},i.map((function(t,e){return m.a.createElement(Se,{onRecentSearchSelect:o,initialValues:a,search:t,index:e,key:t.id,setIsOpen:n,dataTestId:r})}))))},xe=function(t){var e=t.isLoading,n=t.recentSearches,r=t.searchKey,o=t.dataTestId,a=t.setIsOpen,i=t.onRecentSearchSelect,c=t.initialValues;return r||n&&0!==n.length?e?m.a.createElement(v.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!r.trim()?m.a.createElement(Oe,{recentSearches:n,dataTestId:o,setIsOpen:a,onRecentSearchSelect:i,initialValues:c}):r.trim()?m.a.createElement(ct,null,m.a.createElement(h.TranslatableText,{stringId:"No matching results",module:h.TRANSLATION_MODULES.SearchAndBook})):null:null},Ee=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],ke=function(t){var e=t.fetchOptions,n=t.renderedOptions,r=t.recentSearches,a=void 0===r?[]:r,i=t.hasError,c=t.mode,u=t.dataTestId,f=t.value,h=t.debounceTimeout,g=void 0===h?800:h,b=t.activeLocationMode,w=t.defaultLocation,S=t.onChange,O=d(t,Ee),x=s(Object(p.useState)([]),2),E=x[0],_=x[1],C=s(Object(p.useState)(!1),2),T=C[0],j=C[1],P=s(Object(p.useState)(""),2),I=P[0],A=P[1],F=Object(p.useRef)(0),R=s(Object(p.useState)(!1),2),M=R[0],U=R[1],N=Object(p.useRef)();Object(p.useEffect)((function(){f&&0!==f.length||M||(_([]),A(""))}),[f,M]),Object(p.useEffect)((function(){return""!==b&&_((function(t){return t.filter((function(t){return t.label===k[b].label}))})),U(!1),N.current&&clearTimeout(N.current),N.current=setTimeout((function(){document.activeElement.blur(),document.body.click();var t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused")}),100),function(){N.current&&clearTimeout(N.current)}}),[b]);var z=Object(p.useMemo)((function(){var t=function(){var t=l(o.a.mark((function t(n){var r,a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return A(n),F.current+=1,r=F.current,_([]),j(!0),a=null,t.prev=6,t.next=9,e(n);case 9:i=t.sent,r===F.current&&(_(i),a=i),t.next=17;break;case 13:t.prev=13,t.t0=t.catch(6),console.error("Error fetching options:",t.t0),r===F.current&&v.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."});case 17:if(t.prev=17,r!==F.current){t.next=21;break}return j(!1),t.abrupt("return",a);case 21:return t.finish(17);case 22:case"end":return t.stop()}}),t,null,[[6,13,17,22]])})));return function(e){return t.apply(this,arguments)}}();return Object(y.debounce)(t,g)}),[e,g]);Object(p.useEffect)((function(){(null===w||void 0===w?void 0:w.code)&&function(){var t=l(o.a.mark((function t(){var n,r,a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,_([]),j(!0),t.next=5,e(w.code);case 5:if(n=t.sent,_(n),n&&0!==n.length){t.next=9;break}return t.abrupt("return");case 9:r=null,w.type&&(null===(a=n.find((function(t){var e;return t.label.toLowerCase()===(null===(e=k[w.type])||void 0===e?void 0:e.label.toLowerCase())})))||void 0===a?void 0:a.options)&&(r=a.options.find((function(t){return t.code.toLowerCase()===w.code.toLowerCase()||t.selectedValue.toLowerCase()===w.code.toLowerCase()}))),r||(r=n.map((function(t){return t.options})).flat().find((function(t){return t.code.toLowerCase()===w.code.toLowerCase()||t.selectedValue.toLowerCase()===w.code.toLowerCase()}))),r&&S&&(i=Vt(r),S([i])),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),St.isLocal()&&console.error("Error loading default location:",t.t0);case 18:return t.prev=18,j(!1),t.finish(18);case 21:case"end":return t.stop()}}),t,null,[[0,15,18,21]])})));return function(){return t.apply(this,arguments)}}()()}),[null===w||void 0===w?void 0:w.code,null===w||void 0===w?void 0:w.type]);var D=T||I.trim()||(null===a||void 0===a?void 0:a.length)>0,V=M&&D?2:3;return m.a.createElement(m.a.Fragment,null,m.a.createElement(nt,null),m.a.createElement(rt,Object.assign({maxTagCount:V,onSearch:z,$hasError:i,loading:T,options:E,filterOption:!1,notFoundContent:m.a.createElement(xe,{isLoading:T,recentSearches:a,searchKey:I,dataTestId:u,setIsOpen:U,onRecentSearchSelect:O.onRecentSearchSelect,initialValues:O.initialValues}),mode:c,"data-test-id":"".concat(u,"-selector"),allowClear:c===L,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:function(t){U(t),_([]),A("")},open:M&&(T||I.trim()||(null===a||void 0===a?void 0:a.length)>0),value:f,onChange:S},O),n(E)))},Le=function(t){var e=t.omittedPorts,n=t.dataTestId,r=e.map((function(t){var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue}));return m.a.createElement(v.Tooltip,{title:r.join(",")},m.a.createElement(ot,{"data-test-id":"".concat(n,"-extra-ports")},"+".concat(e.length)))},_e=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation","autofillLocationAddress","autofillLocationCode","userCountryCode"];e.default=function(t){var e=t.value,n=t.onChange,r=t.hasError,a=t.dataTestId,i=void 0===a?"location-input":a,u=t.isOriginLocation,f=void 0===u||u,y=t.maxPorts,g=void 0===y?1:y,b=t.supportedLocationModes,w=t.customer,x=t.defaultLocation,E=t.autofillLocationAddress,P=t.autofillLocationCode,I=t.userCountryCode,F=d(t,_e),R=s(Object(p.useState)(e),2),M=R[0],U=R[1],N=s(Object(p.useState)(1===b.length?b[0]:""),2),z=N[0],D=N[1],V=s(Object(p.useState)(Ft(z)||""===z?L:_),2),$=V[0],W=V[1],G=Object(p.useRef)(e),X=Object(p.useRef)(null);Object(p.useEffect)((function(){Ft(z)?W(L):W(_)}),[z]),Object(p.useEffect)((function(){U(e),G.current=e,Array.isArray(e)&&e.length>0?D(e[0].type):(null===x||void 0===x?void 0:x.type)?D(x.type):D("")}),[e,null===x||void 0===x?void 0:x.type]);var B=Object(p.useRef)({onChange:n,selectionMode:$,maxPorts:g});return Object(p.useEffect)((function(){B.current={onChange:n,selectionMode:$,maxPorts:g}}),[n,$,g]),Object(p.useEffect)((function(){var t="".concat(E||"","::").concat(P||"");if((E||P)&&t!==X.current){var e=G.current,n=B.current,r=n.selectionMode,a=n.maxPorts,i=r===_&&"number"===typeof a&&a>1&&Array.isArray(e)&&e.length<a;if(!function(t){return!!t&&(Array.isArray(t)?t.length>0:Object.keys(t).length>0)}(e)||i)(function(){var e=l(o.a.mark((function e(){var n,r,a,i,u,l,s,d,f,p,m;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$t({autofillLocationAddress:E,autofillLocationCode:P,supportedLocationModes:b,customer:w,userCountryCode:I});case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(r=B.current,a=r.onChange,i=r.selectionMode,u=r.maxPorts,l=G.current,!(i===_&&"number"===typeof u&&u>1&&Array.isArray(l))){e.next=19;break}if(s=Et(n),d=new Set((l||[]).map((function(t){return xt((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue))}))),s&&!d.has(s)){e.next=13;break}return e.abrupt("return");case 13:f=Ct(l)||[],p=Array.isArray(f)?f.filter(Boolean):[],m=[].concat(c(p),[n]).slice(0,u),It(m,i,u,U,a),e.next=20;break;case 19:It(i===_?[n]:n,i,u,U,a);case 20:X.current=t,e.next=26;break;case 23:e.prev=23,e.t0=e.catch(0),console.error("Error performing autofill:",e.t0);case 26:case"end":return e.stop()}}),e,null,[[0,23]])})));return function(){return e.apply(this,arguments)}})()()}}),[E,P,b,w,I]),m.a.createElement(ke,Object.assign({mode:$,dataTestId:i,hasError:r,placeholder:m.a.createElement(h.TranslatableText,{style:{fontSize:v.tokens.fdsFontSizeBase},stringId:"Select ".concat(f?C:T)}),value:Ct(M),fetchOptions:jt(z,b,w),renderedOptions:function(t){return function(t,e){if((t||[]).some((function(t){var e;return(null===t||void 0===t||null===(e=t.options)||void 0===e?void 0:e.length)>0})))return t.map((function(t){var n,r=Object.values(k).find((function(e){return e.label===t.label})),o=null===r||void 0===r?void 0:r.icon;return m.a.createElement(v.Select.OptGroup,{label:m.a.createElement("span",{style:{fontFamily:"Open Sans"}},m.a.createElement(v.Icon,{size:"tiny",type:o}),"\xa0 \xa0",t.label),key:t.label,"data-test-id":"".concat(e,"-group-").concat(t.label)},null===(n=t.options)||void 0===n?void 0:n.map((function(n){var r=n.countryCode,a=n.selectedValue,i=n.displayLabel,c=n.type;return m.a.createElement(v.Option,{value:_t(n),title:a,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(a),style:{paddingLeft:"8px"},label:m.a.createElement(m.a.Fragment,null,m.a.createElement(v.Icon,{type:o,size:"tiny"}),"\xa0",m.a.createElement(ot,null,a)),key:n.code},m.a.createElement(Z,{fullWidth:!0,justifyContent:"space-between"},m.a.createElement(Z,{spacing:A.XSMALL},m.a.createElement("span",null,m.a.createElement(v.Avatar,{type:"flag",country:r,size:"small",style:{width:v.tokens.fdsSizeSm,height:v.tokens.fdsSizeSm}})),m.a.createElement(at,null,i)),c===S&&m.a.createElement(v.Icon,{type:"amazon",size:"small"}),c===O&&m.a.createElement(v.Chip,{type:"neutral",iconType:"address-book"})))})))}))}(t,i)},onChange:function(t){var e=null!==t&&void 0!==t?t:[],r=$===_&&Array.isArray(e)&&e.length>0?function(t,e){var n,r=new Map,o=j(Array.isArray(e)?e:[]);try{for(o.s();!(n=o.n()).done;){var a,i=n.value,c=At(i);c&&r.set(c,(null!==(a=r.get(c))&&void 0!==a?a:0)+1)}}catch(O){o.e(O)}finally{o.f()}var u,l=new Map,d=j(t);try{for(d.s();!(u=d.n()).done;){var f,p=u.value,m=At(p);m&&l.set(m,(null!==(f=l.get(m))&&void 0!==f?f:0)+1)}}catch(O){d.e(O)}finally{d.f()}var v,h=j(l);try{for(h.s();!(v=h.n()).done;){var y,g=s(v.value,2),b=g[0],w=g[1],S=null!==(y=r.get(b))&&void 0!==y?y:0;if(w>S&&S>0)return b}}catch(O){h.e(O)}finally{h.f()}return null}(e,M):null;null!==r?function(t,e,n,r){var o=(Array.isArray(e)?e:[]).filter((function(e){return At(e)!==t}));n(o),Pt(o,r)}(r,M,U,n):It(e,$,g,U,n),D("")},activeLocationMode:z,maxTagPlaceholder:function(t){return m.a.createElement(Le,{omittedPorts:t,dataTestId:i})},defaultLocation:x},F))}}])}));
|
|
151
2
|
//# sourceMappingURL=main.bundle.js.map
|