@freightos/fusion-location-input 2.2.0-fds → 3.0.0-7ce44782
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 +3 -1
- package/build/index.html +1 -1
- package/build/main.bundle.js +1 -2
- package/build/main.bundle.js.map +1 -1
- package/build/precache-manifest.bd943a4da10dda31f79e54ea09f73afc.js +10 -0
- package/build/service-worker.js +39 -0
- package/package.json +66 -66
- package/public/index.html +9 -9
- package/build/main.bundle.js.LICENSE.txt +0 -14
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
|
+
```
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.js": "/main.bundle.js",
|
|
4
|
+
"main.js.map": "/main.bundle.js.map",
|
|
4
5
|
"index.html": "/index.html",
|
|
5
|
-
"
|
|
6
|
+
"precache-manifest.bd943a4da10dda31f79e54ea09f73afc.js": "/precache-manifest.bd943a4da10dda31f79e54ea09f73afc.js",
|
|
7
|
+
"service-worker.js": "/service-worker.js"
|
|
6
8
|
},
|
|
7
9
|
"entrypoints": [
|
|
8
10
|
"main.bundle.js"
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Fusion location input</title><script
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Fusion location input</title></head></html><script src="http://ship.freightos.local:8800/FusionLocationInput/main.bundle.js"></script>
|
package/build/main.bundle.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/*! For license information please see main.bundle.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("@freightos/design-system"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash"),require("react"),require("styled-components")):"function"===typeof define&&define.amd?define("FusionLocationInput",["@freightos/design-system","@freightos/freightos-i18n","@freightos/http-client","lodash","react","styled-components"],e):"object"===typeof exports?exports.FusionLocationInput=e(require("@freightos/design-system"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash"),require("react"),require("styled-components")):t.FusionLocationInput=e(t["@freightos/design-system"],t["@freightos/freightos-i18n"],t["@freightos/http-client"],t.lodash,t.react,t["styled-components"])}(self,(t,e,n,o,r,i)=>(()=>{"use strict";var a={2(t){t.exports=n},45(t,e,n){n.d(e,{A:()=>r});var o=n(587);function r(t,e){if(null==t)return{};var n,r,i=(0,o.A)(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},79(t,e,n){n.d(e,{Et:()=>f,LB:()=>v,Sd:()=>g,V5:()=>h,jl:()=>S,tk:()=>y});var o,r,i,a,s,l,c,d=n(528),u=n(186),p=n(694),m=n.n(p);const f=(0,p.createGlobalStyle)(o||(o=(0,d.A)(["\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"]))),h=m()(u.Select)(r||(r=(0,d.A)(["\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"])),u.tokens.fdsBorderRadiusXl,u.tokens.fdsColorPrimaryBlue,u.tokens.fdsColorPrimaryBlue,u.tokens.fdsColorPrimaryBlue10,u.tokens.fdsComponentSpacingXxs,u.tokens.fdsSizeMd,t=>{let{size:e}=t;return"large"===e?"\n\t\t\tmargin-top: ".concat(u.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"},u.tokens.fdsColorPrimaryBlue,u.tokens.fdsComponentSpacingXs,u.tokens.fdsSizeMd,u.tokens.fdsSizeMd,u.tokens.fdsColorPrimaryGray80,t=>{let{$hasError:e}=t;return e&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(u.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(u.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(u.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(u.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")}),y=m().span(i||(i=(0,d.A)(["\n\tfont-size: "," !important;\n"])),u.tokens.fdsFontSizeSm),g=m().div(a||(a=(0,d.A)(["\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"])),u.tokens.fdsFontSizeSm),S=m()(u.Menu)(s||(s=(0,d.A)(["\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"])),u.tokens.fdsBodyTextColorDisabled),v=m().div(l||(l=(0,d.A)(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),u.tokens.fdsFontSizeSm,u.tokens.fdsSizeSm,u.tokens.fdsHeadingsFontFamily);m()(u.Icon)(c||(c=(0,d.A)(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"])))},104(t,e,n){n.d(e,{z:()=>i});var o=n(751),r=n(916);const i=async t=>{await(0,o.p)({method:"put",url:"".concat(r.E2,"/backend/api.php"),options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:t}})}},123(t){var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(r){return!1}}()?Object.assign:function(t,r){for(var i,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))n.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var d=0;d<a.length;d++)o.call(i,a[d])&&(s[a[d]]=i[a[d]])}}return s}},147(t,e,n){n.d(e,{A:()=>p});var o=n(155),r=n(186),i=n(817),a=n(591),s=n(916),l=n(414),c=n(672),d=n(176),u=n(579);const p=t=>{var e,n,p;let{search:m,index:f,dataTestId:h}=t;const y=m.platform_type,g=(0,c.Yy)(m),{units:S,volume:v,weight:T,weightUnit:E,volumeUnit:A}=(0,o.useMemo)(()=>(0,c.VH)(m),[m]),O=1===m.commodity.length&&m.commodity[0].is_temperature,L=null!==(e=m.commodity_temperature)&&void 0!==e&&e.tempRange&&O?s.FW[null===(n=m.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(p=m.commodity_temperature)||void 0===p?void 0:p.temperatureSystem]:"";return(0,u.jsx)(i.A,{spacing:a.o.XSMALL,alignItems:"center",fullWidth:!0,children:y===s.MM.QUOTATION?(0,u.jsxs)(l.XY,{alignItems:"center",spacing:a.o.SMALL,style:{flex:1},children:[g.map((t,e)=>(0,u.jsx)(l.q7,{type:t,size:"tiny","data-test-id":"".concat(h,"rs-package-icon-").concat(f,"-").concat(e)},"".concat(f,"-").concat(e))),(0,u.jsx)(d.A,{text:m.commodity.map(t=>t.label).join(", "),testId:"".concat(h,"rs-commodity-").concat(f)})]}):(0,u.jsxs)(l.XY,{alignItems:"center",spacing:a.o.SMALL,children:[(0,u.jsxs)(i.A,{alignItems:"center",spacing:a.o.XSMALL,"data-test-id":"rs-".concat(f,"-units"),children:[S,"\xa0",g.map((t,e)=>(0,u.jsx)(l.q7,{type:t,size:"tiny","data-test-id":"".concat(h,"rs-package-icon-").concat(f,"-").concat(e)},"".concat(f,"-").concat(e)))]}),(0,u.jsxs)("span",{"data-test-id":"".concat(h,"rs-volume-").concat(f),children:[v,"\xa0",A]}),T&&(0,u.jsxs)("span",{"data-test-id":"".concat(h,"rs-weight-").concat(f),children:[T,"\xa0",E]}),(0,u.jsx)(d.A,{text:m.commodity.map(t=>t.label).join(", "),testId:"".concat(h,"rs-commodity-").concat(f)}),O&&(0,u.jsxs)(i.A,{alignItems:"center",spacing:a.o.XSMALL,"data-test-id":"".concat(h,"rs-temperature-").concat(f),children:[(0,u.jsx)(r.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(h,"rs-temperature-icon-").concat(f)}),(0,u.jsx)("span",{style:{whiteSpace:"nowrap"},children:L})]})]})},f)}},153(t,e,n){n(123);var o=n(155),r=60103;if(e.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var i=Symbol.for;r=i("react.element"),e.Fragment=i("react.fragment")}var a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var o,i={},c=null,d=null;for(o in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(d=e.ref),e)s.call(e,o)&&!l.hasOwnProperty(o)&&(i[o]=e[o]);if(t&&t.defaultProps)for(o in e=t.defaultProps)void 0===i[o]&&(i[o]=e[o]);return{$$typeof:r,type:t,key:c,ref:d,props:i,_owner:a.current}}e.jsx=c,e.jsxs=c},155(t){t.exports=r},176(t,e,n){n.d(e,{A:()=>s});var o=n(155),r=n(186),i=n(414),a=n(579);const s=t=>{let{text:e="",testId:n,isPort:s,isLocationLabel:l=!1,children:c=null}=t;const d=(0,o.useRef)(null),[u,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{(()=>{if(d.current){const t=d.current,e=t.scrollWidth>t.clientWidth;p(e)}})()},[e]);const m=(0,a.jsx)(i.CJ,{ref:d,"data-test-id":n,$isLocationLabel:l,$isPort:s,children:c||e});return u?(0,a.jsx)(r.Tooltip,{title:e,"data-test-id":"".concat(n,"-tooltip"),children:(0,a.jsx)(i.CJ,{ref:d,"data-test-id":n,$isLocationLabel:l,$isPort:s,children:c||e})}):m}},186(e){e.exports=t},198(t){t.exports=e},284(t,e,n){function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}n.d(e,{A:()=>o})},302(t,e,n){n.d(e,{A:()=>a});n(155);var o=n(186),r=n(79),i=n(579);const a=t=>{let{omittedPorts:e,dataTestId:n}=t;const a=e.map(t=>{var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue});return(0,i.jsx)(o.Tooltip,{title:a.join(","),children:(0,i.jsx)(r.tk,{"data-test-id":"".concat(n,"-extra-ports"),children:"+".concat(e.length)})})}},324(t,e,n){n.d(e,{$C:()=>s,DS:()=>c,GB:()=>l,Ot:()=>o,Xf:()=>r,au:()=>i,nE:()=>a});const o="",r={AIRPORT:"airport",SEAPORT:"seaport",FULFILLMENT_CENTER:"fulfillment_center",ADDRESS_BOOK:"address_book",LAST_MILE_ADDRESS:"last_mile_address",ADDRESS:"address"},i={[r.AIRPORT]:{label:"Airports",key:r.AIRPORT,icon:"mode-air"},[r.SEAPORT]:{label:"Ports",key:r.SEAPORT,icon:"mode-ship"},[r.FULFILLMENT_CENTER]:{label:"Fulfillment centers",key:r.FULFILLMENT_CENTER,icon:"fulfillment-center"},[r.ADDRESS_BOOK]:{key:r.ADDRESS_BOOK,groupedBy:"address"},[r.LAST_MILE_ADDRESS]:{key:r.LAST_MILE_ADDRESS,groupedBy:"address"},[r.ADDRESS]:{label:"Address",key:r.ADDRESS,icon:"location"}},a={SINGLE:"single",MULTIPLE:"multiple"},s={ORIGIN:"origin",DESTINATION:"destination"},l=3,c=2},327(t,e,n){n.d(e,{A:()=>r});var o=n(284);function r(t,e){if("object"!=(0,o.A)(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=(0,o.A)(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}},379(t,e,n){n.d(e,{A:()=>i});var o=n(467);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach(function(e){(0,o.A)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}},403(t,e,n){n.d(e,{A:()=>l});n(155);var o=n(186),r=n(198),i=n(79),a=n(519),s=n(579);const l=t=>{let{isLoading:e,recentSearches:n,searchKey:l,dataTestId:c,setIsOpen:d,onRecentSearchSelect:u,initialValues:p}=t;return l||n&&0!==n.length?e?(0,s.jsx)(o.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!l.trim()?(0,s.jsx)(a.A,{recentSearches:n,dataTestId:c,setIsOpen:d,onRecentSearchSelect:u,initialValues:p}):l.trim()?(0,s.jsx)(i.LB,{children:(0,s.jsx)(r.TranslatableText,{stringId:"No matching results",module:r.TRANSLATION_MODULES.SearchAndBook})}):null:null}},414(t,e,n){n.d(e,{CJ:()=>S,H4:()=>v,XY:()=>T,li:()=>E,q7:()=>g,sj:()=>y,uS:()=>h});var o,r,i,a,s,l,c,d=n(528),u=n(186),p=n(694),m=n.n(p),f=n(817);const h=m().div(o||(o=(0,d.A)(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),u.tokens.fdsColorPrimaryGray60,u.tokens.fdsSizeXs,u.tokens.fdsFontWeightRegular,u.tokens.fdsComponentSpacingSm,u.tokens.fdsComponentSpacingSm),y=m()(f.A)(r||(r=(0,d.A)(["\n\tpadding-left: 0 !important;\n"]))),g=m()(u.Icon)(i||(i=(0,d.A)(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),S=m().span(a||(a=(0,d.A)(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),u.tokens.fdsColorPrimaryGray80,t=>{let{$isLocationLabel:e}=t;return!e&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"},t=>{let{$isPort:e}=t;if(void 0!==e)return"min-width: ".concat(e?"65px":"55px",";")}),v=m()(u.Avatar)(s||(s=(0,d.A)(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),u.tokens.fdsColorPrimaryGray20,u.tokens.fdsSizeSm,u.tokens.fdsSizeSm),T=m()(f.A)(l||(l=(0,d.A)(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),E=m()(f.A)(c||(c=(0,d.A)(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"])))},467(t,e,n){n.d(e,{A:()=>r});var o=n(922);function r(t,e,n){return(e=(0,o.A)(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},519(t,e,n){n.d(e,{A:()=>u});n(155);var o=n(186),r=n(198),i=n(591),a=n(79),s=n(757),l=n(598),c=n(414),d=n(579);const u=t=>{let{recentSearches:e,setIsOpen:n,dataTestId:u,onRecentSearchSelect:p,initialValues:m}=t;const f=e?(0,s.CK)(e):[];return(0,d.jsxs)(a.jl,{children:[(0,d.jsxs)(c.uS,{children:[(0,d.jsx)(o.Icon,{"data-test-id":"".concat(u,"rs-icon"),color:o.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),(0,d.jsx)(r.TranslatableText,{stringId:"Recent searches"})]}),(0,d.jsx)(c.li,{direction:i.I.VERTICAL,fullWidth:!0,children:f.map((t,e)=>(0,d.jsx)(l.Z,{onRecentSearchSelect:p,initialValues:m,search:t,index:e,setIsOpen:n,dataTestId:u},t.id))})]})}},528(t,e,n){function o(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}n.d(e,{A:()=>o})},579(t,e,n){t.exports=n(153)},587(t,e,n){function o(t,e){if(null==t)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o]}return n}n.d(e,{A:()=>o})},591(t,e,n){n.d(e,{I:()=>i,o:()=>r});var o=n(186);const r={XXLARGE:o.tokens.fdsComponentSpacingXxl,XLARGE:o.tokens.fdsComponentSpacingXl,LARGE:o.tokens.fdsComponentSpacingLg,MEDIUM:o.tokens.fdsComponentSpacingMd,SMALL:o.tokens.fdsComponentSpacingSm,XSMALL:o.tokens.fdsComponentSpacingXs,XXSMALL:o.tokens.fdsComponentSpacingXxs,NONE:0},i={VERTICAL:"vertical",HORIZONTAL:"horizontal"}},595(t,e,n){n.d(e,{MN:()=>E,Sn:()=>b,dK:()=>w,hy:()=>h,jj:()=>A,mG:()=>L,nq:()=>j,vJ:()=>T,zU:()=>y});var o=n(45),r=n(379),i=(n(155),n(186)),a=n(198),s=n(817),l=n(591),c=n(961),d=n(324),u=n(79),p=n(579);const m=["address"],f=t=>(t||"").trim().toUpperCase(),h=t=>{const e=(t=>{try{return"string"===typeof t?JSON.parse(t):null}catch(e){return null}})(null===t||void 0===t?void 0:t.key);return f((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},y=t=>new Set((t||[]).map(t=>f((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue)))),g=t=>{const e=[];JSON.stringify(t,(t,n)=>(e.push(t),n));const n=Array.from(new Set(e)).sort();return JSON.stringify(t,n)},S=t=>{const{displayLabel:e,selectedValue:n,formattedNameOrAddress:o,code:r,countryCode:i,stateOrProvince:a,city:s,latitude:l,longitude:c,postalOrZipCode:d,sourceType:u,locationType:p,type:m,countryName:f}=t||{};return{displayLabel:e,selectedValue:n||r,formattedNameOrAddress:o,code:r||n,country:i,countryName:f,stateOrProvince:null!==a&&void 0!==a?a:null,city:null!==s&&void 0!==s?s:null,latitude:null!==l&&void 0!==l?l: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}},v=t=>{try{const e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(I(t.key)):t;return g(S(e))}catch(e){return g(S(t))}},T=t=>{const e=t=>(t=>{if(t){var e;const n=t.label||t.selectedValue;return{key:v(t),label:n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Icon,{type:t.sourceType?null===(e=d.au[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",(0,p.jsx)(u.tk,{children:n})]}):void 0}}})(t);return Array.isArray(t)?t.map(e):e(t)},E=(t,e)=>{if((t||[]).some(t=>{var e;return(null===t||void 0===t||null===(e=t.options)||void 0===e?void 0:e.length)>0}))return t.map(t=>{var n;const o=Object.values(d.au).find(e=>e.label===t.label),r=null===o||void 0===o?void 0:o.icon;return(0,p.jsx)(i.Select.OptGroup,{label:(0,p.jsxs)("span",{style:{fontFamily:"Open Sans"},children:[(0,p.jsx)(i.Icon,{size:"tiny",type:r}),"\xa0 \xa0",t.label]}),"data-test-id":"".concat(e,"-group-").concat(t.label),children:null===(n=t.options)||void 0===n?void 0:n.map(n=>{const{countryCode:o,selectedValue:a,displayLabel:c,type:m}=n;return(0,p.jsx)(i.Option,{value:v(n),title:a,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(a),style:{paddingLeft:"8px"},label:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Icon,{type:r,size:"tiny"}),"\xa0",(0,p.jsx)(u.tk,{children:a})]}),children:(0,p.jsxs)(s.A,{fullWidth:!0,justifyContent:"space-between",children:[(0,p.jsxs)(s.A,{spacing:l.o.XSMALL,children:[(0,p.jsx)("span",{children:(0,p.jsx)(i.Avatar,{type:"flag",country:o,size:"small",style:{width:i.tokens.fdsSizeSm,height:i.tokens.fdsSizeSm}})}),(0,p.jsx)(u.Sd,{children:c})]}),m===d.Xf.FULFILLMENT_CENTER&&(0,p.jsx)(i.Icon,{type:"amazon",size:"small"}),m===d.Xf.ADDRESS_BOOK&&(0,p.jsx)(i.Chip,{type:"neutral",iconType:"address-book"})]})},n.code)})},t.label)})},A=(t,e,n)=>async i=>{if(!i)return[];const a=t!==d.Ot?[t]:e;let s=(await(0,c.V)(a,i,n)).results;return s[d.Xf.ADDRESS]&&(s=(t=>{let e=(0,r.A)({},t);const n=t[d.Xf.ADDRESS].filter(t=>t.sourceType===d.Xf.FULFILLMENT_CENTER);if(n.length>0){const{address:t}=e,i=(0,o.A)(e,m);e=(0,r.A)((0,r.A)({},i),{},{[d.Xf.FULFILLMENT_CENTER]:n,address:t.filter(t=>t.type!==d.Xf.FULFILLMENT_CENTER)})}return e})(s)),Object.keys(s).map(t=>{var e;return{label:(null===(e=d.au[t])||void 0===e?void 0:e.label)||t,options:s[t].map(t=>(0,r.A)((0,r.A)({},t),{},{type:t.sourceType}))}})},O=async(t,e)=>{const n=Array.isArray(t)?t:[t];e((await Promise.all(n.map(async t=>{try{const e=null===t||void 0===t?void 0:t.key,n=I(e),o=JSON.parse(n);return(0,r.A)({key:n},o)}catch(e){return}}))).filter(Boolean))},L=(t,e,n,o,r)=>{if(e===d.nE.MULTIPLE){const e=Array.isArray(t)?t:[];if(e.length<=n)o(e),O(e,r);else{var s,l;const t=(null===(s=JSON.parse(null===(l=e[0])||void 0===l?void 0:l.key))||void 0===s?void 0:s.sourceType)===d.Xf.AIRPORT?n>1?"airports":"airport":n>1?"ports":"port";i.Message.danger((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",(0,p.jsx)(a.TranslatableText,{stringId:t})]}))}}else o(t),O(t,r)},b=t=>t&&(t===d.Xf.ADDRESS||t===d.Xf.LAST_MILE_ADDRESS||t===d.Xf.ADDRESS_BOOK||t===d.Xf.FULFILLMENT_CENTER),I=t=>"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t,_=/^[^-]*-\s*(.+?),/,C=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=(t,e)=>[...t[d.Xf.ADDRESS]||[],...t[d.Xf.FULFILLMENT_CENTER]||[]].filter(t=>((t,e)=>{if(!t.displayLabel)return!1;const n=t.displayLabel.match(_);if(null===n||void 0===n||!n[1])return!1;const o=n[1].trim(),r=e.trim().split(/\s+/).map(C);return new RegExp("\\b".concat(r.join("\\s+"),"\\b"),"i").test(o)})(t,e)),j=t=>!!t&&(Array.isArray(t)?t.length>0:Object.keys(t).length>0),w=async t=>{let{autofillLocationAddress:e,autofillLocationCode:n,supportedLocationModes:o,customer:i,userCountryCode:a}=t;if(!e&&!n)return null;let s=null;if(e){const{results:t={}}=await(0,c.V)(o,e,i);s=((t,e)=>0===t.length?null:1!==t.length&&e&&t.find(t=>{var n;return(null===(n=t.countryCode)||void 0===n?void 0:n.toLowerCase())===e.toLowerCase()})||t[0])(x(t,e),a)}if(!s&&n){const{results:t={}}=await(0,c.V)(o,n,i);s=((t,e)=>{const n=t[d.Xf.AIRPORT]||[],o=t[d.Xf.SEAPORT]||[],r=f(e);return[...n,...o].find(t=>f(null===t||void 0===t?void 0:t.code)===r)})(t,n)}return s?(t=>{const e=t.selectedValue||t.displayLabel||t.code,n=(0,r.A)((0,r.A)({},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}})(s):null}},598(t,e,n){n.d(e,{Z:()=>d});n(155);var o=n(186),r=n(591),i=n(104),a=n(414),s=n(663),l=n(147),c=n(579);const d=t=>{let{search:e,index:n,setIsOpen:d,dataTestId:u,onRecentSearchSelect:p}=t;return(0,c.jsxs)(a.sj,{direction:r.I.VERTICAL,fullWidth:!0,spacing:r.o.XSMALL,style:{padding:o.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(u,"rs-card-").concat(n),onClick:()=>{(async()=>{p(e);try{await(0,i.z)(e.id)}catch(t){console.error(t)}d(!1)})()},children:[(0,c.jsx)(s.A,{search:e,index:n,dataTestId:u}),(0,c.jsx)(l.A,{search:e,index:n,dataTestId:u})]},e.id)}},603(t,e,n){n.d(e,{D:()=>u});var o,r,i,a,s=n(528),l=n(694),c=n.n(l),d=n(591);const u=c().div(o||(o=(0,s.A)(["\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"])),t=>{let{$direction:e}=t;return e===d.I.VERTICAL?"column":"row"},t=>{let{$wrap:e}=t;return e?"wrap":"nowrap"},t=>{let{$alignItems:e}=t;return e},t=>{let{$justifyContent:e}=t;return e},t=>{let{$fullWidth:e}=t;return e&&(0,l.css)(r||(r=(0,s.A)(["\n\t\t\twidth: 100%;\n\t\t"])))},t=>{let{$direction:e,$spacing:n}=t;return e===d.I.VERTICAL?(0,l.css)(i||(i=(0,s.A)(["\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):(0,l.css)(a||(a=(0,s.A)(["\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)})},663(t,e,n){n.d(e,{A:()=>u});n(155);var o=n(186),r=n(817),i=n(591),a=n(414),s=n(672),l=n(176),c=n(324),d=n(579);const u=t=>{let{search:e,index:n,dataTestId:u}=t;const p=e.origin.length>1,m=e.destination.length>1,f=p?(0,s.Kh)(e.origin):{[e.origin[0].country]:e.origin},h=m?(0,s.Kh)(e.destination):{[e.destination[0].country]:e.destination};return(0,d.jsxs)(r.A,{alignItems:"center",spacing:i.o.XSMALL,fullWidth:!0,children:[Object.keys(f).map(t=>{const e=f[t].map(t=>t.selectedValue).join(", ");return(0,d.jsxs)(l.A,{text:e,isLocationLabel:!0,testId:"".concat(u,"-origin-").concat(n),isPort:f[t][0].type===c.Xf.SEAPORT,children:[(0,d.jsx)(a.H4,{type:"flag",country:t,size:"small","data-test-id":"".concat(u,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e]},t)}),(0,d.jsx)(o.Icon,{type:"arrow-forward",style:{marginRight:0,color:o.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(h).map(t=>{const e=h[t].map(t=>t.selectedValue).join(", ");return(0,d.jsxs)(l.A,{text:e,isLocationLabel:!0,testId:"".concat(u,"-destination-").concat(n),isPort:h[t][0].type===c.Xf.SEAPORT,children:[(0,d.jsx)(a.H4,{type:"flag",country:t,size:"small","data-test-id":"".concat(u,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e]},t)})]})}},672(t,e,n){n.d(e,{Kh:()=>i,VH:()=>s,Yy:()=>a});var o=n(916);const r=t=>t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",i=t=>{const e=t.reduce((t,e)=>{const n=e.country;return t[n]||(t[n]=[]),t[n].push(e),t},{});return Object.keys(e).forEach(t=>{e[t].sort((t,e)=>t.selectedValue.localeCompare(e.selectedValue))}),e},a=t=>{const e=t.shipment_details.type;if(e===o.E4.TOTALS)return["box-total"];if(e===o.E4.UNITS){const e=t.shipment_details[o.jM.UNITS_SHIPMENT];if((null===e||void 0===e?void 0:e.packageType)===o.iE.BOX){return e.boxPackages.reduce((t,e)=>{var n,o;const r=null===(n=e.type)||void 0===n||null===(o=n.value)||void 0===o?void 0:o.icon;return t.includes(r)||t.push(r),t},[])}return(null===e||void 0===e?void 0:e.packageType)===o.iE.ULD?["uld"]:["box"]}return e===o.E4.CONTAINER?["container"]:["box"]},s=t=>{const e=t.shipment_details.type;if(t.platform_type===o.MM.QUOTATION)return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM};switch(e){case o.E4.CONTAINER:{var n;let e=0,r=0;return null===(n=t.shipment_details[o.jM.CONTAINER_PACKAGES])||void 0===n||n.forEach(t=>{const n=Number(t.units)||0;if(n>0){e+=n;const i=parseInt(t.dimensions.value,10);r+=n*(i/o.PR)}}),{units:e,volume:r,weight:null,weightUnit:null,volumeUnit:"TEU"}}case o.E4.UNITS:{const e=t.shipment_details[o.jM.UNITS_SHIPMENT],n=(null===e||void 0===e?void 0:e.volumeUnit)===o.Q4.CFT?o.vP:o.g1;if((null===e||void 0===e?void 0:e.packageType)===o.iE.BOX){const t=r(null===e||void 0===e?void 0:e.boxPackages.reduce((t,e)=>t+parseFloat(e.width||"0")*parseFloat(e.height||"0")*parseFloat(e.length||"0")*parseFloat(e.units||"0")/n,0)),o=r(e.boxPackages.reduce((t,e)=>t+parseFloat(e.weight||"0"),0));return{units:e.boxPackages.reduce((t,e)=>t+parseFloat(e.units||"0"),0),volume:t,weight:o,weightUnit:e.weightUnit,volumeUnit:e.volumeUnit}}if((null===e||void 0===e?void 0:e.packageType)===o.iE.ULD){const t=r(e.uldPackages.reduce((t,e)=>t+parseFloat(e.volume||"0"),0)),n=r(e.uldPackages.reduce((t,e)=>t+parseFloat(e.weight||"0"),0));return{units:e.uldPackages.length,volume:t,weight:n,weightUnit:e.weightUnit,volumeUnit:e.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM}}case o.E4.TOTALS:{var i,a,s,l,c;const e=r(parseFloat((null===(i=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===i?void 0:i.volume)||"0")),n=r(parseFloat((null===(a=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===a?void 0:a.weight)||"0"));return{units:(null===(s=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===s?void 0:s.units)||0,volume:e,weight:n,weightUnit:(null===(l=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===l?void 0:l.weightUnit)||o.YB.KG,volumeUnit:(null===(c=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===c?void 0:c.volumeUnit)||o.Q4.CBM}}default:return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM}}}},694(t){t.exports=i},751(t,e,n){n.d(e,{p:()=>a});var o=n(379),r=n(2),i=n.n(r);const a=async t=>{let{method:e,url:n="",data:r={},options:a={}}=t;const s=(()=>{if("get"===e){return[Object.keys(r).length?"".concat(n,"?").concat(new URLSearchParams(r).toString()):n,a]}if("post"===e){const t=(0,o.A)((0,o.A)({},null===a||void 0===a?void 0:a.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[n,r,(0,o.A)((0,o.A)({},a),{},{headers:t})]}return[n,r,a]})();return await i()[e](...s)}},757(t,e,n){n.d(e,{CK:()=>r});var o=n(916);const r=t=>[...t].sort((t,e)=>{const n=new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date).getTime()));return new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date).getTime())).getTime()-n.getTime()}).slice(0,o.Dy)},773(t){t.exports=o},817(t,e,n){n.d(e,{A:()=>c});var o=n(379),r=n(45),i=(n(155),n(591)),a=n(603),s=n(579);const l=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],c=t=>{let{direction:e=i.I.HORIZONTAL,alignItems:n="start",spacing:c=i.o.NONE,wrap:d,justifyContent:u,fullWidth:p}=t,m=(0,r.A)(t,l);return(0,s.jsx)(a.D,(0,o.A)((0,o.A)({},m),{},{$direction:e,$alignItems:n,$spacing:c,$wrap:d,$justifyContent:u,$fullWidth:p,children:m.children}))}},866(t,e,n){n.d(e,{A:()=>f});var o=n(379),r=n(45),i=n(155),a=n(186),s=n(773),l=n(324),c=n(79),d=n(403),u=n(927),p=n(579);const m=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],f=t=>{let{fetchOptions:e,renderedOptions:n,recentSearches:f=[],hasError:h,mode:y,dataTestId:g,value:S,debounceTimeout:v=800,activeLocationMode:T,defaultLocation:E,onChange:A}=t,O=(0,r.A)(t,m);const[L,b]=(0,i.useState)([]),[I,_]=(0,i.useState)(!1),[C,x]=(0,i.useState)(""),j=(0,i.useRef)(0),[w,P]=(0,i.useState)(!1),[N,R]=(0,i.useState)(l.GB),k=(0,i.useRef)();(0,i.useEffect)(()=>{S&&0!==S.length||w||(b([]),x(""))},[S,w]),(0,i.useEffect)(()=>(T!==l.Ot&&b(t=>t.filter(t=>t.label===l.au[T].label)),P(!1),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{document.activeElement.blur(),document.body.click();const t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused"),R(l.GB)},100),()=>{k.current&&clearTimeout(k.current)}),[T]);const M=(0,i.useMemo)(()=>(0,s.debounce)(async t=>{x(t),j.current+=1;const n=j.current;b([]),_(!0);let o=null;try{const r=await e(t);n===j.current&&(b(r),o=r)}catch(r){console.error("Error fetching options:",r),n===j.current&&a.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."})}finally{if(n===j.current)return _(!1),o}},v),[e,v]);(0,i.useEffect)(()=>{if(null===E||void 0===E||!E.code)return;(async()=>{try{b([]),_(!0);const t=await e(E.code);if(b(t),!t||0===t.length)return;let n=null;if(E.type){const e=t.find(t=>{var e;return t.label.toLowerCase()===(null===(e=l.au[E.type])||void 0===e?void 0:e.label.toLowerCase())});null!==e&&void 0!==e&&e.options&&(n=e.options.find(t=>t.code.toLowerCase()===E.code.toLowerCase()||t.selectedValue.toLowerCase()===E.code.toLowerCase()))}if(n||(n=t.map(t=>t.options).flat().find(t=>t.code.toLowerCase()===E.code.toLowerCase()||t.selectedValue.toLowerCase()===E.code.toLowerCase())),n&&A){const t={key:JSON.stringify(n),label:n.selectedValue||n.displayLabel||n.code};A([t])}}catch(t){u.A.isLocal()&&console.error("Error loading default location:",t)}finally{_(!1)}})()},[null===E||void 0===E?void 0:E.code,null===E||void 0===E?void 0:E.type]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.Et,{}),(0,p.jsx)(c.V5,(0,o.A)((0,o.A)({maxTagCount:N,onSearch:M,$hasError:h,loading:I,options:L,filterOption:!1,notFoundContent:(0,p.jsx)(d.A,{isLoading:I,recentSearches:f,searchKey:C,dataTestId:g,setIsOpen:P,onRecentSearchSelect:O.onRecentSearchSelect,initialValues:O.initialValues}),mode:y,"data-test-id":"".concat(g,"-selector"),allowClear:y===l.nE.SINGLE,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:t=>{R(t?l.DS:l.GB),b([]),x(""),P(t)},open:w&&(I||C.trim()||(null===f||void 0===f?void 0:f.length)>0),value:S,onChange:A},O),{},{children:n(L)}))]})}},916(t,e,n){n.d(e,{Dy:()=>T,E2:()=>o,E4:()=>f,FW:()=>u,MM:()=>p,PR:()=>m,Q4:()=>g,YB:()=>S,g1:()=>y,iE:()=>v,jM:()=>r,vP:()=>h});const o="/webcargo-alpha",r={ORIGIN:"origin",DESTINATION:"destination",TOTALS_SHIPMENT:"totalShipment",UNITS_SHIPMENT:"unitsShipment",CONTAINER_SHIPMENT:"containerShipment",COMMODITY:"commodity",SHIPMENT_TYPE:"shipmentType",UNITS:"units",VOLUME:"volume",VOLUME_UNIT:"volumeUnit",WEIGHT:"weight",WEIGHT_UNIT:"weightUnit",TURNABLE:"turnable",STACKABLE:"stackable",DEFINE_EACH_UNIT_DIMENSIONS:"defineEachUnitDimensions",DEFINE_EACH_UNIT_WEIGHT:"defineEachUnitWeight",UNIT_DIMENSIONS:"unitDimensions",UNIT_WEIGHTS:"unitWeights",LENGTH:"length",HEIGHT:"height",WIDTH:"width",TYPE:"type",DIMENSION_UNIT:"dimensionUnit",BOX_PACKAGES:"boxPackages",ULD_PACKAGES:"uldPackages",PACKAGE_TYPE:"packageType",TOTAL_WEIGHT:"totalWeight",CONTAINER_PACKAGES:"containerPackages",DIMENSIONS:"dimensions",FULLFILLMENT_DETAILS:"fullfillmentDetails",IS_FULLFILLMENT:"isFullfillment",COMMODITY_TEMPERATURE:"commodityTemperature",BATTERY_HS_CODE:"batteryHsCode",SUPPORTED_FREIGHT_TYPES:"supportedFreightTypes"},i="celsius",a="fahrenheit",s="FRO",l="COL",c="ERT",d="CRT",u={[s]:{[i]:"-10\xbaC or below",[a]:"14\xbaF or below"},[l]:{[i]:"From +2\xbaC To +8\xbaC",[a]:"From 35.6\xbaF To 46.4\xbaF"},[c]:{[i]:"From +2\xbaC To +25\xbaC",[a]:"From 35.6\xbaF To 77\xbaF"},[d]:{[i]:"From +15\xbaC To +25\xbaC",[a]:"From 59\xbaF To 77\xbaF"}},p={BOOKING:"booking",QUOTATION:"quotation",BI:"bi"},m=20,f={UNITS:"units",TOTALS:"totals",CONTAINER:"container"},h=1728,y=1e6,g={CBM:"CBM",CFT:"CFT"},S={KG:"kg",LB:"lb"},v={BOX:"box",ULD:"uld"},T=6},922(t,e,n){n.d(e,{A:()=>i});var o=n(284),r=n(327);function i(t){var e=(0,r.A)(t,"string");return"symbol"==(0,o.A)(e)?e:e+""}},927(t,e,n){n.d(e,{A:()=>o});class o{static isProduction(){return"prod"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}static isTest(){return"test"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}static isLocal(){return"dev"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}}},961(t,e,n){n.d(e,{V:()=>s});var o=n(379),r=n(2),i=n.n(r),a=n(324);const s=async(t,e,n)=>{try{const r=t.reduce((t,e)=>(0,o.A)((0,o.A)({},t),{},{[a.au[e].key]:(0,o.A)((0,o.A)({type:e.toUpperCase()},null!==n&&void 0!==n&&n.code?{searchTerm:n.name}:{}),a.au[e].groupedBy?{groupedBy:a.au[e].groupedBy}:{})}),{});return(await i().post("/geocoder/api/v3/geocoder/locations",{query:e,limit:5,sources:r})).data}catch(r){return console.error("Error fetching locations:",r),{results:{}}}}}},s={};function l(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return a[t](n,n.exports,l),n.exports}l.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return l.d(e,{a:e}),e},l.d=(t,e)=>{for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var c={};l.r(c),l.d(c,{default:()=>E});var d=l(379),u=l(45),p=l(155),m=l(186),f=l(198),h=l(866),y=l(302),g=l(324),S=l(595),v=l(579);const T=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation","autofillLocationAddress","autofillLocationCode","userCountryCode"],E=t=>{let{value:e,onChange:n,hasError:o,dataTestId:r="location-input",isOriginLocation:i=!0,maxPorts:a=1,supportedLocationModes:s,customer:l,defaultLocation:c,autofillLocationAddress:E,autofillLocationCode:A,userCountryCode:O}=t,L=(0,u.A)(t,T);const[b,I]=(0,p.useState)(e),[_,C]=(0,p.useState)(1===s.length?s[0]:g.Ot),[x,j]=(0,p.useState)((0,S.Sn)(_)||_===g.Ot?g.nE.SINGLE:g.nE.MULTIPLE),w=(0,p.useRef)(e),P=(0,p.useRef)(null);(0,p.useEffect)(()=>{(0,S.Sn)(_)?j(g.nE.SINGLE):j(g.nE.MULTIPLE)},[_]),(0,p.useEffect)(()=>{I(e),w.current=e,Array.isArray(e)&&e.length>0?C(e[0].type):null!==c&&void 0!==c&&c.type?C(c.type):C(g.Ot)},[e,null===c||void 0===c?void 0:c.type]);const N=(0,p.useRef)({onChange:n,selectionMode:x,maxPorts:a});return(0,p.useEffect)(()=>{N.current={onChange:n,selectionMode:x,maxPorts:a}},[n,x,a]),(0,p.useEffect)(()=>{const t="".concat(E||"","::").concat(A||"");if(!E&&!A)return;if(t===P.current)return;const e=w.current,{selectionMode:n,maxPorts:o}=N.current,r=n===g.nE.MULTIPLE&&"number"===typeof o&&o>1&&Array.isArray(e)&&e.length<o;if((0,S.nq)(e)&&!r)return;(async()=>{try{const e=await(0,S.dK)({autofillLocationAddress:E,autofillLocationCode:A,supportedLocationModes:s,customer:l,userCountryCode:O});if(!e)return;const{onChange:n,selectionMode:o,maxPorts:r}=N.current,i=w.current;if(o===g.nE.MULTIPLE&&"number"===typeof r&&r>1&&Array.isArray(i)){const t=(0,S.hy)(e),a=(0,S.zU)(i);if(!t||a.has(t))return;const s=(0,S.vJ)(i)||[],l=[...Array.isArray(s)?s.filter(Boolean):[],e].slice(0,r);(0,S.mG)(l,o,r,I,n)}else o===g.nE.MULTIPLE?(0,S.mG)([e],o,r,I,n):(0,S.mG)(e,o,r,I,n);P.current=t}catch(e){console.error("Error performing autofill:",e)}})()},[E,A,s,l,O]),(0,v.jsx)(h.A,(0,d.A)({mode:x,dataTestId:r,hasError:o,placeholder:(0,v.jsx)(f.TranslatableText,{style:{fontSize:m.tokens.fdsFontSizeBase},stringId:"Select ".concat(i?g.$C.ORIGIN:g.$C.DESTINATION)}),value:(0,S.vJ)(b),fetchOptions:(0,S.jj)(_,s,l),renderedOptions:t=>(0,S.MN)(t,r),onChange:t=>{(0,S.mG)(null!==t&&void 0!==t?t:[],x,a,I,n),C(g.Ot)},activeLocationMode:_,maxTagPlaceholder:t=>(0,v.jsx)(y.A,{omittedPorts:t,dataTestId:r}),defaultLocation:c},L))};return c})());
|
|
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(_){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),i=new E(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===u)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 l=s(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,i),a}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(_){return{type:"throw",arg:_}}}t.wrap=l;var u={};function d(){}function f(){}function p(){}var m={};c(m,o,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(x([])));v&&v!==e&&n.call(v,o)&&(m=v);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 l=s(t[o],t,a);if("throw"!==l.type){var u=l.arg,d=u.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){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.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 u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,u;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,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}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 E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function x(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(l(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=x,E.prototype={constructor:E,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"),l=n.call(a,"finallyLoc");if(c&&l){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(!l)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,u):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),u},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),u}},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:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},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";function r(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 o(t,e){if(t){if("string"===typeof t)return r(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)?r(t,e):void 0}}function a(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(l){o=!0,a=l}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,e)||o(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 i(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}n.r(e);var c=n(0),l=n.n(c),s=n(1),u=n(4),d=n(2),f=n.n(d);function p(t,e,n,r,o,a,i){try{var c=t[a](i),l=c.value}catch(s){return void n(s)}c.done?e(l):Promise.resolve(l).then(r,o)}function m(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(t){p(a,r,o,i,c,"next",t)}function c(t){p(a,r,o,i,c,"throw",t)}i(void 0)}))}}var h,v=n(6);function y(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var g="airport",b="seaport",w="fulfillment_center",S="address_book",O="last_mile_address",E="address",x=(y(h={},g,{label:"Airports",key:g,icon:"mode-air"}),y(h,b,{label:"Ports",key:b,icon:"mode-ship"}),y(h,w,{label:"Fulfillment centers",key:w,icon:"fulfillment-center"}),y(h,S,{key:S,groupedBy:"address"}),y(h,O,{key:O,groupedBy:"address"}),y(h,E,{label:"Address",key:E,icon:"location"}),h),k="single",_="multiple",L="origin",T="destination";function j(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var C,P,I,A,F,R,U,N,z,M,D,V,$=n(3),W=n.n($),G=Object($.createGlobalStyle)(C||(C=j(["\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"]))),X=W()(s.Select)(P||(P=j(["\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"])),s.tokens.fdsBorderRadiusXl,s.tokens.fdsColorPrimaryBlue,s.tokens.fdsColorPrimaryBlue,s.tokens.fdsColorPrimaryBlue10,s.tokens.fdsComponentSpacingXxs,s.tokens.fdsSizeMd,(function(t){return"large"===t.size?"\n\t\t\tmargin-top: ".concat(s.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"}),s.tokens.fdsColorPrimaryBlue,s.tokens.fdsComponentSpacingXs,s.tokens.fdsSizeMd,s.tokens.fdsSizeMd,s.tokens.fdsColorPrimaryGray80,(function(t){return t.$hasError&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(s.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(s.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(s.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(s.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")})),B=W.a.span(I||(I=j(["\n\tfont-size: "," !important;\n"])),s.tokens.fdsFontSizeSm),q=W.a.div(A||(A=j(["\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"])),s.tokens.fdsFontSizeSm),K=W()(s.Menu)(F||(F=j(["\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"])),s.tokens.fdsBodyTextColorDisabled),H=W.a.div(R||(R=j(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),s.tokens.fdsFontSizeSm,s.tokens.fdsSizeSm,s.tokens.fdsHeadingsFontFamily),J=(W()(s.Icon)(U||(U=j(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),{XXLARGE:s.tokens.fdsComponentSpacingXxl,XLARGE:s.tokens.fdsComponentSpacingXl,LARGE:s.tokens.fdsComponentSpacingLg,MEDIUM:s.tokens.fdsComponentSpacingMd,SMALL:s.tokens.fdsComponentSpacingSm,XSMALL:s.tokens.fdsComponentSpacingXs,XXSMALL:s.tokens.fdsComponentSpacingXxs,NONE:0}),Y="vertical",Z="horizontal";function Q(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||o(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.")}()}var tt,et,nt,rt,ot="totalShipment",at="unitsShipment",it="containerPackages",ct="celsius",lt="fahrenheit",st="COL",ut="ERT",dt="CRT",ft=(y(V={},"FRO",(y(N={},ct,"-10\xbaC or below"),y(N,lt,"14\xbaF or below"),N)),y(V,st,(y(z={},ct,"From +2\xbaC To +8\xbaC"),y(z,lt,"From 35.6\xbaF To 46.4\xbaF"),z)),y(V,ut,(y(M={},ct,"From +2\xbaC To +25\xbaC"),y(M,lt,"From 35.6\xbaF To 77\xbaF"),M)),y(V,dt,(y(D={},ct,"From +15\xbaC To +25\xbaC"),y(D,lt,"From 59\xbaF To 77\xbaF"),D)),V),pt="quotation",mt="units",ht="totals",vt="container",yt="CBM",gt="CFT",bt="kg",wt="box",St="uld";function Ot(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 Et(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ot(Object(n),!0).forEach((function(e){y(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ot(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var xt=W.a.div(tt||(tt=j(["\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===Y?"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($.css)(et||(et=j(["\n\t\t\twidth: 100%;\n\t\t"])))}),(function(t){var e=t.$direction,n=t.$spacing;return e===Y?Object($.css)(nt||(nt=j(["\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($.css)(rt||(rt=j(["\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)})),kt=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],_t=function(t){var e=t.direction,n=void 0===e?Z:e,r=t.alignItems,o=void 0===r?"start":r,a=t.spacing,c=void 0===a?J.NONE:a,s=t.wrap,u=t.justifyContent,d=t.fullWidth,f=i(t,kt);return l.a.createElement(xt,Object.assign({},f,{$direction:n,$alignItems:o,$spacing:c,$wrap:s,$justifyContent:u,$fullWidth:d}),f.children)},Lt=n(5),Tt=n.n(Lt),jt=function(){var t=m(f.a.mark((function t(e,n,r){var o,a;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=e.reduce((function(t,e){return Et(Et({},t),{},y({},x[e].key,Et(Et({type:e.toUpperCase()},(null===r||void 0===r?void 0:r.code)?{searchTerm:r.name}:{}),x[e].groupedBy?{groupedBy:x[e].groupedBy}:{})))}),{}),t.next=4,Tt.a.post("/geocoder/api/v3/geocoder/locations",{query:n,limit:5,sources:o});case 4:return a=t.sent,t.abrupt("return",a.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)}}();function Ct(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 Pt,It,At,Ft,Rt,Ut,Nt,zt=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)&&Ct(e.prototype,n),r&&Ct(e,r),t}(),Mt=["address"],Dt=function(t){var e=zt.isProduction()?"freightos.com":"test-freightos.com";return"https://platform.".concat(e,"/gateway/").concat(t?"webcargo-talaia":"webcargo-alpha")},Vt=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)},$t=function(t){var e=t||{},n=e.displayLabel,r=e.selectedValue,o=e.formattedNameOrAddress,a=e.code,i=e.countryCode,c=e.stateOrProvince,l=e.city,s=e.latitude,u=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!==l&&void 0!==l?l:null,latitude:null!==s&&void 0!==s?s:null,longitude:null!==u&&void 0!==u?u: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}},Wt=function(t){try{var e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(Ht(t.key)):t;return Vt($t(e))}catch(n){return Vt($t(t))}},Gt=function(t){var e=function(t){return function(t){if(t){var e,n=t.label||t.selectedValue;return{key:Wt(t),label:n?l.a.createElement(l.a.Fragment,null,l.a.createElement(s.Icon,{type:t.sourceType?null===(e=x[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",l.a.createElement(B,null,n)):void 0}}}(t)};return Array.isArray(t)?t.map(e):e(t)},Xt=function(t){var e=Et({},t),n=t[E].filter((function(t){return t.sourceType===w}));if(n.length>0){var r,o=e,a=o.address;e=Et(Et({},i(o,Mt)),{},(y(r={},w,n),y(r,"address",a.filter((function(t){return t.type!==w}))),r))}return e},Bt=function(t,e,n){return function(){var r=m(f.a.mark((function r(o){var a,i,c;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o){r.next=2;break}return r.abrupt("return",[]);case 2:return a=""!==t?[t]:e,r.next=5,jt(a,o,n);case 5:return i=r.sent,(c=i.results)[E]&&(c=Xt(c)),r.abrupt("return",Object.keys(c).map((function(t){var e;return{label:(null===(e=x[t])||void 0===e?void 0:e.label)||t,options:c[t].map((function(t){return Et(Et({},t),{},{type:t.sourceType})}))}})));case 9:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()},qt=function(){var t=m(f.a.mark((function t(e,n){var r,o;return f.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=m(f.a.mark((function t(e){var n,r,o;return f.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=Ht(n),o=JSON.parse(r),t.abrupt("return",Et({key:r},o));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:o=t.sent,n(o.filter(Boolean));case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Kt=function(t){return t&&(t===E||t===O||t===S||t===w)},Ht=function(t){return"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t},Jt=function(){var t=m(f.a.mark((function t(e){var n,r,o,a,i,c,l,s;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.method,r=e.url,o=void 0===r?"":r,a=e.data,i=void 0===a?{}:a,c=e.options,l=void 0===c?{}:c,s=function(){if("get"===n)return[Object.keys(i).length?"".concat(o,"?").concat(new URLSearchParams(i).toString()):o,l];if("post"===n){var t=Et(Et({},null===l||void 0===l?void 0:l.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[o,i,Et(Et({},l),{},{headers:t})]}return[o,i,l]}(),t.next=4,Tt.a[n].apply(Tt.a,Q(s));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Yt=function(){var t=m(f.a.mark((function t(e){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jt({method:"put",url:"".concat(Dt(!1),"/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)}}(),Zt=W.a.div(Pt||(Pt=j(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),s.tokens.fdsColorPrimaryGray60,s.tokens.fdsSizeXs,s.tokens.fdsFontWeightRegular,s.tokens.fdsComponentSpacingSm,s.tokens.fdsComponentSpacingSm),Qt=W()(_t)(It||(It=j(["\n\tpadding-left: 0 !important;\n"]))),te=W()(s.Icon)(At||(At=j(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),ee=W.a.span(Ft||(Ft=j(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),s.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",";")})),ne=W()(s.Avatar)(Rt||(Rt=j(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),s.tokens.fdsColorPrimaryGray20,s.tokens.fdsSizeSm,s.tokens.fdsSizeSm),re=W()(_t)(Ut||(Ut=j(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),oe=W()(_t)(Nt||(Nt=j(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"]))),ae=function(t){return t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0"},ie=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.value.localeCompare(e.value)}))})),e},ce=function(t){var e=t.text,n=void 0===e?"":e,r=t.testId,o=t.isPort,i=void 0===o?void 0:o,u=t.isLocationLabel,d=void 0!==u&&u,f=t.children,p=void 0===f?null:f,m=Object(c.useRef)(null),h=a(Object(c.useState)(!1),2),v=h[0],y=h[1];Object(c.useEffect)((function(){!function(){if(m.current){var t=m.current,e=t.scrollWidth>t.clientWidth;y(e)}}()}),[n]);var g=l.a.createElement(ee,{ref:m,"data-test-id":r,$isLocationLabel:d,$isPort:i},p||n);return v?l.a.createElement(s.Tooltip,{title:n,"data-test-id":"".concat(r,"-tooltip")},l.a.createElement(ee,{ref:m,"data-test-id":r,$isLocationLabel:d,$isPort:i},p||n)):g},le=function(t){var e=t.search,n=t.index,r=t.dataTestId,o=e.origin.length>1,a=e.destination.length>1,i=o?ie(e.origin):y({},e.origin[0].country,e.origin),c=a?ie(e.destination):y({},e.destination[0].country,e.destination);return l.a.createElement(_t,{alignItems:"center",spacing:J.XSMALL,fullWidth:!0},Object.keys(i).map((function(t){var e=i[t].map((function(t){return t.selectedValue})).join(", ");return l.a.createElement(ce,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-origin-").concat(n),isPort:i[t][0].type===b},l.a.createElement(ne,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e)})),l.a.createElement(s.Icon,{type:"arrow-forward",style:{marginRight:0,color:s.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(c).map((function(t){var e=c[t].map((function(t){return t.selectedValue})).join(", ");return l.a.createElement(ce,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-destination-").concat(n),isPort:c[t][0].type===b},l.a.createElement(ne,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e)})))},se=function(t){var e,n,r,o=t.search,a=t.index,i=t.dataTestId,u=o.platform_type,d=function(t){var e=t.shipment_details.type;if(e===ht)return["box-total"];if(e===mt){var n=t.shipment_details[at];return(null===n||void 0===n?void 0:n.packageType)===wt?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)===St?["uld"]:["box"]}return e===vt?["container"]:["box"]}(o),f=Object(c.useMemo)((function(){return function(t){var e=t.shipment_details.type;if(t.platform_type===pt)return{units:0,volume:0,weight:0,weightUnit:bt,volumeUnit:yt};switch(e){case vt:var n,r=0,o=0;return null===(n=t.shipment_details[it])||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 mt:var a=t.shipment_details[at],i=(null===a||void 0===a?void 0:a.volumeUnit)===gt?1728:1e6;if((null===a||void 0===a?void 0:a.packageType)===wt){var c=ae(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)),l=ae(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:l,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}if((null===a||void 0===a?void 0:a.packageType)===St){var s=ae(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.volume||"0")}),0)),u=ae(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:a.uldPackages.length,volume:s,weight:u,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:bt,volumeUnit:yt};case ht:var d,f,p,m,h,v=ae(parseFloat((null===(d=t.shipment_details[ot])||void 0===d?void 0:d.volume)||"0")),y=ae(parseFloat((null===(f=t.shipment_details[ot])||void 0===f?void 0:f.weight)||"0"));return{units:(null===(p=t.shipment_details[ot])||void 0===p?void 0:p.units)||0,volume:v,weight:y,weightUnit:(null===(m=t.shipment_details[ot])||void 0===m?void 0:m.weightUnit)||bt,volumeUnit:(null===(h=t.shipment_details[ot])||void 0===h?void 0:h.volumeUnit)||yt};default:return{units:0,volume:0,weight:0,weightUnit:bt,volumeUnit:yt}}}(o)}),[o]),p=f.units,m=f.volume,h=f.weight,v=f.weightUnit,y=f.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?ft[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 l.a.createElement(_t,{spacing:J.XSMALL,alignItems:"center",fullWidth:!0,key:a},u===pt?l.a.createElement(re,{alignItems:"center",spacing:J.SMALL,style:{flex:1}},d.map((function(t,e){return l.a.createElement(te,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})})),l.a.createElement(ce,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)})):l.a.createElement(re,{alignItems:"center",spacing:J.SMALL},l.a.createElement(_t,{alignItems:"center",spacing:J.XSMALL,"data-test-id":"rs-".concat(a,"-units")},p,"\xa0",d.map((function(t,e){return l.a.createElement(te,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})}))),l.a.createElement("span",{"data-test-id":"".concat(i,"rs-volume-").concat(a)},m,"\xa0",y),h&&l.a.createElement("span",{"data-test-id":"".concat(i,"rs-weight-").concat(a)},h,"\xa0",v),l.a.createElement(ce,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)}),g&&l.a.createElement(_t,{alignItems:"center",spacing:J.XSMALL,"data-test-id":"".concat(i,"rs-temperature-").concat(a)},l.a.createElement(s.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(i,"rs-temperature-icon-").concat(a)}),l.a.createElement("span",{style:{whiteSpace:"nowrap"}},b))))},ue=function(t){var e=t.search,n=t.index,r=t.setIsOpen,o=t.dataTestId,a=t.onRecentSearchSelect,i=function(){var t=m(f.a.mark((function t(){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(e),t.prev=1,t.next=4,Yt(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 l.a.createElement(Qt,{direction:Y,fullWidth:!0,spacing:J.XSMALL,key:e.id,style:{padding:s.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(o,"rs-card-").concat(n),onClick:function(){i()}},l.a.createElement(le,{search:e,index:n,dataTestId:o}),l.a.createElement(se,{search:e,index:n,dataTestId:o}))},de=function(t){var e=t.recentSearches,n=t.setIsOpen,r=t.dataTestId,o=t.onRecentSearchSelect,a=t.initialValues,i=e?function(t){return Q(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 l.a.createElement(K,null,l.a.createElement(Zt,null,l.a.createElement(s.Icon,{"data-test-id":"".concat(r,"rs-icon"),color:s.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),l.a.createElement(u.TranslatableText,{stringId:"Recent searches"})),l.a.createElement(oe,{direction:Y,fullWidth:!0},i.map((function(t,e){return l.a.createElement(ue,{onRecentSearchSelect:o,initialValues:a,search:t,index:e,key:t.id,setIsOpen:n,dataTestId:r})}))))},fe=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?l.a.createElement(s.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!r.trim()?l.a.createElement(de,{recentSearches:n,dataTestId:o,setIsOpen:a,onRecentSearchSelect:i,initialValues:c}):r.trim()?l.a.createElement(H,null,l.a.createElement(u.TranslatableText,{stringId:"No matching results",module:u.TRANSLATION_MODULES.SearchAndBook})):null:null},pe=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],me=function(t){var e=t.fetchOptions,n=t.renderedOptions,r=t.recentSearches,o=void 0===r?[]:r,u=t.hasError,d=t.mode,p=t.dataTestId,h=t.value,y=t.debounceTimeout,g=void 0===y?800:y,b=t.activeLocationMode,w=t.defaultLocation,S=t.onChange,O=i(t,pe),E=a(Object(c.useState)([]),2),_=E[0],L=E[1],T=a(Object(c.useState)(!1),2),j=T[0],C=T[1],P=a(Object(c.useState)(""),2),I=P[0],A=P[1],F=Object(c.useRef)(0),R=a(Object(c.useState)(!1),2),U=R[0],N=R[1],z=a(Object(c.useState)(3),2),M=z[0],D=z[1],V=Object(c.useRef)();Object(c.useEffect)((function(){h&&0!==h.length||U||(L([]),A(""))}),[h,U]),Object(c.useEffect)((function(){return""!==b&&L((function(t){return t.filter((function(t){return t.label===x[b].label}))})),N(!1),V.current&&clearTimeout(V.current),V.current=setTimeout((function(){document.activeElement.blur(),document.body.click();var t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused"),D(3)}),100),function(){V.current&&clearTimeout(V.current)}}),[b]);var $=Object(c.useMemo)((function(){var t=function(){var t=m(f.a.mark((function t(n){var r,o,a;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return A(n),F.current+=1,r=F.current,L([]),C(!0),o=null,t.prev=6,t.next=9,e(n);case 9:a=t.sent,r===F.current&&(L(a),o=a),t.next=17;break;case 13:t.prev=13,t.t0=t.catch(6),console.error("Error fetching options:",t.t0),r===F.current&&s.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 C(!1),t.abrupt("return",o);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(v.debounce)(t,g)}),[e,g]);Object(c.useEffect)((function(){(null===w||void 0===w?void 0:w.code)&&function(){var t=m(f.a.mark((function t(){var n,r,o,a;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,L([]),C(!0),t.next=5,e(w.code);case 5:if(n=t.sent,L(n),n&&0!==n.length){t.next=9;break}return t.abrupt("return");case 9:r=null,w.type&&(null===(o=n.find((function(t){var e;return t.label.toLowerCase()===(null===(e=x[w.type])||void 0===e?void 0:e.label.toLowerCase())})))||void 0===o?void 0:o.options)&&(r=o.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&&(a={key:JSON.stringify(r),label:r.selectedValue||r.displayLabel||r.code},S([a])),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),zt.isLocal()&&console.error("Error loading default location:",t.t0);case 18:return t.prev=18,C(!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]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(G,null),l.a.createElement(X,Object.assign({maxTagCount:M,onSearch:$,$hasError:u,loading:j,options:_,filterOption:!1,notFoundContent:l.a.createElement(fe,{isLoading:j,recentSearches:o,searchKey:I,dataTestId:p,setIsOpen:N,onRecentSearchSelect:O.onRecentSearchSelect,initialValues:O.initialValues}),mode:d,"data-test-id":"".concat(p,"-selector"),allowClear:d===k,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:function(t){D(t?2:3),L([]),A(""),N(t)},open:U&&(j||I.trim()||(null===o||void 0===o?void 0:o.length)>0),value:h,onChange:S},O),n(_)))},he=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 l.a.createElement(s.Tooltip,{title:r.join(",")},l.a.createElement(B,{"data-test-id":"".concat(n,"-extra-ports")},"+".concat(e.length)))},ve=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation"];e.default=function(t){var e=t.value,n=t.onChange,r=t.hasError,o=t.dataTestId,d=void 0===o?"location-input":o,f=t.isOriginLocation,p=void 0===f||f,m=t.maxPorts,h=void 0===m?1:m,v=t.supportedLocationModes,y=t.customer,b=t.defaultLocation,O=i(t,ve),E=a(Object(c.useState)(e),2),j=E[0],C=E[1],P=a(Object(c.useState)(1===v.length?v[0]:""),2),I=P[0],A=P[1],F=a(Object(c.useState)(Kt(I)||""===I?k:_),2),R=F[0],U=F[1];return Object(c.useEffect)((function(){Kt(I)?U(k):U(_)}),[I]),Object(c.useEffect)((function(){C(e),Array.isArray(e)&&e.length>0?A(e[0].type):(null===b||void 0===b?void 0:b.type)?A(b.type):A("")}),[e,null===b||void 0===b?void 0:b.type]),l.a.createElement(me,Object.assign({mode:R,dataTestId:d,hasError:r,placeholder:l.a.createElement(u.TranslatableText,{style:{fontSize:s.tokens.fdsFontSizeBase},stringId:"Select ".concat(p?L:T)}),value:Gt(j),fetchOptions:Bt(I,v,y),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(x).find((function(e){return e.label===t.label})),o=null===r||void 0===r?void 0:r.icon;return l.a.createElement(s.Select.OptGroup,{label:l.a.createElement("span",{style:{fontFamily:"Open Sans"}},l.a.createElement(s.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 l.a.createElement(s.Option,{value:Wt(n),title:a,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(a),style:{paddingLeft:"8px"},label:l.a.createElement(l.a.Fragment,null,l.a.createElement(s.Icon,{type:o,size:"tiny"}),"\xa0",l.a.createElement(B,null,a)),key:n.code},l.a.createElement(_t,{fullWidth:!0,justifyContent:"space-between"},l.a.createElement(_t,{spacing:J.XSMALL},l.a.createElement("span",null,l.a.createElement(s.Avatar,{type:"flag",country:r,size:"small",style:{width:s.tokens.fdsSizeSm,height:s.tokens.fdsSizeSm}})),l.a.createElement(q,null,i)),c===w&&l.a.createElement(s.Icon,{type:"amazon",size:"small"}),c===S&&l.a.createElement(s.Chip,{type:"neutral",iconType:"address-book"})))})))}))}(t,d)},onChange:function(t){!function(t,e,n,r,o){if(e===_){var a=Array.isArray(t)?t:[];if(a.length<=n)r(a),qt(a,o);else{var i,c,d=(null===(i=JSON.parse(null===(c=a[0])||void 0===c?void 0:c.key))||void 0===i?void 0:i.sourceType)===g?n>1?"airports":"airport":n>1?"ports":"port";s.Message.danger(l.a.createElement(l.a.Fragment,null,l.a.createElement(u.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",l.a.createElement(u.TranslatableText,{stringId:d})))}}else r(t),qt(t,o)}(null!==t&&void 0!==t?t:[],R,h,C,n),A("")},activeLocationMode:I,maxTagPlaceholder:function(t){return l.a.createElement(he,{omittedPorts:t,dataTestId:d})},defaultLocation:b},O))}}])}));
|
|
3
2
|
//# sourceMappingURL=main.bundle.js.map
|