(function(T,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@mantine/core"),require("react")):typeof define=="function"&&define.amd?define(["exports","@mantine/core","react"],h):(T=typeof globalThis<"u"?globalThis:T||self,h(T.MantineTagInput={},T.core,T.require$$0))})(this,function(T,h,z){"use strict";const ae=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(z);var H={exports:{}},$={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ie;function Fe(){if(ie)return $;ie=1;var t=ae.default,f=Symbol.for("react.element"),E=Symbol.for("react.fragment"),P=Object.prototype.hasOwnProperty,F=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function k(C,b,s){var d,m={},R=null,j=null;s!==void 0&&(R=""+s),b.key!==void 0&&(R=""+b.key),b.ref!==void 0&&(j=b.ref);for(d in b)P.call(b,d)&&!x.hasOwnProperty(d)&&(m[d]=b[d]);if(C&&C.defaultProps)for(d in b=C.defaultProps,b)m[d]===void 0&&(m[d]=b[d]);return{$$typeof:f,type:C,key:R,ref:j,props:m,_owner:F.current}}return $.Fragment=E,$.jsx=k,$.jsxs=k,$}var Y={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ue;function Ie(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){var t=ae.default,f=Symbol.for("react.element"),E=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),C=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),N=Symbol.iterator,M="@@iterator";function U(e){if(e===null||typeof e!="object")return null;var r=N&&e[N]||e[M];return typeof r=="function"?r:null}var w=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a=1&&g>=0&&i[v]!==y[g];)g--;for(;v>=1&&g>=0;v--,g--)if(i[v]!==y[g]){if(v!==1||g!==1)do if(v--,g--,g<0||i[v]!==y[g]){var _=` `+i[v].replace(" at new "," at ");return e.displayName&&_.includes("")&&(_=_.replace("",e.displayName)),typeof e=="function"&&q.set(e,_),_}while(v>=1&&g>=0);break}}}finally{Z=!1,X.current=c,Ge(),Error.prepareStackTrace=o}var W=e?e.displayName||e.name:"",Ae=W?B(W):"";return typeof e=="function"&&q.set(e,Ae),Ae}function Ke(e,r,n){return _e(e,!1)}function ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function G(e,r,n){if(e==null)return"";if(typeof e=="function")return _e(e,ze(e));if(typeof e=="string")return B(e);switch(e){case s:return B("Suspense");case d:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case b:return Ke(e.render);case m:return G(e.type,r,n);case R:{var a=e,o=a._payload,c=a._init;try{return G(c(o),r,n)}catch{}}}return""}var J=Object.prototype.hasOwnProperty,Ee={},Re=w.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,n=G(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(n)}else Re.setExtraStackFrame(null)}function He(e,r,n,a,o){{var c=Function.call.bind(J);for(var u in e)if(c(e,u)){var i=void 0;try{if(typeof e[u]!="function"){var y=Error((a||"React class")+": "+n+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}i=e[u](r,u,a,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){i=v}i&&!(i instanceof Error)&&(K(o),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",n,u,typeof i),K(null)),i instanceof Error&&!(i.message in Ee)&&(Ee[i.message]=!0,K(o),l("Failed %s type: %s",n,i.message),K(null))}}}var Xe=Array.isArray;function Q(e){return Xe(e)}function pe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function Ze(e){try{return Te(e),!1}catch{return!0}}function Te(e){return""+e}function Ce(e){if(Ze(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",pe(e)),Te(e)}var L=w.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},we,Se,ee;ee={};function er(e){if(J.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function rr(e){if(J.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function tr(e,r){if(typeof e.ref=="string"&&L.current&&r&&L.current.stateNode!==r){var n=S(L.current.type);ee[n]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',S(L.current.type),e.ref),ee[n]=!0)}}function nr(e,r){{var n=function(){we||(we=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function ar(e,r){{var n=function(){Se||(Se=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var ir=function(e,r,n,a,o,c,u){var i={$$typeof:f,type:e,key:r,ref:n,props:u,_owner:c};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function ur(e,r,n,a,o){{var c,u={},i=null,y=null;n!==void 0&&(Ce(n),i=""+n),rr(r)&&(Ce(r.key),i=""+r.key),er(r)&&(y=r.ref,tr(r,o));for(c in r)J.call(r,c)&&!Qe.hasOwnProperty(c)&&(u[c]=r[c]);if(e&&e.defaultProps){var v=e.defaultProps;for(c in v)u[c]===void 0&&(u[c]=v[c])}if(i||y){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&nr(u,g),y&&ar(u,g)}return ir(e,i,y,o,a,L.current,u)}}var re=w.ReactCurrentOwner,Oe=w.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,n=G(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(n)}else Oe.setExtraStackFrame(null)}var te;te=!1;function ne(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function Pe(){{if(re.current){var e=S(re.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function or(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return` Check your code at `+r+":"+n+"."}return""}}var xe={};function lr(e){{var r=Pe();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=` Check the top-level render call using <`+n+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=lr(r);if(xe[n])return;xe[n]=!0;var a="";e&&e._owner&&e._owner!==re.current&&(a=" It was passed a child from "+S(e._owner.type)+"."),I(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,a),I(null)}}function je(e,r){{if(typeof e!="object")return;if(Q(e))for(var n=0;n",i=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,i)}var g=ur(e,r,n,o,c);if(g==null)return g;if(u){var _=r.children;if(_!==void 0)if(a)if(Q(_)){for(var W=0;W<_.length;W++)je(_[W],e);Object.freeze&&Object.freeze(_)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else je(_,e)}return e===P?cr(g):fr(g),g}}function sr(e,r,n){return De(e,r,n,!0)}function dr(e,r,n){return De(e,r,n,!1)}var vr=dr,gr=sr;Y.Fragment=P,Y.jsx=vr,Y.jsxs=gr}()),Y}(function(t){process.env.NODE_ENV==="production"?t.exports=Fe():t.exports=Ie()})(H);const A=H.exports.jsx,oe=H.exports.jsxs,We=t=>{var b;const[f,E]=z.useState((b=t.value)!=null?b:[]),{classes:P}=le({error:(t==null?void 0:t.error)!==void 0}),{disabled:F,size:x,error:k}=t;function C(s){var R,j,N,M,U,w;s.stopPropagation();const d=s.currentTarget.value,m=(R=t==null?void 0:t.separators)!=null?R:[",",";","|","/","\\"];if(s.key==="Enter"){const l=s.currentTarget.value;l&&(t.beforeAddValidate?t.beforeAddValidate(l,f)&&(E([...f,l]),(j=t==null?void 0:t.onChange)==null||j.call(t,[...f,l])):(E([...f,l]),(N=t==null?void 0:t.onChange)==null||N.call(t,[...f,l])),s.currentTarget.value="")}if(!d&&!t.disableBackspaceRemove&&f.length>0&&s.key==="Backspace"&&(s.currentTarget.value=t.isEditOnRemove?`${f[f.length-1]}`:"",E(f.slice(0,f.length-1))),d&&m.includes(s.key)){const l=d.slice(0,d.length-1);l&&(t.beforeAddValidate?t.beforeAddValidate(l,f)&&(E([...f,l]),(M=t==null?void 0:t.onChange)==null||M.call(t,[...f,l])):(E([...f,l]),(U=t==null?void 0:t.onChange)==null||U.call(t,[...f,l])),s.currentTarget.value="")}(w=t==null?void 0:t.onKeyUp)==null||w.call(t,s)}return z.useEffect(()=>{var s,d;(s=t==null?void 0:t.onBlur)==null||s.call(t,f),(d=t==null?void 0:t.onChange)==null||d.call(t,f)},[f]),A(h.Input.Wrapper,{error:k,className:P.tagsWrapper,children:oe(h.Box,{className:"tags-input--wrapper",children:[A(h.Group,{spacing:5,children:f.map(s=>A(h.Badge,{size:x,variant:"dot",...t==null?void 0:t.badgeProps,children:oe(h.Group,{position:"apart",children:[A(h.Text,{children:s}),A(h.CloseButton,{onClick:()=>{var d;E(f.filter(m=>m!==s)),(d=t==null?void 0:t.onRemoved)==null||d.call(t,s)},className:"tags-input--close-button",...t==null?void 0:t.closeButtonProps})]})},s))}),A(h.Input,{disabled:F,onKeyUp:C,placeholder:t==null?void 0:t.placeHolder,size:x})]})})},le=h.createStyles((t,{error:f})=>({tagsWrapper:{width:"100%",maxWidth:"100%",".mantine-Input-wrapper":{width:"100%"},".tags-input--wrapper":{display:"flex",flexWrap:"wrap",width:"100%",minWidth:"100%",border:`${h.rem(1)} solid ${t.primaryColor}`,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,transition:"border-color 100ms ease","&:focus, &:focus-within":t.focusRingStyles.inputStyles(t),borderRadius:h.rem(4),color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,outline:0,padding:`${h.rem(4)} ${h.rem(8)}`,"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}},input:{border:"none",width:"100%",display:"inline-block",margin:0,outline:0,padding:0}},".tags-input--close-button":{display:"flex",background:"transparent",border:"none",outline:0,padding:0,"&:hover":{background:"transparent"},"&:focus":{background:"transparent"},"&:active":{background:"transparent",transform:"none"}}}}));T.TagInput=We,T.useTagStyles=le,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});