kdpa-components 1.5.1 → 1.5.3
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/dist/index.js
CHANGED
|
@@ -270,4 +270,6 @@ function XR(e){return getComputedStyle(e)}function GR(e,t){for(var n in t){var r
|
|
|
270
270
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
271
271
|
* See the License for the specific language governing permissions and
|
|
272
272
|
* limitations under the License.
|
|
273
|
-
*/!function(e,t){var n;function r(e,t){var n=[],r=0;function o(e){return n.push(e),t}function a(){return n[r++]}return{tokenize:function(t){return t.replace(e,o)},detokenize:function(e){return e.replace(new RegExp("("+t+")","g"),a)}}}n=new function(){var e="`TMP`",t="`COMMENT`",n="[^\\u0020-\\u007e]",o="(?:[0-9]*\\.[0-9]+|[0-9]+)",a="direction\\s*:\\s*",i="['\"]?\\s*",s="(^|[^a-zA-Z])",l="\\/\\*\\!?\\s*@noflip\\s*\\*\\/",c="(?:(?:(?:\\\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",u="(?:[_a-z0-9-]|"+n+"|"+c+")",d=o+"(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|"+("-?"+("(?:[_a-z]|"+n+"|"+c+")")+u+"*")+")?",p="((?:-?"+d+")|(?:inherit|auto))",f="(#?"+u+"+|(?:rgba?|hsla?)\\([ \\d.,%-]+\\))",m="(?:[!#$%&*-~]|"+n+"|"+c+")*?",h="(?![a-zA-Z])",b="(?!("+u+"|\\r?\\n|\\s|#|\\:|\\.|\\,|\\+|>|~|\\(|\\)|\\[|\\]|=|\\*=|~=|\\^=|'[^']*'|\"[^\"]*\"|"+t+")*?{)",v="(?!"+m+i+"\\))",y="(?="+m+i+"\\))",g="(\\s*(?:!important\\s*)?[;}])",w=/`TMP`/g,O=new RegExp("\\/\\*[^*]*\\*+([^\\/*][^*]*\\*+)*\\/","gi"),x=new RegExp("("+l+b+"[^;}]+;?)","gi"),T=new RegExp("("+l+"[^\\}]*?})","gi"),k=new RegExp("("+a+")ltr","gi"),E=new RegExp("("+a+")rtl","gi"),C=new RegExp(s+"(left)"+h+v+b,"gi"),P=new RegExp(s+"(right)"+h+v+b,"gi"),S=new RegExp(s+"(left)"+y,"gi"),M=new RegExp(s+"(right)"+y,"gi"),j=new RegExp(s+"(ltr)"+y,"gi"),N=new RegExp(s+"(rtl)"+y,"gi"),D=new RegExp(s+"([ns]?)e-resize","gi"),R=new RegExp(s+"([ns]?)w-resize","gi"),_=new RegExp("((?:margin|padding|border-width)\\s*:\\s*)"+p+"(\\s+)"+p+"(\\s+)"+p+"(\\s+)"+p+g,"gi"),I=new RegExp("((?:-color|border-style)\\s*:\\s*)"+f+"(\\s+)"+f+"(\\s+)"+f+"(\\s+)"+f+g,"gi"),A=new RegExp("(background(?:-position)?\\s*:\\s*(?:[^:;}\\s]+\\s+)*?)("+d+")","gi"),L=new RegExp("(background-position-x\\s*:\\s*)(-?"+o+"%)","gi"),$=new RegExp("(border-radius\\s*:\\s*)"+p+"(?:(?:\\s+"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?)?(?:(?:(?:\\s*\\/\\s*)"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?(?:\\s+"+p+")?)?"+g,"gi"),V=new RegExp("(box-shadow\\s*:\\s*(?:inset\\s*)?)"+p,"gi"),F=new RegExp("(text-shadow\\s*:\\s*)"+p+"(\\s*)"+f,"gi"),B=new RegExp("(text-shadow\\s*:\\s*)"+f+"(\\s*)"+p,"gi"),z=new RegExp("(text-shadow\\s*:\\s*)"+p,"gi"),W=new RegExp("(transform\\s*:[^;}]*)(translateX\\s*\\(\\s*)"+p+"(\\s*\\))","gi"),H=new RegExp("(transform\\s*:[^;}]*)(translate\\s*\\(\\s*)"+p+"((?:\\s*,\\s*"+p+"){0,2}\\s*\\))","gi");function U(e,t,n){var r,o;return"%"===n.slice(-1)&&(-1!==(r=n.indexOf("."))?(o=n.length-r-2,n=(n=100-parseFloat(n)).toFixed(o)+"%"):n=100-parseFloat(n)+"%"),t+n}function K(e){switch(e.length){case 4:e=[e[1],e[0],e[3],e[2]];break;case 3:e=[e[1],e[0],e[1],e[2]];break;case 2:e=[e[1],e[0]];break;case 1:e=[e[0]]}return e.join(" ")}function q(e,t){var n=[].slice.call(arguments),r=n.slice(2,6).filter((function(e){return e})),o=n.slice(6,10).filter((function(e){return e})),a=n[10]||"";return t+(o.length?K(r)+" / "+K(o):K(r))+a}function Y(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function X(e,t,n){return t+Y(n)}function G(e,t,n,r,o){return t+n+Y(r)+o}function Z(e,t,n,r,o){return t+n+r+Y(o)}return{transform:function(n,o){var a=new r(x,"`NOFLIP_SINGLE`"),i=new r(T,"`NOFLIP_CLASS`"),s=new r(O,t);return n=s.tokenize(i.tokenize(a.tokenize(n.replace("`","%60")))),o.transformDirInUrl&&(n=n.replace(j,"$1"+e).replace(N,"$1ltr").replace(w,"rtl")),o.transformEdgeInUrl&&(n=n.replace(S,"$1"+e).replace(M,"$1left").replace(w,"right")),n=n.replace(k,"$1"+e).replace(E,"$1ltr").replace(w,"rtl").replace(C,"$1"+e).replace(P,"$1left").replace(w,"right").replace(D,"$1$2"+e).replace(R,"$1$2e-resize").replace(w,"w-resize").replace($,q).replace(V,X).replace(F,Z).replace(B,Z).replace(z,X).replace(W,G).replace(H,G).replace(_,"$1$2$3$8$5$6$7$4$9").replace(I,"$1$2$3$8$5$6$7$4$9").replace(A,U).replace(L,U),n=a.detokenize(i.detokenize(s.detokenize(n)))}}},e.exports?t.transform=function(e,t,r){var o;return"object"==typeof t?o=t:(o={},"boolean"==typeof t&&(o.transformDirInUrl=t),"boolean"==typeof r&&(o.transformEdgeInUrl=r)),n.transform(e,o)}:"undefined"!=typeof window&&(window.cssjanus=n)}(cW,cW.exports);var uW=B(cW.exports);function dW(e,t,n){switch(e.type){case xz:case Oz:case gz:return e.return=e.return||e.value;case wz:e.value=Array.isArray(e.props)?e.props.join(","):e.props,Array.isArray(e.children)&&e.children.forEach((function(e){e.type===gz&&(e.children=e.value)}))}var r=lW(Array.prototype.concat(e.children),dW);return Rz(r)?e.return=e.value+"{"+r+"}":""}function pW(e,t,n,r){if(e.type===Tz||"@supports"===e.type||e.type===wz&&(!e.parent||"@media"===e.parent.type||e.parent.type===wz)){var o=uW.transform(dW(e));e.children=o?nW(o)[0].children:[],e.return=""}}Object.defineProperty(pW,"name",{value:"stylisRTLPlugin"});const fW=Mn({key:"kdpa",stylisPlugins:[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Oz:return void(e.return=sW(e.value,e.length,n));case Tz:return lW([Wz(e,{value:Mz(e.value,"@","@"+yz)})],r);case wz:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(Sz(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return lW([Wz(e,{props:[Mz(t,/:(read-\w+)/,":"+vz+"$1")]})],r);case"::placeholder":return lW([Wz(e,{props:[Mz(t,/:(plac\w+)/,":"+yz+"input-$1")]}),Wz(e,{props:[Mz(t,/:(plac\w+)/,":"+vz+"$1")]}),Wz(e,{props:[Mz(t,/:(plac\w+)/,bz+"input-$1")]})],r)}return""}))}},pW]});function mW(t){return e(sr,{value:fW,children:t.children})}const hW=o.forwardRef(((t,n)=>e(im,{direction:"up",ref:n,...t})));function bW({children:t,...n}){return e(Lf,{TransitionComponent:hW,fullScreen:!0,...n,children:t})}function vW(e){return ET({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function yW(e){return ET({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function gW({children:n,label:r,expandable:a,defaultOpen:i,...s}){const l=4*r.length,[c,u]=w(i??!0),d=()=>{u((e=>!e))},p=Lo();return e("div",{className:"kdpa-segment",children:t(gT,{container:!0,sx:e=>({border:`2px solid ${e.palette.primary.main} !important`,position:"relative",marginTop:"2rem",marginLeft:"0.1rem",marginRight:"0.1rem",borderRadius:"0.357rem !important",padding:"1rem 0.1rem"}),children:[e("span",{className:"kdpa-segment__label",style:{width:`calc(100px + ${l}px)`,direction:p.direction},children:r}),a&&e("div",{className:"kdpa-segment__icon",children:e(c?vW:yW,{size:20,onClick:d})}),e(wD,{in:!a||c,...s,children:e(o.Fragment,{children:n})})]})})}function wW(e){return ET({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"polyline",attr:{points:"17 8 12 3 7 8"}},{tag:"line",attr:{x1:"12",y1:"3",x2:"12",y2:"15"}}]})(e)}function OW({onUpload:n,label:r,multiple:o=!1,...a}){return t("label",{className:"kdpa-file-uploader",htmlFor:"kdpaFileUploader",children:[r&&e("span",{className:"kdpa-file-uploader__label",children:r}),e(dD,{component:"label",htmlFor:"kdpaFileUploader",sx:{padding:"7px 7px",minWidth:"36px"},children:e(wW,{size:20})}),e("input",{id:"kdpaFileUploader",type:"file",...a,hidden:!0,multiple:!0,onChange:e=>{const t=e.target.files;t&&n(t)}})]})}var xW=e=>"checkbox"===e.type,TW=e=>e instanceof Date,kW=e=>null==e;const EW=e=>"object"==typeof e;var CW=e=>!kW(e)&&!Array.isArray(e)&&EW(e)&&!TW(e),PW=e=>CW(e)&&e.target?xW(e.target)?e.target.checked:e.target.value:e,SW=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),MW=e=>{const t=e.constructor&&e.constructor.prototype;return CW(t)&&t.hasOwnProperty("isPrototypeOf")},jW="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function NW(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(jW&&(e instanceof Blob||e instanceof FileList)||!n&&!CW(e))return e;if(t=n?[]:{},n||MW(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=NW(e[n]));else t=e}return t}var DW=e=>Array.isArray(e)?e.filter(Boolean):[],RW=e=>void 0===e,_W=(e,t,n)=>{if(!t||!CW(e))return n;const r=DW(t.split(/[,[\].]+?/)).reduce(((e,t)=>kW(e)?e:e[t]),e);return RW(r)||r===e?RW(e[t])?n:e[t]:r};const IW={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},AW={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},LW="max",$W="min",VW="maxLength",FW="minLength",BW="pattern",zW="required",WW="validate",HW=o.createContext(null),UW=()=>o.useContext(HW),KW=e=>{const{children:t,...n}=e;return o.createElement(HW.Provider,{value:n},t)};var qW=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const o=a;return t._proxyFormState[o]!==AW.all&&(t._proxyFormState[o]=!r||AW.all),n&&(n[o]=!0),e[o]}});return o},YW=e=>CW(e)&&!Object.keys(e).length,XW=(e,t,n,r)=>{n(e);const{name:o,...a}=e;return YW(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||AW.all)))},GW=e=>Array.isArray(e)?e:[e],ZW=(e,t,n)=>n&&t?e===t||Array.isArray(e)&&e.some((e=>e&&n&&e===t)):!e||!t||e===t||GW(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function QW(e){const t=o.useRef(e);t.current=e,o.useEffect((()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var JW=e=>"string"==typeof e,eH=(e,t,n,r,o)=>JW(e)?(r&&t.watch.add(e),_W(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),_W(n,e)))):(r&&(t.watchAll=!0),n);var tH=e=>/^\w*$/.test(e),nH=e=>DW(e.replace(/["|']|\]/g,"").split(/\.|\[/));function rH(e,t,n){let r=-1;const o=tH(t)?[t]:nH(t),a=o.length,i=a-1;for(;++r<a;){const t=o[r];let a=n;if(r!==i){const n=e[t];a=CW(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}e[t]=a,e=e[t]}return e}function oH(e){const t=UW(),{name:n,disabled:r,control:a=t.control,shouldUnregister:i}=e,s=SW(a._names.array,n),l=function(e){const t=UW(),{control:n=t.control,name:r,defaultValue:a,disabled:i,exact:s}=e||{},l=o.useRef(r);l.current=r,QW({disabled:i,subject:n._subjects.values,next:e=>{ZW(l.current,e.name,s)&&u(NW(eH(l.current,n._names,e.values||n._formValues,!1,a)))}});const[c,u]=o.useState(n._getWatch(r,a));return o.useEffect((()=>n._removeUnmounted())),c}({control:a,name:n,defaultValue:_W(a._formValues,n,_W(a._defaultValues,n,e.defaultValue)),exact:!0}),c=function(e){const t=UW(),{control:n=t.control,disabled:r,name:a,exact:i}=e||{},[s,l]=o.useState(n._formState),c=o.useRef(!0),u=o.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=o.useRef(a);return d.current=a,QW({disabled:r,next:e=>c.current&&ZW(d.current,e.name,i)&&XW(e,u.current,n._updateFormState)&&l({...n._formState,...e}),subject:n._subjects.state}),o.useEffect((()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1})),[n]),qW(s,n,u.current,!1)}({control:a,name:n}),u=o.useRef(a.register(n,{...e.rules,value:l}));return u.current=a.register(n,e.rules),o.useEffect((()=>{const e=a._options.shouldUnregister||i,t=(e,t)=>{const n=_W(a._fields,e);n&&(n._f.mount=t)};if(t(n,!0),e){const e=NW(_W(a._options.defaultValues,n));rH(a._defaultValues,n,e),RW(_W(a._formValues,n))&&rH(a._formValues,n,e)}return()=>{(s?e&&!a._state.action:e)?a.unregister(n):t(n,!1)}}),[n,a,s,i]),o.useEffect((()=>{a._updateDisabledField({disabled:r,fields:a._fields,name:n})}),[r,n,a]),{field:{name:n,value:l,disabled:r,onChange:o.useCallback((e=>u.current.onChange({target:{value:PW(e),name:n},type:IW.CHANGE})),[n]),onBlur:o.useCallback((()=>u.current.onBlur({target:{value:_W(a._formValues,n),name:n},type:IW.BLUR})),[n,a]),ref:e=>{const t=_W(a._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_W(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!_W(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!_W(c.touchedFields,n)},error:{enumerable:!0,get:()=>_W(c.errors,n)}})}}var aH=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{};const iH=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=_W(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else CW(r)&&iH(r,t)}}};var sH=e=>({isOnSubmit:!e||e===AW.onSubmit,isOnBlur:e===AW.onBlur,isOnChange:e===AW.onChange,isOnAll:e===AW.all,isOnTouch:e===AW.onTouched}),lH=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),cH=(e,t,n)=>{const r=DW(_W(e,n));return rH(r,"root",t[n]),rH(e,n,r),e},uH=e=>"boolean"==typeof e,dH=e=>"file"===e.type,pH=e=>"function"==typeof e,fH=e=>{if(!jW)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},mH=e=>JW(e),hH=e=>"radio"===e.type,bH=e=>e instanceof RegExp;const vH={value:!1,isValid:!1},yH={value:!0,isValid:!0};var gH=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!RW(e[0].attributes.value)?RW(e[0].value)||""===e[0].value?yH:{value:e[0].value,isValid:!0}:yH:vH}return vH};const wH={isValid:!1,value:null};var OH=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),wH):wH;function xH(e,t,n="validate"){if(mH(e)||Array.isArray(e)&&e.every(mH)||uH(e)&&!e)return{type:n,message:mH(e)?e:"",ref:t}}var TH=e=>CW(e)&&!bH(e)?e:{value:e,message:""},kH=async(e,t,n,r,o)=>{const{ref:a,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:f,name:m,valueAsNumber:h,mount:b,disabled:v}=e._f,y=_W(t,m);if(!b||v)return{};const g=i?i[0]:a,w=e=>{r&&g.reportValidity&&(g.setCustomValidity(uH(e)?"":e||""),g.reportValidity())},O={},x=hH(a),T=xW(a),k=x||T,E=(h||dH(a))&&RW(a.value)&&RW(y)||fH(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=aH.bind(null,m,n,O),P=(e,t,n,r=VW,o=FW)=>{const i=e?t:n;O[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(o?!Array.isArray(y)||!y.length:s&&(!k&&(E||kW(y))||uH(y)&&!y||T&&!gH(i).isValid||x&&!OH(i).isValid)){const{value:e,message:t}=mH(s)?{value:!!s,message:s}:TH(s);if(e&&(O[m]={type:zW,message:t,ref:g,...C(zW,t)},!n))return w(t),O}if(!(E||kW(u)&&kW(d))){let e,t;const r=TH(d),o=TH(u);if(kW(y)||isNaN(y)){const n=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;JW(r.value)&&y&&(e=s?i(y)>i(r.value):l?y>r.value:n>new Date(r.value)),JW(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:n<new Date(o.value))}else{const n=a.valueAsNumber||(y?+y:y);kW(r.value)||(e=n>r.value),kW(o.value)||(t=n<o.value)}if((e||t)&&(P(!!e,r.message,o.message,LW,$W),!n))return w(O[m].message),O}if((l||c)&&!E&&(JW(y)||o&&Array.isArray(y))){const e=TH(l),t=TH(c),r=!kW(e.value)&&y.length>+e.value,o=!kW(t.value)&&y.length<+t.value;if((r||o)&&(P(r,e.message,t.message),!n))return w(O[m].message),O}if(p&&!E&&JW(y)){const{value:e,message:t}=TH(p);if(bH(e)&&!y.match(e)&&(O[m]={type:BW,message:t,ref:a,...C(BW,t)},!n))return w(t),O}if(f)if(pH(f)){const e=xH(await f(y,t),g);if(e&&(O[m]={...e,...C(WW,e.message)},!n))return w(e.message),O}else if(CW(f)){let e={};for(const r in f){if(!YW(e)&&!n)break;const o=xH(await f[r](y,t),g,r);o&&(e={...o,...C(r,o.message)},w(o.message),n&&(O[m]=e))}if(!YW(e)&&(O[m]={ref:g,...e},!n))return O}return w(!0),O};function EH(e,t){const n=Array.isArray(t)?t:tH(t)?[t]:nH(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=RW(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1,a=n[o];return r&&delete r[a],0!==o&&(CW(r)&&YW(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!RW(e[t]))return!1;return!0}(r))&&EH(e,n.slice(0,-1)),e}function CH(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var PH=e=>kW(e)||!EW(e);function SH(e,t){if(PH(e)||PH(t))return e===t;if(TW(e)&&TW(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(TW(n)&&TW(e)||CW(n)&&CW(e)||Array.isArray(n)&&Array.isArray(e)?!SH(n,e):n!==e)return!1}}return!0}var MH=e=>"select-multiple"===e.type,jH=e=>hH(e)||xW(e),NH=e=>fH(e)&&e.isConnected,DH=e=>{for(const t in e)if(pH(e[t]))return!0;return!1};function RH(e,t={}){const n=Array.isArray(e);if(CW(e)||n)for(const n in e)Array.isArray(e[n])||CW(e[n])&&!DH(e[n])?(t[n]=Array.isArray(e[n])?[]:{},RH(e[n],t[n])):kW(e[n])||(t[n]=!0);return t}function _H(e,t,n){const r=Array.isArray(e);if(CW(e)||r)for(const r in e)Array.isArray(e[r])||CW(e[r])&&!DH(e[r])?RW(t)||PH(n[r])?n[r]=Array.isArray(e[r])?RH(e[r],[]):{...RH(e[r])}:_H(e[r],kW(t)?{}:t[r],n[r]):n[r]=!SH(e[r],t[r]);return n}var IH=(e,t)=>_H(e,t,RH(t)),AH=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>RW(e)?e:t?""===e?NaN:e?+e:e:n&&JW(e)?new Date(e):r?r(e):e;function LH(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return dH(t)?t.files:hH(t)?OH(e.refs).value:MH(t)?[...t.selectedOptions].map((({value:e})=>e)):xW(t)?gH(e.refs).value:AH(RW(t.value)?e.ref.value:t.value,e)}var $H=(e,t,n,r)=>{const o={};for(const n of e){const e=_W(t,n);e&&rH(o,n,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},VH=e=>RW(e)?e:bH(e)?e.source:CW(e)?bH(e.value)?e.value.source:e.value:e,FH=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function BH(e,t,n){const r=_W(e,n);if(r||tH(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),a=_W(t,r),i=_W(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(i&&i.type)return{name:r,error:i};o.pop()}return{name:n}}var zH=(e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e),WH=(e,t)=>!DW(_W(e,t)).length&&EH(e,t);const HH={mode:AW.onSubmit,reValidateMode:AW.onChange,shouldFocusError:!0};function UH(e={},t){let n,r={...HH,...e},o={submitCount:0,isDirty:!1,isLoading:pH(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},i=(CW(r.defaultValues)||CW(r.values))&&NW(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:NW(i),l={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:CH(),array:CH(),state:CH()},f=e.resetOptions&&e.resetOptions.keepDirtyValues,m=sH(r.mode),h=sH(r.reValidateMode),b=r.criteriaMode===AW.all,v=async e=>{if(d.isValid||e){const e=r.resolver?YW((await x()).errors):await T(a,!0);e!==o.isValid&&p.state.next({isValid:e})}},y=e=>d.isValidating&&p.state.next({isValidating:e}),g=(e,t,n,r)=>{const o=_W(a,e);if(o){const a=_W(s,e,RW(n)?_W(i,e):n);RW(a)||r&&r.defaultChecked||t?rH(s,e,t?a:LH(o._f)):C(e,a),l.mount&&v()}},w=(e,t,n,r,a)=>{let s=!1,l=!1;const c={name:e};if(!n||r){d.isDirty&&(l=o.isDirty,o.isDirty=c.isDirty=k(),s=l!==c.isDirty);const n=SH(_W(i,e),t);l=_W(o.dirtyFields,e),n?EH(o.dirtyFields,e):rH(o.dirtyFields,e,!0),c.dirtyFields=o.dirtyFields,s=s||d.dirtyFields&&l!==!n}if(n){const t=_W(o.touchedFields,e);t||(rH(o.touchedFields,e,n),c.touchedFields=o.touchedFields,s=s||d.touchedFields&&t!==n)}return s&&a&&p.state.next(c),s?c:{}},O=(t,r,a,i)=>{const s=_W(o.errors,t),l=d.isValid&&uH(r)&&o.isValid!==r;var c;if(e.delayError&&a?(c=()=>((e,t)=>{rH(o.errors,e,t),p.state.next({errors:o.errors})})(t,a),n=e=>{clearTimeout(u),u=setTimeout(c,e)},n(e.delayError)):(clearTimeout(u),n=null,a?rH(o.errors,t,a):EH(o.errors,t)),(a?!SH(s,a):s)||!YW(i)||l){const e={...i,...l&&uH(r)?{isValid:r}:{},errors:o.errors,name:t};o={...o,...e},p.state.next(e)}y(!1)},x=async e=>r.resolver(s,r.context,$H(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation)),T=async(e,t,n={valid:!0})=>{for(const a in e){const i=e[a];if(i){const{_f:e,...a}=i;if(e){const a=c.array.has(e.name),l=await kH(i,s,b,r.shouldUseNativeValidation&&!t,a);if(l[e.name]&&(n.valid=!1,t))break;!t&&(_W(l,e.name)?a?cH(o.errors,l,e.name):rH(o.errors,e.name,l[e.name]):EH(o.errors,e.name))}a&&await T(a,t,n)}}return n.valid},k=(e,t)=>(e&&t&&rH(s,e,t),!SH(N(),i)),E=(e,t,n)=>eH(e,c,{...l.mount?s:RW(t)?i:JW(e)?{[e]:t}:t},n,t),C=(e,t,n={})=>{const r=_W(a,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&rH(s,e,AH(t,n)),o=fH(n.ref)&&kW(t)?"":t,MH(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?xW(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):dH(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||p.values.next({name:e,values:{...s}})))}(n.shouldDirty||n.shouldTouch)&&w(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&j(e)},P=(e,t,n)=>{for(const r in t){const o=t[r],i=`${e}.${r}`,s=_W(a,i);!c.array.has(e)&&PH(o)&&(!s||s._f)||TW(o)?C(i,o,n):P(i,o,n)}},S=(e,n,r={})=>{const u=_W(a,e),f=c.array.has(e),m=NW(n);rH(s,e,m),f?(p.array.next({name:e,values:{...s}}),(d.isDirty||d.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:IH(i,s),isDirty:k(e,m)})):!u||u._f||kW(m)?C(e,m,r):P(e,m,r),lH(e,c)&&p.state.next({...o}),p.values.next({name:e,values:{...s}}),!l.mount&&t()},M=async e=>{const t=e.target;let i=t.name,l=!0;const u=_W(a,i);if(u){let f,g;const k=t.type?LH(u._f):PW(e),E=e.type===IW.BLUR||e.type===IW.FOCUS_OUT,C=!FH(u._f)&&!r.resolver&&!_W(o.errors,i)&&!u._f.deps||zH(E,_W(o.touchedFields,i),o.isSubmitted,h,m),P=lH(i,c,E);rH(s,i,k),E?(u._f.onBlur&&u._f.onBlur(e),n&&n(0)):u._f.onChange&&u._f.onChange(e);const S=w(i,k,E,!1),M=!YW(S)||P;if(!E&&p.values.next({name:i,type:e.type,values:{...s}}),C)return d.isValid&&v(),M&&p.state.next({name:i,...P?{}:S});if(!E&&P&&p.state.next({...o}),y(!0),r.resolver){const{errors:e}=await x([i]),t=BH(o.errors,a,i),n=BH(e,a,t.name||i);f=n.error,i=n.name,g=YW(e)}else f=(await kH(u,s,b,r.shouldUseNativeValidation))[i],l=isNaN(k)||k===_W(s,i,k),l&&(f?g=!1:d.isValid&&(g=await T(a,!0)));l&&(u._f.deps&&j(u._f.deps),O(i,g,f,S))}},j=async(e,t={})=>{let n,i;const s=GW(e);if(y(!0),r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(e)for(const n of e){const e=_W(t,n);e?rH(o.errors,n,e):EH(o.errors,n)}else o.errors=t;return t})(RW(e)?e:s);n=YW(t),i=e?!s.some((e=>_W(t,e))):n}else e?(i=(await Promise.all(s.map((async e=>{const t=_W(a,e);return await T(t&&t._f?{[e]:t}:t)})))).every(Boolean),(i||o.isValid)&&v()):i=n=await T(a);return p.state.next({...!JW(e)||d.isValid&&n!==o.isValid?{}:{name:e},...r.resolver||!e?{isValid:n}:{},errors:o.errors,isValidating:!1}),t.shouldFocus&&!i&&iH(a,(e=>e&&_W(o.errors,e)),e?s:c.mount),i},N=e=>{const t={...i,...l.mount?s:{}};return RW(e)?t:JW(e)?_W(t,e):e.map((e=>_W(t,e)))},D=(e,t)=>({invalid:!!_W((t||o).errors,e),isDirty:!!_W((t||o).dirtyFields,e),isTouched:!!_W((t||o).touchedFields,e),error:_W((t||o).errors,e)}),R=(e,t,n)=>{const r=(_W(a,e,{_f:{}})._f||{}).ref;rH(o.errors,e,{...t,ref:r}),p.state.next({name:e,errors:o.errors,isValid:!1}),n&&n.shouldFocus&&r&&r.focus&&r.focus()},_=(e,t={})=>{for(const n of e?GW(e):c.mount)c.mount.delete(n),c.array.delete(n),t.keepValue||(EH(a,n),EH(s,n)),!t.keepError&&EH(o.errors,n),!t.keepDirty&&EH(o.dirtyFields,n),!t.keepTouched&&EH(o.touchedFields,n),!r.shouldUnregister&&!t.keepDefaultValue&&EH(i,n);p.values.next({values:{...s}}),p.state.next({...o,...t.keepDirty?{isDirty:k()}:{}}),!t.keepIsValid&&v()},I=({disabled:e,name:t,field:n,fields:r})=>{if(uH(e)){const o=e?void 0:_W(s,t,LH(n?n._f:_W(r,t)._f));rH(s,t,o),w(t,o,!1,!1,!0)}},A=(e,t={})=>{let n=_W(a,e);const o=uH(t.disabled);return rH(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({field:n,disabled:t.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:VH(t.min),max:VH(t.max),minLength:VH(t.minLength),maxLength:VH(t.maxLength),pattern:VH(t.pattern)}:{},name:e,onChange:M,onBlur:M,ref:o=>{if(o){A(e,t),n=_W(a,e);const r=RW(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=jH(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;rH(a,e,{_f:{...n._f,...s?{refs:[...l.filter(NH),r,...Array.isArray(_W(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=_W(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!SW(c.array,e)||!l.action)&&c.unMount.add(e)}}},L=()=>r.shouldFocusError&&iH(a,(e=>e&&_W(o.errors,e)),c.mount),$=(e,t)=>async n=>{n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let i=NW(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();o.errors=e,i=t}else await T(a);EH(o.errors,"root"),YW(o.errors)?(p.state.next({errors:{}}),await e(i,n)):(t&&await t({...o.errors},n),L(),setTimeout(L)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:YW(o.errors),submitCount:o.submitCount+1,errors:o.errors})},V=(n,r={})=>{const u=n?NW(n):i,m=NW(u),h=n&&!YW(n)?m:i;if(r.keepDefaultValues||(i=u),!r.keepValues){if(r.keepDirtyValues||f)for(const e of c.mount)_W(o.dirtyFields,e)?rH(h,e,_W(s,e)):S(e,_W(h,e));else{if(jW&&RW(n))for(const e of c.mount){const t=_W(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(fH(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}s=e.shouldUnregister?r.keepDefaultValues?NW(i):{}:NW(h),p.array.next({values:{...h}}),p.values.next({values:{...h}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!d.isValid||!!r.keepIsValid,l.watch=!!e.shouldUnregister,p.state.next({submitCount:r.keepSubmitCount?o.submitCount:0,isDirty:r.keepDirty?o.isDirty:!(!r.keepDefaultValues||SH(n,i)),isSubmitted:!!r.keepIsSubmitted&&o.isSubmitted,dirtyFields:r.keepDirtyValues?o.dirtyFields:r.keepDefaultValues&&n?IH(i,n):{},touchedFields:r.keepTouched?o.touchedFields:{},errors:r.keepErrors?o.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},F=(e,t)=>V(pH(e)?e(s):e,t);return{control:{register:A,unregister:_,getFieldState:D,handleSubmit:$,setError:R,_executeSchema:x,_getWatch:E,_getDirty:k,_updateValid:v,_removeUnmounted:()=>{for(const e of c.unMount){const t=_W(a,e);t&&(t._f.refs?t._f.refs.every((e=>!NH(e))):!NH(t._f.ref))&&_(e)}c.unMount=new Set},_updateFieldArray:(e,t=[],n,r,c=!0,u=!0)=>{if(r&&n){if(l.action=!0,u&&Array.isArray(_W(a,e))){const t=n(_W(a,e),r.argA,r.argB);c&&rH(a,e,t)}if(u&&Array.isArray(_W(o.errors,e))){const t=n(_W(o.errors,e),r.argA,r.argB);c&&rH(o.errors,e,t),WH(o.errors,e)}if(d.touchedFields&&u&&Array.isArray(_W(o.touchedFields,e))){const t=n(_W(o.touchedFields,e),r.argA,r.argB);c&&rH(o.touchedFields,e,t)}d.dirtyFields&&(o.dirtyFields=IH(i,s)),p.state.next({name:e,isDirty:k(e,t),dirtyFields:o.dirtyFields,errors:o.errors,isValid:o.isValid})}else rH(s,e,t)},_updateDisabledField:I,_getFieldArray:t=>DW(_W(l.mount?s:i,t,e.shouldUnregister?_W(i,t,[]):[])),_reset:V,_resetDefaultValues:()=>pH(r.defaultValues)&&r.defaultValues().then((e=>{F(e,r.resetOptions),p.state.next({isLoading:!1})})),_updateFormState:e=>{o={...o,...e}},_subjects:p,_proxyFormState:d,get _fields(){return a},get _formValues(){return s},get _state(){return l},set _state(e){l=e},get _defaultValues(){return i},get _names(){return c},set _names(e){c=e},get _formState(){return o},set _formState(e){o=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:j,register:A,handleSubmit:$,watch:(e,t)=>pH(e)?p.values.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:S,getValues:N,reset:F,resetField:(e,t={})=>{_W(a,e)&&(RW(t.defaultValue)?S(e,_W(i,e)):(S(e,t.defaultValue),rH(i,e,t.defaultValue)),t.keepTouched||EH(o.touchedFields,e),t.keepDirty||(EH(o.dirtyFields,e),o.isDirty=t.defaultValue?k(e,_W(i,e)):k()),t.keepError||(EH(o.errors,e),d.isValid&&v()),p.state.next({...o}))},clearErrors:e=>{e&&GW(e).forEach((e=>EH(o.errors,e))),p.state.next({errors:e?o.errors:{}})},unregister:_,setError:R,setFocus:(e,t={})=>{const n=_W(a,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:D}}function KH({children:t,onSubmit:n}){const r=function(e={}){const t=o.useRef(),n=o.useRef(),[r,a]=o.useState({isDirty:!1,isValidating:!1,isLoading:pH(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:pH(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...UH(e,(()=>a((e=>({...e}))))),formState:r});const i=t.current.control;return i._options=e,QW({subject:i._subjects.state,next:e=>{XW(e,i._proxyFormState,i._updateFormState,!0)&&a({...i._formState})}}),o.useEffect((()=>{e.values&&!SH(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()}),[e.values,i]),o.useEffect((()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()})),t.current.formState=qW(r,i),t.current}({mode:"onChange"});return e(KW,{...r,children:e("form",{onSubmit:r.handleSubmit(n),children:t})})}function qH({name:n="",rules:r={},Component:o,...a}){const{control:i}=UW(),{field:s,fieldState:{error:l}}=oH({control:i,name:n,rules:r,shouldUnregister:!0});return t("div",{children:[e(o,{...s,...a,onChange:function(...e){s.onChange(...e),a?.onChange?.(...e)}}),l&&l.message&&e("span",{style:{color:"red"},children:l.message})]})}export{pz as KdpaAccordion,mz as KdpaAccordionDetails,fz as KdpaAccordionSummary,lw as KdpaAlert,cw as KdpaAlertTitle,sD as KdpaAutoComplete,_T as KdpaAvatar,hT as KdpaBadge,lD as KdpaButton,pD as KdpaCheckBox,ST as KdpaChip,TD as KdpaCircularProgress,wD as KdpaCollapse,MD as KdpaCollapseTransitions,TI as KdpaCopyToClipboard,DN as KdpaDatePicker,nD as KdpaDateTimePicker,OD as KdpaDivider,KR as KdpaDropZone,PD as KdpaFade,OW as KdpaFileUploader,KH as KdpaFormContainer,rD as KdpaFormControl,oD as KdpaFormControlLabel,qH as KdpaFormField,bW as KdpaFullScreenDialog,gT as KdpaGrid,yT as KdpaGridBadge,SD as KdpaGrow,cD as KdpaIconButton,EI as KdpaInlineSpinner,MT as KdpaInput,jT as KdpaInputLabel,NT as KdpaInputMultiline,O_ as KdpaLazyDrop,CI as KdpaLoading,iD as KdpaMenuItem,fA as KdpaModalImage,bT as KdpaMuiBadge,hA as KdpaPaginationGrid,uD as KdpaPrimaryButton,DT as KdpaRadio,RT as KdpaRadioGroup,mW as KdpaRtlProvider,dD as KdpaSecondaryButton,gW as KdpaSegment,aD as KdpaSelect,PI as KdpaSkeleton,jD as KdpaSlide,mA as KdpaSlider,vD as KdpaSweetAlertConfirm,yD as KdpaSweetAlertDelete,gD as KdpaSweetAlertOK,IT as KdpaSwitch,ED as KdpaTab,CD as KdpaTabs,hz as KdpaThemeProvider,zj as KdpaTimePicker,vT as KdpaTooltip,gA as KdpaTree,dz as KdpaTreeSelect,xD as KdpaTypography,ND as KdpaZoom};
|
|
273
|
+
*/!function(e,t){var n;function r(e,t){var n=[],r=0;function o(e){return n.push(e),t}function a(){return n[r++]}return{tokenize:function(t){return t.replace(e,o)},detokenize:function(e){return e.replace(new RegExp("("+t+")","g"),a)}}}n=new function(){var e="`TMP`",t="`COMMENT`",n="[^\\u0020-\\u007e]",o="(?:[0-9]*\\.[0-9]+|[0-9]+)",a="direction\\s*:\\s*",i="['\"]?\\s*",s="(^|[^a-zA-Z])",l="\\/\\*\\!?\\s*@noflip\\s*\\*\\/",c="(?:(?:(?:\\\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",u="(?:[_a-z0-9-]|"+n+"|"+c+")",d=o+"(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|"+("-?"+("(?:[_a-z]|"+n+"|"+c+")")+u+"*")+")?",p="((?:-?"+d+")|(?:inherit|auto))",f="(#?"+u+"+|(?:rgba?|hsla?)\\([ \\d.,%-]+\\))",m="(?:[!#$%&*-~]|"+n+"|"+c+")*?",h="(?![a-zA-Z])",b="(?!("+u+"|\\r?\\n|\\s|#|\\:|\\.|\\,|\\+|>|~|\\(|\\)|\\[|\\]|=|\\*=|~=|\\^=|'[^']*'|\"[^\"]*\"|"+t+")*?{)",v="(?!"+m+i+"\\))",y="(?="+m+i+"\\))",g="(\\s*(?:!important\\s*)?[;}])",w=/`TMP`/g,O=new RegExp("\\/\\*[^*]*\\*+([^\\/*][^*]*\\*+)*\\/","gi"),x=new RegExp("("+l+b+"[^;}]+;?)","gi"),T=new RegExp("("+l+"[^\\}]*?})","gi"),k=new RegExp("("+a+")ltr","gi"),E=new RegExp("("+a+")rtl","gi"),C=new RegExp(s+"(left)"+h+v+b,"gi"),P=new RegExp(s+"(right)"+h+v+b,"gi"),S=new RegExp(s+"(left)"+y,"gi"),M=new RegExp(s+"(right)"+y,"gi"),j=new RegExp(s+"(ltr)"+y,"gi"),N=new RegExp(s+"(rtl)"+y,"gi"),D=new RegExp(s+"([ns]?)e-resize","gi"),R=new RegExp(s+"([ns]?)w-resize","gi"),_=new RegExp("((?:margin|padding|border-width)\\s*:\\s*)"+p+"(\\s+)"+p+"(\\s+)"+p+"(\\s+)"+p+g,"gi"),I=new RegExp("((?:-color|border-style)\\s*:\\s*)"+f+"(\\s+)"+f+"(\\s+)"+f+"(\\s+)"+f+g,"gi"),A=new RegExp("(background(?:-position)?\\s*:\\s*(?:[^:;}\\s]+\\s+)*?)("+d+")","gi"),L=new RegExp("(background-position-x\\s*:\\s*)(-?"+o+"%)","gi"),$=new RegExp("(border-radius\\s*:\\s*)"+p+"(?:(?:\\s+"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?)?(?:(?:(?:\\s*\\/\\s*)"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?(?:\\s+"+p+")?)?"+g,"gi"),V=new RegExp("(box-shadow\\s*:\\s*(?:inset\\s*)?)"+p,"gi"),F=new RegExp("(text-shadow\\s*:\\s*)"+p+"(\\s*)"+f,"gi"),B=new RegExp("(text-shadow\\s*:\\s*)"+f+"(\\s*)"+p,"gi"),z=new RegExp("(text-shadow\\s*:\\s*)"+p,"gi"),W=new RegExp("(transform\\s*:[^;}]*)(translateX\\s*\\(\\s*)"+p+"(\\s*\\))","gi"),H=new RegExp("(transform\\s*:[^;}]*)(translate\\s*\\(\\s*)"+p+"((?:\\s*,\\s*"+p+"){0,2}\\s*\\))","gi");function U(e,t,n){var r,o;return"%"===n.slice(-1)&&(-1!==(r=n.indexOf("."))?(o=n.length-r-2,n=(n=100-parseFloat(n)).toFixed(o)+"%"):n=100-parseFloat(n)+"%"),t+n}function K(e){switch(e.length){case 4:e=[e[1],e[0],e[3],e[2]];break;case 3:e=[e[1],e[0],e[1],e[2]];break;case 2:e=[e[1],e[0]];break;case 1:e=[e[0]]}return e.join(" ")}function q(e,t){var n=[].slice.call(arguments),r=n.slice(2,6).filter((function(e){return e})),o=n.slice(6,10).filter((function(e){return e})),a=n[10]||"";return t+(o.length?K(r)+" / "+K(o):K(r))+a}function Y(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function X(e,t,n){return t+Y(n)}function G(e,t,n,r,o){return t+n+Y(r)+o}function Z(e,t,n,r,o){return t+n+r+Y(o)}return{transform:function(n,o){var a=new r(x,"`NOFLIP_SINGLE`"),i=new r(T,"`NOFLIP_CLASS`"),s=new r(O,t);return n=s.tokenize(i.tokenize(a.tokenize(n.replace("`","%60")))),o.transformDirInUrl&&(n=n.replace(j,"$1"+e).replace(N,"$1ltr").replace(w,"rtl")),o.transformEdgeInUrl&&(n=n.replace(S,"$1"+e).replace(M,"$1left").replace(w,"right")),n=n.replace(k,"$1"+e).replace(E,"$1ltr").replace(w,"rtl").replace(C,"$1"+e).replace(P,"$1left").replace(w,"right").replace(D,"$1$2"+e).replace(R,"$1$2e-resize").replace(w,"w-resize").replace($,q).replace(V,X).replace(F,Z).replace(B,Z).replace(z,X).replace(W,G).replace(H,G).replace(_,"$1$2$3$8$5$6$7$4$9").replace(I,"$1$2$3$8$5$6$7$4$9").replace(A,U).replace(L,U),n=a.detokenize(i.detokenize(s.detokenize(n)))}}},e.exports?t.transform=function(e,t,r){var o;return"object"==typeof t?o=t:(o={},"boolean"==typeof t&&(o.transformDirInUrl=t),"boolean"==typeof r&&(o.transformEdgeInUrl=r)),n.transform(e,o)}:"undefined"!=typeof window&&(window.cssjanus=n)}(cW,cW.exports);var uW=B(cW.exports);function dW(e,t,n){switch(e.type){case xz:case Oz:case gz:return e.return=e.return||e.value;case wz:e.value=Array.isArray(e.props)?e.props.join(","):e.props,Array.isArray(e.children)&&e.children.forEach((function(e){e.type===gz&&(e.children=e.value)}))}var r=lW(Array.prototype.concat(e.children),dW);return Rz(r)?e.return=e.value+"{"+r+"}":""}function pW(e,t,n,r){if(e.type===Tz||"@supports"===e.type||e.type===wz&&(!e.parent||"@media"===e.parent.type||e.parent.type===wz)){var o=uW.transform(dW(e));e.children=o?nW(o)[0].children:[],e.return=""}}Object.defineProperty(pW,"name",{value:"stylisRTLPlugin"});const fW=Mn({key:"kdpa",stylisPlugins:[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Oz:return void(e.return=sW(e.value,e.length,n));case Tz:return lW([Wz(e,{value:Mz(e.value,"@","@"+yz)})],r);case wz:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(Sz(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return lW([Wz(e,{props:[Mz(t,/:(read-\w+)/,":"+vz+"$1")]})],r);case"::placeholder":return lW([Wz(e,{props:[Mz(t,/:(plac\w+)/,":"+yz+"input-$1")]}),Wz(e,{props:[Mz(t,/:(plac\w+)/,":"+vz+"$1")]}),Wz(e,{props:[Mz(t,/:(plac\w+)/,bz+"input-$1")]})],r)}return""}))}},pW]});function mW(t){return e(sr,{value:fW,children:t.children})}const hW=o.forwardRef(((t,n)=>e(im,{direction:"up",ref:n,...t})));function bW({children:t,...n}){return e(Lf,{TransitionComponent:hW,fullScreen:!0,...n,children:t})}function vW(e){return ET({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function yW(e){return ET({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function gW({children:n,label:r,expandable:a,defaultOpen:i,...s}){const l=4*r.length,[c,u]=w(i??!0),d=()=>{u((e=>!e))},p=Lo();return e("div",{className:"kdpa-segment",children:t(gT,{container:!0,sx:e=>({border:`2px solid ${e.palette.primary.main} !important`,position:"relative",marginTop:"2rem",marginLeft:"0.1rem",marginRight:"0.1rem",borderRadius:"0.357rem !important",padding:"1rem 0.1rem"}),children:[e("span",{className:"kdpa-segment__label",style:{width:`calc(100px + ${l}px)`,direction:p.direction},children:r}),a&&e("div",{className:"kdpa-segment__icon",children:e(c?vW:yW,{size:20,onClick:d})}),e(wD,{in:!a||c,...s,children:e(o.Fragment,{children:n})})]})})}function wW(e){return ET({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"polyline",attr:{points:"17 8 12 3 7 8"}},{tag:"line",attr:{x1:"12",y1:"3",x2:"12",y2:"15"}}]})(e)}function OW({onUpload:n,label:r,multiple:o=!1,...a}){return t("label",{className:"kdpa-file-uploader",htmlFor:"kdpaFileUploader",children:[r&&e("span",{className:"kdpa-file-uploader__label",children:r}),e(dD,{component:"label",htmlFor:"kdpaFileUploader",sx:{padding:"7px 7px",minWidth:"36px"},children:e(wW,{size:20})}),e("input",{id:"kdpaFileUploader",type:"file",...a,hidden:!0,multiple:!0,onChange:e=>{const t=e.target.files;t&&n(t)}})]})}var xW=e=>"checkbox"===e.type,TW=e=>e instanceof Date,kW=e=>null==e;const EW=e=>"object"==typeof e;var CW=e=>!kW(e)&&!Array.isArray(e)&&EW(e)&&!TW(e),PW=e=>CW(e)&&e.target?xW(e.target)?e.target.checked:e.target.value:e,SW=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),MW=e=>{const t=e.constructor&&e.constructor.prototype;return CW(t)&&t.hasOwnProperty("isPrototypeOf")},jW="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function NW(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(jW&&(e instanceof Blob||e instanceof FileList)||!n&&!CW(e))return e;if(t=n?[]:{},n||MW(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=NW(e[n]));else t=e}return t}var DW=e=>Array.isArray(e)?e.filter(Boolean):[],RW=e=>void 0===e,_W=(e,t,n)=>{if(!t||!CW(e))return n;const r=DW(t.split(/[,[\].]+?/)).reduce(((e,t)=>kW(e)?e:e[t]),e);return RW(r)||r===e?RW(e[t])?n:e[t]:r};const IW={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},AW={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},LW="max",$W="min",VW="maxLength",FW="minLength",BW="pattern",zW="required",WW="validate",HW=o.createContext(null),UW=()=>o.useContext(HW),KW=e=>{const{children:t,...n}=e;return o.createElement(HW.Provider,{value:n},t)};var qW=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const o=a;return t._proxyFormState[o]!==AW.all&&(t._proxyFormState[o]=!r||AW.all),n&&(n[o]=!0),e[o]}});return o},YW=e=>CW(e)&&!Object.keys(e).length,XW=(e,t,n,r)=>{n(e);const{name:o,...a}=e;return YW(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||AW.all)))},GW=e=>Array.isArray(e)?e:[e],ZW=(e,t,n)=>n&&t?e===t||Array.isArray(e)&&e.some((e=>e&&n&&e===t)):!e||!t||e===t||GW(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function QW(e){const t=o.useRef(e);t.current=e,o.useEffect((()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var JW=e=>"string"==typeof e,eH=(e,t,n,r,o)=>JW(e)?(r&&t.watch.add(e),_W(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),_W(n,e)))):(r&&(t.watchAll=!0),n);var tH=e=>/^\w*$/.test(e),nH=e=>DW(e.replace(/["|']|\]/g,"").split(/\.|\[/));function rH(e,t,n){let r=-1;const o=tH(t)?[t]:nH(t),a=o.length,i=a-1;for(;++r<a;){const t=o[r];let a=n;if(r!==i){const n=e[t];a=CW(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}e[t]=a,e=e[t]}return e}function oH(e){const t=UW(),{name:n,disabled:r,control:a=t.control,shouldUnregister:i}=e,s=SW(a._names.array,n),l=function(e){const t=UW(),{control:n=t.control,name:r,defaultValue:a,disabled:i,exact:s}=e||{},l=o.useRef(r);l.current=r,QW({disabled:i,subject:n._subjects.values,next:e=>{ZW(l.current,e.name,s)&&u(NW(eH(l.current,n._names,e.values||n._formValues,!1,a)))}});const[c,u]=o.useState(n._getWatch(r,a));return o.useEffect((()=>n._removeUnmounted())),c}({control:a,name:n,defaultValue:_W(a._formValues,n,_W(a._defaultValues,n,e.defaultValue)),exact:!0}),c=function(e){const t=UW(),{control:n=t.control,disabled:r,name:a,exact:i}=e||{},[s,l]=o.useState(n._formState),c=o.useRef(!0),u=o.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=o.useRef(a);return d.current=a,QW({disabled:r,next:e=>c.current&&ZW(d.current,e.name,i)&&XW(e,u.current,n._updateFormState)&&l({...n._formState,...e}),subject:n._subjects.state}),o.useEffect((()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1})),[n]),qW(s,n,u.current,!1)}({control:a,name:n}),u=o.useRef(a.register(n,{...e.rules,value:l}));return u.current=a.register(n,e.rules),o.useEffect((()=>{const e=a._options.shouldUnregister||i,t=(e,t)=>{const n=_W(a._fields,e);n&&(n._f.mount=t)};if(t(n,!0),e){const e=NW(_W(a._options.defaultValues,n));rH(a._defaultValues,n,e),RW(_W(a._formValues,n))&&rH(a._formValues,n,e)}return()=>{(s?e&&!a._state.action:e)?a.unregister(n):t(n,!1)}}),[n,a,s,i]),o.useEffect((()=>{a._updateDisabledField({disabled:r,fields:a._fields,name:n})}),[r,n,a]),{field:{name:n,value:l,disabled:r,onChange:o.useCallback((e=>u.current.onChange({target:{value:PW(e),name:n},type:IW.CHANGE})),[n]),onBlur:o.useCallback((()=>u.current.onBlur({target:{value:_W(a._formValues,n),name:n},type:IW.BLUR})),[n,a]),ref:e=>{const t=_W(a._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_W(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!_W(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!_W(c.touchedFields,n)},error:{enumerable:!0,get:()=>_W(c.errors,n)}})}}var aH=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{};const iH=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=_W(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else CW(r)&&iH(r,t)}}};var sH=e=>({isOnSubmit:!e||e===AW.onSubmit,isOnBlur:e===AW.onBlur,isOnChange:e===AW.onChange,isOnAll:e===AW.all,isOnTouch:e===AW.onTouched}),lH=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),cH=(e,t,n)=>{const r=DW(_W(e,n));return rH(r,"root",t[n]),rH(e,n,r),e},uH=e=>"boolean"==typeof e,dH=e=>"file"===e.type,pH=e=>"function"==typeof e,fH=e=>{if(!jW)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},mH=e=>JW(e),hH=e=>"radio"===e.type,bH=e=>e instanceof RegExp;const vH={value:!1,isValid:!1},yH={value:!0,isValid:!0};var gH=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!RW(e[0].attributes.value)?RW(e[0].value)||""===e[0].value?yH:{value:e[0].value,isValid:!0}:yH:vH}return vH};const wH={isValid:!1,value:null};var OH=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),wH):wH;function xH(e,t,n="validate"){if(mH(e)||Array.isArray(e)&&e.every(mH)||uH(e)&&!e)return{type:n,message:mH(e)?e:"",ref:t}}var TH=e=>CW(e)&&!bH(e)?e:{value:e,message:""},kH=async(e,t,n,r,o)=>{const{ref:a,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:f,name:m,valueAsNumber:h,mount:b,disabled:v}=e._f,y=_W(t,m);if(!b||v)return{};const g=i?i[0]:a,w=e=>{r&&g.reportValidity&&(g.setCustomValidity(uH(e)?"":e||""),g.reportValidity())},O={},x=hH(a),T=xW(a),k=x||T,E=(h||dH(a))&&RW(a.value)&&RW(y)||fH(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=aH.bind(null,m,n,O),P=(e,t,n,r=VW,o=FW)=>{const i=e?t:n;O[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(o?!Array.isArray(y)||!y.length:s&&(!k&&(E||kW(y))||uH(y)&&!y||T&&!gH(i).isValid||x&&!OH(i).isValid)){const{value:e,message:t}=mH(s)?{value:!!s,message:s}:TH(s);if(e&&(O[m]={type:zW,message:t,ref:g,...C(zW,t)},!n))return w(t),O}if(!(E||kW(u)&&kW(d))){let e,t;const r=TH(d),o=TH(u);if(kW(y)||isNaN(y)){const n=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;JW(r.value)&&y&&(e=s?i(y)>i(r.value):l?y>r.value:n>new Date(r.value)),JW(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:n<new Date(o.value))}else{const n=a.valueAsNumber||(y?+y:y);kW(r.value)||(e=n>r.value),kW(o.value)||(t=n<o.value)}if((e||t)&&(P(!!e,r.message,o.message,LW,$W),!n))return w(O[m].message),O}if((l||c)&&!E&&(JW(y)||o&&Array.isArray(y))){const e=TH(l),t=TH(c),r=!kW(e.value)&&y.length>+e.value,o=!kW(t.value)&&y.length<+t.value;if((r||o)&&(P(r,e.message,t.message),!n))return w(O[m].message),O}if(p&&!E&&JW(y)){const{value:e,message:t}=TH(p);if(bH(e)&&!y.match(e)&&(O[m]={type:BW,message:t,ref:a,...C(BW,t)},!n))return w(t),O}if(f)if(pH(f)){const e=xH(await f(y,t),g);if(e&&(O[m]={...e,...C(WW,e.message)},!n))return w(e.message),O}else if(CW(f)){let e={};for(const r in f){if(!YW(e)&&!n)break;const o=xH(await f[r](y,t),g,r);o&&(e={...o,...C(r,o.message)},w(o.message),n&&(O[m]=e))}if(!YW(e)&&(O[m]={ref:g,...e},!n))return O}return w(!0),O};function EH(e,t){const n=Array.isArray(t)?t:tH(t)?[t]:nH(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=RW(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1,a=n[o];return r&&delete r[a],0!==o&&(CW(r)&&YW(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!RW(e[t]))return!1;return!0}(r))&&EH(e,n.slice(0,-1)),e}function CH(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var PH=e=>kW(e)||!EW(e);function SH(e,t){if(PH(e)||PH(t))return e===t;if(TW(e)&&TW(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(TW(n)&&TW(e)||CW(n)&&CW(e)||Array.isArray(n)&&Array.isArray(e)?!SH(n,e):n!==e)return!1}}return!0}var MH=e=>"select-multiple"===e.type,jH=e=>hH(e)||xW(e),NH=e=>fH(e)&&e.isConnected,DH=e=>{for(const t in e)if(pH(e[t]))return!0;return!1};function RH(e,t={}){const n=Array.isArray(e);if(CW(e)||n)for(const n in e)Array.isArray(e[n])||CW(e[n])&&!DH(e[n])?(t[n]=Array.isArray(e[n])?[]:{},RH(e[n],t[n])):kW(e[n])||(t[n]=!0);return t}function _H(e,t,n){const r=Array.isArray(e);if(CW(e)||r)for(const r in e)Array.isArray(e[r])||CW(e[r])&&!DH(e[r])?RW(t)||PH(n[r])?n[r]=Array.isArray(e[r])?RH(e[r],[]):{...RH(e[r])}:_H(e[r],kW(t)?{}:t[r],n[r]):n[r]=!SH(e[r],t[r]);return n}var IH=(e,t)=>_H(e,t,RH(t)),AH=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>RW(e)?e:t?""===e?NaN:e?+e:e:n&&JW(e)?new Date(e):r?r(e):e;function LH(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return dH(t)?t.files:hH(t)?OH(e.refs).value:MH(t)?[...t.selectedOptions].map((({value:e})=>e)):xW(t)?gH(e.refs).value:AH(RW(t.value)?e.ref.value:t.value,e)}var $H=(e,t,n,r)=>{const o={};for(const n of e){const e=_W(t,n);e&&rH(o,n,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},VH=e=>RW(e)?e:bH(e)?e.source:CW(e)?bH(e.value)?e.value.source:e.value:e,FH=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function BH(e,t,n){const r=_W(e,n);if(r||tH(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),a=_W(t,r),i=_W(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(i&&i.type)return{name:r,error:i};o.pop()}return{name:n}}var zH=(e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e),WH=(e,t)=>!DW(_W(e,t)).length&&EH(e,t);const HH={mode:AW.onSubmit,reValidateMode:AW.onChange,shouldFocusError:!0};function UH(e={},t){let n,r={...HH,...e},o={submitCount:0,isDirty:!1,isLoading:pH(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},i=(CW(r.defaultValues)||CW(r.values))&&NW(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:NW(i),l={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:CH(),array:CH(),state:CH()},f=e.resetOptions&&e.resetOptions.keepDirtyValues,m=sH(r.mode),h=sH(r.reValidateMode),b=r.criteriaMode===AW.all,v=async e=>{if(d.isValid||e){const e=r.resolver?YW((await x()).errors):await T(a,!0);e!==o.isValid&&p.state.next({isValid:e})}},y=e=>d.isValidating&&p.state.next({isValidating:e}),g=(e,t,n,r)=>{const o=_W(a,e);if(o){const a=_W(s,e,RW(n)?_W(i,e):n);RW(a)||r&&r.defaultChecked||t?rH(s,e,t?a:LH(o._f)):C(e,a),l.mount&&v()}},w=(e,t,n,r,a)=>{let s=!1,l=!1;const c={name:e};if(!n||r){d.isDirty&&(l=o.isDirty,o.isDirty=c.isDirty=k(),s=l!==c.isDirty);const n=SH(_W(i,e),t);l=_W(o.dirtyFields,e),n?EH(o.dirtyFields,e):rH(o.dirtyFields,e,!0),c.dirtyFields=o.dirtyFields,s=s||d.dirtyFields&&l!==!n}if(n){const t=_W(o.touchedFields,e);t||(rH(o.touchedFields,e,n),c.touchedFields=o.touchedFields,s=s||d.touchedFields&&t!==n)}return s&&a&&p.state.next(c),s?c:{}},O=(t,r,a,i)=>{const s=_W(o.errors,t),l=d.isValid&&uH(r)&&o.isValid!==r;var c;if(e.delayError&&a?(c=()=>((e,t)=>{rH(o.errors,e,t),p.state.next({errors:o.errors})})(t,a),n=e=>{clearTimeout(u),u=setTimeout(c,e)},n(e.delayError)):(clearTimeout(u),n=null,a?rH(o.errors,t,a):EH(o.errors,t)),(a?!SH(s,a):s)||!YW(i)||l){const e={...i,...l&&uH(r)?{isValid:r}:{},errors:o.errors,name:t};o={...o,...e},p.state.next(e)}y(!1)},x=async e=>r.resolver(s,r.context,$H(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation)),T=async(e,t,n={valid:!0})=>{for(const a in e){const i=e[a];if(i){const{_f:e,...a}=i;if(e){const a=c.array.has(e.name),l=await kH(i,s,b,r.shouldUseNativeValidation&&!t,a);if(l[e.name]&&(n.valid=!1,t))break;!t&&(_W(l,e.name)?a?cH(o.errors,l,e.name):rH(o.errors,e.name,l[e.name]):EH(o.errors,e.name))}a&&await T(a,t,n)}}return n.valid},k=(e,t)=>(e&&t&&rH(s,e,t),!SH(N(),i)),E=(e,t,n)=>eH(e,c,{...l.mount?s:RW(t)?i:JW(e)?{[e]:t}:t},n,t),C=(e,t,n={})=>{const r=_W(a,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&rH(s,e,AH(t,n)),o=fH(n.ref)&&kW(t)?"":t,MH(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?xW(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):dH(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||p.values.next({name:e,values:{...s}})))}(n.shouldDirty||n.shouldTouch)&&w(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&j(e)},P=(e,t,n)=>{for(const r in t){const o=t[r],i=`${e}.${r}`,s=_W(a,i);!c.array.has(e)&&PH(o)&&(!s||s._f)||TW(o)?C(i,o,n):P(i,o,n)}},S=(e,n,r={})=>{const u=_W(a,e),f=c.array.has(e),m=NW(n);rH(s,e,m),f?(p.array.next({name:e,values:{...s}}),(d.isDirty||d.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:IH(i,s),isDirty:k(e,m)})):!u||u._f||kW(m)?C(e,m,r):P(e,m,r),lH(e,c)&&p.state.next({...o}),p.values.next({name:e,values:{...s}}),!l.mount&&t()},M=async e=>{const t=e.target;let i=t.name,l=!0;const u=_W(a,i);if(u){let f,g;const k=t.type?LH(u._f):PW(e),E=e.type===IW.BLUR||e.type===IW.FOCUS_OUT,C=!FH(u._f)&&!r.resolver&&!_W(o.errors,i)&&!u._f.deps||zH(E,_W(o.touchedFields,i),o.isSubmitted,h,m),P=lH(i,c,E);rH(s,i,k),E?(u._f.onBlur&&u._f.onBlur(e),n&&n(0)):u._f.onChange&&u._f.onChange(e);const S=w(i,k,E,!1),M=!YW(S)||P;if(!E&&p.values.next({name:i,type:e.type,values:{...s}}),C)return d.isValid&&v(),M&&p.state.next({name:i,...P?{}:S});if(!E&&P&&p.state.next({...o}),y(!0),r.resolver){const{errors:e}=await x([i]),t=BH(o.errors,a,i),n=BH(e,a,t.name||i);f=n.error,i=n.name,g=YW(e)}else f=(await kH(u,s,b,r.shouldUseNativeValidation))[i],l=isNaN(k)||k===_W(s,i,k),l&&(f?g=!1:d.isValid&&(g=await T(a,!0)));l&&(u._f.deps&&j(u._f.deps),O(i,g,f,S))}},j=async(e,t={})=>{let n,i;const s=GW(e);if(y(!0),r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(e)for(const n of e){const e=_W(t,n);e?rH(o.errors,n,e):EH(o.errors,n)}else o.errors=t;return t})(RW(e)?e:s);n=YW(t),i=e?!s.some((e=>_W(t,e))):n}else e?(i=(await Promise.all(s.map((async e=>{const t=_W(a,e);return await T(t&&t._f?{[e]:t}:t)})))).every(Boolean),(i||o.isValid)&&v()):i=n=await T(a);return p.state.next({...!JW(e)||d.isValid&&n!==o.isValid?{}:{name:e},...r.resolver||!e?{isValid:n}:{},errors:o.errors,isValidating:!1}),t.shouldFocus&&!i&&iH(a,(e=>e&&_W(o.errors,e)),e?s:c.mount),i},N=e=>{const t={...i,...l.mount?s:{}};return RW(e)?t:JW(e)?_W(t,e):e.map((e=>_W(t,e)))},D=(e,t)=>({invalid:!!_W((t||o).errors,e),isDirty:!!_W((t||o).dirtyFields,e),isTouched:!!_W((t||o).touchedFields,e),error:_W((t||o).errors,e)}),R=(e,t,n)=>{const r=(_W(a,e,{_f:{}})._f||{}).ref;rH(o.errors,e,{...t,ref:r}),p.state.next({name:e,errors:o.errors,isValid:!1}),n&&n.shouldFocus&&r&&r.focus&&r.focus()},_=(e,t={})=>{for(const n of e?GW(e):c.mount)c.mount.delete(n),c.array.delete(n),t.keepValue||(EH(a,n),EH(s,n)),!t.keepError&&EH(o.errors,n),!t.keepDirty&&EH(o.dirtyFields,n),!t.keepTouched&&EH(o.touchedFields,n),!r.shouldUnregister&&!t.keepDefaultValue&&EH(i,n);p.values.next({values:{...s}}),p.state.next({...o,...t.keepDirty?{isDirty:k()}:{}}),!t.keepIsValid&&v()},I=({disabled:e,name:t,field:n,fields:r})=>{if(uH(e)){const o=e?void 0:_W(s,t,LH(n?n._f:_W(r,t)._f));rH(s,t,o),w(t,o,!1,!1,!0)}},A=(e,t={})=>{let n=_W(a,e);const o=uH(t.disabled);return rH(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({field:n,disabled:t.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:VH(t.min),max:VH(t.max),minLength:VH(t.minLength),maxLength:VH(t.maxLength),pattern:VH(t.pattern)}:{},name:e,onChange:M,onBlur:M,ref:o=>{if(o){A(e,t),n=_W(a,e);const r=RW(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=jH(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;rH(a,e,{_f:{...n._f,...s?{refs:[...l.filter(NH),r,...Array.isArray(_W(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=_W(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!SW(c.array,e)||!l.action)&&c.unMount.add(e)}}},L=()=>r.shouldFocusError&&iH(a,(e=>e&&_W(o.errors,e)),c.mount),$=(e,t)=>async n=>{n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let i=NW(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();o.errors=e,i=t}else await T(a);EH(o.errors,"root"),YW(o.errors)?(p.state.next({errors:{}}),await e(i,n)):(t&&await t({...o.errors},n),L(),setTimeout(L)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:YW(o.errors),submitCount:o.submitCount+1,errors:o.errors})},V=(n,r={})=>{const u=n?NW(n):i,m=NW(u),h=n&&!YW(n)?m:i;if(r.keepDefaultValues||(i=u),!r.keepValues){if(r.keepDirtyValues||f)for(const e of c.mount)_W(o.dirtyFields,e)?rH(h,e,_W(s,e)):S(e,_W(h,e));else{if(jW&&RW(n))for(const e of c.mount){const t=_W(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(fH(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}s=e.shouldUnregister?r.keepDefaultValues?NW(i):{}:NW(h),p.array.next({values:{...h}}),p.values.next({values:{...h}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!d.isValid||!!r.keepIsValid,l.watch=!!e.shouldUnregister,p.state.next({submitCount:r.keepSubmitCount?o.submitCount:0,isDirty:r.keepDirty?o.isDirty:!(!r.keepDefaultValues||SH(n,i)),isSubmitted:!!r.keepIsSubmitted&&o.isSubmitted,dirtyFields:r.keepDirtyValues?o.dirtyFields:r.keepDefaultValues&&n?IH(i,n):{},touchedFields:r.keepTouched?o.touchedFields:{},errors:r.keepErrors?o.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},F=(e,t)=>V(pH(e)?e(s):e,t);return{control:{register:A,unregister:_,getFieldState:D,handleSubmit:$,setError:R,_executeSchema:x,_getWatch:E,_getDirty:k,_updateValid:v,_removeUnmounted:()=>{for(const e of c.unMount){const t=_W(a,e);t&&(t._f.refs?t._f.refs.every((e=>!NH(e))):!NH(t._f.ref))&&_(e)}c.unMount=new Set},_updateFieldArray:(e,t=[],n,r,c=!0,u=!0)=>{if(r&&n){if(l.action=!0,u&&Array.isArray(_W(a,e))){const t=n(_W(a,e),r.argA,r.argB);c&&rH(a,e,t)}if(u&&Array.isArray(_W(o.errors,e))){const t=n(_W(o.errors,e),r.argA,r.argB);c&&rH(o.errors,e,t),WH(o.errors,e)}if(d.touchedFields&&u&&Array.isArray(_W(o.touchedFields,e))){const t=n(_W(o.touchedFields,e),r.argA,r.argB);c&&rH(o.touchedFields,e,t)}d.dirtyFields&&(o.dirtyFields=IH(i,s)),p.state.next({name:e,isDirty:k(e,t),dirtyFields:o.dirtyFields,errors:o.errors,isValid:o.isValid})}else rH(s,e,t)},_updateDisabledField:I,_getFieldArray:t=>DW(_W(l.mount?s:i,t,e.shouldUnregister?_W(i,t,[]):[])),_reset:V,_resetDefaultValues:()=>pH(r.defaultValues)&&r.defaultValues().then((e=>{F(e,r.resetOptions),p.state.next({isLoading:!1})})),_updateFormState:e=>{o={...o,...e}},_subjects:p,_proxyFormState:d,get _fields(){return a},get _formValues(){return s},get _state(){return l},set _state(e){l=e},get _defaultValues(){return i},get _names(){return c},set _names(e){c=e},get _formState(){return o},set _formState(e){o=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:j,register:A,handleSubmit:$,watch:(e,t)=>pH(e)?p.values.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:S,getValues:N,reset:F,resetField:(e,t={})=>{_W(a,e)&&(RW(t.defaultValue)?S(e,_W(i,e)):(S(e,t.defaultValue),rH(i,e,t.defaultValue)),t.keepTouched||EH(o.touchedFields,e),t.keepDirty||(EH(o.dirtyFields,e),o.isDirty=t.defaultValue?k(e,_W(i,e)):k()),t.keepError||(EH(o.errors,e),d.isValid&&v()),p.state.next({...o}))},clearErrors:e=>{e&&GW(e).forEach((e=>EH(o.errors,e))),p.state.next({errors:e?o.errors:{}})},unregister:_,setError:R,setFocus:(e,t={})=>{const n=_W(a,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:D}}function KH({children:t,onSubmit:n}){const r=function(e={}){const t=o.useRef(),n=o.useRef(),[r,a]=o.useState({isDirty:!1,isValidating:!1,isLoading:pH(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:pH(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...UH(e,(()=>a((e=>({...e}))))),formState:r});const i=t.current.control;return i._options=e,QW({subject:i._subjects.state,next:e=>{XW(e,i._proxyFormState,i._updateFormState,!0)&&a({...i._formState})}}),o.useEffect((()=>{e.values&&!SH(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()}),[e.values,i]),o.useEffect((()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()})),t.current.formState=qW(r,i),t.current}({mode:"onChange"});return e(KW,{...r,children:e("form",{onSubmit:r.handleSubmit(n),children:t})})}function qH({name:n="",rules:r={},Component:o,...a}){const{control:i}=UW(),{field:s,fieldState:{error:l}}=oH({control:i,name:n,rules:r,shouldUnregister:!0});return t("div",{children:[e(o,{...s,...a,onChange:function(...e){
|
|
274
|
+
//! this will change in the future
|
|
275
|
+
a.autoComplete?s.onChange(e[1]):s.onChange(...e),a?.onChange?.(...e)}}),l&&l.message&&e("span",{style:{color:"red"},children:l.message})]})}export{pz as KdpaAccordion,mz as KdpaAccordionDetails,fz as KdpaAccordionSummary,lw as KdpaAlert,cw as KdpaAlertTitle,sD as KdpaAutoComplete,_T as KdpaAvatar,hT as KdpaBadge,lD as KdpaButton,pD as KdpaCheckBox,ST as KdpaChip,TD as KdpaCircularProgress,wD as KdpaCollapse,MD as KdpaCollapseTransitions,TI as KdpaCopyToClipboard,DN as KdpaDatePicker,nD as KdpaDateTimePicker,OD as KdpaDivider,KR as KdpaDropZone,PD as KdpaFade,OW as KdpaFileUploader,KH as KdpaFormContainer,rD as KdpaFormControl,oD as KdpaFormControlLabel,qH as KdpaFormField,bW as KdpaFullScreenDialog,gT as KdpaGrid,yT as KdpaGridBadge,SD as KdpaGrow,cD as KdpaIconButton,EI as KdpaInlineSpinner,MT as KdpaInput,jT as KdpaInputLabel,NT as KdpaInputMultiline,O_ as KdpaLazyDrop,CI as KdpaLoading,iD as KdpaMenuItem,fA as KdpaModalImage,bT as KdpaMuiBadge,hA as KdpaPaginationGrid,uD as KdpaPrimaryButton,DT as KdpaRadio,RT as KdpaRadioGroup,mW as KdpaRtlProvider,dD as KdpaSecondaryButton,gW as KdpaSegment,aD as KdpaSelect,PI as KdpaSkeleton,jD as KdpaSlide,mA as KdpaSlider,vD as KdpaSweetAlertConfirm,yD as KdpaSweetAlertDelete,gD as KdpaSweetAlertOK,IT as KdpaSwitch,ED as KdpaTab,CD as KdpaTabs,hz as KdpaThemeProvider,zj as KdpaTimePicker,vT as KdpaTooltip,gA as KdpaTree,dz as KdpaTreeSelect,xD as KdpaTypography,ND as KdpaZoom};
|
|
@@ -3,6 +3,7 @@ export interface KdpaFormFieldProps {
|
|
|
3
3
|
name: string;
|
|
4
4
|
rules: any;
|
|
5
5
|
Component: React.ElementType;
|
|
6
|
+
autoComplete?: boolean;
|
|
6
7
|
onChange?: (e: unknown) => void;
|
|
7
8
|
}
|
|
8
9
|
declare function KdpaFormField({ name, rules, Component, ...props }: KdpaFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KdpaFormField.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/KdpaFormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"KdpaFormField.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/KdpaFormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACjC;AAED,iBAAS,aAAa,CAAC,EACrB,IAAS,EACT,KAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,kBAAkB,2CA6BpB;AAED,eAAe,aAAa,CAAC"}
|