@freightos/fusion-location-input 2.2.6-a691267e → 2.2.6-d80cfa66
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/build/asset-manifest.json +1 -1
- package/build/main.bundle.js +1 -1
- package/build/main.bundle.js.map +1 -1
- package/build/{precache-manifest.8683c88704824a60a179e34a02fe54c3.js → precache-manifest.7235a42e546db43f710cd20b0daf556a.js} +1 -1
- package/build/service-worker.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main.js": "/main.bundle.js",
|
|
4
4
|
"main.js.map": "/main.bundle.js.map",
|
|
5
5
|
"index.html": "/index.html",
|
|
6
|
-
"precache-manifest.
|
|
6
|
+
"precache-manifest.7235a42e546db43f710cd20b0daf556a.js": "/precache-manifest.7235a42e546db43f710cd20b0daf556a.js",
|
|
7
7
|
"service-worker.js": "/service-worker.js"
|
|
8
8
|
},
|
|
9
9
|
"entrypoints": [
|
package/build/main.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):"function"===typeof define&&define.amd?define("FusionLocationInput",["react","@freightos/design-system","styled-components","@freightos/freightos-i18n","@freightos/http-client","lodash"],e):"object"===typeof exports?exports.FusionLocationInput=e(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):t.FusionLocationInput=e(t.React,t["@freightos/design-system"],t["styled-components"],t["@freightos/freightos-i18n"],t["@freightos/http-client"],t.lodash)}(this,(function(t,e,n,r,o,a){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="http://ship.freightos.local:8800/FusionLocationInput/",n(n.s=7)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){t.exports=n(8)},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e,n){t.exports=n(9)},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"===typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(L){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),i=new x(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return k()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=w(i,n);if(c){if(c===s)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(L){return{type:"throw",arg:L}}}t.wrap=u;var s={};function d(){}function f(){}function p(){}var m={};c(m,o,(function(){return this}));var v=Object.getPrototypeOf,h=v&&v(v(E([])));h&&h!==e&&n.call(h,o)&&(m=h);var y=p.prototype=d.prototype=Object.create(m);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var r;this._invoke=function(o,a){function i(){return new e((function(r,i){!function r(o,a,i,c){var u=l(t[o],t,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"===typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(d).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,c)}))}c(u.arg)}(o,a,r,i)}))}return r=r?r.then(i,i):i()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,s;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=p,c(y,"constructor",p),c(p,"constructor",f),f.displayName=c(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(b.prototype),c(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new b(u(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(y),c(y,i,"Generator"),c(y,o,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=E,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return i.type="throw",i.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,s):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=r}catch(o){"object"===typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";n.r(e);var r=n(2),o=n.n(r);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){if(t){if("string"===typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function c(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(l){return void n(l)}c.done?e(u):Promise.resolve(u).then(r,o)}function l(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(t){u(a,r,o,i,c,"next",t)}function c(t){u(a,r,o,i,c,"throw",t)}i(void 0)}))}}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(u){o=!0,a=u}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var f,p=n(0),m=n.n(p),v=n(1),h=n(4),y=n(6);function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b="airport",w="seaport",S="fulfillment_center",O="address_book",x="last_mile_address",E="address",k=(g(f={},b,{label:"Airports",key:b,icon:"mode-air"}),g(f,w,{label:"Ports",key:w,icon:"mode-ship"}),g(f,S,{label:"Fulfillment centers",key:S,icon:"fulfillment-center"}),g(f,O,{key:O,groupedBy:"address"}),g(f,x,{key:x,groupedBy:"address"}),g(f,E,{label:"Address",key:E,icon:"location"}),f),L="single",_="multiple",C="origin",T="destination";function j(t){if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=i(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw o}}}}function P(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function I(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A={XXLARGE:v.tokens.fdsComponentSpacingXxl,XLARGE:v.tokens.fdsComponentSpacingXl,LARGE:v.tokens.fdsComponentSpacingLg,MEDIUM:v.tokens.fdsComponentSpacingMd,SMALL:v.tokens.fdsComponentSpacingSm,XSMALL:v.tokens.fdsComponentSpacingXs,XXSMALL:v.tokens.fdsComponentSpacingXxs,NONE:0},F="vertical",R="horizontal";function M(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var U,N,z,D,V,$,W,G,X,B,q,K=n(3),J=n.n(K),H=J.a.div(U||(U=M(["\n\tdisplay: flex;\n\tflex-direction: ",";\n\tflex-wrap: ",";\n\talign-items: ",";\n\tjustify-content: ",";\n\tbox-sizing: border-box;\n\n\t","\n\t",";\n"])),(function(t){return t.$direction===F?"column":"row"}),(function(t){return t.$wrap?"wrap":"nowrap"}),(function(t){return t.$alignItems}),(function(t){return t.$justifyContent}),(function(t){return t.$fullWidth&&Object(K.css)(N||(N=M(["\n\t\t\twidth: 100%;\n\t\t"])))}),(function(t){var e=t.$direction,n=t.$spacing;return e===F?Object(K.css)(z||(z=M(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-top: ",";\n\t\t\t\t\t}\n\t\t\t "])),n):Object(K.css)(D||(D=M(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-left: ",";\n\t\t\t\t\t}\n\t\t\t "])),n)})),Y=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],Z=function(t){var e=t.direction,n=void 0===e?R:e,r=t.alignItems,o=void 0===r?"start":r,a=t.spacing,i=void 0===a?A.NONE:a,c=t.wrap,u=t.justifyContent,l=t.fullWidth,s=d(t,Y);return m.a.createElement(H,Object.assign({},s,{$direction:n,$alignItems:o,$spacing:i,$wrap:c,$justifyContent:u,$fullWidth:l}),s.children)},Q=n(5),tt=n.n(Q),et=function(){var t=l(o.a.mark((function t(e,n,r){var a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a=e.reduce((function(t,e){return I(I({},t),{},g({},k[e].key,I(I({type:e.toUpperCase()},(null===r||void 0===r?void 0:r.code)?{searchTerm:r.name}:{}),k[e].groupedBy?{groupedBy:k[e].groupedBy}:{})))}),{}),t.next=4,tt.a.post("/geocoder/api/v3/geocoder/locations",{query:n,limit:5,sources:a});case 4:return i=t.sent,t.abrupt("return",i.data);case 8:return t.prev=8,t.t0=t.catch(0),console.error("Error fetching locations:",t.t0),t.abrupt("return",{results:{}});case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n,r){return t.apply(this,arguments)}}(),nt=Object(K.createGlobalStyle)(V||(V=M(["\n .ant-select-dropdown {\n .ant-select-dropdown-menu {\n max-height: 400px;\n padding: 0 !important;\n margin-top: 0 !important;\n }\n }\n"]))),rt=J()(v.Select)($||($=M(["\n\t.ant-select-selection__rendered {\n\t\tmin-width: 100% !important;\n\t}\n\n\tli.ant-select-selection__choice {\n\t\tborder-radius: ",";\n\t\tborder: none;\n\t\tborder-color: ",";\n\t\tcolor: ",";\n\t\tbackground-color: ",";\n\t\tline-height: 10px !important;\n\t\tmargin-right: ",";\n\t\twidth: fit-content;\n\t\tmax-width: 90px;\n\t\theight: "," !important;\n\t\t","\n\n\t\t.ant-select-selection__choice__remove {\n\t\t\tcolor: ",";\n\t\t\tmargin-top: "," !important;\n\t\t}\n\n\t\t.ant-select-selection__choice__content {\n\t\t\tline-height: "," !important;\n\t\t\theight: "," !important;\n\t\t}\n\t}\n\n\tli.ant-select-selection__choice__disabled {\n\t\tborder: none;\n\t\tbackground-color: transparent;\n\t\tpadding: 0;\n\t\tpadding-left: 0;\n\t\twidth: fit-content;\n\t}\n\n\t.ant-select-dropdown .ant-select-not-found {\n\t\tcursor: pointer !important;\n\t}\n\n\t.ant-select-selection-selected-value {\n\t\tmax-width: 280px !important;\n\t}\n\n\tli.ant-select-search.ant-select-search--inline {\n\t\tmargin-left: -1px !important;\n\t}\n\t.ant-select-search__field {\n\t\tcolor: "," !important;\n\t}\n\t","\n"])),v.tokens.fdsBorderRadiusXl,v.tokens.fdsColorPrimaryBlue,v.tokens.fdsColorPrimaryBlue,v.tokens.fdsColorPrimaryBlue10,v.tokens.fdsComponentSpacingXxs,v.tokens.fdsSizeMd,(function(t){return"large"===t.size?"\n\t\t\tmargin-top: ".concat(v.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"}),v.tokens.fdsColorPrimaryBlue,v.tokens.fdsComponentSpacingXs,v.tokens.fdsSizeMd,v.tokens.fdsSizeMd,v.tokens.fdsColorPrimaryGray80,(function(t){return t.$hasError&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(v.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(v.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(v.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(v.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")})),ot=J.a.span(W||(W=M(["\n\tfont-size: "," !important;\n"])),v.tokens.fdsFontSizeSm),at=J.a.div(G||(G=M(["\n\tfont-size: "," !important;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 2;\n\t-webkit-box-orient: vertical;\n"])),v.tokens.fdsFontSizeSm),it=J()(v.Menu)(X||(X=M(["\n\tcursor: pointer !important;\n\n\t.ant-menu-item-group-title {\n\t\tpadding: 0;\n\t\tcolor: ",";\n\t}\n\n\t.ant-menu-item {\n\t\tpadding: 0;\n\t\twhite-space: normal;\n\t\tline-height: normal;\n\n\t\t&:hover {\n\t\t\tbackground-color: #f5f5f5;\n\t\t}\n\t}\n"])),v.tokens.fdsBodyTextColorDisabled),ct=J.a.div(B||(B=M(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),v.tokens.fdsFontSizeSm,v.tokens.fdsSizeSm,v.tokens.fdsHeadingsFontFamily);J()(v.Icon)(q||(q=M(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"])));function ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var lt,st,dt,ft,pt,mt,vt,ht,yt,gt,bt,wt,St=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,r=[{key:"isProduction",value:function(){return"prod"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}},{key:"isTest",value:function(){return"test"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}},{key:"isLocal",value:function(){return"dev"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}}],(n=null)&&ut(e.prototype,n),r&&ut(e,r),t}(),Ot=["address"],xt=function(t){return(t||"").trim().toUpperCase()},Et=function(t){var e=function(t){try{return"string"===typeof t?JSON.parse(t):null}catch(e){return null}}(null===t||void 0===t?void 0:t.key);return xt((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},kt=function(t){var e=[];JSON.stringify(t,(function(t,n){return e.push(t),n}));var n=Array.from(new Set(e)).sort();return JSON.stringify(t,n)},Lt=function(t){var e=t||{},n=e.displayLabel,r=e.selectedValue,o=e.formattedNameOrAddress,a=e.code,i=e.countryCode,c=e.stateOrProvince,u=e.city,l=e.latitude,s=e.longitude,d=e.postalOrZipCode,f=e.sourceType,p=e.locationType,m=e.type;return{displayLabel:n,selectedValue:r||a,formattedNameOrAddress:o,code:a||r,country:i,countryName:e.countryName,stateOrProvince:null!==c&&void 0!==c?c:null,city:null!==u&&void 0!==u?u:null,latitude:null!==l&&void 0!==l?l:null,longitude:null!==s&&void 0!==s?s:null,postalOrZipCode:null!==d&&void 0!==d?d:null,sourceType:null!==f&&void 0!==f?f:null,locationType:null!==p&&void 0!==p?p:null,type:null!==m&&void 0!==m?m:f}},_t=function(t){try{var e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(Rt(t.key)):t;return kt(Lt(e))}catch(n){return kt(Lt(t))}},Ct=function(t){var e=function(t){return function(t){if(t){var e,n=t.label||t.selectedValue;return{key:_t(t),label:n?m.a.createElement(m.a.Fragment,null,m.a.createElement(v.Icon,{type:t.sourceType?null===(e=k[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",m.a.createElement(ot,null,n)):void 0}}}(t)};return Array.isArray(t)?t.map(e):e(t)},Tt=function(t){var e=I({},t),n=t[E].filter((function(t){return t.sourceType===S}));if(n.length>0){var r,o=e,a=o.address;e=I(I({},d(o,Ot)),{},(g(r={},S,n),g(r,"address",a.filter((function(t){return t.type!==S}))),r))}return e},jt=function(t,e,n){return function(){var r=l(o.a.mark((function r(a){var i,c,u;return o.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a){r.next=2;break}return r.abrupt("return",[]);case 2:return i=""!==t?[t]:e,r.next=5,et(i,a,n);case 5:return c=r.sent,(u=c.results)[E]&&(u=Tt(u)),r.abrupt("return",Object.keys(u).map((function(t){var e;return{label:(null===(e=k[t])||void 0===e?void 0:e.label)||t,options:u[t].map((function(t){return I(I({},t),{},{type:t.sourceType})}))}})));case 9:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()},Pt=function(){var t=l(o.a.mark((function t(e,n){var r,a;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Array.isArray(e)?e:[e],t.next=3,Promise.all(r.map(function(){var t=l(o.a.mark((function t(e){var n,r,a;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=null===e||void 0===e?void 0:e.key,r=Rt(n),a=JSON.parse(r),t.abrupt("return",I({key:r},a));case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()));case 3:a=t.sent,n(a.filter(Boolean));case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),It=function(t,e,n,r,o){if(e===_){var a=Array.isArray(t)?t:[];if(a.length<=n)r(a),Pt(a,o);else{var i,c,u=(null===(i=JSON.parse(null===(c=a[0])||void 0===c?void 0:c.key))||void 0===i?void 0:i.sourceType)===b?n>1?"airports":"airport":n>1?"ports":"port";v.Message.danger(m.a.createElement(m.a.Fragment,null,m.a.createElement(h.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",m.a.createElement(h.TranslatableText,{stringId:u})))}}else r(t),Pt(t,o)},At=function(t){var e,n,r,o=null;try{if("string"===typeof(null===t||void 0===t?void 0:t.key)){var a=JSON.parse(t.key);o=(null===a||void 0===a?void 0:a.code)||(null===a||void 0===a?void 0:a.selectedValue)||null}}catch(i){}return((null!==(e=null!==(n=null!==(r=o)&&void 0!==r?r:null===t||void 0===t?void 0:t.code)&&void 0!==n?n:null===t||void 0===t?void 0:t.selectedValue)&&void 0!==e?e:"")||"").trim().toUpperCase()},Ft=function(t){return t&&(t===E||t===x||t===O||t===S)},Rt=function(t){return"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t},Mt=/^[^-]*-\s*(.+?),/,Ut=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},Nt=function(t,e){var n=t[E]||[],r=t[S]||[];return[].concat(c(n),c(r)).filter((function(t){return function(t,e){if(!t.displayLabel)return!1;var n=t.displayLabel.match(Mt);if(!(null===n||void 0===n?void 0:n[1]))return!1;var r=n[1].trim(),o=e.trim().split(/\s+/).map(Ut);return new RegExp("\\b".concat(o.join("\\s+"),"\\b"),"i").test(r)}(t,e)}))},zt=function(t,e){return 0===t.length?null:1!==t.length&&e&&t.find((function(t){var n;return(null===(n=t.countryCode)||void 0===n?void 0:n.toLowerCase())===e.toLowerCase()}))||t[0]},Dt=function(t,e){var n=t[b]||[],r=t[w]||[],o=xt(e);return[].concat(c(n),c(r)).find((function(t){return xt(null===t||void 0===t?void 0:t.code)===o}))},Vt=function(t){var e=t.selectedValue||t.displayLabel||t.code,n=I(I({},t),{},{selectedValue:e,displayLabel:t.displayLabel||e,country:t.countryCode||t.country,type:t.type||t.sourceType});return n.country&&delete n.countryCode,{key:JSON.stringify(n),label:e}},$t=function(){var t=l(o.a.mark((function t(e){var n,r,a,i,c,u,l,s,d,f,p;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.autofillLocationAddress,r=e.autofillLocationCode,a=e.supportedLocationModes,i=e.customer,c=e.userCountryCode,n||r){t.next=3;break}return t.abrupt("return",null);case 3:if(u=null,!n){t.next=12;break}return t.next=7,et(a,n,i);case 7:l=t.sent,s=l.results,d=Nt(void 0===s?{}:s,n),u=zt(d,c);case 12:if(u||!r){t.next=19;break}return t.next=15,et(a,r,i);case 15:f=t.sent,p=f.results,u=Dt(void 0===p?{}:p,r);case 19:return t.abrupt("return",u?Vt(u):null);case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Wt="totalShipment",Gt="unitsShipment",Xt="containerPackages",Bt="celsius",qt="fahrenheit",Kt="COL",Jt="ERT",Ht="CRT",Yt=(g(pt={},"FRO",(g(lt={},Bt,"-10\xbaC or below"),g(lt,qt,"14\xbaF or below"),lt)),g(pt,Kt,(g(st={},Bt,"From +2\xbaC To +8\xbaC"),g(st,qt,"From 35.6\xbaF To 46.4\xbaF"),st)),g(pt,Jt,(g(dt={},Bt,"From +2\xbaC To +25\xbaC"),g(dt,qt,"From 35.6\xbaF To 77\xbaF"),dt)),g(pt,Ht,(g(ft={},Bt,"From +15\xbaC To +25\xbaC"),g(ft,qt,"From 59\xbaF To 77\xbaF"),ft)),pt),Zt="quotation",Qt="units",te="totals",ee="container",ne="CBM",re="CFT",oe="kg",ae="box",ie="uld",ce=function(){var t=l(o.a.mark((function t(e){var n,r,a,i,u,l,s,d;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.method,r=e.url,a=void 0===r?"":r,i=e.data,u=void 0===i?{}:i,l=e.options,s=void 0===l?{}:l,d=function(){if("get"===n)return[Object.keys(u).length?"".concat(a,"?").concat(new URLSearchParams(u).toString()):a,s];if("post"===n){var t=I(I({},null===s||void 0===s?void 0:s.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[a,u,I(I({},s),{},{headers:t})]}return[a,u,s]}(),t.next=4,tt.a[n].apply(tt.a,c(d));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ue=function(){var t=l(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ce({method:"put",url:"".concat("/webcargo-alpha","/backend/api.php"),options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:e}});case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),le=J.a.div(mt||(mt=M(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),v.tokens.fdsColorPrimaryGray60,v.tokens.fdsSizeXs,v.tokens.fdsFontWeightRegular,v.tokens.fdsComponentSpacingSm,v.tokens.fdsComponentSpacingSm),se=J()(Z)(vt||(vt=M(["\n\tpadding-left: 0 !important;\n"]))),de=J()(v.Icon)(ht||(ht=M(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),fe=J.a.span(yt||(yt=M(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),v.tokens.fdsColorPrimaryGray80,(function(t){return!t.$isLocationLabel&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"}),(function(t){var e=t.$isPort;if(void 0!==e)return"min-width: ".concat(e?"65px":"55px",";")})),pe=J()(v.Avatar)(gt||(gt=M(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),v.tokens.fdsColorPrimaryGray20,v.tokens.fdsSizeSm,v.tokens.fdsSizeSm),me=J()(Z)(bt||(bt=M(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),ve=J()(Z)(wt||(wt=M(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"]))),he=function(t){return t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0"},ye=function(t){var e=t.reduce((function(t,e){var n=e.country;return t[n]||(t[n]=[]),t[n].push(e),t}),{});return Object.keys(e).forEach((function(t){e[t].sort((function(t,e){return t.selectedValue.localeCompare(e.selectedValue)}))})),e},ge=function(t){var e=t.text,n=void 0===e?"":e,r=t.testId,o=t.isPort,a=void 0===o?void 0:o,i=t.isLocationLabel,c=void 0!==i&&i,u=t.children,l=void 0===u?null:u,d=Object(p.useRef)(null),f=s(Object(p.useState)(!1),2),h=f[0],y=f[1];Object(p.useEffect)((function(){!function(){if(d.current){var t=d.current,e=t.scrollWidth>t.clientWidth;y(e)}}()}),[n]);var g=m.a.createElement(fe,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n);return h?m.a.createElement(v.Tooltip,{title:n,"data-test-id":"".concat(r,"-tooltip")},m.a.createElement(fe,{ref:d,"data-test-id":r,$isLocationLabel:c,$isPort:a},l||n)):g},be=function(t){var e=t.search,n=t.index,r=t.dataTestId,o=e.origin.length>1,a=e.destination.length>1,i=o?ye(e.origin):g({},e.origin[0].country,e.origin),c=a?ye(e.destination):g({},e.destination[0].country,e.destination);return m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,fullWidth:!0},Object.keys(i).map((function(t){var e=i[t].map((function(t){return t.selectedValue})).join(", ");return m.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-origin-").concat(n),isPort:i[t][0].type===w},m.a.createElement(pe,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e)})),m.a.createElement(v.Icon,{type:"arrow-forward",style:{marginRight:0,color:v.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(c).map((function(t){var e=c[t].map((function(t){return t.selectedValue})).join(", ");return m.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(r,"-destination-").concat(n),isPort:c[t][0].type===w},m.a.createElement(pe,{type:"flag",country:t,size:"small","data-test-id":"".concat(r,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e)})))},we=function(t){var e,n,r,o=t.search,a=t.index,i=t.dataTestId,c=o.platform_type,u=function(t){var e=t.shipment_details.type;if(e===te)return["box-total"];if(e===Qt){var n=t.shipment_details[Gt];return(null===n||void 0===n?void 0:n.packageType)===ae?n.boxPackages.reduce((function(t,e){var n,r,o=null===(n=e.type)||void 0===n||null===(r=n.value)||void 0===r?void 0:r.icon;return t.includes(o)||t.push(o),t}),[]):(null===n||void 0===n?void 0:n.packageType)===ie?["uld"]:["box"]}return e===ee?["container"]:["box"]}(o),l=Object(p.useMemo)((function(){return function(t){var e=t.shipment_details.type;if(t.platform_type===Zt)return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne};switch(e){case ee:var n,r=0,o=0;return null===(n=t.shipment_details[Xt])||void 0===n||n.forEach((function(t){var e=Number(t.units)||0;if(e>0){r+=e;var n=parseInt(t.dimensions.value,10);o+=e*(n/20)}})),{units:r,volume:o,weight:null,weightUnit:null,volumeUnit:"TEU"};case Qt:var a=t.shipment_details[Gt],i=(null===a||void 0===a?void 0:a.volumeUnit)===re?1728:1e6;if((null===a||void 0===a?void 0:a.packageType)===ae){var c=he(null===a||void 0===a?void 0:a.boxPackages.reduce((function(t,e){return t+parseFloat(e.width||"0")*parseFloat(e.height||"0")*parseFloat(e.length||"0")*parseFloat(e.units||"0")/i}),0)),u=he(a.boxPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:a.boxPackages.reduce((function(t,e){return t+parseFloat(e.units||"0")}),0),volume:c,weight:u,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}if((null===a||void 0===a?void 0:a.packageType)===ie){var l=he(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.volume||"0")}),0)),s=he(a.uldPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:a.uldPackages.length,volume:l,weight:s,weightUnit:a.weightUnit,volumeUnit:a.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne};case te:var d,f,p,m,v,h=he(parseFloat((null===(d=t.shipment_details[Wt])||void 0===d?void 0:d.volume)||"0")),y=he(parseFloat((null===(f=t.shipment_details[Wt])||void 0===f?void 0:f.weight)||"0"));return{units:(null===(p=t.shipment_details[Wt])||void 0===p?void 0:p.units)||0,volume:h,weight:y,weightUnit:(null===(m=t.shipment_details[Wt])||void 0===m?void 0:m.weightUnit)||oe,volumeUnit:(null===(v=t.shipment_details[Wt])||void 0===v?void 0:v.volumeUnit)||ne};default:return{units:0,volume:0,weight:0,weightUnit:oe,volumeUnit:ne}}}(o)}),[o]),s=l.units,d=l.volume,f=l.weight,h=l.weightUnit,y=l.volumeUnit,g=1===o.commodity.length&&o.commodity[0].is_temperature,b=(null===(e=o.commodity_temperature)||void 0===e?void 0:e.tempRange)&&g?Yt[null===(n=o.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(r=o.commodity_temperature)||void 0===r?void 0:r.temperatureSystem]:"";return m.a.createElement(Z,{spacing:A.XSMALL,alignItems:"center",fullWidth:!0,key:a},c===Zt?m.a.createElement(me,{alignItems:"center",spacing:A.SMALL,style:{flex:1}},u.map((function(t,e){return m.a.createElement(de,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})})),m.a.createElement(ge,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)})):m.a.createElement(me,{alignItems:"center",spacing:A.SMALL},m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,"data-test-id":"rs-".concat(a,"-units")},s,"\xa0",u.map((function(t,e){return m.a.createElement(de,{type:t,key:"".concat(a,"-").concat(e),size:"tiny","data-test-id":"".concat(i,"rs-package-icon-").concat(a,"-").concat(e)})}))),m.a.createElement("span",{"data-test-id":"".concat(i,"rs-volume-").concat(a)},d,"\xa0",y),f&&m.a.createElement("span",{"data-test-id":"".concat(i,"rs-weight-").concat(a)},f,"\xa0",h),m.a.createElement(ge,{text:o.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(i,"rs-commodity-").concat(a)}),g&&m.a.createElement(Z,{alignItems:"center",spacing:A.XSMALL,"data-test-id":"".concat(i,"rs-temperature-").concat(a)},m.a.createElement(v.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(i,"rs-temperature-icon-").concat(a)}),m.a.createElement("span",{style:{whiteSpace:"nowrap"}},b))))},Se=function(t){var e=t.search,n=t.index,r=t.setIsOpen,a=t.dataTestId,i=t.onRecentSearchSelect,c=function(){var t=l(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i(e),t.prev=1,t.next=4,ue(e.id);case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.error(t.t0);case 9:r(!1);case 10:case"end":return t.stop()}}),t,null,[[1,6]])})));return function(){return t.apply(this,arguments)}}();return m.a.createElement(se,{direction:F,fullWidth:!0,spacing:A.XSMALL,key:e.id,style:{padding:v.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(a,"rs-card-").concat(n),onClick:function(){c()}},m.a.createElement(be,{search:e,index:n,dataTestId:a}),m.a.createElement(we,{search:e,index:n,dataTestId:a}))},Oe=function(t){var e=t.recentSearches,n=t.setIsOpen,r=t.dataTestId,o=t.onRecentSearchSelect,a=t.initialValues,i=e?function(t){return c(t).sort((function(t,e){if(t.is_saved!==e.is_saved)return t.is_saved?-1:1;if(t.is_saved&&e.is_saved){var n=new Date(t.saved_update_date).getTime();return new Date(e.saved_update_date).getTime()-n}var r=new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date||0).getTime())).getTime();return new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date||0).getTime())).getTime()-r})).slice(0,6)}(e):[];return m.a.createElement(it,null,m.a.createElement(le,null,m.a.createElement(v.Icon,{"data-test-id":"".concat(r,"rs-icon"),color:v.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),m.a.createElement(h.TranslatableText,{stringId:"Recent searches"})),m.a.createElement(ve,{direction:F,fullWidth:!0},i.map((function(t,e){return m.a.createElement(Se,{onRecentSearchSelect:o,initialValues:a,search:t,index:e,key:t.id,setIsOpen:n,dataTestId:r})}))))},xe=function(t){var e=t.isLoading,n=t.recentSearches,r=t.searchKey,o=t.dataTestId,a=t.setIsOpen,i=t.onRecentSearchSelect,c=t.initialValues;return r||n&&0!==n.length?e?m.a.createElement(v.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!r.trim()?m.a.createElement(Oe,{recentSearches:n,dataTestId:o,setIsOpen:a,onRecentSearchSelect:i,initialValues:c}):r.trim()?m.a.createElement(ct,null,m.a.createElement(h.TranslatableText,{stringId:"No matching results",module:h.TRANSLATION_MODULES.SearchAndBook})):null:null},Ee=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],ke=function(t){var e=t.fetchOptions,n=t.renderedOptions,r=t.recentSearches,a=void 0===r?[]:r,i=t.hasError,c=t.mode,u=t.dataTestId,f=t.value,h=t.debounceTimeout,g=void 0===h?800:h,b=t.activeLocationMode,w=t.defaultLocation,S=t.onChange,O=d(t,Ee),x=s(Object(p.useState)([]),2),E=x[0],_=x[1],C=s(Object(p.useState)(!1),2),T=C[0],j=C[1],P=s(Object(p.useState)(""),2),I=P[0],A=P[1],F=Object(p.useRef)(0),R=s(Object(p.useState)(!1),2),M=R[0],U=R[1],N=Object(p.useRef)();Object(p.useEffect)((function(){f&&0!==f.length||M||(_([]),A(""))}),[f,M]),Object(p.useEffect)((function(){return""!==b&&_((function(t){return t.filter((function(t){return t.label===k[b].label}))})),U(!1),N.current&&clearTimeout(N.current),N.current=setTimeout((function(){document.activeElement.blur(),document.body.click();var t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused")}),100),function(){N.current&&clearTimeout(N.current)}}),[b]);var z=Object(p.useMemo)((function(){var t=function(){var t=l(o.a.mark((function t(n){var r,a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return A(n),F.current+=1,r=F.current,_([]),j(!0),a=null,t.prev=6,t.next=9,e(n);case 9:i=t.sent,r===F.current&&(_(i),a=i),t.next=17;break;case 13:t.prev=13,t.t0=t.catch(6),console.error("Error fetching options:",t.t0),r===F.current&&v.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."});case 17:if(t.prev=17,r!==F.current){t.next=21;break}return j(!1),t.abrupt("return",a);case 21:return t.finish(17);case 22:case"end":return t.stop()}}),t,null,[[6,13,17,22]])})));return function(e){return t.apply(this,arguments)}}();return Object(y.debounce)(t,g)}),[e,g]);Object(p.useEffect)((function(){(null===w||void 0===w?void 0:w.code)&&function(){var t=l(o.a.mark((function t(){var n,r,a,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,_([]),j(!0),t.next=5,e(w.code);case 5:if(n=t.sent,_(n),n&&0!==n.length){t.next=9;break}return t.abrupt("return");case 9:r=null,w.type&&(null===(a=n.find((function(t){var e;return t.label.toLowerCase()===(null===(e=k[w.type])||void 0===e?void 0:e.label.toLowerCase())})))||void 0===a?void 0:a.options)&&(r=a.options.find((function(t){return t.code.toLowerCase()===w.code.toLowerCase()||t.selectedValue.toLowerCase()===w.code.toLowerCase()}))),r||(r=n.map((function(t){return t.options})).flat().find((function(t){return t.code.toLowerCase()===w.code.toLowerCase()||t.selectedValue.toLowerCase()===w.code.toLowerCase()}))),r&&S&&(i=Vt(r),S([i])),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),St.isLocal()&&console.error("Error loading default location:",t.t0);case 18:return t.prev=18,j(!1),t.finish(18);case 21:case"end":return t.stop()}}),t,null,[[0,15,18,21]])})));return function(){return t.apply(this,arguments)}}()()}),[null===w||void 0===w?void 0:w.code,null===w||void 0===w?void 0:w.type]);var D=T||I.trim()||(null===a||void 0===a?void 0:a.length)>0,V=M&&D?2:3;return m.a.createElement(m.a.Fragment,null,m.a.createElement(nt,null),m.a.createElement(rt,Object.assign({maxTagCount:V,onSearch:z,$hasError:i,loading:T,options:E,filterOption:!1,notFoundContent:m.a.createElement(xe,{isLoading:T,recentSearches:a,searchKey:I,dataTestId:u,setIsOpen:U,onRecentSearchSelect:O.onRecentSearchSelect,initialValues:O.initialValues}),mode:c,"data-test-id":"".concat(u,"-selector"),allowClear:c===L,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:function(t){U(t),_([]),A("")},open:M&&(T||I.trim()||(null===a||void 0===a?void 0:a.length)>0),value:f,onChange:S},O),n(E)))},Le=function(t){var e=t.omittedPorts,n=t.dataTestId,r=e.map((function(t){var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue}));return m.a.createElement(v.Tooltip,{title:r.join(",")},m.a.createElement(ot,{"data-test-id":"".concat(n,"-extra-ports")},"+".concat(e.length)))},_e=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation","autofillLocationAddress","autofillLocationCode","userCountryCode"];e.default=function(t){var e=t.value,n=t.onChange,r=t.hasError,a=t.dataTestId,i=void 0===a?"location-input":a,u=t.isOriginLocation,f=void 0===u||u,y=t.maxPorts,g=void 0===y?1:y,b=t.supportedLocationModes,w=t.customer,x=t.defaultLocation,E=t.autofillLocationAddress,P=t.autofillLocationCode,I=t.userCountryCode,F=d(t,_e),R=s(Object(p.useState)(e),2),M=R[0],U=R[1],N=s(Object(p.useState)(1===b.length?b[0]:""),2),z=N[0],D=N[1],V=s(Object(p.useState)(Ft(z)||""===z?L:_),2),$=V[0],W=V[1],G=Object(p.useRef)(e),X=Object(p.useRef)(null);Object(p.useEffect)((function(){Ft(z)?W(L):W(_)}),[z]),Object(p.useEffect)((function(){U(e),G.current=e,Array.isArray(e)&&e.length>0?D(e[0].type):(null===x||void 0===x?void 0:x.type)?D(x.type):D("")}),[e,null===x||void 0===x?void 0:x.type]);var B=Object(p.useRef)({onChange:n,selectionMode:$,maxPorts:g});return Object(p.useEffect)((function(){B.current={onChange:n,selectionMode:$,maxPorts:g}}),[n,$,g]),Object(p.useEffect)((function(){var t="".concat(E||"","::").concat(P||"");if((E||P)&&t!==X.current){var e=G.current,n=B.current,r=n.selectionMode,a=n.maxPorts,i=r===_&&"number"===typeof a&&a>1&&Array.isArray(e)&&e.length<a;if(!function(t){return!!t&&(Array.isArray(t)?t.length>0:Object.keys(t).length>0)}(e)||i)(function(){var e=l(o.a.mark((function e(){var n,r,a,i,u,l,s,d,f,p,m;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$t({autofillLocationAddress:E,autofillLocationCode:P,supportedLocationModes:b,customer:w,userCountryCode:I});case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(r=B.current,a=r.onChange,i=r.selectionMode,u=r.maxPorts,l=G.current,!(i===_&&"number"===typeof u&&u>1&&Array.isArray(l))){e.next=19;break}if(s=Et(n),d=new Set((l||[]).map((function(t){return xt((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue))}))),s&&!d.has(s)){e.next=13;break}return e.abrupt("return");case 13:f=Ct(l)||[],p=Array.isArray(f)?f.filter(Boolean):[],m=[].concat(c(p),[n]).slice(0,u),It(m,i,u,U,a),e.next=20;break;case 19:It(i===_?[n]:n,i,u,U,a);case 20:X.current=t,e.next=26;break;case 23:e.prev=23,e.t0=e.catch(0),console.error("Error performing autofill:",e.t0);case 26:case"end":return e.stop()}}),e,null,[[0,23]])})));return function(){return e.apply(this,arguments)}})()()}}),[E,P,b,w,I]),m.a.createElement(ke,Object.assign({mode:$,dataTestId:i,hasError:r,placeholder:m.a.createElement(h.TranslatableText,{style:{fontSize:v.tokens.fdsFontSizeBase},stringId:"Select ".concat(f?C:T)}),value:Ct(M),fetchOptions:jt(z,b,w),renderedOptions:function(t){return function(t,e){if((t||[]).some((function(t){var e;return(null===t||void 0===t||null===(e=t.options)||void 0===e?void 0:e.length)>0})))return t.map((function(t){var n,r=Object.values(k).find((function(e){return e.label===t.label})),o=null===r||void 0===r?void 0:r.icon;return m.a.createElement(v.Select.OptGroup,{label:m.a.createElement("span",{style:{fontFamily:"Open Sans"}},m.a.createElement(v.Icon,{size:"tiny",type:o}),"\xa0 \xa0",t.label),key:t.label,"data-test-id":"".concat(e,"-group-").concat(t.label)},null===(n=t.options)||void 0===n?void 0:n.map((function(n){var r=n.countryCode,a=n.selectedValue,i=n.displayLabel,c=n.type;return m.a.createElement(v.Option,{value:_t(n),title:a,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(a),style:{paddingLeft:"8px"},label:m.a.createElement(m.a.Fragment,null,m.a.createElement(v.Icon,{type:o,size:"tiny"}),"\xa0",m.a.createElement(ot,null,a)),key:n.code},m.a.createElement(Z,{fullWidth:!0,justifyContent:"space-between"},m.a.createElement(Z,{spacing:A.XSMALL},m.a.createElement("span",null,m.a.createElement(v.Avatar,{type:"flag",country:r,size:"small",style:{width:v.tokens.fdsSizeSm,height:v.tokens.fdsSizeSm}})),m.a.createElement(at,null,i)),c===S&&m.a.createElement(v.Icon,{type:"amazon",size:"small"}),c===O&&m.a.createElement(v.Chip,{type:"neutral",iconType:"address-book"})))})))}))}(t,i)},onChange:function(t){var e=null!==t&&void 0!==t?t:[],r=$===_&&Array.isArray(e)&&e.length>0?function(t,e){var n,r=new Map,o=j(Array.isArray(e)?e:[]);try{for(o.s();!(n=o.n()).done;){var a,i=n.value,c=At(i);c&&r.set(c,(null!==(a=r.get(c))&&void 0!==a?a:0)+1)}}catch(O){o.e(O)}finally{o.f()}var u,l=new Map,d=j(t);try{for(d.s();!(u=d.n()).done;){var f,p=u.value,m=At(p);m&&l.set(m,(null!==(f=l.get(m))&&void 0!==f?f:0)+1)}}catch(O){d.e(O)}finally{d.f()}var v,h=j(l);try{for(h.s();!(v=h.n()).done;){var y,g=s(v.value,2),b=g[0],w=g[1],S=null!==(y=r.get(b))&&void 0!==y?y:0;if(w>S&&S>0)return b}}catch(O){h.e(O)}finally{h.f()}return null}(e,M):null;null!==r?function(t,e,n,r){var o=(Array.isArray(e)?e:[]).filter((function(e){return At(e)!==t}));n(o),Pt(o,r)}(r,M,U,n):It(e,$,g,U,n),D("")},activeLocationMode:z,maxTagPlaceholder:function(t){return m.a.createElement(Le,{omittedPorts:t,dataTestId:i})},defaultLocation:x},F))}}])}));
|
|
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,u,n,r,o){return function(t){var e={};function u(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,u),r.l=!0,r.exports}return u.m=t,u.c=e,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)u.d(n,r,function(e){return t[e]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="http://ship.freightos.local:8800/FusionLocationInput/",u(u.s=7)}([function(e,u){e.exports=t},function(t,u){t.exports=e},function(t,e,u){t.exports=u(8)},function(t,e){t.exports=u},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=o},function(t,e,u){t.exports=u(9)},function(t,e,u){var n=function(t){"use strict";var e=Object.prototype,u=e.hasOwnProperty,n="function"===typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function i(t,e,u){return Object.defineProperty(t,e,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(w){i=function(t,e,u){return t[e]=u}}function c(t,e,u,n){var r=e&&e.prototype instanceof D?e:D,o=Object.create(r.prototype),a=new g(n||[]);return o._invoke=function(t,e,u){var n="suspendedStart";return function(r,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===r)throw o;return B()}for(u.method=r,u.arg=o;;){var a=u.delegate;if(a){var i=h(a,u);if(i){if(i===s)continue;return i}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===n)throw n="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);n="executing";var c=l(t,e,u);if("normal"===c.type){if(n=u.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:u.done}}"throw"===c.type&&(n="completed",u.method="throw",u.arg=c.arg)}}}(t,u,a),o}function l(t,e,u){try{return{type:"normal",arg:t.call(e,u)}}catch(w){return{type:"throw",arg:w}}}t.wrap=c;var s={};function D(){}function d(){}function f(){}var p={};i(p,r,(function(){return this}));var m=Object.getPrototypeOf,F=m&&m(m(b([])));F&&F!==e&&u.call(F,r)&&(p=F);var v=f.prototype=D.prototype=Object.create(p);function C(t){["next","throw","return"].forEach((function(e){i(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){var n;this._invoke=function(r,o){function a(){return new e((function(n,a){!function n(r,o,a,i){var c=l(t[r],t,o);if("throw"!==c.type){var s=c.arg,D=s.value;return D&&"object"===typeof D&&u.call(D,"__await")?e.resolve(D.__await).then((function(t){n("next",t,a,i)}),(function(t){n("throw",t,a,i)})):e.resolve(D).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,i)}))}i(c.arg)}(r,o,n,a)}))}return n=n?n.then(a,a):a()}}function h(t,e){var u=t.iterator[e.method];if(void 0===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,h(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 n=l(u,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var r=n.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function A(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 y(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function g(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function b(t){if(t){var e=t[r];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(u.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:B}}function B(){return{value:void 0,done:!0}}return d.prototype=f,i(v,"constructor",f),i(f,"constructor",d),d.displayName=i(f,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,i(t,a,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},C(E.prototype),i(E.prototype,o,(function(){return this})),t.AsyncIterator=E,t.async=function(e,u,n,r,o){void 0===o&&(o=Promise);var a=new E(c(e,u,n,r),o);return t.isGeneratorFunction(u)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},C(v),i(v,a,"Generator"),i(v,r,(function(){return this})),i(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var u in t)e.push(u);return e.reverse(),function u(){for(;e.length;){var n=e.pop();if(n in t)return u.value=n,u.done=!1,u}return u.done=!0,u}},t.values=b,g.prototype={constructor:g,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(y),!t)for(var e in this)"t"===e.charAt(0)&&u.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 n(u,n){return a.type="throw",a.arg=t,e.next=u,n&&(e.method="next",e.arg=void 0),!!n}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var i=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,s):this.complete(a)},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 u=this.tryEntries[e];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),y(u),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var u=this.tryEntries[e];if(u.tryLoc===t){var n=u.completion;if("throw"===n.type){var r=n.arg;y(u)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,u){return this.delegate={iterator:b(t),resultName:e,nextLoc:u},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=n}catch(r){"object"===typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,u){"use strict";u.r(e);var n=u(2),r=u.n(n);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var u=0,n=new Array(e);u<e;u++)n[u]=t[u];return n}function a(t,e){if(t){if("string"===typeof t)return o(t,e);var u=Object.prototype.toString.call(t).slice(8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?Array.from(u):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?o(t,e):void 0}}function i(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||a(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 c(t,e,u,n,r,o,a){try{var i=t[o](a),c=i.value}catch(l){return void u(l)}i.done?e(c):Promise.resolve(c).then(n,r)}function l(t){return function(){var e=this,u=arguments;return new Promise((function(n,r){var o=t.apply(e,u);function a(t){c(o,n,r,a,i,"next",t)}function i(t){c(o,n,r,a,i,"throw",t)}a(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 u=[],n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done)&&(u.push(a.value),!e||u.length!==e);n=!0);}catch(c){r=!0,o=c}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return u}}(t,e)||a(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 u,n,r=function(t,e){if(null==t)return{};var u,n,r={},o=Object.keys(t);for(n=0;n<o.length;n++)u=o[n],e.indexOf(u)>=0||(r[u]=t[u]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)u=o[n],e.indexOf(u)>=0||Object.prototype.propertyIsEnumerable.call(t,u)&&(r[u]=t[u])}return r}var d,f=u(0),p=u.n(f),m=u(1),F=u(4),v=u(6);function C(t,e,u){return e in t?Object.defineProperty(t,e,{value:u,enumerable:!0,configurable:!0,writable:!0}):t[e]=u,t}var E="airport",h="seaport",A="fulfillment_center",y="address_book",g="last_mile_address",b="address",B=(C(d={},E,{label:"Airports",key:E,icon:"mode-air"}),C(d,h,{label:"Ports",key:h,icon:"mode-ship"}),C(d,A,{label:"Fulfillment centers",key:A,icon:"fulfillment-center"}),C(d,y,{key:y,groupedBy:"address"}),C(d,g,{key:g,groupedBy:"address"}),C(d,b,{label:"Address",key:b,icon:"location"}),d),w="single",S="multiple",x="origin",O="destination";function k(t){if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=a(t))){var e=0,u=function(){};return{s:u,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,r,o=!0,i=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw r}}}}function L(t,e){var u=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),u.push.apply(u,n)}return u}function _(t){for(var e=1;e<arguments.length;e++){var u=null!=arguments[e]?arguments[e]:{};e%2?L(Object(u),!0).forEach((function(e){C(t,e,u[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(u)):L(Object(u)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(u,e))}))}return t}var T={XXLARGE:m.tokens.fdsComponentSpacingXxl,XLARGE:m.tokens.fdsComponentSpacingXl,LARGE:m.tokens.fdsComponentSpacingLg,MEDIUM:m.tokens.fdsComponentSpacingMd,SMALL:m.tokens.fdsComponentSpacingSm,XSMALL:m.tokens.fdsComponentSpacingXs,XXSMALL:m.tokens.fdsComponentSpacingXxs,NONE:0},j="vertical",P="horizontal";function I(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var M,N,R,z,U,V,$,q,W,G,X,K=u(3),J=u.n(K),H=J.a.div(M||(M=I(["\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===j?"column":"row"}),(function(t){return t.$wrap?"wrap":"nowrap"}),(function(t){return t.$alignItems}),(function(t){return t.$justifyContent}),(function(t){return t.$fullWidth&&Object(K.css)(N||(N=I(["\n\t\t\twidth: 100%;\n\t\t"])))}),(function(t){var e=t.$direction,u=t.$spacing;return e===j?Object(K.css)(R||(R=I(["\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 "])),u):Object(K.css)(z||(z=I(["\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 "])),u)})),Z=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],Y=function(t){var e=t.direction,u=void 0===e?P:e,n=t.alignItems,r=void 0===n?"start":n,o=t.spacing,a=void 0===o?T.NONE:o,i=t.wrap,c=t.justifyContent,l=t.fullWidth,s=D(t,Z);return p.a.createElement(H,Object.assign({},s,{$direction:u,$alignItems:r,$spacing:a,$wrap:i,$justifyContent:c,$fullWidth:l}),s.children)},Q=u(5),tt=u.n(Q),et=function(){var t=l(r.a.mark((function t(e,u,n){var o,a;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,o=(e||[]).filter((function(t){return B[t]})).reduce((function(t,e){return _(_({},t),{},C({},B[e].key,_(_({type:e.toUpperCase()},(null===n||void 0===n?void 0:n.code)?{searchTerm:n.name}:{}),B[e].groupedBy?{groupedBy:B[e].groupedBy}:{})))}),{}),0!==Object.keys(o).length){t.next=4;break}return t.abrupt("return",{results:{}});case 4:return t.next=6,tt.a.post("/geocoder/api/v3/geocoder/locations",{query:u,limit:5,sources:o});case 6:return a=t.sent,t.abrupt("return",a.data);case 10:return t.prev=10,t.t0=t.catch(0),console.error("Error fetching locations:",t.t0),t.abrupt("return",{results:{}});case 14:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,u,n){return t.apply(this,arguments)}}(),ut=Object(K.createGlobalStyle)(U||(U=I(["\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"]))),nt=J()(m.Select)(V||(V=I(["\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"])),m.tokens.fdsBorderRadiusXl,m.tokens.fdsColorPrimaryBlue,m.tokens.fdsColorPrimaryBlue,m.tokens.fdsColorPrimaryBlue10,m.tokens.fdsComponentSpacingXxs,m.tokens.fdsSizeMd,(function(t){return"large"===t.size?"\n\t\t\tmargin-top: ".concat(m.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"}),m.tokens.fdsColorPrimaryBlue,m.tokens.fdsComponentSpacingXs,m.tokens.fdsSizeMd,m.tokens.fdsSizeMd,m.tokens.fdsColorPrimaryGray80,(function(t){return t.$hasError&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(m.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(m.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(m.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(m.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")})),rt=J.a.span($||($=I(["\n\tfont-size: "," !important;\n"])),m.tokens.fdsFontSizeSm),ot=J.a.div(q||(q=I(["\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"])),m.tokens.fdsFontSizeSm),at=J()(m.Menu)(W||(W=I(["\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"])),m.tokens.fdsBodyTextColorDisabled),it=J.a.div(G||(G=I(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),m.tokens.fdsFontSizeSm,m.tokens.fdsSizeSm,m.tokens.fdsHeadingsFontFamily);J()(m.Icon)(X||(X=I(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"])));function ct(t,e){for(var u=0;u<e.length;u++){var n=e[u];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var lt,st,Dt,dt,ft,pt,mt,Ft,vt,Ct,Et,ht,At=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,u,n;return e=t,n=[{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}}],(u=null)&&ct(e.prototype,u),n&&ct(e,n),t}(),yt=["address"],gt=function(t){return(t||"").trim().toUpperCase()},bt=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 gt((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},Bt=function(t){var e=[];JSON.stringify(t,(function(t,u){return e.push(t),u}));var u=Array.from(new Set(e)).sort();return JSON.stringify(t,u)},wt=function(t){var e=t||{},u=e.displayLabel,n=e.selectedValue,r=e.formattedNameOrAddress,o=e.code,a=e.countryCode,i=e.stateOrProvince,c=e.city,l=e.latitude,s=e.longitude,D=e.postalOrZipCode,d=e.sourceType,f=e.locationType,p=e.type;return{displayLabel:u,selectedValue:n||o,formattedNameOrAddress:r,code:o||n,country:a,countryName:e.countryName,stateOrProvince:null!==i&&void 0!==i?i:null,city:null!==c&&void 0!==c?c: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!==d&&void 0!==d?d:null,locationType:null!==f&&void 0!==f?f:null,type:null!==p&&void 0!==p?p:d}},St=function(t){try{var e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(Pt(t.key)):t;return Bt(wt(e))}catch(u){return Bt(wt(t))}},xt=function(t){var e=function(t){return function(t){if(t){var e,u=t.label||t.selectedValue;return{key:St(t),label:u?p.a.createElement(p.a.Fragment,null,p.a.createElement(m.Icon,{type:t.sourceType?null===(e=B[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",p.a.createElement(rt,null,u)):void 0}}}(t)};return Array.isArray(t)?t.map(e):e(t)},Ot=function(t){var e=_({},t),u=t[b].filter((function(t){return t.sourceType===A}));if(u.length>0){var n,r=e,o=r.address;e=_(_({},D(r,yt)),{},(C(n={},A,u),C(n,"address",o.filter((function(t){return t.type!==A}))),n))}return e},kt=function(t,e,u){return function(){var n=l(r.a.mark((function n(o){var a,i,c;return r.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(o){n.next=2;break}return n.abrupt("return",[]);case 2:return a=""!==t?[t]:e,n.next=5,et(a,o,u);case 5:return i=n.sent,(c=i.results)[b]&&(c=Ot(c)),n.abrupt("return",Object.keys(c).map((function(t){var e;return{label:(null===(e=B[t])||void 0===e?void 0:e.label)||t,options:c[t].map((function(t){return _(_({},t),{},{type:t.sourceType})}))}})));case 9:case"end":return n.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}()},Lt=function(){var t=l(r.a.mark((function t(e,u){var n,o;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Array.isArray(e)?e:[e],t.next=3,Promise.all(n.map(function(){var t=l(r.a.mark((function t(e){var u,n,o;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,u=null===e||void 0===e?void 0:e.key,n=Pt(u),o=JSON.parse(n),t.abrupt("return",_({key:n},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,u(o.filter(Boolean));case 5:case"end":return t.stop()}}),t)})));return function(e,u){return t.apply(this,arguments)}}(),_t=function(t,e,u,n,r){if(e===S){var o=Array.isArray(t)?t:[];if(o.length<=u)n(o),Lt(o,r);else{var a,i,c=(null===(a=JSON.parse(null===(i=o[0])||void 0===i?void 0:i.key))||void 0===a?void 0:a.sourceType)===E?u>1?"airports":"airport":u>1?"ports":"port";m.Message.danger(p.a.createElement(p.a.Fragment,null,p.a.createElement(F.TranslatableText,{stringId:"You cannot enter more than"})," "," ",u," "," ",p.a.createElement(F.TranslatableText,{stringId:c})))}}else n(t),Lt(t,r)},Tt=function(t){var e,u,n,r=null;try{if("string"===typeof(null===t||void 0===t?void 0:t.key)){var o=JSON.parse(t.key);r=(null===o||void 0===o?void 0:o.code)||(null===o||void 0===o?void 0:o.selectedValue)||null}}catch(a){}return((null!==(e=null!==(u=null!==(n=r)&&void 0!==n?n:null===t||void 0===t?void 0:t.code)&&void 0!==u?u:null===t||void 0===t?void 0:t.selectedValue)&&void 0!==e?e:"")||"").trim().toUpperCase()},jt=function(t){return t&&(t===b||t===g||t===y||t===A)},Pt=function(t){return"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t},It=function(t){return(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/(?:(?![0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])[\s\S])+/g," ").trim()},Mt=function(t){return It(t).split(" ").filter(Boolean)},Nt=/^\d+[a-z]?$/,Rt=function(t){return(t||"").split(",")[0].trim()},zt=function(t,e,u,n){var r=new Set(Mt(function(t){return[null===t||void 0===t?void 0:t.formattedNameOrAddress,null===t||void 0===t?void 0:t.displayLabel,null===t||void 0===t?void 0:t.selectedValue].filter(Boolean).join(" ")}(t)));if(0===r.size)return 0;if(n){if(0===u.length)return 0;if(!u.every((function(t){return r.has(t)})))return 0;var o=It(null===t||void 0===t?void 0:t.postalOrZipCode);if(u.every((function(t){return t===o})))return 0}return e.filter((function(t){return r.has(t)})).length/e.length},Ut=function(t,e){var u=t[b]||[],n=t[A]||[],r=Mt(e);if(0===r.length)return[];var o=function(t){return Mt(Rt(t)).filter((function(t){return Nt.test(t)}))}(e);return[].concat(i(u.map((function(t){return{address:t,requiresStreetNumber:!0}}))),i(n.map((function(t){return{address:t,requiresStreetNumber:!1}})))).map((function(t){var e=t.address,u=t.requiresStreetNumber;return{address:e,score:zt(e,r,o,u)}})).filter((function(t){return t.score>=.5})).sort((function(t,e){return e.score-t.score}))},Vt=function(t,e){if(0===t.length)return null;var u=t[0].score,n=t.filter((function(t){return t.score===u})).map((function(t){return t.address}));if(1===n.length||!e)return n[0];var r=e.toLowerCase();return n.find((function(t){return(t.countryCode||t.country||"").toLowerCase()===r}))||n[0]},$t=function(t,e){var u=t[E]||[],n=t[h]||[],r=gt(e);return[].concat(i(u),i(n)).find((function(t){return gt(null===t||void 0===t?void 0:t.code)===r}))},qt=function(t){var e=t.selectedValue||t.displayLabel||t.code,u=_(_({},t),{},{selectedValue:e,displayLabel:t.displayLabel||e,country:t.countryCode||t.country,type:t.type||t.sourceType});return u.country&&delete u.countryCode,{key:JSON.stringify(u),label:e}},Wt=function(t){return(t||[]).some(jt)},Gt=function(){var t=l(r.a.mark((function t(e){var u,n,o,a,i,c,l;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=e.query,n=e.supportedLocationModes,o=e.customer,a=e.userCountryCode,t.next=3,et(n,u,o);case 3:return i=t.sent,c=i.results,l=void 0===c?{}:c,t.abrupt("return",Vt(Ut(l,u),a));case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Xt=function(){var t=l(r.a.mark((function t(e){var u,n,o,a,i,c,l,D,d,f,p,m,F;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=e.autofillLocationAddress,n=e.autofillLocationCode,o=e.supportedLocationModes,a=e.customer,i=e.userCountryCode,u||n){t.next=3;break}return t.abrupt("return",null);case 3:if(c=null,!u||!Wt(o)){t.next=13;break}return l=Rt(u),t.next=8,Promise.all([Gt({query:u,supportedLocationModes:o,customer:a,userCountryCode:i}),l&&l!==u.trim()?Gt({query:l,supportedLocationModes:o,customer:a,userCountryCode:i}):null]);case 8:D=t.sent,d=s(D,2),f=d[0],p=d[1],c=f||p;case 13:if(c||!n){t.next=20;break}return t.next=16,et(o,n,a);case 16:m=t.sent,F=m.results,c=$t(void 0===F?{}:F,n);case 20:return t.abrupt("return",c?qt(c):null);case 21:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Kt="totalShipment",Jt="unitsShipment",Ht="containerPackages",Zt="celsius",Yt="fahrenheit",Qt="COL",te="ERT",ee="CRT",ue=(C(ft={},"FRO",(C(lt={},Zt,"-10\xbaC or below"),C(lt,Yt,"14\xbaF or below"),lt)),C(ft,Qt,(C(st={},Zt,"From +2\xbaC To +8\xbaC"),C(st,Yt,"From 35.6\xbaF To 46.4\xbaF"),st)),C(ft,te,(C(Dt={},Zt,"From +2\xbaC To +25\xbaC"),C(Dt,Yt,"From 35.6\xbaF To 77\xbaF"),Dt)),C(ft,ee,(C(dt={},Zt,"From +15\xbaC To +25\xbaC"),C(dt,Yt,"From 59\xbaF To 77\xbaF"),dt)),ft),ne="quotation",re="units",oe="totals",ae="container",ie="CBM",ce="CFT",le="kg",se="box",De="uld",de=function(){var t=l(r.a.mark((function t(e){var u,n,o,a,c,l,s,D;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=e.method,n=e.url,o=void 0===n?"":n,a=e.data,c=void 0===a?{}:a,l=e.options,s=void 0===l?{}:l,D=function(){if("get"===u)return[Object.keys(c).length?"".concat(o,"?").concat(new URLSearchParams(c).toString()):o,s];if("post"===u){var t=_(_({},null===s||void 0===s?void 0:s.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[o,c,_(_({},s),{},{headers:t})]}return[o,c,s]}(),t.next=4,tt.a[u].apply(tt.a,i(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)}}(),fe=function(){var t=l(r.a.mark((function t(e){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,de({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)}}(),pe=J.a.div(pt||(pt=I(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),m.tokens.fdsColorPrimaryGray60,m.tokens.fdsSizeXs,m.tokens.fdsFontWeightRegular,m.tokens.fdsComponentSpacingSm,m.tokens.fdsComponentSpacingSm),me=J()(Y)(mt||(mt=I(["\n\tpadding-left: 0 !important;\n"]))),Fe=J()(m.Icon)(Ft||(Ft=I(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),ve=J.a.span(vt||(vt=I(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),m.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",";")})),Ce=J()(m.Avatar)(Ct||(Ct=I(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),m.tokens.fdsColorPrimaryGray20,m.tokens.fdsSizeSm,m.tokens.fdsSizeSm),Ee=J()(Y)(Et||(Et=I(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),he=J()(Y)(ht||(ht=I(["\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"},ye=function(t){var e=t.reduce((function(t,e){var u=e.country;return t[u]||(t[u]=[]),t[u].push(e),t}),{});return Object.keys(e).forEach((function(t){e[t].sort((function(t,e){return(t.selectedValue||"").localeCompare(e.selectedValue||"")}))})),e},ge=function(t){var e=t.text,u=void 0===e?"":e,n=t.testId,r=t.isPort,o=void 0===r?void 0:r,a=t.isLocationLabel,i=void 0!==a&&a,c=t.children,l=void 0===c?null:c,D=Object(f.useRef)(null),d=s(Object(f.useState)(!1),2),F=d[0],v=d[1];Object(f.useEffect)((function(){!function(){if(D.current){var t=D.current,e=t.scrollWidth>t.clientWidth;v(e)}}()}),[u]);var C=p.a.createElement(ve,{ref:D,"data-test-id":n,$isLocationLabel:i,$isPort:o},l||u);return F?p.a.createElement(m.Tooltip,{title:u,"data-test-id":"".concat(n,"-tooltip")},p.a.createElement(ve,{ref:D,"data-test-id":n,$isLocationLabel:i,$isPort:o},l||u)):C},be=function(t){var e=t.search,u=t.index,n=t.dataTestId,r=e.origin.length>1,o=e.destination.length>1,a=r?ye(e.origin):C({},e.origin[0].country,e.origin),i=o?ye(e.destination):C({},e.destination[0].country,e.destination);return p.a.createElement(Y,{alignItems:"center",spacing:T.XSMALL,fullWidth:!0},Object.keys(a).map((function(t){var e=a[t].map((function(t){return t.selectedValue})).join(", ");return p.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(n,"-origin-").concat(u),isPort:a[t][0].type===h},p.a.createElement(Ce,{type:"flag",country:t,size:"small","data-test-id":"".concat(n,"-origin-flag-").concat(u),style:{marginRight:"4px"}}),e)})),p.a.createElement(m.Icon,{type:"arrow-forward",style:{marginRight:0,color:m.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(i).map((function(t){var e=i[t].map((function(t){return t.selectedValue})).join(", ");return p.a.createElement(ge,{key:t,text:e,isLocationLabel:!0,testId:"".concat(n,"-destination-").concat(u),isPort:i[t][0].type===h},p.a.createElement(Ce,{type:"flag",country:t,size:"small","data-test-id":"".concat(n,"-destination-flag-").concat(u),style:{marginRight:"4px"}}),e)})))},Be=function(t){var e,u,n,r=t.search,o=t.index,a=t.dataTestId,i=r.platform_type,c=function(t){var e=t.shipment_details.type;if(e===oe)return["box-total"];if(e===re){var u=t.shipment_details[Jt];return(null===u||void 0===u?void 0:u.packageType)===se?u.boxPackages.reduce((function(t,e){var u,n,r=null===(u=e.type)||void 0===u||null===(n=u.value)||void 0===n?void 0:n.icon;return t.includes(r)||t.push(r),t}),[]):(null===u||void 0===u?void 0:u.packageType)===De?["uld"]:["box"]}return e===ae?["container"]:["box"]}(r),l=Object(f.useMemo)((function(){return function(t){var e=t.shipment_details.type;if(t.platform_type===ne)return{units:0,volume:0,weight:0,weightUnit:le,volumeUnit:ie};switch(e){case ae:var u,n=0,r=0;return null===(u=t.shipment_details[Ht])||void 0===u||u.forEach((function(t){var e=Number(t.units)||0;if(e>0){n+=e;var u=parseInt(t.dimensions.value,10);r+=e*(u/20)}})),{units:n,volume:r,weight:null,weightUnit:null,volumeUnit:"TEU"};case re:var o=t.shipment_details[Jt],a=(null===o||void 0===o?void 0:o.volumeUnit)===ce?1728:1e6;if((null===o||void 0===o?void 0:o.packageType)===se){var i=Ae(null===o||void 0===o?void 0:o.boxPackages.reduce((function(t,e){return t+parseFloat(e.width||"0")*parseFloat(e.height||"0")*parseFloat(e.length||"0")*parseFloat(e.units||"0")/a}),0)),c=Ae(o.boxPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:o.boxPackages.reduce((function(t,e){return t+parseFloat(e.units||"0")}),0),volume:i,weight:c,weightUnit:o.weightUnit,volumeUnit:o.volumeUnit}}if((null===o||void 0===o?void 0:o.packageType)===De){var l=Ae(o.uldPackages.reduce((function(t,e){return t+parseFloat(e.volume||"0")}),0)),s=Ae(o.uldPackages.reduce((function(t,e){return t+parseFloat(e.weight||"0")}),0));return{units:o.uldPackages.length,volume:l,weight:s,weightUnit:o.weightUnit,volumeUnit:o.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:le,volumeUnit:ie};case oe:var D,d,f,p,m,F=Ae(parseFloat((null===(D=t.shipment_details[Kt])||void 0===D?void 0:D.volume)||"0")),v=Ae(parseFloat((null===(d=t.shipment_details[Kt])||void 0===d?void 0:d.weight)||"0"));return{units:(null===(f=t.shipment_details[Kt])||void 0===f?void 0:f.units)||0,volume:F,weight:v,weightUnit:(null===(p=t.shipment_details[Kt])||void 0===p?void 0:p.weightUnit)||le,volumeUnit:(null===(m=t.shipment_details[Kt])||void 0===m?void 0:m.volumeUnit)||ie};default:return{units:0,volume:0,weight:0,weightUnit:le,volumeUnit:ie}}}(r)}),[r]),s=l.units,D=l.volume,d=l.weight,F=l.weightUnit,v=l.volumeUnit,C=1===r.commodity.length&&r.commodity[0].is_temperature,E=(null===(e=r.commodity_temperature)||void 0===e?void 0:e.tempRange)&&C?ue[null===(u=r.commodity_temperature)||void 0===u?void 0:u.tempRange][null===(n=r.commodity_temperature)||void 0===n?void 0:n.temperatureSystem]:"";return p.a.createElement(Y,{spacing:T.XSMALL,alignItems:"center",fullWidth:!0,key:o},i===ne?p.a.createElement(Ee,{alignItems:"center",spacing:T.SMALL,style:{flex:1}},c.map((function(t,e){return p.a.createElement(Fe,{type:t,key:"".concat(o,"-").concat(e),size:"tiny","data-test-id":"".concat(a,"rs-package-icon-").concat(o,"-").concat(e)})})),p.a.createElement(ge,{text:r.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(a,"rs-commodity-").concat(o)})):p.a.createElement(Ee,{alignItems:"center",spacing:T.SMALL},p.a.createElement(Y,{alignItems:"center",spacing:T.XSMALL,"data-test-id":"rs-".concat(o,"-units")},s,"\xa0",c.map((function(t,e){return p.a.createElement(Fe,{type:t,key:"".concat(o,"-").concat(e),size:"tiny","data-test-id":"".concat(a,"rs-package-icon-").concat(o,"-").concat(e)})}))),p.a.createElement("span",{"data-test-id":"".concat(a,"rs-volume-").concat(o)},D,"\xa0",v),d&&p.a.createElement("span",{"data-test-id":"".concat(a,"rs-weight-").concat(o)},d,"\xa0",F),p.a.createElement(ge,{text:r.commodity.map((function(t){return t.label})).join(", "),testId:"".concat(a,"rs-commodity-").concat(o)}),C&&p.a.createElement(Y,{alignItems:"center",spacing:T.XSMALL,"data-test-id":"".concat(a,"rs-temperature-").concat(o)},p.a.createElement(m.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(a,"rs-temperature-icon-").concat(o)}),p.a.createElement("span",{style:{whiteSpace:"nowrap"}},E))))},we=function(t){var e=t.search,u=t.index,n=t.setIsOpen,o=t.dataTestId,a=t.onRecentSearchSelect,i=function(){var t=l(r.a.mark((function t(){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(e),t.prev=1,t.next=4,fe(e.id);case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.error(t.t0);case 9:n(!1);case 10:case"end":return t.stop()}}),t,null,[[1,6]])})));return function(){return t.apply(this,arguments)}}();return p.a.createElement(me,{direction:j,fullWidth:!0,spacing:T.XSMALL,key:e.id,style:{padding:m.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(o,"rs-card-").concat(u),onClick:function(){i()}},p.a.createElement(be,{search:e,index:u,dataTestId:o}),p.a.createElement(Be,{search:e,index:u,dataTestId:o}))},Se=function(t){var e=t.recentSearches,u=t.setIsOpen,n=t.dataTestId,r=t.onRecentSearchSelect,o=t.initialValues,a=e?function(t){return i(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 u=new Date(t.saved_update_date).getTime();return new Date(e.saved_update_date).getTime()-u}var n=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()-n})).slice(0,6)}(e):[];return p.a.createElement(at,null,p.a.createElement(pe,null,p.a.createElement(m.Icon,{"data-test-id":"".concat(n,"rs-icon"),color:m.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),p.a.createElement(F.TranslatableText,{stringId:"Recent searches"})),p.a.createElement(he,{direction:j,fullWidth:!0},a.map((function(t,e){return p.a.createElement(we,{onRecentSearchSelect:r,initialValues:o,search:t,index:e,key:t.id,setIsOpen:u,dataTestId:n})}))))},xe=function(t){var e=t.isLoading,u=t.recentSearches,n=t.searchKey,r=t.dataTestId,o=t.setIsOpen,a=t.onRecentSearchSelect,i=t.initialValues;return n||u&&0!==u.length?e?p.a.createElement(m.Spin,{size:"small"}):(null===u||void 0===u?void 0:u.length)>0&&!n.trim()?p.a.createElement(Se,{recentSearches:u,dataTestId:r,setIsOpen:o,onRecentSearchSelect:a,initialValues:i}):n.trim()?p.a.createElement(it,null,p.a.createElement(F.TranslatableText,{stringId:"No matching results",module:F.TRANSLATION_MODULES.SearchAndBook})):null:null},Oe=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],ke=function(t){var e=t.fetchOptions,u=t.renderedOptions,n=t.recentSearches,o=void 0===n?[]:n,a=t.hasError,i=t.mode,c=t.dataTestId,d=t.value,F=t.debounceTimeout,C=void 0===F?800:F,E=t.activeLocationMode,h=t.defaultLocation,A=t.onChange,y=D(t,Oe),g=s(Object(f.useState)([]),2),b=g[0],S=g[1],x=s(Object(f.useState)(!1),2),O=x[0],k=x[1],L=s(Object(f.useState)(""),2),_=L[0],T=L[1],j=Object(f.useRef)(0),P=s(Object(f.useState)(!1),2),I=P[0],M=P[1],N=Object(f.useRef)();Object(f.useEffect)((function(){d&&0!==d.length||I||(S([]),T(""))}),[d,I]),Object(f.useEffect)((function(){return""!==E&&S((function(t){return t.filter((function(t){return t.label===B[E].label}))})),M(!1),N.current&&clearTimeout(N.current),N.current=setTimeout((function(){document.activeElement.blur(),document.body.click();var t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused")}),100),function(){N.current&&clearTimeout(N.current)}}),[E]);var R=Object(f.useMemo)((function(){var t=function(){var t=l(r.a.mark((function t(u){var n,o,a;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return T(u),j.current+=1,n=j.current,S([]),k(!0),o=null,t.prev=6,t.next=9,e(u);case 9:a=t.sent,n===j.current&&(S(a),o=a),t.next=17;break;case 13:t.prev=13,t.t0=t.catch(6),console.error("Error fetching options:",t.t0),n===j.current&&m.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."});case 17:if(t.prev=17,n!==j.current){t.next=21;break}return k(!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,C)}),[e,C]);Object(f.useEffect)((function(){(null===h||void 0===h?void 0:h.code)&&function(){var t=l(r.a.mark((function t(){var u,n,o,a;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,S([]),k(!0),t.next=5,e(h.code);case 5:if(u=t.sent,S(u),u&&0!==u.length){t.next=9;break}return t.abrupt("return");case 9:n=null,h.type&&(null===(o=u.find((function(t){var e;return t.label.toLowerCase()===(null===(e=B[h.type])||void 0===e?void 0:e.label.toLowerCase())})))||void 0===o?void 0:o.options)&&(n=o.options.find((function(t){return t.code.toLowerCase()===h.code.toLowerCase()||t.selectedValue.toLowerCase()===h.code.toLowerCase()}))),n||(n=u.map((function(t){return t.options})).flat().find((function(t){return t.code.toLowerCase()===h.code.toLowerCase()||t.selectedValue.toLowerCase()===h.code.toLowerCase()}))),n&&A&&(a=qt(n),A([a])),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),At.isLocal()&&console.error("Error loading default location:",t.t0);case 18:return t.prev=18,k(!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===h||void 0===h?void 0:h.code,null===h||void 0===h?void 0:h.type]);var z=O||_.trim()||(null===o||void 0===o?void 0:o.length)>0,U=I&&z?2:3;return p.a.createElement(p.a.Fragment,null,p.a.createElement(ut,null),p.a.createElement(nt,Object.assign({maxTagCount:U,onSearch:R,$hasError:a,loading:O,options:b,filterOption:!1,notFoundContent:p.a.createElement(xe,{isLoading:O,recentSearches:o,searchKey:_,dataTestId:c,setIsOpen:M,onRecentSearchSelect:y.onRecentSearchSelect,initialValues:y.initialValues}),mode:i,"data-test-id":"".concat(c,"-selector"),allowClear:i===w,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:function(t){M(t),S([]),T("")},open:I&&(O||_.trim()||(null===o||void 0===o?void 0:o.length)>0),value:d,onChange:A},y),u(b)))},Le=function(t){var e=t.omittedPorts,u=t.dataTestId,n=e.map((function(t){var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue}));return p.a.createElement(m.Tooltip,{title:n.join(",")},p.a.createElement(rt,{"data-test-id":"".concat(u,"-extra-ports")},"+".concat(e.length)))},_e=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation","autofillLocationAddress","autofillLocationCode","userCountryCode"];e.default=function(t){var e=t.value,u=t.onChange,n=t.hasError,o=t.dataTestId,a=void 0===o?"location-input":o,c=t.isOriginLocation,d=void 0===c||c,v=t.maxPorts,C=void 0===v?1:v,E=t.supportedLocationModes,h=t.customer,g=t.defaultLocation,b=t.autofillLocationAddress,L=t.autofillLocationCode,_=t.userCountryCode,j=D(t,_e),P=s(Object(f.useState)(e),2),I=P[0],M=P[1],N=s(Object(f.useState)(1===E.length?E[0]:""),2),R=N[0],z=N[1],U=s(Object(f.useState)(jt(R)||""===R?w:S),2),V=U[0],$=U[1],q=Object(f.useRef)(e),W=Object(f.useRef)(null);Object(f.useEffect)((function(){jt(R)?$(w):$(S)}),[R]),Object(f.useEffect)((function(){M(e),q.current=e,Array.isArray(e)&&e.length>0?z(e[0].type):(null===g||void 0===g?void 0:g.type)?z(g.type):z("")}),[e,null===g||void 0===g?void 0:g.type]);var G=Object(f.useRef)({onChange:u,selectionMode:V,maxPorts:C});return Object(f.useEffect)((function(){G.current={onChange:u,selectionMode:V,maxPorts:C}}),[u,V,C]),Object(f.useEffect)((function(){var t="".concat(b||"","::").concat(L||"");if((b||L)&&t!==W.current){var e=q.current,u=G.current,n=u.selectionMode,o=u.maxPorts,a=n===S&&"number"===typeof o&&o>1&&Array.isArray(e)&&e.length<o;if(!function(t){return!!t&&(Array.isArray(t)?t.length>0:Object.keys(t).length>0)}(e)||a)(function(){var e=l(r.a.mark((function e(){var u,n,o,a,c,l,s,D,d,f,p;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Xt({autofillLocationAddress:b,autofillLocationCode:L,supportedLocationModes:E,customer:h,userCountryCode:_});case 3:if(u=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(n=G.current,o=n.onChange,a=n.selectionMode,c=n.maxPorts,l=q.current,!(a===S&&"number"===typeof c&&c>1&&Array.isArray(l))){e.next=19;break}if(s=bt(u),D=new Set((l||[]).map((function(t){return gt((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:d=xt(l)||[],f=Array.isArray(d)?d.filter(Boolean):[],p=[].concat(i(f),[u]).slice(0,c),_t(p,a,c,M,o),e.next=20;break;case 19:_t(a===S?[u]:u,a,c,M,o);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)}})()()}}),[b,L,E,h,_]),p.a.createElement(ke,Object.assign({mode:V,dataTestId:a,hasError:n,placeholder:p.a.createElement(F.TranslatableText,{style:{fontSize:m.tokens.fdsFontSizeBase},stringId:"Select ".concat(d?x:O)}),value:xt(I),fetchOptions:kt(R,E,h),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 u,n=Object.values(B).find((function(e){return e.label===t.label})),r=null===n||void 0===n?void 0:n.icon;return p.a.createElement(m.Select.OptGroup,{label:p.a.createElement("span",{style:{fontFamily:"Open Sans"}},p.a.createElement(m.Icon,{size:"tiny",type:r}),"\xa0 \xa0",t.label),key:t.label,"data-test-id":"".concat(e,"-group-").concat(t.label)},null===(u=t.options)||void 0===u?void 0:u.map((function(u){var n=u.countryCode,o=u.selectedValue,a=u.displayLabel,i=u.type;return p.a.createElement(m.Option,{value:St(u),title:o,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(o),style:{paddingLeft:"8px"},label:p.a.createElement(p.a.Fragment,null,p.a.createElement(m.Icon,{type:r,size:"tiny"}),"\xa0",p.a.createElement(rt,null,o)),key:u.code},p.a.createElement(Y,{fullWidth:!0,justifyContent:"space-between"},p.a.createElement(Y,{spacing:T.XSMALL},p.a.createElement("span",null,p.a.createElement(m.Avatar,{type:"flag",country:n,size:"small",style:{width:m.tokens.fdsSizeSm,height:m.tokens.fdsSizeSm}})),p.a.createElement(ot,null,a)),i===A&&p.a.createElement(m.Icon,{type:"amazon",size:"small"}),i===y&&p.a.createElement(m.Chip,{type:"neutral",iconType:"address-book"})))})))}))}(t,a)},onChange:function(t){var e=null!==t&&void 0!==t?t:[],n=V===S&&Array.isArray(e)&&e.length>0?function(t,e){var u,n=new Map,r=k(Array.isArray(e)?e:[]);try{for(r.s();!(u=r.n()).done;){var o,a=u.value,i=Tt(a);i&&n.set(i,(null!==(o=n.get(i))&&void 0!==o?o:0)+1)}}catch(y){r.e(y)}finally{r.f()}var c,l=new Map,D=k(t);try{for(D.s();!(c=D.n()).done;){var d,f=c.value,p=Tt(f);p&&l.set(p,(null!==(d=l.get(p))&&void 0!==d?d:0)+1)}}catch(y){D.e(y)}finally{D.f()}var m,F=k(l);try{for(F.s();!(m=F.n()).done;){var v,C=s(m.value,2),E=C[0],h=C[1],A=null!==(v=n.get(E))&&void 0!==v?v:0;if(h>A&&A>0)return E}}catch(y){F.e(y)}finally{F.f()}return null}(e,I):null;null!==n?function(t,e,u,n){var r=(Array.isArray(e)?e:[]).filter((function(e){return Tt(e)!==t}));u(r),Lt(r,n)}(n,I,M,u):_t(e,V,C,M,u),z("")},activeLocationMode:R,maxTagPlaceholder:function(t){return p.a.createElement(Le,{omittedPorts:t,dataTestId:a})},defaultLocation:g},j))}}])}));
|
|
2
2
|
//# sourceMappingURL=main.bundle.js.map
|