Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/Options/util.es",["module","exports","require","data-engine-js-components-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.random=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},t.compose=function(...e){return e.reduceRight(((e,t)=>(...r)=>{const n=t(...r);return Array.isArray(n)?e(...n):e(n)}))},t.isOptionValueGenerated=function(e,t,r,o){if(e!==t)return!1;if(""===o.value)return!0;const i=r.indexOf(o);if(r.some((({value:e},t)=>e===o.value&&t!==i)))return!0;if(o.edited)return!1;if(new RegExp("^".concat(Liferay.Language.get("option"),"\\d*$")).test(o.value))return!0;if(new RegExp("^".concat(o.value.replace(/\d+$/,""),"\\d*")).test((0,n.normalizeFieldName)(o.label)))return!0;return!0},t.dedupValue=a,t.findDuplicateReference=l,t.getDefaultOptionValue=c,t.normalizeReference=f,t.normalizeValue=d,t.normalizeFields=function(e,t,r){return t.map(((n,o)=>{const u=d(e,n,t,r);return i(i({},n),{},{reference:f(t,i(i({},n),{},{value:u}),o),value:u})}))};var n=r("data-engine-js-components-web");function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t,r,o){let i=0;const u=(e,a)=>{const l=e.find((e=>{var t;return(null===(t=e.value)||void 0===t?void 0:t.toLowerCase())===(null==a?void 0:a.toLowerCase())}));l&&l.id!==r?o?(i+=1,u(e,t+i)):u(e,n.FieldSupport.getDefaultFieldName(!0)):t=a};return u(e,t),t}function l(e,t,r){return e.filter(((e,r)=>r!==t)).some((({reference:e})=>(null==e?void 0:e.toLowerCase())===(null==r?void 0:r.toLowerCase())))}function c(e,t){return e?t:n.FieldSupport.getDefaultFieldName(!0)}function f(e,t,r){const{reference:o,value:i}=t;return!o||l(e,r,o)?i||n.FieldSupport.getDefaultFieldName(!0):o}function d(e,t,r,o){const{label:i,value:u}=t;let l=u||c(o,i);return l||(l=Liferay.Language.get("option")),l=a(r,l,t.id,o),e?l:(0,n.normalizeFieldName)(l)}}}));
//# sourceMappingURL=util.es.js.map