@freightos/fusion-location-input 2.2.0 → 2.2.1-2372840e
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.08680a0b614934272963a5afe56a6ec4.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.08680a0b614934272963a5afe56a6ec4.js": "/precache-manifest.08680a0b614934272963a5afe56a6ec4.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(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 h=Object.getPrototypeOf,v=h&&h(h(E([])));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 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),h=n(1),v=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,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var P,I,A,F,R,M,N,U,z,D,V,$,W=n(3),G=n.n(W),X=Object(W.createGlobalStyle)(P||(P=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"]))),B=G()(h.Select)(I||(I=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"])),h.tokens.fdsBorderRadiusXl,h.tokens.fdsColorPrimaryBlue,h.tokens.fdsColorPrimaryBlue,h.tokens.fdsColorPrimaryBlue10,h.tokens.fdsComponentSpacingXxs,h.tokens.fdsSizeMd,(function(t){return"large"===t.size?"\n\t\t\tmargin-top: ".concat(h.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"}),h.tokens.fdsColorPrimaryBlue,h.tokens.fdsComponentSpacingXs,h.tokens.fdsSizeMd,h.tokens.fdsSizeMd,h.tokens.fdsColorPrimaryGray80,(function(t){return t.$hasError&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(h.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(h.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(h.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(h.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")})),q=G.a.span(A||(A=j(["\n\tfont-size: "," !important;\n"])),h.tokens.fdsFontSizeSm),K=G.a.div(F||(F=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"])),h.tokens.fdsFontSizeSm),J=G()(h.Menu)(R||(R=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"])),h.tokens.fdsBodyTextColorDisabled),H=G.a.div(M||(M=j(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),h.tokens.fdsFontSizeSm,h.tokens.fdsSizeSm,h.tokens.fdsHeadingsFontFamily),Y=(G()(h.Icon)(N||(N=j(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),{XXLARGE:h.tokens.fdsComponentSpacingXxl,XLARGE:h.tokens.fdsComponentSpacingXl,LARGE:h.tokens.fdsComponentSpacingLg,MEDIUM:h.tokens.fdsComponentSpacingMd,SMALL:h.tokens.fdsComponentSpacingSm,XSMALL:h.tokens.fdsComponentSpacingXs,XXSMALL:h.tokens.fdsComponentSpacingXxs,NONE:0}),Z="vertical",Q="horizontal",tt="totalShipment",et="unitsShipment",nt="containerPackages",rt="celsius",ot="fahrenheit",at="COL",it="ERT",ct="CRT",ut=(g($={},"FRO",(g(U={},rt,"-10\xbaC or below"),g(U,ot,"14\xbaF or below"),U)),g($,at,(g(z={},rt,"From +2\xbaC To +8\xbaC"),g(z,ot,"From 35.6\xbaF To 46.4\xbaF"),z)),g($,it,(g(D={},rt,"From +2\xbaC To +25\xbaC"),g(D,ot,"From 35.6\xbaF To 77\xbaF"),D)),g($,ct,(g(V={},rt,"From +15\xbaC To +25\xbaC"),g(V,ot,"From 59\xbaF To 77\xbaF"),V)),$),lt="quotation",st="units",dt="totals",ft="container",pt="CBM",mt="CFT",ht="kg",vt="box",yt="uld";function gt(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 bt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?gt(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var wt,St,Ot,xt,Et,kt,Lt,_t,Ct,Tt,jt,Pt=n(5),It=n.n(Pt),At=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=bt(bt({},null===s||void 0===s?void 0:s.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[a,u,bt(bt({},s),{},{headers:t})]}return[a,u,s]}(),t.next=4,It.a[n].apply(It.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)}}(),Ft=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,At({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)}}(),Rt=G.a.div(wt||(wt=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===Z?"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(W.css)(St||(St=j(["\n\t\t\twidth: 100%;\n\t\t"])))}),(function(t){var e=t.$direction,n=t.$spacing;return e===Z?Object(W.css)(Ot||(Ot=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(W.css)(xt||(xt=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)})),Mt=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],Nt=function(t){var e=t.direction,n=void 0===e?Q:e,r=t.alignItems,o=void 0===r?"start":r,a=t.spacing,i=void 0===a?Y.NONE:a,c=t.wrap,u=t.justifyContent,l=t.fullWidth,s=d(t,Mt);return m.a.createElement(Rt,Object.assign({},s,{$direction:n,$alignItems:o,$spacing:i,$wrap:c,$justifyContent:u,$fullWidth:l}),s.children)},Ut=G.a.div(Et||(Et=j(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),h.tokens.fdsColorPrimaryGray60,h.tokens.fdsSizeXs,h.tokens.fdsFontWeightRegular,h.tokens.fdsComponentSpacingSm,h.tokens.fdsComponentSpacingSm),zt=G()(Nt)(kt||(kt=j(["\n\tpadding-left: 0 !important;\n"]))),Dt=G()(h.Icon)(Lt||(Lt=j(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),Vt=G.a.span(_t||(_t=j(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),h.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",";")})),$t=G()(h.Avatar)(Ct||(Ct=j(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),h.tokens.fdsColorPrimaryGray20,h.tokens.fdsSizeSm,h.tokens.fdsSizeSm),Wt=G()(Nt)(Tt||(Tt=j(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),Gt=G()(Nt)(jt||(jt=j(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"]))),Xt=function(t){return t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0"},Bt=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},qt=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),v=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(Vt,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n);return v?m.a.createElement(h.Tooltip,{title:n,"data-test-id":"".concat(r,"-tooltip")},m.a.createElement(Vt,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n)):g},Kt=function(t){var e=t.search,n=t.index,r=t.dataTestId,o=e.origin.length>1,a=e.destination.length>1,i=o?Bt(e.origin):g({},e.origin[0].country,e.origin),c=a?Bt(e.destination):g({},e.destination[0].country,e.destination);return m.a.createElement(Nt,{alignItems:"center",spacing:Y.XSMALL,fullWidth:!0},Object.keys(i).map((function(t){var e=i[t].map((function(t){return t.selectedValue})).join(", ");return m.a.createElement(qt,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-origin-").concat(n),isPort:i[t][0].type===w},m.a.createElement($t,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e)})),m.a.createElement(h.Icon,{type:"arrow-forward",style:{marginRight:0,color:h.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(qt,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-destination-").concat(n),isPort:c[t][0].type===w},m.a.createElement($t,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e)})))},Jt=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===dt)return["box-total"];if(e===st){var n=t.shipment_details[et];return(null===n||void 0===n?void 0:n.packageType)===vt?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)===yt?["uld"]:["box"]}return e===ft?["container"]:["box"]}(o),l=Object(p.useMemo)((function(){return function(t){var e=t.shipment_details.type;if(t.platform_type===lt)return{units:0,volume:0,weight:0,weightUnit:ht,volumeUnit:pt};switch(e){case ft:var n,r=0,o=0;return null===(n=t.shipment_details[nt])||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 st:var a=t.shipment_details[et],i=(null===a||void 0===a?void 0:a.volumeUnit)===mt?1728:1e6;if((null===a||void 0===a?void 0:a.packageType)===vt){var c=Xt(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=Xt(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)===yt){var l=Xt(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.volume||"0")}),0)),s=Xt(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:ht,volumeUnit:pt};case dt:var d,f,p,m,h,v=Xt(parseFloat((null===(d=t.shipment_details[tt])||void 0===d?void 0:d.volume)||"0")),y=Xt(parseFloat((null===(f=t.shipment_details[tt])||void 0===f?void 0:f.weight)||"0"));return{units:(null===(p=t.shipment_details[tt])||void 0===p?void 0:p.units)||0,volume:v,weight:y,weightUnit:(null===(m=t.shipment_details[tt])||void 0===m?void 0:m.weightUnit)||ht,volumeUnit:(null===(h=t.shipment_details[tt])||void 0===h?void 0:h.volumeUnit)||pt};default:return{units:0,volume:0,weight:0,weightUnit:ht,volumeUnit:pt}}}(o)}),[o]),s=l.units,d=l.volume,f=l.weight,v=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?ut[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(Nt,{spacing:Y.XSMALL,alignItems:"center",fullWidth:!0,key:a},c===lt?m.a.createElement(Wt,{alignItems:"center",spacing:Y.SMALL,style:{flex:1}},u.map((function(t,e){return m.a.createElement(Dt,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})})),m.a.createElement(qt,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)})):m.a.createElement(Wt,{alignItems:"center",spacing:Y.SMALL},m.a.createElement(Nt,{alignItems:"center",spacing:Y.XSMALL,"data-test-id":"rs-".concat(a,"-units")},s,"\xa0",u.map((function(t,e){return m.a.createElement(Dt,{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",v),m.a.createElement(qt,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)}),g&&m.a.createElement(Nt,{alignItems:"center",spacing:Y.XSMALL,"data-test-id":"".concat(i,"rs-temperature-").concat(a)},m.a.createElement(h.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(i,"rs-temperature-icon-").concat(a)}),m.a.createElement("span",{style:{whiteSpace:"nowrap"}},b))))},Ht=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,Ft(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(zt,{direction:Z,fullWidth:!0,spacing:Y.XSMALL,key:e.id,style:{padding:h.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(a,"rs-card-").concat(n),onClick:function(){c()}},m.a.createElement(Kt,{search:e,index:n,dataTestId:a}),m.a.createElement(Jt,{search:e,index:n,dataTestId:a}))},Yt=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(J,null,m.a.createElement(Ut,null,m.a.createElement(h.Icon,{"data-test-id":"".concat(r,"rs-icon"),color:h.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),m.a.createElement(v.TranslatableText,{stringId:"Recent searches"})),m.a.createElement(Gt,{direction:Z,fullWidth:!0},i.map((function(t,e){return m.a.createElement(Ht,{onRecentSearchSelect:o,initialValues:a,search:t,index:e,key:t.id,setIsOpen:n,dataTestId:r})}))))},Zt=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(h.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!r.trim()?m.a.createElement(Yt,{recentSearches:n,dataTestId:o,setIsOpen:a,onRecentSearchSelect:i,initialValues:c}):r.trim()?m.a.createElement(H,null,m.a.createElement(v.TranslatableText,{stringId:"No matching results",module:v.TRANSLATION_MODULES.SearchAndBook})):null:null};function Qt(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 te=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)&&Qt(e.prototype,n),r&&Qt(e,r),t}(),ee=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],ne=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,v=t.debounceTimeout,g=void 0===v?800:v,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],N=R[1],U=s(Object(p.useState)(3),2),z=U[0],D=U[1],V=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}))})),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(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&&h.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={key:JSON.stringify(r),label:r.selectedValue||r.displayLabel||r.code},S([i])),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),te.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]);return m.a.createElement(m.a.Fragment,null,m.a.createElement(X,null),m.a.createElement(B,Object.assign({maxTagCount:z,onSearch:$,$hasError:i,loading:T,options:E,filterOption:!1,notFoundContent:m.a.createElement(Zt,{isLoading:T,recentSearches:a,searchKey:I,dataTestId:u,setIsOpen:N,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){D(t?2:3),_([]),A(""),N(t)},open:M&&(T||I.trim()||(null===a||void 0===a?void 0:a.length)>0),value:f,onChange:S},O),n(E)))},re=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(h.Tooltip,{title:r.join(",")},m.a.createElement(q,{"data-test-id":"".concat(n,"-extra-ports")},"+".concat(e.length)))},oe=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 bt(bt({},t),{},g({},k[e].key,bt(bt({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,It.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)}}(),ae=["address"],ie=function(t){return(t||"").trim().toUpperCase()},ce=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 ie((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},ue=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)},le=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}},se=function(t){try{var e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(ye(t.key)):t;return ue(le(e))}catch(n){return ue(le(t))}},de=function(t){var e=function(t){return function(t){if(t){var e,n=t.label||t.selectedValue;return{key:se(t),label:n?m.a.createElement(m.a.Fragment,null,m.a.createElement(h.Icon,{type:t.sourceType?null===(e=k[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",m.a.createElement(q,null,n)):void 0}}}(t)};return Array.isArray(t)?t.map(e):e(t)},fe=function(t){var e=bt({},t),n=t[E].filter((function(t){return t.sourceType===S}));if(n.length>0){var r,o=e,a=o.address;e=bt(bt({},d(o,ae)),{},(g(r={},S,n),g(r,"address",a.filter((function(t){return t.type!==S}))),r))}return e},pe=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,oe(i,a,n);case 5:return c=r.sent,(u=c.results)[E]&&(u=fe(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 bt(bt({},t),{},{type:t.sourceType})}))}})));case 9:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()},me=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=ye(n),a=JSON.parse(r),t.abrupt("return",bt({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)}}(),he=function(t,e,n,r,o){if(e===_){var a=Array.isArray(t)?t:[];if(a.length<=n)r(a),me(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";h.Message.danger(m.a.createElement(m.a.Fragment,null,m.a.createElement(v.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",m.a.createElement(v.TranslatableText,{stringId:u})))}}else r(t),me(t,o)},ve=function(t){return t&&(t===E||t===x||t===O||t===S)},ye=function(t){return"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t},ge=/^[^-]*-\s*(.+?),/,be=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},we=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(ge);if(!(null===n||void 0===n?void 0:n[1]))return!1;var r=n[1].trim(),o=e.trim().split(/\s+/).map(be);return new RegExp("\\b".concat(o.join("\\s+"),"\\b"),"i").test(r)}(t,e)}))},Se=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]},Oe=function(t,e){var n=t[b]||[],r=t[w]||[],o=ie(e);return[].concat(c(n),c(r)).find((function(t){return ie(null===t||void 0===t?void 0:t.code)===o}))},xe=function(t){var e=t.selectedValue||t.displayLabel||t.code,n=bt(bt({},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}},Ee=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,oe(a,n,i);case 7:l=t.sent,s=l.results,d=we(void 0===s?{}:s,n),u=Se(d,c);case 12:if(u||!r){t.next=19;break}return t.next=15,oe(a,r,i);case 15:f=t.sent,p=f.results,u=Oe(void 0===p?{}:p,r);case 19:return t.abrupt("return",u?xe(u):null);case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ke=["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,j=t.autofillLocationCode,P=t.userCountryCode,I=d(t,ke),A=s(Object(p.useState)(e),2),F=A[0],R=A[1],M=s(Object(p.useState)(1===b.length?b[0]:""),2),N=M[0],U=M[1],z=s(Object(p.useState)(ve(N)||""===N?L:_),2),D=z[0],V=z[1],$=Object(p.useRef)(e),W=Object(p.useRef)(null);Object(p.useEffect)((function(){ve(N)?V(L):V(_)}),[N]),Object(p.useEffect)((function(){R(e),$.current=e,Array.isArray(e)&&e.length>0?U(e[0].type):(null===x||void 0===x?void 0:x.type)?U(x.type):U("")}),[e,null===x||void 0===x?void 0:x.type]);var G=Object(p.useRef)({onChange:n,selectionMode:D,maxPorts:g});return Object(p.useEffect)((function(){G.current={onChange:n,selectionMode:D,maxPorts:g}}),[n,D,g]),Object(p.useEffect)((function(){var t="".concat(E||"","::").concat(j||"");if((E||j)&&t!==W.current){var e=$.current,n=G.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,Ee({autofillLocationAddress:E,autofillLocationCode:j,supportedLocationModes:b,customer:w,userCountryCode:P});case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(r=G.current,a=r.onChange,i=r.selectionMode,u=r.maxPorts,l=$.current,!(i===_&&"number"===typeof u&&u>1&&Array.isArray(l))){e.next=19;break}if(s=ce(n),d=new Set((l||[]).map((function(t){return ie((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=de(l)||[],p=Array.isArray(f)?f.filter(Boolean):[],m=[].concat(c(p),[n]).slice(0,u),he(m,i,u,R,a),e.next=20;break;case 19:he(i===_?[n]:n,i,u,R,a);case 20:W.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,j,b,w,P]),m.a.createElement(ne,Object.assign({mode:D,dataTestId:i,hasError:r,placeholder:m.a.createElement(v.TranslatableText,{style:{fontSize:h.tokens.fdsFontSizeBase},stringId:"Select ".concat(f?C:T)}),value:de(F),fetchOptions:pe(N,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(h.Select.OptGroup,{label:m.a.createElement("span",{style:{fontFamily:"Open Sans"}},m.a.createElement(h.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(h.Option,{value:se(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(h.Icon,{type:o,size:"tiny"}),"\xa0",m.a.createElement(q,null,a)),key:n.code},m.a.createElement(Nt,{fullWidth:!0,justifyContent:"space-between"},m.a.createElement(Nt,{spacing:Y.XSMALL},m.a.createElement("span",null,m.a.createElement(h.Avatar,{type:"flag",country:r,size:"small",style:{width:h.tokens.fdsSizeSm,height:h.tokens.fdsSizeSm}})),m.a.createElement(K,null,i)),c===S&&m.a.createElement(h.Icon,{type:"amazon",size:"small"}),c===O&&m.a.createElement(h.Chip,{type:"neutral",iconType:"address-book"})))})))}))}(t,i)},onChange:function(t){he(null!==t&&void 0!==t?t:[],D,g,R,n),U("")},activeLocationMode:N,maxTagPlaceholder:function(t){return m.a.createElement(re,{omittedPorts:t,dataTestId:i})},defaultLocation:x},I))}}])}));
|
|
3
2
|
//# sourceMappingURL=main.bundle.js.map
|