"use strict";(globalThis.itsecWebpackJsonP=globalThis.itsecWebpackJsonP||[]).push([[3689],{23689:(e,t,o)=>{o.r(t),o.d(t,{default:()=>v,useCreatable:()=>d});var n=o(58168),i=o(51609),a=o(13526),r=o(52836),l=o(89379),u=o(45458),s=o(80045),c=o(63538),p=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],g=function(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,o=String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase(),n=String(t.getOptionValue(e)).toLowerCase(),i=String(t.getOptionLabel(e)).toLowerCase();return n===o||i===o},f={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,t,o,n){return!(!e||t.some((function(t){return g(e,t,n)}))||o.some((function(t){return g(e,t,n)})))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}};function d(e){var t=e.allowCreateWhileLoading,o=void 0!==t&&t,n=e.createOptionPosition,r=void 0===n?"last":n,g=e.formatCreateLabel,d=void 0===g?f.formatCreateLabel:g,v=e.isValidNewOption,O=void 0===v?f.isValidNewOption:v,C=e.getNewOptionData,b=void 0===C?f.getNewOptionData:C,w=e.onCreateOption,L=e.options,h=void 0===L?[]:L,m=e.onChange,A=(0,s.A)(e,p),N=A.getOptionValue,V=void 0===N?a.g:N,D=A.getOptionLabel,P=void 0===D?a.b:D,S=A.inputValue,W=A.isLoading,_=A.isMulti,k=A.value,M=A.name,y=(0,i.useMemo)((function(){return O(S,(0,c.H)(k),h,{getOptionValue:V,getOptionLabel:P})?b(S,d(S)):void 0}),[d,b,P,V,S,O,h,k]),H=(0,i.useMemo)((function(){return!o&&W||!y?h:"first"===r?[y].concat((0,u.A)(h)):[].concat((0,u.A)(h),[y])}),[o,r,W,y,h]),J=(0,i.useCallback)((function(e,t){if("select-option"!==t.action)return m(e,t);var o=Array.isArray(e)?e:[e];if(o[o.length-1]!==y)m(e,t);else if(w)w(S);else{var n=b(S,S),i={action:"create-option",name:M,option:n};m((0,c.D)(_,[].concat((0,u.A)((0,c.H)(k)),[n]),n),i)}}),[b,S,_,M,y,w,m,k]);return(0,l.A)((0,l.A)({},A),{},{options:H,onChange:J})}o(75795),o(27003);var v=(0,i.forwardRef)((function(e,t){var o=d((0,r.u)(e));return i.createElement(a.S,(0,n.A)({ref:t},o))}))}}]);